From 559bac70027bd5161697a3c8dd0907cf89111d31 Mon Sep 17 00:00:00 2001 From: Yanis48 Date: Tue, 15 Dec 2020 19:37:13 +0100 Subject: Fix automapped again --- .../cuchaz/enigma/analysis/StructureTreeNode.java | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'enigma/src/main/java') diff --git a/enigma/src/main/java/cuchaz/enigma/analysis/StructureTreeNode.java b/enigma/src/main/java/cuchaz/enigma/analysis/StructureTreeNode.java index 312c2fe..876b5ca 100644 --- a/enigma/src/main/java/cuchaz/enigma/analysis/StructureTreeNode.java +++ b/enigma/src/main/java/cuchaz/enigma/analysis/StructureTreeNode.java @@ -3,6 +3,7 @@ package cuchaz.enigma.analysis; import cuchaz.enigma.EnigmaProject; import cuchaz.enigma.api.service.NameProposalService; import cuchaz.enigma.api.service.ObfuscationTestService; +import cuchaz.enigma.translation.TranslateResult; import cuchaz.enigma.translation.mapping.EntryRemapper; import cuchaz.enigma.translation.representation.TypeDescriptor; import cuchaz.enigma.translation.representation.entry.*; @@ -84,24 +85,26 @@ public class StructureTreeNode extends DefaultMutableTreeNode { @Override public String toString() { - ParentedEntry translatedEntry = this.mapper.deobfuscate(this.entry); - String result = translatedEntry.getName(); - - if (!this.nameProposalServices.isEmpty()) { - for (NameProposalService service : this.nameProposalServices) { - if (service.proposeName(this.entry, this.mapper).isPresent()) { - result = service.proposeName(this.entry, this.mapper).get(); + TranslateResult translateResult = this.mapper.extendedDeobfuscate(this.entry); + String result = translateResult.getValue().getName(); + + if (translateResult.isObfuscated()) { + if (!this.nameProposalServices.isEmpty()) { + for (NameProposalService service : this.nameProposalServices) { + if (service.proposeName(this.entry, this.mapper).isPresent()) { + result = service.proposeName(this.entry, this.mapper).get(); + } } } } if (this.entry instanceof FieldDefEntry) { - FieldDefEntry field = (FieldDefEntry) translatedEntry; + FieldDefEntry field = (FieldDefEntry) translateResult.getValue(); String returnType = this.parseDesc(field.getDesc()); result = result + ": " + returnType; } else if (this.entry instanceof MethodDefEntry) { - MethodDefEntry method = (MethodDefEntry) translatedEntry; + MethodDefEntry method = (MethodDefEntry) translateResult.getValue(); String args = this.parseArgs(method.getDesc().getArgumentDescs()); String returnType = this.parseDesc(method.getDesc().getReturnDesc()); -- cgit v1.2.3