Skip to content

Commit

Permalink
Quick hack to fix the new dynamic surrounding's footsteps sounds
Browse files Browse the repository at this point in the history
Signed-off-by: djpadbit <[email protected]>
  • Loading branch information
djpadbit committed Jan 3, 2019
1 parent ceacd15 commit 98664d5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/sonicether/soundphysics/SoundPhysics.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

/**
Expand Down

0 comments on commit 98664d5

Please sign in to comment.