summaryrefslogtreecommitdiff
path: root/src/cuchaz/enigma/ConvertMain.java
diff options
context:
space:
mode:
authorGravatar jeff2015-03-08 20:48:30 -0400
committerGravatar jeff2015-03-08 20:48:30 -0400
commit4ceb8d490058e48df666bf7227ce020e60928be5 (patch)
treebdfb432cd1d61dc4914b8591468193dcd7e7421c /src/cuchaz/enigma/ConvertMain.java
parentlots of small tweaks and improvements (diff)
downloadenigma-fork-4ceb8d490058e48df666bf7227ce020e60928be5.tar.gz
enigma-fork-4ceb8d490058e48df666bf7227ce020e60928be5.tar.xz
enigma-fork-4ceb8d490058e48df666bf7227ce020e60928be5.zip
more tweaks, improvements, and bug fixes
Diffstat (limited to '')
-rw-r--r--src/cuchaz/enigma/ConvertMain.java22
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
3import java.io.File; 3import java.io.File;
4import java.io.FileReader; 4import java.io.FileReader;
5import java.io.FileWriter;
5import java.io.IOException; 6import java.io.IOException;
6import java.util.jar.JarFile; 7import java.util.jar.JarFile;
7 8
@@ -14,6 +15,7 @@ import cuchaz.enigma.gui.MatchingGui.SaveListener;
14import cuchaz.enigma.mapping.MappingParseException; 15import cuchaz.enigma.mapping.MappingParseException;
15import cuchaz.enigma.mapping.Mappings; 16import cuchaz.enigma.mapping.Mappings;
16import cuchaz.enigma.mapping.MappingsReader; 17import cuchaz.enigma.mapping.MappingsReader;
18import cuchaz.enigma.mapping.MappingsWriter;
17 19
18 20
19public class ConvertMain { 21public 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}