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>
bzip2
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() { class OriginalPcSaveTransformer : Transformer() {
override fun transformCode(classPath: ClassPath, library: Library, clazz: ClassNode, method: MethodNode): Boolean { override fun transformCode(classPath: ClassPath, library: Library, clazz: ClassNode, method: MethodNode): Boolean {
for ((pc, insn) in method.instructions.withIndex()) { for ((pc, insn) in method.instructions.filter { it.opcode != -1 }.withIndex()) {
if (insn.opcode != -1) {
classPath.originalPcs[insn] = pc classPath.originalPcs[insn] = pc
} }
}
return false return false
} }

Loading…
Cancel
Save