diff options
Diffstat (limited to 'src/cuchaz')
| -rw-r--r-- | src/cuchaz/enigma/Deobfuscator.java | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/src/cuchaz/enigma/Deobfuscator.java b/src/cuchaz/enigma/Deobfuscator.java index 0356f92..d15c25f 100644 --- a/src/cuchaz/enigma/Deobfuscator.java +++ b/src/cuchaz/enigma/Deobfuscator.java | |||
| @@ -16,10 +16,12 @@ import java.io.IOException; | |||
| 16 | import java.io.StringWriter; | 16 | import java.io.StringWriter; |
| 17 | import java.util.List; | 17 | import java.util.List; |
| 18 | import java.util.Map; | 18 | import java.util.Map; |
| 19 | import java.util.Set; | ||
| 19 | import java.util.jar.JarFile; | 20 | import java.util.jar.JarFile; |
| 20 | 21 | ||
| 21 | import javassist.bytecode.Descriptor; | 22 | import javassist.bytecode.Descriptor; |
| 22 | 23 | ||
| 24 | import com.beust.jcommander.internal.Sets; | ||
| 23 | import com.google.common.collect.Maps; | 25 | import com.google.common.collect.Maps; |
| 24 | import com.strobel.assembler.metadata.MetadataSystem; | 26 | import com.strobel.assembler.metadata.MetadataSystem; |
| 25 | import com.strobel.assembler.metadata.TypeDefinition; | 27 | import com.strobel.assembler.metadata.TypeDefinition; |
| @@ -42,9 +44,9 @@ import cuchaz.enigma.mapping.ConstructorEntry; | |||
| 42 | import cuchaz.enigma.mapping.Entry; | 44 | import cuchaz.enigma.mapping.Entry; |
| 43 | import cuchaz.enigma.mapping.FieldEntry; | 45 | import cuchaz.enigma.mapping.FieldEntry; |
| 44 | import cuchaz.enigma.mapping.Mappings; | 46 | import cuchaz.enigma.mapping.Mappings; |
| 47 | import cuchaz.enigma.mapping.MappingsRenamer; | ||
| 45 | import cuchaz.enigma.mapping.MethodEntry; | 48 | import cuchaz.enigma.mapping.MethodEntry; |
| 46 | import cuchaz.enigma.mapping.MethodMapping; | 49 | import cuchaz.enigma.mapping.MethodMapping; |
| 47 | import cuchaz.enigma.mapping.MappingsRenamer; | ||
| 48 | import cuchaz.enigma.mapping.TranslationDirection; | 50 | import cuchaz.enigma.mapping.TranslationDirection; |
| 49 | import cuchaz.enigma.mapping.Translator; | 51 | import cuchaz.enigma.mapping.Translator; |
| 50 | 52 | ||
| @@ -246,18 +248,12 @@ public class Deobfuscator | |||
| 246 | public void writeSources( File dirOut, ProgressListener progress ) | 248 | public void writeSources( File dirOut, ProgressListener progress ) |
| 247 | throws IOException | 249 | throws IOException |
| 248 | { | 250 | { |
| 249 | int numClasses = m_jarIndex.getObfClassEntries().size(); | 251 | // get the classes to decompile |
| 250 | if( progress != null ) | 252 | Set<ClassEntry> classEntries = Sets.newHashSet(); |
| 251 | { | ||
| 252 | progress.init( numClasses ); | ||
| 253 | } | ||
| 254 | int i = 0; | ||
| 255 | |||
| 256 | // DEOBFUSCATE ALL THE THINGS!! @_@ | ||
| 257 | for( ClassEntry obfClassEntry : m_jarIndex.getObfClassEntries() ) | 253 | for( ClassEntry obfClassEntry : m_jarIndex.getObfClassEntries() ) |
| 258 | { | 254 | { |
| 259 | // skip inner classes | 255 | // skip inner classes |
| 260 | if( m_jarIndex.getOuterClass( obfClassEntry.getName() ) != null ) | 256 | if( obfClassEntry.isInnerClass() ) |
| 261 | { | 257 | { |
| 262 | continue; | 258 | continue; |
| 263 | } | 259 | } |
| @@ -268,6 +264,18 @@ public class Deobfuscator | |||
| 268 | continue; | 264 | continue; |
| 269 | } | 265 | } |
| 270 | 266 | ||
| 267 | classEntries.add( obfClassEntry ); | ||
| 268 | } | ||
| 269 | |||
| 270 | if( progress != null ) | ||
| 271 | { | ||
| 272 | progress.init( classEntries.size() ); | ||
| 273 | } | ||
| 274 | |||
| 275 | // DEOBFUSCATE ALL THE THINGS!! @_@ | ||
| 276 | int i = 0; | ||
| 277 | for( ClassEntry obfClassEntry : classEntries ) | ||
| 278 | { | ||
| 271 | ClassEntry deobfClassEntry = deobfuscateEntry( new ClassEntry( obfClassEntry ) ); | 279 | ClassEntry deobfClassEntry = deobfuscateEntry( new ClassEntry( obfClassEntry ) ); |
| 272 | if( progress != null ) | 280 | if( progress != null ) |
| 273 | { | 281 | { |
| @@ -287,7 +295,7 @@ public class Deobfuscator | |||
| 287 | } | 295 | } |
| 288 | 296 | ||
| 289 | // done! | 297 | // done! |
| 290 | progress.onProgress( numClasses, "Done!" ); | 298 | progress.onProgress( classEntries.size(), "Done!" ); |
| 291 | } | 299 | } |
| 292 | 300 | ||
| 293 | public <T extends Entry> T obfuscateEntry( T deobfEntry ) | 301 | public <T extends Entry> T obfuscateEntry( T deobfEntry ) |