From 6cc9ab9e3b387e11c7ba71bef7a285a2808c3a59 Mon Sep 17 00:00:00 2001 From: Graham Date: Sun, 8 Mar 2020 20:44:37 +0000 Subject: [PATCH] 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 --- .../dev/openrs2/deob/transform/OriginalPcSaveTransformer.kt | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/deob/src/main/java/dev/openrs2/deob/transform/OriginalPcSaveTransformer.kt b/deob/src/main/java/dev/openrs2/deob/transform/OriginalPcSaveTransformer.kt index 1e181e7962..a0cb58f96b 100644 --- a/deob/src/main/java/dev/openrs2/deob/transform/OriginalPcSaveTransformer.kt +++ b/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