diff options
Diffstat (limited to 'src/cuchaz/enigma/mapping/Mappings.java')
| -rw-r--r-- | src/cuchaz/enigma/mapping/Mappings.java | 26 |
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; | |||
| 24 | import com.google.common.collect.Sets; | 24 | import com.google.common.collect.Sets; |
| 25 | 25 | ||
| 26 | import cuchaz.enigma.Util; | 26 | import cuchaz.enigma.Util; |
| 27 | import cuchaz.enigma.analysis.TranslationIndex; | ||
| 28 | import cuchaz.enigma.mapping.SignatureUpdater.ClassNameUpdater; | 27 | import cuchaz.enigma.mapping.SignatureUpdater.ClassNameUpdater; |
| 29 | 28 | ||
| 30 | public class Mappings implements Serializable | 29 | public 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!" ); |