From 47642e9b4275ff6f3cc46120eb7eea9e81ba315d Mon Sep 17 00:00:00 2001 From: Graham Date: Sat, 10 Jul 2021 15:09:20 +0100 Subject: [PATCH] Improve logging in ResourceTransformer Signed-off-by: Graham --- .../org/openrs2/patcher/transform/ResourceTransformer.kt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/patcher/src/main/kotlin/org/openrs2/patcher/transform/ResourceTransformer.kt b/patcher/src/main/kotlin/org/openrs2/patcher/transform/ResourceTransformer.kt index 2448419e..30115763 100644 --- a/patcher/src/main/kotlin/org/openrs2/patcher/transform/ResourceTransformer.kt +++ b/patcher/src/main/kotlin/org/openrs2/patcher/transform/ResourceTransformer.kt @@ -23,10 +23,14 @@ public class ResourceTransformer( private val glResources: List> = Resource.compressGlNatives(), private val miscResources: List = Resource.compressMiscNatives() ) : Transformer() { + private var blocks = 0 + private var checksums = 0 private var glBlocks = 0 private var miscBlocks = 0 override fun preTransform(classPath: ClassPath) { + blocks = 0 + checksums = 0 glBlocks = 0 miscBlocks = 0 } @@ -52,6 +56,8 @@ public class ResourceTransformer( for ((j, byte) in resource.digest.withIndex()) { method.instructions.set(match[28 + 4 * j], byte.toInt().toAbstractInsnNode()) } + + blocks++ } val checksumMatch = CLIENT_CHECKSUM_MATCHER.match(method).filter { m -> @@ -63,6 +69,8 @@ public class ResourceTransformer( if (checksumMatch != null) { val client = resources.single { it.source == "runescape.js5" || it.source == "runescape_gl.js5" } method.instructions.set(checksumMatch[1], client.checksum.toAbstractInsnNode()) + + checksums++ } } @@ -191,6 +199,7 @@ public class ResourceTransformer( } override fun postTransform(classPath: ClassPath) { + logger.info { "Replaced $blocks resource constructor blocks and $checksums tracing exception checksums" } logger.info { "Replaced $glBlocks jaggl and $miscBlocks jagmisc resource constructor blocks" } }