diff options
| author | 2015-03-19 02:20:32 -0400 | |
|---|---|---|
| committer | 2015-03-19 02:20:32 -0400 | |
| commit | 96ba0ab422d7f9747e93461524991cf5ceeb48c4 (patch) | |
| tree | cd9504acae257575e0a354e79386da67acd796c6 /src/cuchaz/enigma/bytecode/MethodParameterWriter.java | |
| parent | Added tag v0.10 beta for changeset 68f12fd9afb0 (diff) | |
| download | enigma-fork-96ba0ab422d7f9747e93461524991cf5ceeb48c4.tar.gz enigma-fork-96ba0ab422d7f9747e93461524991cf5ceeb48c4.tar.xz enigma-fork-96ba0ab422d7f9747e93461524991cf5ceeb48c4.zip | |
fix issue with naming method arguments and the local variable tables
Diffstat (limited to 'src/cuchaz/enigma/bytecode/MethodParameterWriter.java')
| -rw-r--r-- | src/cuchaz/enigma/bytecode/MethodParameterWriter.java | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/cuchaz/enigma/bytecode/MethodParameterWriter.java b/src/cuchaz/enigma/bytecode/MethodParameterWriter.java index f64ca02..87c9196 100644 --- a/src/cuchaz/enigma/bytecode/MethodParameterWriter.java +++ b/src/cuchaz/enigma/bytecode/MethodParameterWriter.java | |||
| @@ -15,6 +15,8 @@ import java.util.List; | |||
| 15 | 15 | ||
| 16 | import javassist.CtBehavior; | 16 | import javassist.CtBehavior; |
| 17 | import javassist.CtClass; | 17 | import javassist.CtClass; |
| 18 | import javassist.bytecode.CodeAttribute; | ||
| 19 | import javassist.bytecode.LocalVariableAttribute; | ||
| 18 | import cuchaz.enigma.mapping.ArgumentEntry; | 20 | import cuchaz.enigma.mapping.ArgumentEntry; |
| 19 | import cuchaz.enigma.mapping.BehaviorEntry; | 21 | import cuchaz.enigma.mapping.BehaviorEntry; |
| 20 | import cuchaz.enigma.mapping.EntryFactory; | 22 | import cuchaz.enigma.mapping.EntryFactory; |
| @@ -33,6 +35,15 @@ public class MethodParameterWriter { | |||
| 33 | 35 | ||
| 34 | // Procyon will read method arguments from the "MethodParameters" attribute, so write those | 36 | // Procyon will read method arguments from the "MethodParameters" attribute, so write those |
| 35 | for (CtBehavior behavior : c.getDeclaredBehaviors()) { | 37 | for (CtBehavior behavior : c.getDeclaredBehaviors()) { |
| 38 | |||
| 39 | // if there's a local variable table here, don't write a MethodParameters attribute | ||
| 40 | // let the local variable writer deal with it instead | ||
| 41 | // procyon starts doing really weird things if we give it both attributes | ||
| 42 | CodeAttribute codeAttribute = behavior.getMethodInfo().getCodeAttribute(); | ||
| 43 | if (codeAttribute != null && codeAttribute.getAttribute(LocalVariableAttribute.tag) != null) { | ||
| 44 | continue; | ||
| 45 | } | ||
| 46 | |||
| 36 | BehaviorEntry behaviorEntry = EntryFactory.getBehaviorEntry(behavior); | 47 | BehaviorEntry behaviorEntry = EntryFactory.getBehaviorEntry(behavior); |
| 37 | 48 | ||
| 38 | // get the number of arguments | 49 | // get the number of arguments |
| @@ -53,6 +64,9 @@ public class MethodParameterWriter { | |||
| 53 | } | 64 | } |
| 54 | 65 | ||
| 55 | // save the mappings to the class | 66 | // save the mappings to the class |
| 67 | for (String name : names) { | ||
| 68 | System.out.println("\t" + name); | ||
| 69 | } | ||
| 56 | MethodParametersAttribute.updateClass(behavior.getMethodInfo(), names); | 70 | MethodParametersAttribute.updateClass(behavior.getMethodInfo(), names); |
| 57 | } | 71 | } |
| 58 | } | 72 | } |