diff options
| author | 2018-07-03 14:24:20 +0100 | |
|---|---|---|
| committer | 2018-07-03 14:24:20 +0100 | |
| commit | 3fde8f31d5e35256935de6945f6d36757e8e4adc (patch) | |
| tree | df19f4994459b9c6f5c1e466d962f3a58bd6d6cf /src | |
| parent | Output directly to file on source export (diff) | |
| download | enigma-3fde8f31d5e35256935de6945f6d36757e8e4adc.tar.gz enigma-3fde8f31d5e35256935de6945f6d36757e8e4adc.tar.xz enigma-3fde8f31d5e35256935de6945f6d36757e8e4adc.zip | |
Make decompile parallel
Diffstat (limited to 'src')
| -rw-r--r-- | src/main/java/cuchaz/enigma/Deobfuscator.java | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/main/java/cuchaz/enigma/Deobfuscator.java b/src/main/java/cuchaz/enigma/Deobfuscator.java index 6fe6e643..5e0bcb89 100644 --- a/src/main/java/cuchaz/enigma/Deobfuscator.java +++ b/src/main/java/cuchaz/enigma/Deobfuscator.java | |||
| @@ -11,6 +11,7 @@ | |||
| 11 | 11 | ||
| 12 | package cuchaz.enigma; | 12 | package cuchaz.enigma; |
| 13 | 13 | ||
| 14 | import com.google.common.base.Stopwatch; | ||
| 14 | import com.google.common.collect.Lists; | 15 | import com.google.common.collect.Lists; |
| 15 | import com.google.common.collect.Maps; | 16 | import com.google.common.collect.Maps; |
| 16 | import com.google.common.collect.Sets; | 17 | import com.google.common.collect.Sets; |
| @@ -267,11 +268,12 @@ public class Deobfuscator { | |||
| 267 | } | 268 | } |
| 268 | 269 | ||
| 269 | // DEOBFUSCATE ALL THE THINGS!! @_@ | 270 | // DEOBFUSCATE ALL THE THINGS!! @_@ |
| 270 | int i = 0; | 271 | Stopwatch stopwatch = Stopwatch.createStarted(); |
| 271 | for (ClassEntry obfClassEntry : classEntries) { | 272 | AtomicInteger count = new AtomicInteger(); |
| 273 | classEntries.parallelStream().forEach(obfClassEntry -> { | ||
| 272 | ClassEntry deobfClassEntry = deobfuscateEntry(new ClassEntry(obfClassEntry)); | 274 | ClassEntry deobfClassEntry = deobfuscateEntry(new ClassEntry(obfClassEntry)); |
| 273 | if (progress != null) { | 275 | if (progress != null) { |
| 274 | progress.onProgress(i++, deobfClassEntry.toString()); | 276 | progress.onProgress(count.getAndIncrement(), deobfClassEntry.toString()); |
| 275 | } | 277 | } |
| 276 | 278 | ||
| 277 | try { | 279 | try { |
| @@ -283,7 +285,7 @@ public class Deobfuscator { | |||
| 283 | file.getParentFile().mkdirs(); | 285 | file.getParentFile().mkdirs(); |
| 284 | try (Writer writer = new BufferedWriter(new FileWriter(file))) { | 286 | try (Writer writer = new BufferedWriter(new FileWriter(file))) { |
| 285 | sourceTree.acceptVisitor(new InsertParenthesesVisitor(), null); | 287 | sourceTree.acceptVisitor(new InsertParenthesesVisitor(), null); |
| 286 | sourceTree.acceptVisitor(new JavaOutputVisitor(new PlainTextOutput(writer), this.settings), null); | 288 | sourceTree.acceptVisitor(new JavaOutputVisitor(new PlainTextOutput(writer), settings), null); |
| 287 | } | 289 | } |
| 288 | } catch (Throwable t) { | 290 | } catch (Throwable t) { |
| 289 | // don't crash the whole world here, just log the error and keep going | 291 | // don't crash the whole world here, just log the error and keep going |
| @@ -291,9 +293,11 @@ public class Deobfuscator { | |||
| 291 | System.err.println("Unable to deobfuscate class " + deobfClassEntry + " (" + obfClassEntry + ")"); | 293 | System.err.println("Unable to deobfuscate class " + deobfClassEntry + " (" + obfClassEntry + ")"); |
| 292 | t.printStackTrace(System.err); | 294 | t.printStackTrace(System.err); |
| 293 | } | 295 | } |
| 294 | } | 296 | }); |
| 297 | stopwatch.stop(); | ||
| 298 | System.out.println("Done in : " + stopwatch.toString()); | ||
| 295 | if (progress != null) { | 299 | if (progress != null) { |
| 296 | progress.onProgress(i, "Done!"); | 300 | progress.onProgress(count.get(), "Done:"); |
| 297 | } | 301 | } |
| 298 | } | 302 | } |
| 299 | 303 | ||