diff options
| author | 2016-08-17 19:54:22 +0200 | |
|---|---|---|
| committer | 2016-08-17 19:54:22 +0200 | |
| commit | 7defa283eb2c6d4c540f7cdf94f862c93775c8a4 (patch) | |
| tree | 61e79d6d038ead6d4612fbb6f2e923924f3e06c2 | |
| parent | Revert "Removed unused methods" (diff) | |
| download | enigma-7defa283eb2c6d4c540f7cdf94f862c93775c8a4.tar.gz enigma-7defa283eb2c6d4c540f7cdf94f862c93775c8a4.tar.xz enigma-7defa283eb2c6d4c540f7cdf94f862c93775c8a4.zip | |
Fix #4, at least to the extent we currently need it
| -rw-r--r-- | src/main/java/cuchaz/enigma/ConvertMain.java | 5 | ||||
| -rw-r--r-- | src/main/java/cuchaz/enigma/convert/MappingsConverter.java | 10 | ||||
| -rw-r--r-- | src/main/java/cuchaz/enigma/mapping/ClassEntry.java | 2 |
3 files changed, 10 insertions, 7 deletions
diff --git a/src/main/java/cuchaz/enigma/ConvertMain.java b/src/main/java/cuchaz/enigma/ConvertMain.java index 4c6be7fd..67baeae9 100644 --- a/src/main/java/cuchaz/enigma/ConvertMain.java +++ b/src/main/java/cuchaz/enigma/ConvertMain.java | |||
| @@ -308,11 +308,8 @@ public class ConvertMain { | |||
| 308 | System.out.println("WARNING: Broken behavior entry " + mapping.getKey() + " (" + mapping.getValue().getDeobfName() + ")"); | 308 | System.out.println("WARNING: Broken behavior entry " + mapping.getKey() + " (" + mapping.getValue().getDeobfName() + ")"); |
| 309 | } | 309 | } |
| 310 | 310 | ||
| 311 | //TODO Fix | ||
| 312 | // write out the converted mappings | 311 | // write out the converted mappings |
| 313 | // try (FileWriter out = new FileWriter(outMappingsFile)) { | 312 | new MappingsEnigmaWriter().write(outMappingsFile, newMappings, true); |
| 314 | // new MappingsWriter().write(out, newMappings); | ||
| 315 | // } | ||
| 316 | System.out.println("Wrote converted mappings to:\n\t" + outMappingsFile.getAbsolutePath()); | 313 | System.out.println("Wrote converted mappings to:\n\t" + outMappingsFile.getAbsolutePath()); |
| 317 | } | 314 | } |
| 318 | 315 | ||
diff --git a/src/main/java/cuchaz/enigma/convert/MappingsConverter.java b/src/main/java/cuchaz/enigma/convert/MappingsConverter.java index 61b0e7ef..4b4bb812 100644 --- a/src/main/java/cuchaz/enigma/convert/MappingsConverter.java +++ b/src/main/java/cuchaz/enigma/convert/MappingsConverter.java | |||
| @@ -117,13 +117,19 @@ public class MappingsConverter { | |||
| 117 | Collections.sort(chainSizes); | 117 | Collections.sort(chainSizes); |
| 118 | for (int chainSize : chainSizes) { | 118 | for (int chainSize : chainSizes) { |
| 119 | for (java.util.Map.Entry<ClassEntry, ClassEntry> match : matchesByDestChainSize.get(chainSize)) { | 119 | for (java.util.Map.Entry<ClassEntry, ClassEntry> match : matchesByDestChainSize.get(chainSize)) { |
| 120 | |||
| 121 | // get class info | 120 | // get class info |
| 122 | ClassEntry obfSourceClassEntry = match.getKey(); | 121 | ClassEntry obfSourceClassEntry = match.getKey(); |
| 123 | ClassEntry obfDestClassEntry = match.getValue(); | 122 | ClassEntry obfDestClassEntry = match.getValue(); |
| 124 | List<ClassEntry> destClassChain = destDeobfuscator.getJarIndex().getObfClassChain(obfDestClassEntry); | 123 | List<ClassEntry> destClassChain = destDeobfuscator.getJarIndex().getObfClassChain(obfDestClassEntry); |
| 125 | 124 | ||
| 126 | ClassMapping sourceMapping = sourceDeobfuscator.getMappings().getClassByObf(obfSourceClassEntry); | 125 | ClassMapping sourceMapping; |
| 126 | if (obfSourceClassEntry.isInnerClass()) { | ||
| 127 | List<ClassMapping> srcClassChain = sourceDeobfuscator.getMappings().getClassMappingChain(obfSourceClassEntry); | ||
| 128 | sourceMapping = srcClassChain.get(srcClassChain.size() - 1); | ||
| 129 | } else { | ||
| 130 | sourceMapping = sourceDeobfuscator.getMappings().getClassByObf(obfSourceClassEntry); | ||
| 131 | } | ||
| 132 | |||
| 127 | if (sourceMapping == null) { | 133 | if (sourceMapping == null) { |
| 128 | // if this class was never deobfuscated, don't try to match it | 134 | // if this class was never deobfuscated, don't try to match it |
| 129 | continue; | 135 | continue; |
diff --git a/src/main/java/cuchaz/enigma/mapping/ClassEntry.java b/src/main/java/cuchaz/enigma/mapping/ClassEntry.java index a58d0548..398b1355 100644 --- a/src/main/java/cuchaz/enigma/mapping/ClassEntry.java +++ b/src/main/java/cuchaz/enigma/mapping/ClassEntry.java | |||
| @@ -68,7 +68,7 @@ public class ClassEntry implements Entry { | |||
| 68 | } | 68 | } |
| 69 | 69 | ||
| 70 | public boolean equals(ClassEntry other) { | 70 | public boolean equals(ClassEntry other) { |
| 71 | return this.name.equals(other.name); | 71 | return other != null && this.name.equals(other.name); |
| 72 | } | 72 | } |
| 73 | 73 | ||
| 74 | @Override | 74 | @Override |