From 06f5aca2c19d62a04e7e722f46094342feb3ed7a Mon Sep 17 00:00:00 2001 From: Thog Date: Mon, 17 Oct 2016 12:10:54 +0200 Subject: Preparing needed things for the modification --- src/main/java/cuchaz/enigma/ConvertMain.java | 10 ++++++---- 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 { editFieldMatches(sourceJar, destJar, outMappingsFile, mappings, classMatchesFile, fieldMatchesFile); convertMappings(outMappingsFile, sourceJar, destJar, mappings, classMatchesFile, fieldMatchesFile); } else if (command.equalsIgnoreCase("computeMethodMatches")) { - computeMethodMatches(methodMatchesFile, destJar, outMappingsFile, classMatchesFile); + computeMethodMatches(outMappingsFile, sourceJar, destJar, mappings, classMatchesFile, fieldMatchesFile, methodMatchesFile); convertMappings(outMappingsFile, sourceJar, destJar, mappings, classMatchesFile, fieldMatchesFile, methodMatchesFile); } else if (command.equalsIgnoreCase("editMethodMatches")) { editMethodMatches(sourceJar, destJar, outMappingsFile, mappings, classMatchesFile, methodMatchesFile); @@ -224,15 +224,17 @@ public class ConvertMain { } - private static void computeMethodMatches(File methodMatchesFile, JarFile destJar, File destMappingsFile, File classMatchesFile) + private static void computeMethodMatches(File outMappingsFile, JarFile sourceJar, JarFile destJar, Mappings sourceMappings, File classMatchesFile, File fieldMatchesFile, File methodMatchesFile) throws IOException, MappingParseException { System.out.println("Reading class matches..."); ClassMatches classMatches = MatchesReader.readClasses(classMatchesFile); - System.out.println("Reading mappings..."); - Mappings destMappings = new MappingsEnigmaReader().read(destMappingsFile); + System.out.println("Reading dest mappings..."); + Mappings destMappings = new MappingsEnigmaReader().read(outMappingsFile); System.out.println("Indexing dest jar..."); Deobfuscator destDeobfuscator = new Deobfuscator(destJar); + System.out.println("Indexing source jar..."); + Deobfuscator sourceDeobfuscator = new Deobfuscator(sourceJar); System.out.println("Writing method matches..."); 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 { public Set filterEntries(Collection obfDestFields, BehaviorEntry obfSourceField, ClassMatches classMatches) { Set out = Sets.newHashSet(); for (BehaviorEntry obfDestField : obfDestFields) { - Signature translatedDestSignature = translate(obfDestField.getSignature(), - classMatches.getUniqueMatches().inverse()); - if ((translatedDestSignature == null && obfSourceField.getSignature() == null) - || translatedDestSignature != null && obfSourceField.getSignature() != null - && translatedDestSignature.equals(obfSourceField.getSignature())) + // Try to translate the signature + Signature translatedDestSignature = translate(obfDestField.getSignature(), classMatches.getUniqueMatches().inverse()); + if (translatedDestSignature != null && obfSourceField.getSignature() != null && translatedDestSignature.equals(obfSourceField.getSignature())) out.add(obfDestField); } return out; -- cgit v1.2.3