From b34b708f6636dc262c0ed41c50e3614f9a8d58b9 Mon Sep 17 00:00:00 2001 From: Owain van Brakel Date: Fri, 29 Apr 2022 09:16:18 +0200 Subject: [PATCH 1/3] project(mixins): Simplify this --- .../mixins/RSObjectCompositionMixin.java | 276 +----------------- 1 file changed, 4 insertions(+), 272 deletions(-) diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/RSObjectCompositionMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/RSObjectCompositionMixin.java index 382398027e..5212e83f05 100644 --- a/runelite-mixins/src/main/java/net/runelite/mixins/RSObjectCompositionMixin.java +++ b/runelite-mixins/src/main/java/net/runelite/mixins/RSObjectCompositionMixin.java @@ -1,12 +1,8 @@ package net.runelite.mixins; -import net.runelite.api.IterableHashTable; -import net.runelite.api.Node; -import net.runelite.api.mixins.Copy; import net.runelite.api.mixins.Inject; import net.runelite.api.mixins.MethodHook; import net.runelite.api.mixins.Mixin; -import net.runelite.api.mixins.Replace; import net.runelite.api.mixins.Shadow; import net.runelite.rs.api.RSBuffer; import net.runelite.rs.api.RSClient; @@ -43,277 +39,13 @@ public abstract class RSObjectCompositionMixin implements RSObjectComposition return accessBitMask; } - @Copy("decodeNext") - @Replace("decodeNext") - public void decodeNext(RSBuffer buffer, int opcode) + @Inject + @MethodHook(value = "decodeNext", end = true) + public void decodeNextHook(RSBuffer buffer, int opcode) { - int var3; - int var4; - if (opcode == 1) - { - var3 = buffer.readUnsignedByte(); - if (var3 > 0) - { - if (getModelIds() != null && !getObjectDefinitionIsLowDetail()) - { - buffer.setOffset(buffer.getOffset() + 3 * var3); - } - else - { - setModels(new int[var3]); - setModelIds(new int[var3]); - - for (var4 = 0; var4 < var3; ++var4) - { - getModelIds()[var4] = buffer.readUnsignedShort(); - getModels()[var4] = buffer.readUnsignedByte(); - } - } - } - } - else if (opcode == 2) - { - setName(buffer.readStringCp1252NullTerminated()); - } - else if (opcode == 5) - { - var3 = buffer.readUnsignedByte(); - if (var3 > 0) - { - if (getModelIds() != null && !getObjectDefinitionIsLowDetail()) - { - buffer.setOffset(buffer.getOffset() + var3 * 2); - } - else - { - setModels(null); - setModelIds(new int[var3]); - - for (var4 = 0; var4 < var3; ++var4) - { - getModelIds()[var4] = buffer.readUnsignedShort(); - } - } - } - } - else if (opcode == 14) - { - setSizeX(buffer.readUnsignedByte()); - } - else if (opcode == 15) - { - setSizeY(buffer.readUnsignedByte()); - } - else if (opcode == 17) - { - setInteractType(0); - setBoolean1(false); - } - else if (opcode == 18) - { - setBoolean1(false); - } - else if (opcode == 19) - { - setInt1(buffer.readUnsignedByte()); - } - else if (opcode == 21) - { - setClipType(0); - } - else if (opcode == 22) - { - setNonFlatShading(true); - } - else if (opcode == 23) - { - setModelClipped(true); - } - else if (opcode == 24) - { - setAnimationId(buffer.readUnsignedShort()); - if (getAnimationId() == 65535) - { - setAnimationId(-1); - } - } - else if (opcode == 27) - { - setInteractType(1); - } - else if (opcode == 28) - { - setInt2(buffer.readUnsignedByte()); - } - else if (opcode == 29) - { - setAmbient(buffer.readByte()); - } - else if (opcode == 39) - { - setContrast(buffer.readByte() * 25); - } - else if (opcode >= 30 && opcode < 35) - { - getActions()[opcode - 30] = buffer.readStringCp1252NullTerminated(); - if (getActions()[opcode - 30].equalsIgnoreCase("Hidden")) - { - getActions()[opcode - 30] = null; - } - } - else if (opcode == 40) - { - var3 = buffer.readUnsignedByte(); - setRecolorFrom(new short[var3]); - setRecolorTo(new short[var3]); - for (var4 = 0; var4 < var3; ++var4) - { - getRecolorFrom()[var4] = (short) buffer.readUnsignedShort(); - getRecolorTo()[var4] = (short) buffer.readUnsignedShort(); - } - } - else if (opcode == 41) - { - var3 = buffer.readUnsignedByte(); - setRetextureFrom(new short[var3]); - setRetextureTo(new short[var3]); - for (var4 = 0; var4 < var3; ++var4) - { - getRetextureFrom()[var4] = (short) buffer.readUnsignedShort(); - getRetextureTo()[var4] = (short) buffer.readUnsignedShort(); - } - } - else if (opcode == 61) - { - buffer.readUnsignedShort(); - } - else if (opcode == 62) - { - setIsRotated(true); - } - else if (opcode == 64) - { - setClipped(false); - } - else if (opcode == 65) - { - setModelSizeX(buffer.readUnsignedShort()); - } - else if (opcode == 66) - { - setModelHeight(buffer.readUnsignedShort()); - } - else if (opcode == 67) - { - setModelSizeY(buffer.readUnsignedShort()); - } - else if (opcode == 68) - { - setMapSceneId(buffer.readUnsignedShort()); - } - else if (opcode == 69) + if (opcode == 69) { accessBitMask = buffer.readUnsignedByte(); } - else if (opcode == 70) - { - setOffsetX(buffer.readShort()); - } - else if (opcode == 71) - { - setOffsetHeight(buffer.readShort()); - } - else if (opcode == 72) - { - setOffsetY(buffer.readShort()); - } - else if (opcode == 73) - { - setBoolean2(true); - } - else if (opcode == 74) - { - setIsSolid(true); - } - else if (opcode == 75) - { - setInt3(buffer.readUnsignedByte()); - } - else if (opcode != 77 && opcode != 92) - { - if (opcode == 78) - { - setAmbientSoundId(buffer.readUnsignedShort()); - setInt7(buffer.readUnsignedByte()); - } - else if (opcode == 79) - { - setInt5(buffer.readUnsignedShort()); - setInt6(buffer.readUnsignedShort()); - setInt7(buffer.readUnsignedByte()); - - var3 = buffer.readUnsignedByte(); - setSoundEffectIds(new int[var3]); - - for (var4 = 0; var4 < var3; ++var4) - { - getSoundEffectIds()[var4] = buffer.readUnsignedShort(); - } - } - else if (opcode == 81) - { - setClipType(buffer.readUnsignedByte() * 256); - } - else if (opcode == 82) - { - setMapIconId(buffer.readUnsignedShort()); - } - else if (opcode == 89) - { - setBoolean3(false); - } - else if (opcode == 249) - { - setParams((IterableHashTable) client.readStringIntParameters(buffer, getParams())); - } - } - else - { - setTransformVarbit(buffer.readUnsignedShort()); - if (getTransformVarbit() == 65535) - { - setTransformVarbit(-1); - } - setTransformVarp(buffer.readUnsignedShort()); - if (getTransformVarp() == 65535) - { - setTransformVarp(-1); - } - - var3 = -1; - - if (opcode == 92) - { - var3 = buffer.readUnsignedShort(); - if (var3 == 65535) - { - var3 = -1; - } - } - - var4 = buffer.readUnsignedByte(); - setTransforms(new int[var4 + 2]); - - for (int var5 = 0; var5 <= var4; ++var5) - { - getTransforms()[var5] = buffer.readUnsignedShort(); - if (getTransforms()[var5] == 65535) - { - getTransforms()[var5] = -1; - } - } - - getTransforms()[var4 + 1] = var3; - } } } From 011027bc6958130a127f1a9ff49abe12f1c28621 Mon Sep 17 00:00:00 2001 From: Owain van Brakel Date: Fri, 29 Apr 2022 11:26:15 +0200 Subject: [PATCH 2/3] project(mixins): Update interpolation blacklist --- .../net/runelite/mixins/RSDynamicObjectMixin.java | 3 ++- .../main/java/net/runelite/mixins/RSNPCMixin.java | 12 ++++++++++-- .../main/java/net/runelite/mixins/RSPlayerMixin.java | 2 +- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/RSDynamicObjectMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/RSDynamicObjectMixin.java index d69e951218..1e057fa4e5 100644 --- a/runelite-mixins/src/main/java/net/runelite/mixins/RSDynamicObjectMixin.java +++ b/runelite-mixins/src/main/java/net/runelite/mixins/RSDynamicObjectMixin.java @@ -25,6 +25,7 @@ package net.runelite.mixins; import net.runelite.api.DialogOption; +import net.runelite.api.ObjectID; import net.runelite.api.events.DialogProcessed; import net.runelite.api.events.DynamicObjectAnimationChanged; import net.runelite.api.mixins.Copy; @@ -75,7 +76,7 @@ public abstract class RSDynamicObjectMixin implements RSDynamicObject @Inject public void onAnimCycleCountChanged(int idx) { - if (client.isInterpolateObjectAnimations()) + if (client.isInterpolateObjectAnimations() && this.getId() != ObjectID.WATER_WHEEL_26671) { // sets the packed anim frame with the frame cycle int objectFrameCycle = client.getGameCycle() - getAnimCycleCount(); diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/RSNPCMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/RSNPCMixin.java index 1a2778ea5b..01f81d46ca 100644 --- a/runelite-mixins/src/main/java/net/runelite/mixins/RSNPCMixin.java +++ b/runelite-mixins/src/main/java/net/runelite/mixins/RSNPCMixin.java @@ -28,6 +28,7 @@ import java.awt.Polygon; import java.awt.Shape; import net.runelite.api.AnimationID; import net.runelite.api.NPCComposition; +import net.runelite.api.NpcID; import net.runelite.api.Perspective; import net.runelite.api.coords.LocalPoint; import net.runelite.api.events.NpcChanged; @@ -140,8 +141,15 @@ public abstract class RSNPCMixin implements RSNPC public RSModel copy$getModel() { if (!client.isInterpolateNpcAnimations() - || getAnimation() == AnimationID.HELLHOUND_DEFENCE) - { + || this.getAnimation() == AnimationID.HELLHOUND_DEFENCE + || this.getAnimation() == 8270 + || this.getAnimation() == 8271 + || this.getPoseAnimation() == 5583 + || this.getId() == NpcID.WYRM && this.getAnimation() == AnimationID.IDLE + || this.getId() == NpcID.TREE_SPIRIT && this.getAnimation() == AnimationID.IDLE + || this.getId() == NpcID.TREE_SPIRIT_6380 && this.getAnimation() == AnimationID.IDLE + || this.getId() == NpcID.TREE_SPIRIT_HARD && this.getAnimation() == AnimationID.IDLE + ) { return copy$getModel(); } int actionFrame = getActionFrame(); diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/RSPlayerMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/RSPlayerMixin.java index ed963a288d..5994bc53c2 100644 --- a/runelite-mixins/src/main/java/net/runelite/mixins/RSPlayerMixin.java +++ b/runelite-mixins/src/main/java/net/runelite/mixins/RSPlayerMixin.java @@ -231,7 +231,7 @@ public abstract class RSPlayerMixin implements RSPlayer @Replace("getModel") public RSModel copy$getModel() { - if (!client.isInterpolatePlayerAnimations()) + if (!client.isInterpolatePlayerAnimations() || this.getPoseAnimation() == 244) { return copy$getModel(); } From 60d90a58d5915d577a251edd6158fccf5a9bbb58 Mon Sep 17 00:00:00 2001 From: Owain van Brakel Date: Fri, 29 Apr 2022 20:06:43 +0200 Subject: [PATCH 3/3] bootstrap: Skip injection-annotations --- buildSrc/src/main/kotlin/BootstrapTask.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/buildSrc/src/main/kotlin/BootstrapTask.kt b/buildSrc/src/main/kotlin/BootstrapTask.kt index 6b85dbf601..353c8532f7 100644 --- a/buildSrc/src/main/kotlin/BootstrapTask.kt +++ b/buildSrc/src/main/kotlin/BootstrapTask.kt @@ -128,6 +128,10 @@ open class BootstrapTask @Inject constructor(@Input val type: String) : DefaultT val artifactsSet = HashSet() project.configurations["runtimeClasspath"].resolvedConfiguration.resolvedArtifacts.forEach { + if (it.file.name.contains("injection-annotations")) { + return@forEach + } + val module = it.moduleVersion.id.toString() val splat = module.split(":") @@ -206,7 +210,7 @@ open class BootstrapTask @Inject constructor(@Input val type: String) : DefaultT if (!artifactsSet.contains(filePath)) { artifactsSet.add(filePath) - val sha = if(it.file.name.contains("injection-annotations")) "bf1ef2a463fca3e1ece80c70d63a5f5f8ce7b260396175de0d7a8e98f2c4d06b" else hash(artifactFile.readBytes()) + val sha = hash(artifactFile.readBytes()) val json = JsonBuilder( "name" to it.file.name,