summaryrefslogtreecommitdiff
path: root/src/cuchaz/enigma/mapping/Mappings.java
diff options
context:
space:
mode:
authorGravatar jeff2014-10-01 00:04:18 -0400
committerGravatar jeff2014-10-01 00:04:18 -0400
commit5eeee98418bb39367258442a82b75a081a6f91e0 (patch)
tree16bd812576caad8a3af7f5616bdcaac7bc30b992 /src/cuchaz/enigma/mapping/Mappings.java
parentfixed nasty issue with renaming inner classes, but alas, more bugs remain (diff)
downloadenigma-fork-5eeee98418bb39367258442a82b75a081a6f91e0.tar.gz
enigma-fork-5eeee98418bb39367258442a82b75a081a6f91e0.tar.xz
enigma-fork-5eeee98418bb39367258442a82b75a081a6f91e0.zip
fixed inner class renaming bug
also added smarter sorting to class mappings
Diffstat (limited to 'src/cuchaz/enigma/mapping/Mappings.java')
-rw-r--r--src/cuchaz/enigma/mapping/Mappings.java26
1 files changed, 3 insertions, 23 deletions
diff --git a/src/cuchaz/enigma/mapping/Mappings.java b/src/cuchaz/enigma/mapping/Mappings.java
index 45b41bc..3a39d10 100644
--- a/src/cuchaz/enigma/mapping/Mappings.java
+++ b/src/cuchaz/enigma/mapping/Mappings.java
@@ -24,7 +24,6 @@ import com.google.common.collect.Maps;
24import com.google.common.collect.Sets; 24import com.google.common.collect.Sets;
25 25
26import cuchaz.enigma.Util; 26import cuchaz.enigma.Util;
27import cuchaz.enigma.analysis.TranslationIndex;
28import cuchaz.enigma.mapping.SignatureUpdater.ClassNameUpdater; 27import cuchaz.enigma.mapping.SignatureUpdater.ClassNameUpdater;
29 28
30public class Mappings implements Serializable 29public class Mappings implements Serializable
@@ -125,35 +124,16 @@ public class Mappings implements Serializable
125 return m_classesByDeobf.get( deobfName ); 124 return m_classesByDeobf.get( deobfName );
126 } 125 }
127 126
128 public Translator getTranslator( TranslationIndex index, TranslationDirection direction ) 127 public Translator getTranslator( TranslationDirection direction )
129 { 128 {
130 switch( direction ) 129 switch( direction )
131 { 130 {
132 case Deobfuscating: 131 case Deobfuscating:
133 132
134 return new Translator( direction, m_classesByObf, index ); 133 return new Translator( direction, m_classesByObf );
135 134
136 case Obfuscating: 135 case Obfuscating:
137 136
138 // deobfuscate the index
139 index = new TranslationIndex( index );
140 Map<String,String> renames = Maps.newHashMap();
141 for( ClassMapping classMapping : classes() )
142 {
143 if( classMapping.getDeobfName() != null )
144 {
145 renames.put( classMapping.getObfName(), classMapping.getDeobfName() );
146 }
147 for( ClassMapping innerClassMapping : classMapping.innerClasses() )
148 {
149 if( innerClassMapping.getDeobfName() != null )
150 {
151 renames.put( innerClassMapping.getObfName(), innerClassMapping.getDeobfName() );
152 }
153 }
154 }
155 index.renameClasses( renames );
156
157 // fill in the missing deobf class entries with obf entries 137 // fill in the missing deobf class entries with obf entries
158 Map<String,ClassMapping> classes = Maps.newHashMap(); 138 Map<String,ClassMapping> classes = Maps.newHashMap();
159 for( ClassMapping classMapping : classes() ) 139 for( ClassMapping classMapping : classes() )
@@ -168,7 +148,7 @@ public class Mappings implements Serializable
168 } 148 }
169 } 149 }
170 150
171 return new Translator( direction, classes, index ); 151 return new Translator( direction, classes );
172 152
173 default: 153 default:
174 throw new Error( "Invalid translation direction!" ); 154 throw new Error( "Invalid translation direction!" );