Open-source multiplayer game server compatible with the RuneScape client
https://www.openrs2.org/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
897 B
28 lines
897 B
package dev.openrs2.deob.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.MethodNode
|
|
|
|
class OriginalPcSaveTransformer : Transformer() {
|
|
override fun transformCode(classPath: ClassPath, library: Library, clazz: ClassNode, method: MethodNode): Boolean {
|
|
for ((pc, insn) in method.instructions.withIndex()) {
|
|
if (insn.opcode != -1) {
|
|
classPath.originalPcs[insn] = pc
|
|
}
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
override fun postTransform(classPath: ClassPath) {
|
|
logger.info { "Saved ${classPath.originalPcs.size} original instruction indexes" }
|
|
}
|
|
|
|
companion object {
|
|
private val logger = InlineLogger()
|
|
}
|
|
}
|
|
|