forked from openrs2/openrs2
parent
37abac9e48
commit
a4cd83fff0
@ -0,0 +1,40 @@ |
||||
package dev.openrs2.bundler.transform |
||||
|
||||
import com.github.michaelbull.logging.InlineLogger |
||||
import dev.openrs2.asm.classpath.ClassPath |
||||
import dev.openrs2.asm.classpath.Library |
||||
import dev.openrs2.asm.transform.Transformer |
||||
import org.objectweb.asm.tree.ClassNode |
||||
import org.objectweb.asm.tree.LdcInsnNode |
||||
import org.objectweb.asm.tree.MethodNode |
||||
|
||||
class TypoTransformer : Transformer() { |
||||
private var errorsFixed = 0 |
||||
|
||||
override fun preTransform(classPath: ClassPath) { |
||||
errorsFixed = 0 |
||||
} |
||||
|
||||
override fun transformCode(classPath: ClassPath, library: Library, clazz: ClassNode, method: MethodNode): Boolean { |
||||
for (insn in method.instructions) { |
||||
if (insn !is LdcInsnNode) { |
||||
continue |
||||
} |
||||
|
||||
if (insn.cst == "Carregando /secure/libs_v4s/RCras - ") { |
||||
insn.cst = "Carregando texturas - " |
||||
errorsFixed++ |
||||
} |
||||
} |
||||
|
||||
return false |
||||
} |
||||
|
||||
override fun postTransform(classPath: ClassPath) { |
||||
logger.info { "Fixed $errorsFixed typographical errors" } |
||||
} |
||||
|
||||
companion object { |
||||
private val logger = InlineLogger() |
||||
} |
||||
} |
Loading…
Reference in new issue