Exclude virtual nodes from the original PC counter

It's possible that future versions of ASM will introduce additional
types of virtual node. Only counting real instructions should make this
more reliable.

Signed-off-by: Graham <gpe@openrs2.dev>
feat/deob-ir
Graham 5 years ago
parent a027209b18
commit 6cc9ab9e3b
  1. 4
      deob/src/main/java/dev/openrs2/deob/transform/OriginalPcSaveTransformer.kt

@ -9,11 +9,9 @@ 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) {
for ((pc, insn) in method.instructions.filter { it.opcode != -1 }.withIndex()) {
classPath.originalPcs[insn] = pc
}
}
return false
}

Loading…
Cancel
Save