diff options
| author | 2018-07-18 13:46:00 +0100 | |
|---|---|---|
| committer | 2018-07-18 13:46:00 +0100 | |
| commit | 1ebe691c12f68beea378b133ddc4bcbde7f3f795 (patch) | |
| tree | fb051d9fde5644bd144a7e9d7bcecc70a256359c /src/main/java/cuchaz/enigma/gui | |
| parent | Recursively rebuild method names (diff) | |
| parent | Update version number (diff) | |
| download | enigma-fork-1ebe691c12f68beea378b133ddc4bcbde7f3f795.tar.gz enigma-fork-1ebe691c12f68beea378b133ddc4bcbde7f3f795.tar.xz enigma-fork-1ebe691c12f68beea378b133ddc4bcbde7f3f795.zip | |
Merge pull request #62 from OpenModLoader/asm
ASM based class translator
Diffstat (limited to 'src/main/java/cuchaz/enigma/gui')
9 files changed, 53 insertions, 67 deletions
diff --git a/src/main/java/cuchaz/enigma/gui/ClassSelector.java b/src/main/java/cuchaz/enigma/gui/ClassSelector.java index ed84ef2..93c5d4b 100644 --- a/src/main/java/cuchaz/enigma/gui/ClassSelector.java +++ b/src/main/java/cuchaz/enigma/gui/ClassSelector.java | |||
| @@ -17,7 +17,7 @@ import com.google.common.collect.Maps; | |||
| 17 | import com.google.common.collect.Multimap; | 17 | import com.google.common.collect.Multimap; |
| 18 | import cuchaz.enigma.gui.node.ClassSelectorClassNode; | 18 | import cuchaz.enigma.gui.node.ClassSelectorClassNode; |
| 19 | import cuchaz.enigma.gui.node.ClassSelectorPackageNode; | 19 | import cuchaz.enigma.gui.node.ClassSelectorPackageNode; |
| 20 | import cuchaz.enigma.mapping.ClassEntry; | 20 | import cuchaz.enigma.mapping.entry.ClassEntry; |
| 21 | import cuchaz.enigma.throwables.IllegalNameException; | 21 | import cuchaz.enigma.throwables.IllegalNameException; |
| 22 | 22 | ||
| 23 | import javax.swing.*; | 23 | import javax.swing.*; |
| @@ -328,8 +328,12 @@ public class ClassSelector extends JTree { | |||
| 328 | } | 328 | } |
| 329 | 329 | ||
| 330 | public ClassSelectorPackageNode getPackageNode(ClassEntry entry) { | 330 | public ClassSelectorPackageNode getPackageNode(ClassEntry entry) { |
| 331 | String packageName = entry.getPackageName(); | ||
| 332 | if (packageName == null){ | ||
| 333 | packageName = "(none)"; | ||
| 334 | } | ||
| 331 | for (ClassSelectorPackageNode packageNode : packageNodes()) { | 335 | for (ClassSelectorPackageNode packageNode : packageNodes()) { |
| 332 | if (packageNode.getPackageName().equals(entry.getPackageName())) { | 336 | if (packageNode.getPackageName().equals(packageName)) { |
| 333 | return packageNode; | 337 | return packageNode; |
| 334 | } | 338 | } |
| 335 | } | 339 | } |
diff --git a/src/main/java/cuchaz/enigma/gui/CodeReader.java b/src/main/java/cuchaz/enigma/gui/CodeReader.java index f76dc89..ac45b4a 100644 --- a/src/main/java/cuchaz/enigma/gui/CodeReader.java +++ b/src/main/java/cuchaz/enigma/gui/CodeReader.java | |||
| @@ -17,8 +17,8 @@ import cuchaz.enigma.analysis.EntryReference; | |||
| 17 | import cuchaz.enigma.analysis.SourceIndex; | 17 | import cuchaz.enigma.analysis.SourceIndex; |
| 18 | import cuchaz.enigma.analysis.Token; | 18 | import cuchaz.enigma.analysis.Token; |
| 19 | import cuchaz.enigma.gui.highlight.SelectionHighlightPainter; | 19 | import cuchaz.enigma.gui.highlight.SelectionHighlightPainter; |
| 20 | import cuchaz.enigma.mapping.ClassEntry; | 20 | import cuchaz.enigma.mapping.entry.ClassEntry; |
| 21 | import cuchaz.enigma.mapping.Entry; | 21 | import cuchaz.enigma.mapping.entry.Entry; |
| 22 | import de.sciss.syntaxpane.DefaultSyntaxKit; | 22 | import de.sciss.syntaxpane.DefaultSyntaxKit; |
| 23 | 23 | ||
| 24 | import javax.swing.*; | 24 | import javax.swing.*; |
| @@ -162,7 +162,7 @@ public class CodeReader extends JEditorPane { | |||
| 162 | // couldn't find the class declaration token, might be an anonymous class | 162 | // couldn't find the class declaration token, might be an anonymous class |
| 163 | // look for any declaration in that class instead | 163 | // look for any declaration in that class instead |
| 164 | for (Entry entry : sourceIndex.declarations()) { | 164 | for (Entry entry : sourceIndex.declarations()) { |
| 165 | if (entry.getClassEntry().equals(classEntry)) { | 165 | if (entry.getOwnerClassEntry().equals(classEntry)) { |
| 166 | token = sourceIndex.getDeclarationToken(entry); | 166 | token = sourceIndex.getDeclarationToken(entry); |
| 167 | break; | 167 | break; |
| 168 | } | 168 | } |
diff --git a/src/main/java/cuchaz/enigma/gui/Gui.java b/src/main/java/cuchaz/enigma/gui/Gui.java index 4a891cf..cfac8ad 100644 --- a/src/main/java/cuchaz/enigma/gui/Gui.java +++ b/src/main/java/cuchaz/enigma/gui/Gui.java | |||
| @@ -32,10 +32,10 @@ import cuchaz.enigma.gui.panels.PanelEditor; | |||
| 32 | import cuchaz.enigma.gui.panels.PanelIdentifier; | 32 | import cuchaz.enigma.gui.panels.PanelIdentifier; |
| 33 | import cuchaz.enigma.gui.panels.PanelObf; | 33 | import cuchaz.enigma.gui.panels.PanelObf; |
| 34 | import cuchaz.enigma.mapping.*; | 34 | import cuchaz.enigma.mapping.*; |
| 35 | import cuchaz.enigma.mapping.entry.*; | ||
| 35 | import cuchaz.enigma.throwables.IllegalNameException; | 36 | import cuchaz.enigma.throwables.IllegalNameException; |
| 36 | import cuchaz.enigma.utils.Utils; | 37 | import cuchaz.enigma.utils.Utils; |
| 37 | import de.sciss.syntaxpane.DefaultSyntaxKit; | 38 | import de.sciss.syntaxpane.DefaultSyntaxKit; |
| 38 | import javassist.bytecode.Descriptor; | ||
| 39 | 39 | ||
| 40 | import javax.swing.*; | 40 | import javax.swing.*; |
| 41 | import javax.swing.text.BadLocationException; | 41 | import javax.swing.text.BadLocationException; |
| @@ -48,8 +48,10 @@ import java.awt.*; | |||
| 48 | import java.awt.event.*; | 48 | import java.awt.event.*; |
| 49 | import java.io.File; | 49 | import java.io.File; |
| 50 | import java.io.IOException; | 50 | import java.io.IOException; |
| 51 | import java.util.*; | 51 | import java.util.Collection; |
| 52 | import java.util.Collections; | ||
| 52 | import java.util.List; | 53 | import java.util.List; |
| 54 | import java.util.Vector; | ||
| 53 | import java.util.function.Function; | 55 | import java.util.function.Function; |
| 54 | 56 | ||
| 55 | public class Gui { | 57 | public class Gui { |
| @@ -438,14 +440,10 @@ public class Gui { | |||
| 438 | showFieldEntry((FieldEntry) this.reference.entry); | 440 | showFieldEntry((FieldEntry) this.reference.entry); |
| 439 | } else if (this.reference.entry instanceof MethodEntry) { | 441 | } else if (this.reference.entry instanceof MethodEntry) { |
| 440 | showMethodEntry((MethodEntry) this.reference.entry); | 442 | showMethodEntry((MethodEntry) this.reference.entry); |
| 441 | } else if (this.reference.entry instanceof ConstructorEntry) { | ||
| 442 | showConstructorEntry((ConstructorEntry) this.reference.entry); | ||
| 443 | } else if (this.reference.entry instanceof ArgumentEntry) { | ||
| 444 | showArgumentEntry((ArgumentEntry) this.reference.entry); | ||
| 445 | } else if (this.reference.entry instanceof LocalVariableEntry) { | 443 | } else if (this.reference.entry instanceof LocalVariableEntry) { |
| 446 | showLocalVariableEntry((LocalVariableEntry) this.reference.entry); | 444 | showLocalVariableEntry((LocalVariableEntry) this.reference.entry); |
| 447 | } else { | 445 | } else { |
| 448 | throw new Error("Unknown entry type: " + this.reference.entry.getClass().getName()); | 446 | throw new Error("Unknown entry desc: " + this.reference.entry.getClass().getName()); |
| 449 | } | 447 | } |
| 450 | 448 | ||
| 451 | redraw(); | 449 | redraw(); |
| @@ -453,10 +451,9 @@ public class Gui { | |||
| 453 | 451 | ||
| 454 | private void showLocalVariableEntry(LocalVariableEntry entry) { | 452 | private void showLocalVariableEntry(LocalVariableEntry entry) { |
| 455 | addNameValue(infoPanel, "Variable", entry.getName()); | 453 | addNameValue(infoPanel, "Variable", entry.getName()); |
| 456 | addNameValue(infoPanel, "Class", entry.getClassEntry().getName()); | 454 | addNameValue(infoPanel, "Class", entry.getOwnerClassEntry().getName()); |
| 457 | addNameValue(infoPanel, "Method", entry.getBehaviorEntry().getName()); | 455 | addNameValue(infoPanel, "Method", entry.getOwnerEntry().getName()); |
| 458 | addNameValue(infoPanel, "Index", Integer.toString(entry.getIndex())); | 456 | addNameValue(infoPanel, "Index", Integer.toString(entry.getIndex())); |
| 459 | addNameValue(infoPanel, "Type", entry.getType().toString()); | ||
| 460 | } | 457 | } |
| 461 | 458 | ||
| 462 | private void showClassEntry(ClassEntry entry) { | 459 | private void showClassEntry(ClassEntry entry) { |
| @@ -466,32 +463,20 @@ public class Gui { | |||
| 466 | 463 | ||
| 467 | private void showFieldEntry(FieldEntry entry) { | 464 | private void showFieldEntry(FieldEntry entry) { |
| 468 | addNameValue(infoPanel, "Field", entry.getName()); | 465 | addNameValue(infoPanel, "Field", entry.getName()); |
| 469 | addNameValue(infoPanel, "Class", entry.getClassEntry().getName()); | 466 | addNameValue(infoPanel, "Class", entry.getOwnerClassEntry().getName()); |
| 470 | addNameValue(infoPanel, "Type", entry.getType().toString()); | 467 | addNameValue(infoPanel, "TypeDescriptor", entry.getDesc().toString()); |
| 471 | addModifierComboBox(infoPanel, "Modifier", entry); | 468 | addModifierComboBox(infoPanel, "Modifier", entry); |
| 472 | } | 469 | } |
| 473 | 470 | ||
| 474 | private void showMethodEntry(MethodEntry entry) { | 471 | private void showMethodEntry(MethodEntry entry) { |
| 475 | addNameValue(infoPanel, "Method", entry.getName()); | 472 | if (entry.isConstructor()) { |
| 476 | addNameValue(infoPanel, "Class", entry.getClassEntry().getName()); | 473 | addNameValue(infoPanel, "Constructor", entry.getOwnerClassEntry().getName()); |
| 477 | addNameValue(infoPanel, "Signature", entry.getSignature().toString()); | 474 | } else { |
| 478 | addModifierComboBox(infoPanel, "Modifier", entry); | 475 | addNameValue(infoPanel, "Method", entry.getName()); |
| 479 | 476 | addNameValue(infoPanel, "Class", entry.getOwnerClassEntry().getName()); | |
| 480 | } | ||
| 481 | |||
| 482 | private void showConstructorEntry(ConstructorEntry entry) { | ||
| 483 | addNameValue(infoPanel, "Constructor", entry.getClassEntry().getName()); | ||
| 484 | if (!entry.isStatic()) { | ||
| 485 | addNameValue(infoPanel, "Signature", entry.getSignature().toString()); | ||
| 486 | addModifierComboBox(infoPanel, "Modifier", entry); | ||
| 487 | } | 477 | } |
| 488 | } | 478 | addNameValue(infoPanel, "MethodDescriptor", entry.getDesc().toString()); |
| 489 | 479 | addModifierComboBox(infoPanel, "Modifier", entry); | |
| 490 | private void showArgumentEntry(ArgumentEntry entry) { | ||
| 491 | addNameValue(infoPanel, "Argument", entry.getName()); | ||
| 492 | addNameValue(infoPanel, "Class", entry.getClassEntry().getName()); | ||
| 493 | addNameValue(infoPanel, "Method", entry.getBehaviorEntry().getName()); | ||
| 494 | addNameValue(infoPanel, "Index", Integer.toString(entry.getIndex())); | ||
| 495 | } | 480 | } |
| 496 | 481 | ||
| 497 | private void addNameValue(JPanel container, String name, String value) { | 482 | private void addNameValue(JPanel container, String name, String value) { |
| @@ -532,8 +517,8 @@ public class Gui { | |||
| 532 | reference = this.controller.getDeobfReference(token); | 517 | reference = this.controller.getDeobfReference(token); |
| 533 | boolean isClassEntry = isToken && reference.entry instanceof ClassEntry; | 518 | boolean isClassEntry = isToken && reference.entry instanceof ClassEntry; |
| 534 | boolean isFieldEntry = isToken && reference.entry instanceof FieldEntry; | 519 | boolean isFieldEntry = isToken && reference.entry instanceof FieldEntry; |
| 535 | boolean isMethodEntry = isToken && reference.entry instanceof MethodEntry; | 520 | boolean isMethodEntry = isToken && reference.entry instanceof MethodEntry && !((MethodEntry) reference.entry).isConstructor(); |
| 536 | boolean isConstructorEntry = isToken && reference.entry instanceof ConstructorEntry; | 521 | boolean isConstructorEntry = isToken && reference.entry instanceof MethodEntry && ((MethodEntry) reference.entry).isConstructor(); |
| 537 | boolean isInJar = isToken && this.controller.entryIsInJar(reference.entry); | 522 | boolean isInJar = isToken && this.controller.entryIsInJar(reference.entry); |
| 538 | boolean isRenameable = isToken && this.controller.referenceIsRenameable(reference); | 523 | boolean isRenameable = isToken && this.controller.referenceIsRenameable(reference); |
| 539 | 524 | ||
| @@ -710,16 +695,13 @@ public class Gui { | |||
| 710 | if (reference.entry instanceof ClassEntry) { | 695 | if (reference.entry instanceof ClassEntry) { |
| 711 | // look for calls to the default constructor | 696 | // look for calls to the default constructor |
| 712 | // TODO: get a list of all the constructors and find calls to all of them | 697 | // TODO: get a list of all the constructors and find calls to all of them |
| 713 | BehaviorReferenceTreeNode node = this.controller.getMethodReferences(new ConstructorEntry((ClassEntry) reference.entry, new Signature("()V"))); | 698 | MethodReferenceTreeNode node = this.controller.getMethodReferences(new MethodEntry((ClassEntry) reference.entry, "<init>", new MethodDescriptor("()V"))); |
| 714 | callsTree.setModel(new DefaultTreeModel(node)); | 699 | callsTree.setModel(new DefaultTreeModel(node)); |
| 715 | } else if (reference.entry instanceof FieldEntry) { | 700 | } else if (reference.entry instanceof FieldEntry) { |
| 716 | FieldReferenceTreeNode node = this.controller.getFieldReferences((FieldEntry) reference.entry); | 701 | FieldReferenceTreeNode node = this.controller.getFieldReferences((FieldEntry) reference.entry); |
| 717 | callsTree.setModel(new DefaultTreeModel(node)); | 702 | callsTree.setModel(new DefaultTreeModel(node)); |
| 718 | } else if (reference.entry instanceof MethodEntry) { | 703 | } else if (reference.entry instanceof MethodEntry) { |
| 719 | BehaviorReferenceTreeNode node = this.controller.getMethodReferences((MethodEntry) reference.entry); | 704 | MethodReferenceTreeNode node = this.controller.getMethodReferences((MethodEntry) reference.entry); |
| 720 | callsTree.setModel(new DefaultTreeModel(node)); | ||
| 721 | } else if (reference.entry instanceof ConstructorEntry) { | ||
| 722 | BehaviorReferenceTreeNode node = this.controller.getMethodReferences((ConstructorEntry) reference.entry); | ||
| 723 | callsTree.setModel(new DefaultTreeModel(node)); | 705 | callsTree.setModel(new DefaultTreeModel(node)); |
| 724 | } | 706 | } |
| 725 | 707 | ||
| @@ -790,7 +772,6 @@ public class Gui { | |||
| 790 | // package rename | 772 | // package rename |
| 791 | if (data instanceof String) { | 773 | if (data instanceof String) { |
| 792 | for (int i = 0; i < node.getChildCount(); i++) { | 774 | for (int i = 0; i < node.getChildCount(); i++) { |
| 793 | data = Descriptor.toJvmName((String) data); | ||
| 794 | DefaultMutableTreeNode childNode = (DefaultMutableTreeNode) node.getChildAt(i); | 775 | DefaultMutableTreeNode childNode = (DefaultMutableTreeNode) node.getChildAt(i); |
| 795 | ClassEntry prevDataChild = (ClassEntry) childNode.getUserObject(); | 776 | ClassEntry prevDataChild = (ClassEntry) childNode.getUserObject(); |
| 796 | ClassEntry dataChild = new ClassEntry(data + "/" + prevDataChild.getSimpleName()); | 777 | ClassEntry dataChild = new ClassEntry(data + "/" + prevDataChild.getSimpleName()); |
| @@ -807,15 +788,15 @@ public class Gui { | |||
| 807 | } | 788 | } |
| 808 | 789 | ||
| 809 | public void moveClassTree(EntryReference<Entry, Entry> deobfReference, String newName) { | 790 | public void moveClassTree(EntryReference<Entry, Entry> deobfReference, String newName) { |
| 810 | String oldEntry = deobfReference.entry.getClassEntry().getPackageName(); | 791 | String oldEntry = deobfReference.entry.getOwnerClassEntry().getPackageName(); |
| 811 | String newEntry = new ClassEntry(Descriptor.toJvmName(newName)).getPackageName(); | 792 | String newEntry = new ClassEntry(newName).getPackageName(); |
| 812 | moveClassTree(deobfReference, newName, oldEntry == null, | 793 | moveClassTree(deobfReference, newName, oldEntry == null, |
| 813 | newEntry == null); | 794 | newEntry == null); |
| 814 | } | 795 | } |
| 815 | 796 | ||
| 816 | public void moveClassTree(EntryReference<Entry, Entry> deobfReference, String newName, boolean isOldOb, boolean isNewOb) { | 797 | public void moveClassTree(EntryReference<Entry, Entry> deobfReference, String newName, boolean isOldOb, boolean isNewOb) { |
| 817 | ClassEntry oldEntry = deobfReference.entry.getClassEntry(); | 798 | ClassEntry oldEntry = deobfReference.entry.getOwnerClassEntry(); |
| 818 | ClassEntry newEntry = new ClassEntry(Descriptor.toJvmName(newName)); | 799 | ClassEntry newEntry = new ClassEntry(newName); |
| 819 | 800 | ||
| 820 | // Ob -> deob | 801 | // Ob -> deob |
| 821 | if (isOldOb && !isNewOb) { | 802 | if (isOldOb && !isNewOb) { |
diff --git a/src/main/java/cuchaz/enigma/gui/GuiController.java b/src/main/java/cuchaz/enigma/gui/GuiController.java index 6d98743..ae1b652 100644 --- a/src/main/java/cuchaz/enigma/gui/GuiController.java +++ b/src/main/java/cuchaz/enigma/gui/GuiController.java | |||
| @@ -18,6 +18,10 @@ import cuchaz.enigma.Deobfuscator; | |||
| 18 | import cuchaz.enigma.analysis.*; | 18 | import cuchaz.enigma.analysis.*; |
| 19 | import cuchaz.enigma.gui.dialog.ProgressDialog; | 19 | import cuchaz.enigma.gui.dialog.ProgressDialog; |
| 20 | import cuchaz.enigma.mapping.*; | 20 | import cuchaz.enigma.mapping.*; |
| 21 | import cuchaz.enigma.mapping.entry.ClassEntry; | ||
| 22 | import cuchaz.enigma.mapping.entry.Entry; | ||
| 23 | import cuchaz.enigma.mapping.entry.FieldEntry; | ||
| 24 | import cuchaz.enigma.mapping.entry.MethodEntry; | ||
| 21 | import cuchaz.enigma.throwables.MappingParseException; | 25 | import cuchaz.enigma.throwables.MappingParseException; |
| 22 | import cuchaz.enigma.utils.ReadableToken; | 26 | import cuchaz.enigma.utils.ReadableToken; |
| 23 | 27 | ||
| @@ -51,10 +55,10 @@ public class GuiController { | |||
| 51 | return this.isDirty; | 55 | return this.isDirty; |
| 52 | } | 56 | } |
| 53 | 57 | ||
| 54 | public void openJar(final JarFile jar) { | 58 | public void openJar(final JarFile jar) throws IOException { |
| 55 | this.gui.onStartOpenJar(); | 59 | this.gui.onStartOpenJar(); |
| 56 | this.deobfuscator = new Deobfuscator(jar); | 60 | this.deobfuscator = new Deobfuscator(jar); |
| 57 | this.gui.onFinishOpenJar(this.deobfuscator.getJarName()); | 61 | this.gui.onFinishOpenJar(jar.getName()); |
| 58 | refreshClasses(); | 62 | refreshClasses(); |
| 59 | } | 63 | } |
| 60 | 64 | ||
| @@ -161,24 +165,24 @@ public class GuiController { | |||
| 161 | 165 | ||
| 162 | public ClassInheritanceTreeNode getClassInheritance(ClassEntry deobfClassEntry) { | 166 | public ClassInheritanceTreeNode getClassInheritance(ClassEntry deobfClassEntry) { |
| 163 | ClassEntry obfClassEntry = this.deobfuscator.obfuscateEntry(deobfClassEntry); | 167 | ClassEntry obfClassEntry = this.deobfuscator.obfuscateEntry(deobfClassEntry); |
| 164 | ClassInheritanceTreeNode rootNode = this.deobfuscator.getJarIndex().getClassInheritance(this.deobfuscator.getTranslator(TranslationDirection.Deobfuscating), obfClassEntry); | 168 | ClassInheritanceTreeNode rootNode = this.deobfuscator.getJarIndex().getClassInheritance(this.deobfuscator.getTranslator(TranslationDirection.DEOBFUSCATING), obfClassEntry); |
| 165 | return ClassInheritanceTreeNode.findNode(rootNode, obfClassEntry); | 169 | return ClassInheritanceTreeNode.findNode(rootNode, obfClassEntry); |
| 166 | } | 170 | } |
| 167 | 171 | ||
| 168 | public ClassImplementationsTreeNode getClassImplementations(ClassEntry deobfClassEntry) { | 172 | public ClassImplementationsTreeNode getClassImplementations(ClassEntry deobfClassEntry) { |
| 169 | ClassEntry obfClassEntry = this.deobfuscator.obfuscateEntry(deobfClassEntry); | 173 | ClassEntry obfClassEntry = this.deobfuscator.obfuscateEntry(deobfClassEntry); |
| 170 | return this.deobfuscator.getJarIndex().getClassImplementations(this.deobfuscator.getTranslator(TranslationDirection.Deobfuscating), obfClassEntry); | 174 | return this.deobfuscator.getJarIndex().getClassImplementations(this.deobfuscator.getTranslator(TranslationDirection.DEOBFUSCATING), obfClassEntry); |
| 171 | } | 175 | } |
| 172 | 176 | ||
| 173 | public MethodInheritanceTreeNode getMethodInheritance(MethodEntry deobfMethodEntry) { | 177 | public MethodInheritanceTreeNode getMethodInheritance(MethodEntry deobfMethodEntry) { |
| 174 | MethodEntry obfMethodEntry = this.deobfuscator.obfuscateEntry(deobfMethodEntry); | 178 | MethodEntry obfMethodEntry = this.deobfuscator.obfuscateEntry(deobfMethodEntry); |
| 175 | MethodInheritanceTreeNode rootNode = this.deobfuscator.getJarIndex().getMethodInheritance(this.deobfuscator.getTranslator(TranslationDirection.Deobfuscating), obfMethodEntry); | 179 | MethodInheritanceTreeNode rootNode = this.deobfuscator.getJarIndex().getMethodInheritance(this.deobfuscator.getTranslator(TranslationDirection.DEOBFUSCATING), obfMethodEntry); |
| 176 | return MethodInheritanceTreeNode.findNode(rootNode, obfMethodEntry); | 180 | return MethodInheritanceTreeNode.findNode(rootNode, obfMethodEntry); |
| 177 | } | 181 | } |
| 178 | 182 | ||
| 179 | public MethodImplementationsTreeNode getMethodImplementations(MethodEntry deobfMethodEntry) { | 183 | public MethodImplementationsTreeNode getMethodImplementations(MethodEntry deobfMethodEntry) { |
| 180 | MethodEntry obfMethodEntry = this.deobfuscator.obfuscateEntry(deobfMethodEntry); | 184 | MethodEntry obfMethodEntry = this.deobfuscator.obfuscateEntry(deobfMethodEntry); |
| 181 | List<MethodImplementationsTreeNode> rootNodes = this.deobfuscator.getJarIndex().getMethodImplementations(this.deobfuscator.getTranslator(TranslationDirection.Deobfuscating), obfMethodEntry); | 185 | List<MethodImplementationsTreeNode> rootNodes = this.deobfuscator.getJarIndex().getMethodImplementations(this.deobfuscator.getTranslator(TranslationDirection.DEOBFUSCATING), obfMethodEntry); |
| 182 | if (rootNodes.isEmpty()) { | 186 | if (rootNodes.isEmpty()) { |
| 183 | return null; | 187 | return null; |
| 184 | } | 188 | } |
| @@ -190,14 +194,14 @@ public class GuiController { | |||
| 190 | 194 | ||
| 191 | public FieldReferenceTreeNode getFieldReferences(FieldEntry deobfFieldEntry) { | 195 | public FieldReferenceTreeNode getFieldReferences(FieldEntry deobfFieldEntry) { |
| 192 | FieldEntry obfFieldEntry = this.deobfuscator.obfuscateEntry(deobfFieldEntry); | 196 | FieldEntry obfFieldEntry = this.deobfuscator.obfuscateEntry(deobfFieldEntry); |
| 193 | FieldReferenceTreeNode rootNode = new FieldReferenceTreeNode(this.deobfuscator.getTranslator(TranslationDirection.Deobfuscating), obfFieldEntry); | 197 | FieldReferenceTreeNode rootNode = new FieldReferenceTreeNode(this.deobfuscator.getTranslator(TranslationDirection.DEOBFUSCATING), obfFieldEntry); |
| 194 | rootNode.load(this.deobfuscator.getJarIndex(), true); | 198 | rootNode.load(this.deobfuscator.getJarIndex(), true); |
| 195 | return rootNode; | 199 | return rootNode; |
| 196 | } | 200 | } |
| 197 | 201 | ||
| 198 | public BehaviorReferenceTreeNode getMethodReferences(BehaviorEntry deobfBehaviorEntry) { | 202 | public MethodReferenceTreeNode getMethodReferences(MethodEntry deobfMethodEntry) { |
| 199 | BehaviorEntry obfBehaviorEntry = this.deobfuscator.obfuscateEntry(deobfBehaviorEntry); | 203 | MethodEntry obfMethodEntry = this.deobfuscator.obfuscateEntry(deobfMethodEntry); |
| 200 | BehaviorReferenceTreeNode rootNode = new BehaviorReferenceTreeNode(this.deobfuscator.getTranslator(TranslationDirection.Deobfuscating), obfBehaviorEntry); | 204 | MethodReferenceTreeNode rootNode = new MethodReferenceTreeNode(this.deobfuscator.getTranslator(TranslationDirection.DEOBFUSCATING), obfMethodEntry); |
| 201 | rootNode.load(this.deobfuscator.getJarIndex(), true); | 205 | rootNode.load(this.deobfuscator.getJarIndex(), true); |
| 202 | return rootNode; | 206 | return rootNode; |
| 203 | } | 207 | } |
diff --git a/src/main/java/cuchaz/enigma/gui/GuiTricks.java b/src/main/java/cuchaz/enigma/gui/GuiTricks.java index 8bf57d3..9208455 100644 --- a/src/main/java/cuchaz/enigma/gui/GuiTricks.java +++ b/src/main/java/cuchaz/enigma/gui/GuiTricks.java | |||
| @@ -14,7 +14,6 @@ package cuchaz.enigma.gui; | |||
| 14 | import javax.swing.*; | 14 | import javax.swing.*; |
| 15 | import java.awt.*; | 15 | import java.awt.*; |
| 16 | import java.awt.event.ActionListener; | 16 | import java.awt.event.ActionListener; |
| 17 | import java.util.Arrays; | ||
| 18 | 17 | ||
| 19 | public class GuiTricks { | 18 | public class GuiTricks { |
| 20 | 19 | ||
| @@ -27,7 +26,7 @@ public class GuiTricks { | |||
| 27 | public static void deactivateButton(JButton button) { | 26 | public static void deactivateButton(JButton button) { |
| 28 | button.setEnabled(false); | 27 | button.setEnabled(false); |
| 29 | button.setText(""); | 28 | button.setText(""); |
| 30 | for (ActionListener listener : Arrays.asList(button.getActionListeners())) { | 29 | for (ActionListener listener : button.getActionListeners()) { |
| 31 | button.removeActionListener(listener); | 30 | button.removeActionListener(listener); |
| 32 | } | 31 | } |
| 33 | } | 32 | } |
| @@ -35,7 +34,7 @@ public class GuiTricks { | |||
| 35 | public static void activateButton(JButton button, String text, ActionListener newListener) { | 34 | public static void activateButton(JButton button, String text, ActionListener newListener) { |
| 36 | button.setText(text); | 35 | button.setText(text); |
| 37 | button.setEnabled(true); | 36 | button.setEnabled(true); |
| 38 | for (ActionListener listener : Arrays.asList(button.getActionListeners())) { | 37 | for (ActionListener listener : button.getActionListeners()) { |
| 39 | button.removeActionListener(listener); | 38 | button.removeActionListener(listener); |
| 40 | } | 39 | } |
| 41 | button.addActionListener(newListener); | 40 | button.addActionListener(newListener); |
diff --git a/src/main/java/cuchaz/enigma/gui/ScoredClassEntry.java b/src/main/java/cuchaz/enigma/gui/ScoredClassEntry.java index 1fd2fa8..34ec26e 100644 --- a/src/main/java/cuchaz/enigma/gui/ScoredClassEntry.java +++ b/src/main/java/cuchaz/enigma/gui/ScoredClassEntry.java | |||
| @@ -11,7 +11,7 @@ | |||
| 11 | 11 | ||
| 12 | package cuchaz.enigma.gui; | 12 | package cuchaz.enigma.gui; |
| 13 | 13 | ||
| 14 | import cuchaz.enigma.mapping.ClassEntry; | 14 | import cuchaz.enigma.mapping.entry.ClassEntry; |
| 15 | 15 | ||
| 16 | public class ScoredClassEntry extends ClassEntry { | 16 | public class ScoredClassEntry extends ClassEntry { |
| 17 | 17 | ||
diff --git a/src/main/java/cuchaz/enigma/gui/node/ClassSelectorClassNode.java b/src/main/java/cuchaz/enigma/gui/node/ClassSelectorClassNode.java index dc933cd..a965a8f 100644 --- a/src/main/java/cuchaz/enigma/gui/node/ClassSelectorClassNode.java +++ b/src/main/java/cuchaz/enigma/gui/node/ClassSelectorClassNode.java | |||
| @@ -11,7 +11,7 @@ | |||
| 11 | 11 | ||
| 12 | package cuchaz.enigma.gui.node; | 12 | package cuchaz.enigma.gui.node; |
| 13 | 13 | ||
| 14 | import cuchaz.enigma.mapping.ClassEntry; | 14 | import cuchaz.enigma.mapping.entry.ClassEntry; |
| 15 | 15 | ||
| 16 | import javax.swing.tree.DefaultMutableTreeNode; | 16 | import javax.swing.tree.DefaultMutableTreeNode; |
| 17 | 17 | ||
diff --git a/src/main/java/cuchaz/enigma/gui/node/ClassSelectorPackageNode.java b/src/main/java/cuchaz/enigma/gui/node/ClassSelectorPackageNode.java index f80abba..caa985c 100644 --- a/src/main/java/cuchaz/enigma/gui/node/ClassSelectorPackageNode.java +++ b/src/main/java/cuchaz/enigma/gui/node/ClassSelectorPackageNode.java | |||
| @@ -11,8 +11,6 @@ | |||
| 11 | 11 | ||
| 12 | package cuchaz.enigma.gui.node; | 12 | package cuchaz.enigma.gui.node; |
| 13 | 13 | ||
| 14 | import javassist.bytecode.Descriptor; | ||
| 15 | |||
| 16 | import javax.swing.tree.DefaultMutableTreeNode; | 14 | import javax.swing.tree.DefaultMutableTreeNode; |
| 17 | 15 | ||
| 18 | public class ClassSelectorPackageNode extends DefaultMutableTreeNode { | 16 | public class ClassSelectorPackageNode extends DefaultMutableTreeNode { |
| @@ -41,7 +39,7 @@ public class ClassSelectorPackageNode extends DefaultMutableTreeNode { | |||
| 41 | 39 | ||
| 42 | @Override | 40 | @Override |
| 43 | public String toString() { | 41 | public String toString() { |
| 44 | return !packageName.equals("(none)") ? Descriptor.toJavaName(this.packageName) : "(none)"; | 42 | return !packageName.equals("(none)") ? this.packageName : "(none)"; |
| 45 | } | 43 | } |
| 46 | 44 | ||
| 47 | @Override | 45 | @Override |
diff --git a/src/main/java/cuchaz/enigma/gui/panels/PanelObf.java b/src/main/java/cuchaz/enigma/gui/panels/PanelObf.java index 4bbd32b..9eb8f8f 100644 --- a/src/main/java/cuchaz/enigma/gui/panels/PanelObf.java +++ b/src/main/java/cuchaz/enigma/gui/panels/PanelObf.java | |||
| @@ -2,7 +2,7 @@ package cuchaz.enigma.gui.panels; | |||
| 2 | 2 | ||
| 3 | import cuchaz.enigma.gui.ClassSelector; | 3 | import cuchaz.enigma.gui.ClassSelector; |
| 4 | import cuchaz.enigma.gui.Gui; | 4 | import cuchaz.enigma.gui.Gui; |
| 5 | import cuchaz.enigma.mapping.ClassEntry; | 5 | import cuchaz.enigma.mapping.entry.ClassEntry; |
| 6 | 6 | ||
| 7 | import javax.swing.*; | 7 | import javax.swing.*; |
| 8 | import java.awt.*; | 8 | import java.awt.*; |