diff options
| author | 2016-10-17 12:10:54 +0200 | |
|---|---|---|
| committer | 2016-10-17 12:10:54 +0200 | |
| commit | 06f5aca2c19d62a04e7e722f46094342feb3ed7a (patch) | |
| tree | b6b8dfae8c95b9a8c57994d426c2240c325deb73 | |
| parent | Revert "apply similar fix to fields" (diff) | |
| download | enigma-06f5aca2c19d62a04e7e722f46094342feb3ed7a.tar.gz enigma-06f5aca2c19d62a04e7e722f46094342feb3ed7a.tar.xz enigma-06f5aca2c19d62a04e7e722f46094342feb3ed7a.zip | |
Preparing needed things for the modification
| -rw-r--r-- | src/main/java/cuchaz/enigma/ConvertMain.java | 10 | ||||
| -rw-r--r-- | src/main/java/cuchaz/enigma/convert/MappingsConverter.java | 8 |
2 files changed, 9 insertions, 9 deletions
diff --git a/src/main/java/cuchaz/enigma/ConvertMain.java b/src/main/java/cuchaz/enigma/ConvertMain.java index 67baeae9..77150038 100644 --- a/src/main/java/cuchaz/enigma/ConvertMain.java +++ b/src/main/java/cuchaz/enigma/ConvertMain.java | |||
| @@ -63,7 +63,7 @@ public class ConvertMain { | |||
| 63 | editFieldMatches(sourceJar, destJar, outMappingsFile, mappings, classMatchesFile, fieldMatchesFile); | 63 | editFieldMatches(sourceJar, destJar, outMappingsFile, mappings, classMatchesFile, fieldMatchesFile); |
| 64 | convertMappings(outMappingsFile, sourceJar, destJar, mappings, classMatchesFile, fieldMatchesFile); | 64 | convertMappings(outMappingsFile, sourceJar, destJar, mappings, classMatchesFile, fieldMatchesFile); |
| 65 | } else if (command.equalsIgnoreCase("computeMethodMatches")) { | 65 | } else if (command.equalsIgnoreCase("computeMethodMatches")) { |
| 66 | computeMethodMatches(methodMatchesFile, destJar, outMappingsFile, classMatchesFile); | 66 | computeMethodMatches(outMappingsFile, sourceJar, destJar, mappings, classMatchesFile, fieldMatchesFile, methodMatchesFile); |
| 67 | convertMappings(outMappingsFile, sourceJar, destJar, mappings, classMatchesFile, fieldMatchesFile, methodMatchesFile); | 67 | convertMappings(outMappingsFile, sourceJar, destJar, mappings, classMatchesFile, fieldMatchesFile, methodMatchesFile); |
| 68 | } else if (command.equalsIgnoreCase("editMethodMatches")) { | 68 | } else if (command.equalsIgnoreCase("editMethodMatches")) { |
| 69 | editMethodMatches(sourceJar, destJar, outMappingsFile, mappings, classMatchesFile, methodMatchesFile); | 69 | editMethodMatches(sourceJar, destJar, outMappingsFile, mappings, classMatchesFile, methodMatchesFile); |
| @@ -224,15 +224,17 @@ public class ConvertMain { | |||
| 224 | } | 224 | } |
| 225 | 225 | ||
| 226 | 226 | ||
| 227 | private static void computeMethodMatches(File methodMatchesFile, JarFile destJar, File destMappingsFile, File classMatchesFile) | 227 | private static void computeMethodMatches(File outMappingsFile, JarFile sourceJar, JarFile destJar, Mappings sourceMappings, File classMatchesFile, File fieldMatchesFile, File methodMatchesFile) |
| 228 | throws IOException, MappingParseException { | 228 | throws IOException, MappingParseException { |
| 229 | 229 | ||
| 230 | System.out.println("Reading class matches..."); | 230 | System.out.println("Reading class matches..."); |
| 231 | ClassMatches classMatches = MatchesReader.readClasses(classMatchesFile); | 231 | ClassMatches classMatches = MatchesReader.readClasses(classMatchesFile); |
| 232 | System.out.println("Reading mappings..."); | 232 | System.out.println("Reading dest mappings..."); |
| 233 | Mappings destMappings = new MappingsEnigmaReader().read(destMappingsFile); | 233 | Mappings destMappings = new MappingsEnigmaReader().read(outMappingsFile); |
| 234 | System.out.println("Indexing dest jar..."); | 234 | System.out.println("Indexing dest jar..."); |
| 235 | Deobfuscator destDeobfuscator = new Deobfuscator(destJar); | 235 | Deobfuscator destDeobfuscator = new Deobfuscator(destJar); |
| 236 | System.out.println("Indexing source jar..."); | ||
| 237 | Deobfuscator sourceDeobfuscator = new Deobfuscator(sourceJar); | ||
| 236 | 238 | ||
| 237 | System.out.println("Writing method matches..."); | 239 | System.out.println("Writing method matches..."); |
| 238 | 240 | ||
diff --git a/src/main/java/cuchaz/enigma/convert/MappingsConverter.java b/src/main/java/cuchaz/enigma/convert/MappingsConverter.java index a80d9ce1..aa80014a 100644 --- a/src/main/java/cuchaz/enigma/convert/MappingsConverter.java +++ b/src/main/java/cuchaz/enigma/convert/MappingsConverter.java | |||
| @@ -364,11 +364,9 @@ public class MappingsConverter { | |||
| 364 | public Set<BehaviorEntry> filterEntries(Collection<BehaviorEntry> obfDestFields, BehaviorEntry obfSourceField, ClassMatches classMatches) { | 364 | public Set<BehaviorEntry> filterEntries(Collection<BehaviorEntry> obfDestFields, BehaviorEntry obfSourceField, ClassMatches classMatches) { |
| 365 | Set<BehaviorEntry> out = Sets.newHashSet(); | 365 | Set<BehaviorEntry> out = Sets.newHashSet(); |
| 366 | for (BehaviorEntry obfDestField : obfDestFields) { | 366 | for (BehaviorEntry obfDestField : obfDestFields) { |
| 367 | Signature translatedDestSignature = translate(obfDestField.getSignature(), | 367 | // Try to translate the signature |
| 368 | classMatches.getUniqueMatches().inverse()); | 368 | Signature translatedDestSignature = translate(obfDestField.getSignature(), classMatches.getUniqueMatches().inverse()); |
| 369 | if ((translatedDestSignature == null && obfSourceField.getSignature() == null) | 369 | if (translatedDestSignature != null && obfSourceField.getSignature() != null && translatedDestSignature.equals(obfSourceField.getSignature())) |
| 370 | || translatedDestSignature != null && obfSourceField.getSignature() != null | ||
| 371 | && translatedDestSignature.equals(obfSourceField.getSignature())) | ||
| 372 | out.add(obfDestField); | 370 | out.add(obfDestField); |
| 373 | } | 371 | } |
| 374 | return out; | 372 | return out; |