diff options
| author | 2015-03-15 00:44:35 -0400 | |
|---|---|---|
| committer | 2015-03-15 00:44:35 -0400 | |
| commit | 294e97d7e4cda6cadb62918fd822e7d0d11f16a9 (patch) | |
| tree | e90ba16c26d4a98b6d89f4fdc470c1da711683eb /src/cuchaz/enigma/ConvertMain.java | |
| parent | complete mappings converion code. Still need to debug though (diff) | |
| download | enigma-fork-294e97d7e4cda6cadb62918fd822e7d0d11f16a9.tar.gz enigma-fork-294e97d7e4cda6cadb62918fd822e7d0d11f16a9.tar.xz enigma-fork-294e97d7e4cda6cadb62918fd822e7d0d11f16a9.zip | |
fix bugs in the mappings converter
Diffstat (limited to 'src/cuchaz/enigma/ConvertMain.java')
| -rw-r--r-- | src/cuchaz/enigma/ConvertMain.java | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/src/cuchaz/enigma/ConvertMain.java b/src/cuchaz/enigma/ConvertMain.java index c5c92bc..79caae4 100644 --- a/src/cuchaz/enigma/ConvertMain.java +++ b/src/cuchaz/enigma/ConvertMain.java | |||
| @@ -14,12 +14,16 @@ import cuchaz.enigma.convert.MemberMatches; | |||
| 14 | import cuchaz.enigma.gui.ClassMatchingGui; | 14 | import cuchaz.enigma.gui.ClassMatchingGui; |
| 15 | import cuchaz.enigma.gui.MemberMatchingGui; | 15 | import cuchaz.enigma.gui.MemberMatchingGui; |
| 16 | import cuchaz.enigma.mapping.BehaviorEntry; | 16 | import cuchaz.enigma.mapping.BehaviorEntry; |
| 17 | import cuchaz.enigma.mapping.ClassEntry; | ||
| 18 | import cuchaz.enigma.mapping.ClassMapping; | ||
| 17 | import cuchaz.enigma.mapping.FieldEntry; | 19 | import cuchaz.enigma.mapping.FieldEntry; |
| 20 | import cuchaz.enigma.mapping.FieldMapping; | ||
| 18 | import cuchaz.enigma.mapping.MappingParseException; | 21 | import cuchaz.enigma.mapping.MappingParseException; |
| 19 | import cuchaz.enigma.mapping.Mappings; | 22 | import cuchaz.enigma.mapping.Mappings; |
| 20 | import cuchaz.enigma.mapping.MappingsChecker; | 23 | import cuchaz.enigma.mapping.MappingsChecker; |
| 21 | import cuchaz.enigma.mapping.MappingsReader; | 24 | import cuchaz.enigma.mapping.MappingsReader; |
| 22 | import cuchaz.enigma.mapping.MappingsWriter; | 25 | import cuchaz.enigma.mapping.MappingsWriter; |
| 26 | import cuchaz.enigma.mapping.MethodMapping; | ||
| 23 | 27 | ||
| 24 | 28 | ||
| 25 | public class ConvertMain { | 29 | public class ConvertMain { |
| @@ -158,7 +162,7 @@ public class ConvertMain { | |||
| 158 | 162 | ||
| 159 | // apply matches | 163 | // apply matches |
| 160 | Mappings newMappings = MappingsConverter.newMappings(classMatches, mappings, deobfuscators.source, deobfuscators.dest); | 164 | Mappings newMappings = MappingsConverter.newMappings(classMatches, mappings, deobfuscators.source, deobfuscators.dest); |
| 161 | MappingsConverter.applyMemberMatches(newMappings, fieldMatches, MappingsConverter.getFieldDoer()); | 165 | MappingsConverter.applyMemberMatches(newMappings, classMatches, fieldMatches, MappingsConverter.getFieldDoer()); |
| 162 | 166 | ||
| 163 | // write out the converted mappings | 167 | // write out the converted mappings |
| 164 | try (FileWriter out = new FileWriter(outMappingsFile)) { | 168 | try (FileWriter out = new FileWriter(outMappingsFile)) { |
| @@ -232,8 +236,25 @@ public class ConvertMain { | |||
| 232 | 236 | ||
| 233 | // apply matches | 237 | // apply matches |
| 234 | Mappings newMappings = MappingsConverter.newMappings(classMatches, mappings, deobfuscators.source, deobfuscators.dest); | 238 | Mappings newMappings = MappingsConverter.newMappings(classMatches, mappings, deobfuscators.source, deobfuscators.dest); |
| 235 | MappingsConverter.applyMemberMatches(newMappings, fieldMatches, MappingsConverter.getFieldDoer()); | 239 | MappingsConverter.applyMemberMatches(newMappings, classMatches, fieldMatches, MappingsConverter.getFieldDoer()); |
| 236 | MappingsConverter.applyMemberMatches(newMappings, methodMatches, MappingsConverter.getMethodDoer()); | 240 | MappingsConverter.applyMemberMatches(newMappings, classMatches, methodMatches, MappingsConverter.getMethodDoer()); |
| 241 | |||
| 242 | // check the final mappings | ||
| 243 | MappingsChecker checker = new MappingsChecker(deobfuscators.dest.getJarIndex()); | ||
| 244 | checker.dropBrokenMappings(newMappings); | ||
| 245 | |||
| 246 | for (java.util.Map.Entry<ClassEntry,ClassMapping> mapping : checker.getDroppedClassMappings().entrySet()) { | ||
| 247 | System.out.println("WARNING: Broken class entry " + mapping.getKey() + " (" + mapping.getValue().getDeobfName() + ")"); | ||
| 248 | } | ||
| 249 | for (java.util.Map.Entry<ClassEntry,ClassMapping> mapping : checker.getDroppedInnerClassMappings().entrySet()) { | ||
| 250 | System.out.println("WARNING: Broken inner class entry " + mapping.getKey() + " (" + mapping.getValue().getDeobfName() + ")"); | ||
| 251 | } | ||
| 252 | for (java.util.Map.Entry<FieldEntry,FieldMapping> mapping : checker.getDroppedFieldMappings().entrySet()) { | ||
| 253 | System.out.println("WARNING: Broken field entry " + mapping.getKey() + " (" + mapping.getValue().getDeobfName() + ")"); | ||
| 254 | } | ||
| 255 | for (java.util.Map.Entry<BehaviorEntry,MethodMapping> mapping : checker.getDroppedMethodMappings().entrySet()) { | ||
| 256 | System.out.println("WARNING: Broken behavior entry " + mapping.getKey() + " (" + mapping.getValue().getDeobfName() + ")"); | ||
| 257 | } | ||
| 237 | 258 | ||
| 238 | // write out the converted mappings | 259 | // write out the converted mappings |
| 239 | try (FileWriter out = new FileWriter(outMappingsFile)) { | 260 | try (FileWriter out = new FileWriter(outMappingsFile)) { |