diff options
| author | 2018-07-10 10:02:31 +0100 | |
|---|---|---|
| committer | 2018-07-10 10:02:31 +0100 | |
| commit | 4ed1e26c968151e2f50849121f9bb9600deeb90f (patch) | |
| tree | c34636afe567d9ae75eb31ae592549a72b225bc2 /src/main/java/cuchaz/enigma/Deobfuscator.java | |
| parent | Merge pull request #7 from thiakil/method_field_handles (diff) | |
| parent | fix signature remap of inners for now (diff) | |
| download | enigma-fork-4ed1e26c968151e2f50849121f9bb9600deeb90f.tar.gz enigma-fork-4ed1e26c968151e2f50849121f9bb9600deeb90f.tar.xz enigma-fork-4ed1e26c968151e2f50849121f9bb9600deeb90f.zip | |
Merge pull request #6 from thiakil/speedy-getsources
Speedy getsources + sig fix
Diffstat (limited to 'src/main/java/cuchaz/enigma/Deobfuscator.java')
| -rw-r--r-- | src/main/java/cuchaz/enigma/Deobfuscator.java | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/main/java/cuchaz/enigma/Deobfuscator.java b/src/main/java/cuchaz/enigma/Deobfuscator.java index 0e03753..b2cecfe 100644 --- a/src/main/java/cuchaz/enigma/Deobfuscator.java +++ b/src/main/java/cuchaz/enigma/Deobfuscator.java | |||
| @@ -163,6 +163,10 @@ public class Deobfuscator { | |||
| 163 | } | 163 | } |
| 164 | 164 | ||
| 165 | public CompilationUnit getSourceTree(String className) { | 165 | public CompilationUnit getSourceTree(String className) { |
| 166 | return getSourceTree(className, createTypeLoader()); | ||
| 167 | } | ||
| 168 | |||
| 169 | public CompilationUnit getSourceTree(String className, ITranslatingTypeLoader loader) { | ||
| 166 | 170 | ||
| 167 | // we don't know if this class name is obfuscated or deobfuscated | 171 | // we don't know if this class name is obfuscated or deobfuscated |
| 168 | // we need to tell the decompiler the deobfuscated name so it doesn't get freaked out | 172 | // we need to tell the decompiler the deobfuscated name so it doesn't get freaked out |
| @@ -178,7 +182,6 @@ public class Deobfuscator { | |||
| 178 | } | 182 | } |
| 179 | 183 | ||
| 180 | // set the desc loader | 184 | // set the desc loader |
| 181 | TranslatingTypeLoader loader = createTypeLoader(); | ||
| 182 | this.settings.setTypeLoader(loader); | 185 | this.settings.setTypeLoader(loader); |
| 183 | 186 | ||
| 184 | // see if procyon can find the desc | 187 | // see if procyon can find the desc |
| @@ -267,6 +270,10 @@ public class Deobfuscator { | |||
| 267 | progress.init(classEntries.size(), "Decompiling classes..."); | 270 | progress.init(classEntries.size(), "Decompiling classes..."); |
| 268 | } | 271 | } |
| 269 | 272 | ||
| 273 | //create a common instance outside the loop as mappings shouldn't be changing while this is happening | ||
| 274 | //synchronized to make sure the parallelStream doesn't CME with the cache | ||
| 275 | ITranslatingTypeLoader typeLoader = new SynchronizedTypeLoader(createTypeLoader()); | ||
| 276 | |||
| 270 | // DEOBFUSCATE ALL THE THINGS!! @_@ | 277 | // DEOBFUSCATE ALL THE THINGS!! @_@ |
| 271 | Stopwatch stopwatch = Stopwatch.createStarted(); | 278 | Stopwatch stopwatch = Stopwatch.createStarted(); |
| 272 | AtomicInteger count = new AtomicInteger(); | 279 | AtomicInteger count = new AtomicInteger(); |
| @@ -278,7 +285,7 @@ public class Deobfuscator { | |||
| 278 | 285 | ||
| 279 | try { | 286 | try { |
| 280 | // get the source | 287 | // get the source |
| 281 | CompilationUnit sourceTree = getSourceTree(obfClassEntry.getName()); | 288 | CompilationUnit sourceTree = getSourceTree(obfClassEntry.getName(), typeLoader); |
| 282 | 289 | ||
| 283 | // write the file | 290 | // write the file |
| 284 | File file = new File(dirOut, deobfClassEntry.getName().replace('.', '/') + ".java"); | 291 | File file = new File(dirOut, deobfClassEntry.getName().replace('.', '/') + ".java"); |
| @@ -295,7 +302,7 @@ public class Deobfuscator { | |||
| 295 | } | 302 | } |
| 296 | }); | 303 | }); |
| 297 | stopwatch.stop(); | 304 | stopwatch.stop(); |
| 298 | System.out.println("Done in : " + stopwatch.toString()); | 305 | System.out.println("writeSources Done in : " + stopwatch.toString()); |
| 299 | if (progress != null) { | 306 | if (progress != null) { |
| 300 | progress.onProgress(count.get(), "Done:"); | 307 | progress.onProgress(count.get(), "Done:"); |
| 301 | } | 308 | } |
| @@ -658,4 +665,5 @@ public class Deobfuscator { | |||
| 658 | public interface ClassTransformer { | 665 | public interface ClassTransformer { |
| 659 | String transform(ClassNode node, ClassWriter writer); | 666 | String transform(ClassNode node, ClassWriter writer); |
| 660 | } | 667 | } |
| 668 | |||
| 661 | } | 669 | } |