diff options
Diffstat (limited to '')
| -rw-r--r-- | src/cuchaz/enigma/ConvertMain.java | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/src/cuchaz/enigma/ConvertMain.java b/src/cuchaz/enigma/ConvertMain.java index cad49f5..975cdcc 100644 --- a/src/cuchaz/enigma/ConvertMain.java +++ b/src/cuchaz/enigma/ConvertMain.java | |||
| @@ -2,6 +2,7 @@ package cuchaz.enigma; | |||
| 2 | 2 | ||
| 3 | import java.io.File; | 3 | import java.io.File; |
| 4 | import java.io.FileReader; | 4 | import java.io.FileReader; |
| 5 | import java.io.FileWriter; | ||
| 5 | import java.io.IOException; | 6 | import java.io.IOException; |
| 6 | import java.util.jar.JarFile; | 7 | import java.util.jar.JarFile; |
| 7 | 8 | ||
| @@ -14,6 +15,7 @@ import cuchaz.enigma.gui.MatchingGui.SaveListener; | |||
| 14 | import cuchaz.enigma.mapping.MappingParseException; | 15 | import cuchaz.enigma.mapping.MappingParseException; |
| 15 | import cuchaz.enigma.mapping.Mappings; | 16 | import cuchaz.enigma.mapping.Mappings; |
| 16 | import cuchaz.enigma.mapping.MappingsReader; | 17 | import cuchaz.enigma.mapping.MappingsReader; |
| 18 | import cuchaz.enigma.mapping.MappingsWriter; | ||
| 17 | 19 | ||
| 18 | 20 | ||
| 19 | public class ConvertMain { | 21 | public class ConvertMain { |
| @@ -32,7 +34,7 @@ public class ConvertMain { | |||
| 32 | 34 | ||
| 33 | //computeMatches(matchingFile, sourceJar, destJar, mappings); | 35 | //computeMatches(matchingFile, sourceJar, destJar, mappings); |
| 34 | editMatches(matchingFile, sourceJar, destJar, mappings); | 36 | editMatches(matchingFile, sourceJar, destJar, mappings); |
| 35 | //convertMappings(outMappingsFile, mappings, matchingFile); | 37 | //convertMappings(outMappingsFile, sourceJar, destJar, mappings, matchingFile); |
| 36 | 38 | ||
| 37 | /* TODO | 39 | /* TODO |
| 38 | // write out the converted mappings | 40 | // write out the converted mappings |
| @@ -56,7 +58,7 @@ public class ConvertMain { | |||
| 56 | Matches matches = MatchesReader.read(matchingFile); | 58 | Matches matches = MatchesReader.read(matchingFile); |
| 57 | System.out.println("Indexing source jar..."); | 59 | System.out.println("Indexing source jar..."); |
| 58 | Deobfuscator sourceDeobfuscator = new Deobfuscator(sourceJar); | 60 | Deobfuscator sourceDeobfuscator = new Deobfuscator(sourceJar); |
| 59 | sourceDeobfuscator.setMappings(mappings); | 61 | sourceDeobfuscator.setMappings(mappings, false); |
| 60 | System.out.println("Indexing dest jar..."); | 62 | System.out.println("Indexing dest jar..."); |
| 61 | Deobfuscator destDeobfuscator = new Deobfuscator(destJar); | 63 | Deobfuscator destDeobfuscator = new Deobfuscator(destJar); |
| 62 | System.out.println("Starting GUI..."); | 64 | System.out.println("Starting GUI..."); |
| @@ -72,9 +74,21 @@ public class ConvertMain { | |||
| 72 | }); | 74 | }); |
| 73 | } | 75 | } |
| 74 | 76 | ||
| 75 | private static void convertMappings(File outMappingsFile, Mappings mappings, File matchingFile) | 77 | private static void convertMappings(File outMappingsFile, JarFile sourceJar, JarFile destJar, Mappings mappings, File matchingFile) |
| 76 | throws IOException { | 78 | throws IOException { |
| 79 | System.out.println("Reading matches..."); | ||
| 77 | Matches matches = MatchesReader.read(matchingFile); | 80 | Matches matches = MatchesReader.read(matchingFile); |
| 78 | MappingsConverter.convertMappings(mappings, matches.getUniqueMatches()); | 81 | System.out.println("Indexing source jar..."); |
| 82 | Deobfuscator sourceDeobfuscator = new Deobfuscator(sourceJar); | ||
| 83 | sourceDeobfuscator.setMappings(mappings); | ||
| 84 | System.out.println("Indexing dest jar..."); | ||
| 85 | Deobfuscator destDeobfuscator = new Deobfuscator(destJar); | ||
| 86 | |||
| 87 | Mappings newMappings = MappingsConverter.newMappings(matches, mappings, sourceDeobfuscator, destDeobfuscator); | ||
| 88 | |||
| 89 | try (FileWriter out = new FileWriter(outMappingsFile)) { | ||
| 90 | new MappingsWriter().write(out, newMappings); | ||
| 91 | } | ||
| 92 | System.out.println("Write converted mappings to: " + outMappingsFile.getAbsolutePath()); | ||
| 79 | } | 93 | } |
| 80 | } | 94 | } |