summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Thog2016-09-01 18:50:56 +0200
committerGravatar Thog2016-09-01 18:50:56 +0200
commit357e86d096f91c2734b78227cff3166332a54636 (patch)
tree964a938b688eca4142a243b552dfe1d2dc9e00ee /src
parentCrash if we find duplicate mappings of classes (Fix #15) (diff)
downloadenigma-357e86d096f91c2734b78227cff3166332a54636.tar.gz
enigma-357e86d096f91c2734b78227cff3166332a54636.tar.xz
enigma-357e86d096f91c2734b78227cff3166332a54636.zip
Converter: fix inheritance issue with matcher system
Diffstat (limited to 'src')
-rw-r--r--src/main/java/cuchaz/enigma/convert/MemberMatches.java29
-rw-r--r--src/main/java/cuchaz/enigma/gui/MemberMatchingGui.java4
2 files changed, 26 insertions, 7 deletions
diff --git a/src/main/java/cuchaz/enigma/convert/MemberMatches.java b/src/main/java/cuchaz/enigma/convert/MemberMatches.java
index 32850cca..e0888d54 100644
--- a/src/main/java/cuchaz/enigma/convert/MemberMatches.java
+++ b/src/main/java/cuchaz/enigma/convert/MemberMatches.java
@@ -11,13 +11,13 @@
11package cuchaz.enigma.convert; 11package cuchaz.enigma.convert;
12 12
13import com.google.common.collect.*; 13import com.google.common.collect.*;
14import cuchaz.enigma.Deobfuscator;
15import cuchaz.enigma.mapping.ClassEntry;
16import cuchaz.enigma.mapping.Entry;
14 17
15import java.util.Collection; 18import java.util.Collection;
16import java.util.Set; 19import java.util.Set;
17 20
18import cuchaz.enigma.mapping.ClassEntry;
19import cuchaz.enigma.mapping.Entry;
20
21 21
22public class MemberMatches<T extends Entry> { 22public class MemberMatches<T extends Entry> {
23 23
@@ -123,8 +123,17 @@ public class MemberMatches<T extends Entry> {
123 public boolean isUnmatchableSourceEntry(T sourceEntry) { 123 public boolean isUnmatchableSourceEntry(T sourceEntry) {
124 return m_unmatchableSourceEntries.containsEntry(sourceEntry.getClassEntry(), sourceEntry); 124 return m_unmatchableSourceEntries.containsEntry(sourceEntry.getClassEntry(), sourceEntry);
125 } 125 }
126
127 public void makeMatch(T sourceEntry, T destEntry) { 126 public void makeMatch(T sourceEntry, T destEntry) {
127 makeMatch(sourceEntry, destEntry, null, null);
128 }
129
130 public void makeMatch(T sourceEntry, T destEntry, Deobfuscator sourceDeobfuscator, Deobfuscator destDeobfuscator) {
131 if (sourceDeobfuscator != null && destDeobfuscator != null)
132 {
133 makeMatch(sourceEntry, destEntry);
134 sourceEntry = (T) sourceEntry.cloneToNewClass(sourceDeobfuscator.getJarIndex().getTranslationIndex().resolveEntryClass(sourceEntry, true));
135 destEntry = (T) destEntry.cloneToNewClass(destDeobfuscator.getJarIndex().getTranslationIndex().resolveEntryClass(destEntry, true));
136 }
128 boolean wasRemoved = m_unmatchedSourceEntries.remove(sourceEntry.getClassEntry(), sourceEntry); 137 boolean wasRemoved = m_unmatchedSourceEntries.remove(sourceEntry.getClassEntry(), sourceEntry);
129 assert (wasRemoved); 138 assert (wasRemoved);
130 wasRemoved = m_unmatchedDestEntries.remove(destEntry.getClassEntry(), destEntry); 139 wasRemoved = m_unmatchedDestEntries.remove(destEntry.getClassEntry(), destEntry);
@@ -137,7 +146,17 @@ public class MemberMatches<T extends Entry> {
137 return match != null && match.equals(destEntry); 146 return match != null && match.equals(destEntry);
138 } 147 }
139 148
140 public void unmakeMatch(T sourceEntry, T destEntry) { 149 public void unmakeMatch(T sourceEntry, T destEntry, Deobfuscator sourceDeobfuscator, Deobfuscator destDeobfuscator)
150 {
151 if (sourceDeobfuscator != null && destDeobfuscator != null)
152 {
153 makeMatch(sourceEntry, destEntry);
154 sourceEntry = (T) sourceEntry.cloneToNewClass(
155 sourceDeobfuscator.getJarIndex().getTranslationIndex().resolveEntryClass(sourceEntry, true));
156 destEntry = (T) destEntry.cloneToNewClass(
157 destDeobfuscator.getJarIndex().getTranslationIndex().resolveEntryClass(destEntry, true));
158 }
159
141 boolean wasRemoved = m_matches.remove(sourceEntry) != null; 160 boolean wasRemoved = m_matches.remove(sourceEntry) != null;
142 assert (wasRemoved); 161 assert (wasRemoved);
143 wasRemoved = m_matchedSourceEntries.remove(sourceEntry.getClassEntry(), sourceEntry); 162 wasRemoved = m_matchedSourceEntries.remove(sourceEntry.getClassEntry(), sourceEntry);
diff --git a/src/main/java/cuchaz/enigma/gui/MemberMatchingGui.java b/src/main/java/cuchaz/enigma/gui/MemberMatchingGui.java
index 30902c44..8f7d6e3c 100644
--- a/src/main/java/cuchaz/enigma/gui/MemberMatchingGui.java
+++ b/src/main/java/cuchaz/enigma/gui/MemberMatchingGui.java
@@ -437,7 +437,7 @@ public class MemberMatchingGui<T extends Entry> {
437 protected void match() { 437 protected void match() {
438 438
439 // update the field matches 439 // update the field matches
440 m_memberMatches.makeMatch(m_obfSourceEntry, m_obfDestEntry); 440 m_memberMatches.makeMatch(m_obfSourceEntry, m_obfDestEntry, m_sourceDeobfuscator, m_destDeobfuscator);
441 save(); 441 save();
442 442
443 // update the ui 443 // update the ui
@@ -451,7 +451,7 @@ public class MemberMatchingGui<T extends Entry> {
451 protected void unmatch() { 451 protected void unmatch() {
452 452
453 // update the field matches 453 // update the field matches
454 m_memberMatches.unmakeMatch(m_obfSourceEntry, m_obfDestEntry); 454 m_memberMatches.unmakeMatch(m_obfSourceEntry, m_obfDestEntry, m_sourceDeobfuscator, m_destDeobfuscator);
455 save(); 455 save();
456 456
457 // update the ui 457 // update the ui