diff options
| author | 2016-08-14 21:41:07 +0200 | |
|---|---|---|
| committer | 2016-08-14 21:41:07 +0200 | |
| commit | 8ec1ffe8b78463fc56b01b6dec13614130878feb (patch) | |
| tree | 6d71ee4af61362dd9c10c6e785778a8336adb41d | |
| parent | Fix remapping of methods in children class with interfaces (diff) | |
| download | enigma-8ec1ffe8b78463fc56b01b6dec13614130878feb.tar.gz enigma-8ec1ffe8b78463fc56b01b6dec13614130878feb.tar.xz enigma-8ec1ffe8b78463fc56b01b6dec13614130878feb.zip | |
Propagate arguments remapping to children classes
TODO: support support not identical behavior (constructors)
| -rw-r--r-- | src/main/java/cuchaz/enigma/Constants.java | 2 | ||||
| -rw-r--r-- | src/main/java/cuchaz/enigma/mapping/Translator.java | 31 |
2 files changed, 20 insertions, 13 deletions
diff --git a/src/main/java/cuchaz/enigma/Constants.java b/src/main/java/cuchaz/enigma/Constants.java index c6a58259..25fe1065 100644 --- a/src/main/java/cuchaz/enigma/Constants.java +++ b/src/main/java/cuchaz/enigma/Constants.java | |||
| @@ -12,7 +12,7 @@ package cuchaz.enigma; | |||
| 12 | 12 | ||
| 13 | public class Constants { | 13 | public class Constants { |
| 14 | public static final String NAME = "Enigma"; | 14 | public static final String NAME = "Enigma"; |
| 15 | public static final String VERSION = "0.2 - Beta"; | 15 | public static final String VERSION = "0.11.0 (Chorus Fork)"; |
| 16 | public static final String URL = "http://www.cuchazinteractive.com/enigma"; | 16 | public static final String URL = "http://www.cuchazinteractive.com/enigma"; |
| 17 | public static final int MiB = 1024 * 1024; // 1 mebibyte | 17 | public static final int MiB = 1024 * 1024; // 1 mebibyte |
| 18 | public static final int KiB = 1024; // 1 kebibyte | 18 | public static final int KiB = 1024; // 1 kebibyte |
diff --git a/src/main/java/cuchaz/enigma/mapping/Translator.java b/src/main/java/cuchaz/enigma/mapping/Translator.java index de48c9a1..125e03f4 100644 --- a/src/main/java/cuchaz/enigma/mapping/Translator.java +++ b/src/main/java/cuchaz/enigma/mapping/Translator.java | |||
| @@ -203,22 +203,29 @@ public class Translator { | |||
| 203 | throw new Error("Wrong entry type!"); | 203 | throw new Error("Wrong entry type!"); |
| 204 | } | 204 | } |
| 205 | 205 | ||
| 206 | // TODO: support not identical behavior (specific to constructor) | ||
| 206 | public String translate(ArgumentEntry in) { | 207 | public String translate(ArgumentEntry in) { |
| 207 | 208 | ||
| 208 | // look for the class | 209 | // look for identical behavior in superclasses |
| 209 | ClassMapping classMapping = findClassMapping(in.getClassEntry()); | 210 | ClassEntry entry = this.index.resolveEntryClass(in, true); |
| 210 | if (classMapping != null) { | ||
| 211 | 211 | ||
| 212 | // look for the method | 212 | if (entry != null) |
| 213 | MethodMapping methodMapping = this.direction.choose( | 213 | { |
| 214 | classMapping.getMethodByObf(in.getMethodName(), in.getMethodSignature()), | 214 | // look for the class |
| 215 | classMapping.getMethodByDeobf(in.getMethodName(), translateSignature(in.getMethodSignature())) | 215 | ClassMapping classMapping = findClassMapping(entry); |
| 216 | ); | 216 | if (classMapping != null) { |
| 217 | if (methodMapping != null) { | 217 | |
| 218 | return this.direction.choose( | 218 | // look for the method |
| 219 | methodMapping.getDeobfArgumentName(in.getIndex()), | 219 | MethodMapping methodMapping = this.direction.choose( |
| 220 | methodMapping.getObfArgumentName(in.getIndex()) | 220 | classMapping.getMethodByObf(in.getMethodName(), in.getMethodSignature()), |
| 221 | classMapping.getMethodByDeobf(in.getMethodName(), translateSignature(in.getMethodSignature())) | ||
| 221 | ); | 222 | ); |
| 223 | if (methodMapping != null) { | ||
| 224 | return this.direction.choose( | ||
| 225 | methodMapping.getDeobfArgumentName(in.getIndex()), | ||
| 226 | methodMapping.getObfArgumentName(in.getIndex()) | ||
| 227 | ); | ||
| 228 | } | ||
| 222 | } | 229 | } |
| 223 | } | 230 | } |
| 224 | return null; | 231 | return null; |