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. 6
      deob/src/main/java/dev/openrs2/deob/transform/OriginalPcSaveTransformer.kt

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

Loading…
Cancel
Save