diff options
| author | 2018-05-19 21:06:53 +0200 | |
|---|---|---|
| committer | 2018-05-19 21:06:53 +0200 | |
| commit | 0f0cae8845c53b7db032bd8d459e60a7ac084564 (patch) | |
| tree | 1858e226e51c51bbe41d26e70291a22a03dfbffe | |
| parent | Signature refactoring (diff) | |
| download | enigma-0f0cae8845c53b7db032bd8d459e60a7ac084564.tar.gz enigma-0f0cae8845c53b7db032bd8d459e60a7ac084564.tar.xz enigma-0f0cae8845c53b7db032bd8d459e60a7ac084564.zip | |
Fix highlighting of mapped names
| -rw-r--r-- | src/main/java/cuchaz/enigma/mapping/DirectionalTranslator.java | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/src/main/java/cuchaz/enigma/mapping/DirectionalTranslator.java b/src/main/java/cuchaz/enigma/mapping/DirectionalTranslator.java index fe141c66..5f5208a0 100644 --- a/src/main/java/cuchaz/enigma/mapping/DirectionalTranslator.java +++ b/src/main/java/cuchaz/enigma/mapping/DirectionalTranslator.java | |||
| @@ -119,13 +119,16 @@ public class DirectionalTranslator implements Translator { | |||
| 119 | 119 | ||
| 120 | private String translateFieldName(FieldEntry entry) { | 120 | private String translateFieldName(FieldEntry entry) { |
| 121 | // resolve the class entry | 121 | // resolve the class entry |
| 122 | ClassEntry resolvedClassEntry = this.index.resolveEntryOwner(entry); | 122 | ClassEntry resolvedClassEntry = this.index.resolveEntryOwner(entry, true); |
| 123 | if (resolvedClassEntry != null) { | 123 | if (resolvedClassEntry != null) { |
| 124 | // look for the class | 124 | // look for the class |
| 125 | ClassMapping classMapping = findClassMapping(resolvedClassEntry); | 125 | ClassMapping classMapping = findClassMapping(resolvedClassEntry); |
| 126 | if (classMapping != null) { | 126 | if (classMapping != null) { |
| 127 | // look for the field | 127 | // look for the field |
| 128 | FieldMapping mapping = classMapping.getFieldByObf(entry.getName(), entry.getDesc()); | 128 | FieldMapping mapping = this.direction.choose( |
| 129 | classMapping.getFieldByObf(entry.getName(), entry.getDesc()), | ||
| 130 | classMapping.getFieldByDeobf(entry.getName(), getTranslatedTypeDesc(entry.getDesc())) | ||
| 131 | ); | ||
| 129 | if (mapping != null) { | 132 | if (mapping != null) { |
| 130 | return this.direction.choose(mapping.getDeobfName(), mapping.getObfName()); | 133 | return this.direction.choose(mapping.getDeobfName(), mapping.getObfName()); |
| 131 | } | 134 | } |
| @@ -166,7 +169,10 @@ public class DirectionalTranslator implements Translator { | |||
| 166 | ClassMapping classMapping = findClassMapping(resolvedOwner); | 169 | ClassMapping classMapping = findClassMapping(resolvedOwner); |
| 167 | if (classMapping != null) { | 170 | if (classMapping != null) { |
| 168 | // look for the method | 171 | // look for the method |
| 169 | MethodMapping mapping = classMapping.getMethodByObf(entry.getName(), entry.getDesc()); | 172 | MethodMapping mapping = this.direction.choose( |
| 173 | classMapping.getMethodByObf(entry.getName(), entry.getDesc()), | ||
| 174 | classMapping.getMethodByDeobf(entry.getName(), getTranslatedMethodDesc(entry.getDesc())) | ||
| 175 | ); | ||
| 170 | if (mapping != null) { | 176 | if (mapping != null) { |
| 171 | return this.direction.choose(mapping.getDeobfName(), mapping.getObfName()); | 177 | return this.direction.choose(mapping.getDeobfName(), mapping.getObfName()); |
| 172 | } | 178 | } |
| @@ -230,7 +236,10 @@ public class DirectionalTranslator implements Translator { | |||
| 230 | ClassMapping classMapping = findClassMapping(ownerEntry); | 236 | ClassMapping classMapping = findClassMapping(ownerEntry); |
| 231 | if (classMapping != null) { | 237 | if (classMapping != null) { |
| 232 | // look for the method | 238 | // look for the method |
| 233 | MethodMapping methodMapping = classMapping.getMethodByObf(entry.getMethodName(), entry.getMethodDesc()); | 239 | MethodMapping methodMapping = this.direction.choose( |
| 240 | classMapping.getMethodByObf(entry.getMethodName(), entry.getMethodDesc()), | ||
| 241 | classMapping.getMethodByDeobf(entry.getMethodName(), getTranslatedMethodDesc(entry.getMethodDesc())) | ||
| 242 | ); | ||
| 234 | if (methodMapping != null) { | 243 | if (methodMapping != null) { |
| 235 | int index = entry.getIndex(); | 244 | int index = entry.getIndex(); |
| 236 | return this.direction.choose( | 245 | return this.direction.choose( |
| @@ -345,11 +354,6 @@ public class DirectionalTranslator implements Translator { | |||
| 345 | } | 354 | } |
| 346 | 355 | ||
| 347 | private String remapClass(String name) { | 356 | private String remapClass(String name) { |
| 348 | String translatedName = getTranslatedClass(new ClassEntry(name)).getName(); | 357 | return getTranslatedClass(new ClassEntry(name)).getName(); |
| 349 | int separatorIndex = translatedName.lastIndexOf("$"); | ||
| 350 | if (separatorIndex != -1) { | ||
| 351 | translatedName = translatedName.substring(separatorIndex + 1); | ||
| 352 | } | ||
| 353 | return translatedName; | ||
| 354 | } | 358 | } |
| 355 | } | 359 | } |