diff options
| author | 2019-02-19 21:00:43 +0200 | |
|---|---|---|
| committer | 2019-02-19 21:00:43 +0200 | |
| commit | c0b0388aae76d39d780c2b4ad2531feb9d633e62 (patch) | |
| tree | 92ed3273d7961c2309c732d39cebd99e687a1532 /src/main/java/cuchaz/enigma/Deobfuscator.java | |
| parent | Added Basic Search (#102) (diff) | |
| download | enigma-fork-c0b0388aae76d39d780c2b4ad2531feb9d633e62.tar.gz enigma-fork-c0b0388aae76d39d780c2b4ad2531feb9d633e62.tar.xz enigma-fork-c0b0388aae76d39d780c2b4ad2531feb9d633e62.zip | |
Bridge Method Fixes (#111)
* Detect synthetic bridges not marked as bridges, and add back flags to produced bytecode
* Remove debug check
* Remove more test code
* Remove unneeded change to `TranslationClassVisitor`
Diffstat (limited to 'src/main/java/cuchaz/enigma/Deobfuscator.java')
| -rw-r--r-- | src/main/java/cuchaz/enigma/Deobfuscator.java | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/main/java/cuchaz/enigma/Deobfuscator.java b/src/main/java/cuchaz/enigma/Deobfuscator.java index 843c761..47cd05c 100644 --- a/src/main/java/cuchaz/enigma/Deobfuscator.java +++ b/src/main/java/cuchaz/enigma/Deobfuscator.java | |||
| @@ -24,6 +24,7 @@ import cuchaz.enigma.analysis.IndexTreeBuilder; | |||
| 24 | import cuchaz.enigma.analysis.ParsedJar; | 24 | import cuchaz.enigma.analysis.ParsedJar; |
| 25 | import cuchaz.enigma.analysis.index.JarIndex; | 25 | import cuchaz.enigma.analysis.index.JarIndex; |
| 26 | import cuchaz.enigma.api.EnigmaPlugin; | 26 | import cuchaz.enigma.api.EnigmaPlugin; |
| 27 | import cuchaz.enigma.bytecode.translators.SourceFixVisitor; | ||
| 27 | import cuchaz.enigma.bytecode.translators.TranslationClassVisitor; | 28 | import cuchaz.enigma.bytecode.translators.TranslationClassVisitor; |
| 28 | import cuchaz.enigma.translation.Translatable; | 29 | import cuchaz.enigma.translation.Translatable; |
| 29 | import cuchaz.enigma.translation.Translator; | 30 | import cuchaz.enigma.translation.Translator; |
| @@ -81,7 +82,10 @@ public class Deobfuscator { | |||
| 81 | 82 | ||
| 82 | listener.accept("Preparing..."); | 83 | listener.accept("Preparing..."); |
| 83 | 84 | ||
| 84 | this.obfSourceProvider = new SourceProvider(SourceProvider.createSettings(), new CompiledSourceTypeLoader(parsedJar)); | 85 | CompiledSourceTypeLoader typeLoader = new CompiledSourceTypeLoader(parsedJar); |
| 86 | typeLoader.addVisitor(visitor -> new SourceFixVisitor(Opcodes.ASM5, visitor, jarIndex)); | ||
| 87 | |||
| 88 | this.obfSourceProvider = new SourceProvider(SourceProvider.createSettings(), typeLoader); | ||
| 85 | 89 | ||
| 86 | // init mappings | 90 | // init mappings |
| 87 | mapper = new EntryRemapper(jarIndex); | 91 | mapper = new EntryRemapper(jarIndex); |
| @@ -230,16 +234,19 @@ public class Deobfuscator { | |||
| 230 | } | 234 | } |
| 231 | 235 | ||
| 232 | //create a common instance outside the loop as mappings shouldn't be changing while this is happening | 236 | //create a common instance outside the loop as mappings shouldn't be changing while this is happening |
| 237 | CompiledSourceTypeLoader typeLoader = new CompiledSourceTypeLoader(translatedClasses::get); | ||
| 238 | typeLoader.addVisitor(visitor -> new SourceFixVisitor(Opcodes.ASM5, visitor, jarIndex)); | ||
| 239 | |||
| 233 | //synchronized to make sure the parallelStream doesn't CME with the cache | 240 | //synchronized to make sure the parallelStream doesn't CME with the cache |
| 234 | ITypeLoader typeLoader = new SynchronizedTypeLoader(new CompiledSourceTypeLoader(translatedClasses::get)); | 241 | ITypeLoader synchronizedTypeLoader = new SynchronizedTypeLoader(typeLoader); |
| 235 | 242 | ||
| 236 | MetadataSystem metadataSystem = new Deobfuscator.NoRetryMetadataSystem(typeLoader); | 243 | MetadataSystem metadataSystem = new Deobfuscator.NoRetryMetadataSystem(synchronizedTypeLoader); |
| 237 | 244 | ||
| 238 | //ensures methods are loaded on classload and prevents race conditions | 245 | //ensures methods are loaded on classload and prevents race conditions |
| 239 | metadataSystem.setEagerMethodLoadingEnabled(true); | 246 | metadataSystem.setEagerMethodLoadingEnabled(true); |
| 240 | 247 | ||
| 241 | DecompilerSettings settings = SourceProvider.createSettings(); | 248 | DecompilerSettings settings = SourceProvider.createSettings(); |
| 242 | SourceProvider sourceProvider = new SourceProvider(settings, typeLoader, metadataSystem); | 249 | SourceProvider sourceProvider = new SourceProvider(settings, synchronizedTypeLoader, metadataSystem); |
| 243 | 250 | ||
| 244 | AtomicInteger count = new AtomicInteger(); | 251 | AtomicInteger count = new AtomicInteger(); |
| 245 | 252 | ||