From 98664d5c99b40afb10f84e170202393e7875978b Mon Sep 17 00:00:00 2001 From: djpadbit Date: Thu, 3 Jan 2019 15:13:58 +0100 Subject: [PATCH] Quick hack to fix the new dynamic surrounding's footsteps sounds Signed-off-by: djpadbit --- .../java/com/sonicether/soundphysics/CoreModInjector.java | 8 +++++--- .../java/com/sonicether/soundphysics/SoundPhysics.java | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/sonicether/soundphysics/CoreModInjector.java b/src/main/java/com/sonicether/soundphysics/CoreModInjector.java index dc8f26bd..cfef9d42 100644 --- a/src/main/java/com/sonicether/soundphysics/CoreModInjector.java +++ b/src/main/java/com/sonicether/soundphysics/CoreModInjector.java @@ -44,11 +44,13 @@ public byte[] transform(final String obfuscated, final String deobfuscated, byte AbstractInsnNode.METHOD_INSN, "setVolume", null, toInject, false, 0, 0, false, 0); toInject = new InsnList(); - toInject.add(new VarInsnNode(Opcodes.ALOAD, 1)); - toInject.add(new MethodInsnNode(Opcodes.INVOKEINTERFACE, "cgt", "a", "()Lnf;", true)); + toInject.add(new VarInsnNode(Opcodes.ALOAD, 4)); + toInject.add(new MethodInsnNode(Opcodes.INVOKEVIRTUAL, "cgq", "a", "()Lnf;", false)); + toInject.add(new MethodInsnNode(Opcodes.INVOKEVIRTUAL, "nf", "toString", "()Ljava/lang/String;", false)); + toInject.add(new VarInsnNode(Opcodes.ALOAD, 3)); toInject.add(new MethodInsnNode(Opcodes.INVOKEVIRTUAL, "nf", "toString", "()Ljava/lang/String;", false)); toInject.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "com/sonicether/soundphysics/SoundPhysics", - "setLastSoundName", "(Ljava/lang/String;)V", false)); + "setLastSoundName", "(Ljava/lang/String;Ljava/lang/String;)V", false)); // Target method: playSound bytes = patchMethodInClass(obfuscated, bytes, "c", "(Lcgt;)V", Opcodes.INVOKEVIRTUAL, diff --git a/src/main/java/com/sonicether/soundphysics/SoundPhysics.java b/src/main/java/com/sonicether/soundphysics/SoundPhysics.java index ae943717..51ab3752 100644 --- a/src/main/java/com/sonicether/soundphysics/SoundPhysics.java +++ b/src/main/java/com/sonicether/soundphysics/SoundPhysics.java @@ -326,8 +326,8 @@ public static void setLastSoundCategory(final SoundCategory sc) { /** * CALLED BY ASM INJECTED CODE! */ - public static void setLastSoundName(final String name) { - lastSoundName = name; + public static void setLastSoundName(final String soundName, final String eventName) { + lastSoundName = soundName+"||"+eventName; // Quick hack to check the event and sound name } /**