From 31fbcf6cc82ed64d9e02a55f0ca0552630b05ef9 Mon Sep 17 00:00:00 2001 From: scrash Date: Sat, 21 Sep 2024 22:48:34 +0200 Subject: [PATCH] Fix jar -> directory output and add test from #89 --- .../uwu/narumi/deobfuscator/Deobfuscator.java | 2 +- .../deobfuscator/TestDeobfuscation.java | 5 + .../base/AssertingResultSaver.java | 18 +- .../base/TestDeobfuscationBase.java | 26 +- testData/compiled/custom-jars/SnakeGame.jar | Bin 0 -> 10410 bytes .../results/custom-jars/SnakeGame/Main.dec | 221 ++++ testData/results/custom-jars/SnakeGame/a.dec | 83 ++ testData/results/custom-jars/SnakeGame/b.dec | 20 + testData/results/custom-jars/SnakeGame/c.dec | 23 + testData/results/custom-jars/SnakeGame/d.dec | 1011 +++++++++++++++++ testData/results/custom-jars/SnakeGame/e.dec | 175 +++ testData/results/custom-jars/SnakeGame/f.dec | 15 + 12 files changed, 1578 insertions(+), 21 deletions(-) create mode 100644 testData/compiled/custom-jars/SnakeGame.jar create mode 100644 testData/results/custom-jars/SnakeGame/Main.dec create mode 100644 testData/results/custom-jars/SnakeGame/a.dec create mode 100644 testData/results/custom-jars/SnakeGame/b.dec create mode 100644 testData/results/custom-jars/SnakeGame/c.dec create mode 100644 testData/results/custom-jars/SnakeGame/d.dec create mode 100644 testData/results/custom-jars/SnakeGame/e.dec create mode 100644 testData/results/custom-jars/SnakeGame/f.dec diff --git a/deobfuscator-impl/src/main/java/uwu/narumi/deobfuscator/Deobfuscator.java b/deobfuscator-impl/src/main/java/uwu/narumi/deobfuscator/Deobfuscator.java index ec1b6d47..1bfa3f7b 100644 --- a/deobfuscator-impl/src/main/java/uwu/narumi/deobfuscator/Deobfuscator.java +++ b/deobfuscator-impl/src/main/java/uwu/narumi/deobfuscator/Deobfuscator.java @@ -150,7 +150,7 @@ private void saveClassesToDir() { try { byte[] data = classWrapper.compileToBytes(this.context); - Path path = this.options.outputDir().resolve(classWrapper.getPathInJar() + ".class"); + Path path = this.options.outputDir().resolve(classWrapper.getPathInJar()); Files.createDirectories(path.getParent()); Files.write(path, data); } catch (Exception e) { diff --git a/deobfuscator-impl/src/test/java/uwu/narumi/deobfuscator/TestDeobfuscation.java b/deobfuscator-impl/src/test/java/uwu/narumi/deobfuscator/TestDeobfuscation.java index 42184dc4..be1d73f7 100644 --- a/deobfuscator-impl/src/test/java/uwu/narumi/deobfuscator/TestDeobfuscation.java +++ b/deobfuscator-impl/src/test/java/uwu/narumi/deobfuscator/TestDeobfuscation.java @@ -81,5 +81,10 @@ protected void registerAll() { Source.of("zkm/sample2/SimpleLongDecrypter", false), Source.of("zkm/sample2/FallbackLongDecrypter", false) ); + + register("Zelix (21) Snake Game", InputType.CUSTOM_JAR, + List.of(ComposedZelixTransformer::new), + Source.of("SnakeGame") + ); } } diff --git a/deobfuscator-impl/src/test/java/uwu/narumi/deobfuscator/base/AssertingResultSaver.java b/deobfuscator-impl/src/test/java/uwu/narumi/deobfuscator/base/AssertingResultSaver.java index f5121e1d..1dec045d 100644 --- a/deobfuscator-impl/src/test/java/uwu/narumi/deobfuscator/base/AssertingResultSaver.java +++ b/deobfuscator-impl/src/test/java/uwu/narumi/deobfuscator/base/AssertingResultSaver.java @@ -14,14 +14,15 @@ */ public class AssertingResultSaver implements IResultSaver { - private final TestDeobfuscationBase.InputType inputType; - private final String jarRelativePath; + private final Path root; private boolean savedContent = false; public AssertingResultSaver(TestDeobfuscationBase.InputType inputType, String jarRelativePath) { - this.inputType = inputType; - this.jarRelativePath = jarRelativePath; + this.root = inputType == TestDeobfuscationBase.InputType.CUSTOM_JAR + ? TestDeobfuscationBase.RESULTS_CLASSES_PATH.resolve(inputType.directory()).resolve(jarRelativePath) + : TestDeobfuscationBase.RESULTS_CLASSES_PATH.resolve(inputType.directory()); + } @Override @@ -42,9 +43,12 @@ public void saveClassFile(String path, String qualifiedName, String entryName, S // Replace CRLF with LF content = content.replace("\r\n", "\n"); - Path saveTo = this.inputType == TestDeobfuscationBase.InputType.CUSTOM_JAR - ? TestDeobfuscationBase.RESULTS_CLASSES_PATH.resolve(inputType.directory()).resolve(this.jarRelativePath).resolve(entryName + ".dec") - : TestDeobfuscationBase.RESULTS_CLASSES_PATH.resolve(inputType.directory()).resolve(entryName + ".dec"); + // The Vineflower implementations of IContextSource append .java + if (entryName.endsWith(".java")) { + entryName = entryName.substring(0, entryName.length() - 5); + } + + Path saveTo = this.root.resolve(entryName + ".dec"); try { if (Files.exists(saveTo)) { diff --git a/deobfuscator-impl/src/test/java/uwu/narumi/deobfuscator/base/TestDeobfuscationBase.java b/deobfuscator-impl/src/test/java/uwu/narumi/deobfuscator/base/TestDeobfuscationBase.java index 5d36194d..4a335ffe 100644 --- a/deobfuscator-impl/src/test/java/uwu/narumi/deobfuscator/base/TestDeobfuscationBase.java +++ b/deobfuscator-impl/src/test/java/uwu/narumi/deobfuscator/base/TestDeobfuscationBase.java @@ -41,10 +41,10 @@ public abstract class TestDeobfuscationBase { /** * Register input files for testing * - * @param testName Test name - * @param inputType Input type. See enum optionsConsumer. + * @param testName Test name + * @param inputType Input type. See enum optionsConsumer. * @param transformers Transformers to use - * @param sources You can choose one class or multiple classes for testing + * @param sources You can choose one class or multiple classes for testing */ protected void register(String testName, InputType inputType, List> transformers, Source... sources) { this.registeredTests.add(new RegisteredTest(testName, inputType, transformers, sources)); @@ -90,7 +90,7 @@ private void runTest() { DeobfuscatorOptions.Builder optionsBuilder = DeobfuscatorOptions.builder() .transformers(this.transformers.toArray(new Supplier[0])); - Path inputDir = null; + Path decompilerInputDir = DEOBFUSCATED_CLASSES_PATH.resolve(this.inputType.directory()); String jarSource = null; // Get sources paths @@ -101,13 +101,13 @@ private void runTest() { jarSource = sources[0].sourceName; - Path relativePath = Path.of(this.inputType.directory(), sources[0] + ".jar"); + Path relativePath = Path.of(this.inputType.directory(), jarSource); // Add jar input - Path inputJarPath = COMPILED_CLASSES_PATH.resolve(relativePath); + Path inputJarPath = COMPILED_CLASSES_PATH.resolve(relativePath + ".jar"); optionsBuilder.inputJar(inputJarPath); - inputDir = DEOBFUSCATED_CLASSES_PATH.resolve(relativePath); + decompilerInputDir = decompilerInputDir.resolve(jarSource); } else { for (Source source : sources) { Path compiledClassPath = COMPILED_CLASSES_PATH.resolve(this.inputType.directory()).resolve(source.sourceName + ".class"); @@ -118,14 +118,14 @@ private void runTest() { } // Add class - optionsBuilder.clazz(compiledClassPath, source.sourceName); + optionsBuilder.clazz(compiledClassPath, source.sourceName + ".class"); } } // Last configurations optionsBuilder .outputJar(null) - .outputDir(DEOBFUSCATED_CLASSES_PATH.resolve(this.inputType.directory())); + .outputDir(decompilerInputDir); // Build and run deobfuscator! Deobfuscator.from(optionsBuilder.build()).start(); @@ -146,14 +146,14 @@ private void runTest() { } // Assert output - this.assertOutput(contextSources, inputDir, jarSource); + this.assertOutput(contextSources, decompilerInputDir, jarSource); } /** * Asserts output of a decompilation result * - * @param contextSources Classes to be decompiled - * @param inputDir Optionally you can give a whole directory to decompile. + * @param contextSources Classes to be decompiled + * @param inputDir Optionally you can give a whole directory to decompile. * @param jarRelativePath Specifies a relative path in save directory. Only used for jars */ private void assertOutput(List contextSources, @Nullable Path inputDir, @Nullable String jarRelativePath) { @@ -208,7 +208,7 @@ public String directory() { /** * @param sourceName Class or jar path - * @param decompile Should decompile this source. Does not work with {@link InputType#CUSTOM_JAR} + * @param decompile Should decompile this source. Does not work with {@link InputType#CUSTOM_JAR} */ public record Source(String sourceName, boolean decompile) { public static Source of(String source, boolean decompile) { diff --git a/testData/compiled/custom-jars/SnakeGame.jar b/testData/compiled/custom-jars/SnakeGame.jar new file mode 100644 index 0000000000000000000000000000000000000000..a43a210d86e350839254e2fd2fb6ea951ab74f12 GIT binary patch literal 10410 zcmaia1ymhPwlxym65QQgFP1-Bn#xed_etTTuq~4K@@aA|lkOD~~4BUkv-TEC*5nvPj8`v&jMFrNlwX zDy(wi7jh%RvN9~JlV~z5jAJ9?bxQ0rT>+{8;XO4_zKx4)w`+1?Y_p~l72V(^8uXt!uXDas%qQl9HU6kp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nakeGame/Main.dec new file mode 100644 index 00000000..5b7a3dbc --- /dev/null +++ b/testData/results/custom-jars/SnakeGame/Main.dec @@ -0,0 +1,221 @@ +public class Main { + private static final String a; + private static final long[] b; + private static final Integer[] c; + + public static void main(String[] var0) { + long var1 = 53836601486112L; + e var3 = new e(); + var3.setTitle(a); + var3.setSize(a(23704, 8408508685984484905L), a(21193, 5113680640368394361L)); + var3.setVisible(true); + var3.setDefaultCloseOperation(3); + } + + // $VF: Irreducible bytecode was duplicated to produce valid code + static { + char[] var10001 = "K9,%\u0001".toCharArray(); + int var10003 = var10001.length; + int var8 = 0; + char[] var29 = var10001; + int var18 = var10003; + char[] var35; + int var10004; + char var10005; + byte var10006; + if (var10003 <= 1) { + var35 = var10001; + var10004 = var8; + var10005 = var10001[var8]; + switch (var8 % 7) { + case 0: + var10006 = 24; + break; + case 1: + var10006 = 87; + break; + case 2: + var10006 = 77; + break; + case 3: + var10006 = 78; + break; + case 4: + var10006 = 100; + break; + case 5: + var10006 = 22; + break; + default: + var10006 = 62; + } + } else { + var29 = var10001; + var18 = var10003; + if (var10003 <= var8) { + String var44 = new String(var10001).intern(); + byte var25 = -1; + a = var44; + long var9 = 75645303560601L; + long[] var14 = new long[2]; + int var11 = 0; + String var12 = "\u0098wSód\u0081ØÌpÐ\u0018\"\r\u0096Ö\u009c"; + byte var13 = 16; + byte var10 = 0; + + do { + byte var26 = var10; + var10 += 8; + byte[] var15 = var12.substring(var26, var10).getBytes("ISO-8859-1"); + int var27 = var11++; + long var47 = ( + ((long)var15[0] & 255L) << 56 + | ((long)var15[1] & 255L) << 48 + | ((long)var15[2] & 255L) << 40 + | ((long)var15[3] & 255L) << 32 + | ((long)var15[4] & 255L) << 24 + | ((long)var15[5] & 255L) << 16 + | ((long)var15[6] & 255L) << 8 + | (long)var15[7] & 255L + ) + ^ var9; + byte var45 = -1; + var14[var27] = var47; + } while (var10 < var13); + + b = var14; + c = new Integer[2]; + return; + } + + var35 = var10001; + var10004 = var8; + var10005 = var10001[var8]; + switch (var8 % 7) { + case 0: + var10006 = 24; + break; + case 1: + var10006 = 87; + break; + case 2: + var10006 = 77; + break; + case 3: + var10006 = 78; + break; + case 4: + var10006 = 100; + break; + case 5: + var10006 = 22; + break; + default: + var10006 = 62; + } + } + + while (true) { + var35[var10004] = (char)(var10005 ^ var10006); + var8++; + if (var18 == 0) { + var10004 = var18; + var35 = var29; + var10005 = var29[var18]; + switch (var8 % 7) { + case 0: + var10006 = 24; + break; + case 1: + var10006 = 87; + break; + case 2: + var10006 = 77; + break; + case 3: + var10006 = 78; + break; + case 4: + var10006 = 100; + break; + case 5: + var10006 = 22; + break; + default: + var10006 = 62; + } + } else { + if (var18 <= var8) { + String var42 = new String(var29).intern(); + byte var22 = -1; + a = var42; + long var0 = 75645303560601L; + long[] var6 = new long[2]; + int var3 = 0; + String var4 = "\u0098wSód\u0081ØÌpÐ\u0018\"\r\u0096Ö\u009c"; + byte var5 = 16; + byte var2 = 0; + + do { + byte var23 = var2; + var2 += 8; + byte[] var7 = var4.substring(var23, var2).getBytes("ISO-8859-1"); + int var24 = var3++; + long var46 = ( + ((long)var7[0] & 255L) << 56 + | ((long)var7[1] & 255L) << 48 + | ((long)var7[2] & 255L) << 40 + | ((long)var7[3] & 255L) << 32 + | ((long)var7[4] & 255L) << 24 + | ((long)var7[5] & 255L) << 16 + | ((long)var7[6] & 255L) << 8 + | (long)var7[7] & 255L + ) + ^ var0; + byte var43 = -1; + var6[var24] = var46; + } while (var2 < var5); + + b = var6; + c = new Integer[2]; + return; + } + + var35 = var29; + var10004 = var8; + var10005 = var29[var8]; + switch (var8 % 7) { + case 0: + var10006 = 24; + break; + case 1: + var10006 = 87; + break; + case 2: + var10006 = 77; + break; + case 3: + var10006 = 78; + break; + case 4: + var10006 = 100; + break; + case 5: + var10006 = 22; + break; + default: + var10006 = 62; + } + } + } + } + + private static int a(int var0, long var1) { + int var3 = var0 ^ (int)(var1 & 32767L) ^ 4784; + if (c[var3] == null) { + c[var3] = (int)(b[var3] ^ var1); + } + + return c[var3]; + } +} diff --git a/testData/results/custom-jars/SnakeGame/a.dec b/testData/results/custom-jars/SnakeGame/a.dec new file mode 100644 index 00000000..0e71cdc4 --- /dev/null +++ b/testData/results/custom-jars/SnakeGame/a.dec @@ -0,0 +1,83 @@ +import java.awt.event.KeyAdapter; +import java.awt.event.KeyEvent; + +public class a extends KeyAdapter { + public void keyPressed(KeyEvent var1) { + boolean var4; + label60: { + label61: { + label62: { + var4 = d.h; + int var10000 = var1.getKeyCode(); + if (!var4) { + switch (var10000) { + case 37: + break label61; + case 38: + break label62; + case 39: + var10000 = d.e; + break; + case 40: + break label60; + default: + return; + } + } + + if (!var4) { + if (var10000 == 2) { + return; + } + + var10000 = 1; + } + + d.e = var10000; + if (!var4) { + return; + } + } + + int var5 = d.e; + if (!var4) { + if (d.e == 4) { + return; + } + + var5 = 3; + } + + d.e = var5; + if (!var4) { + return; + } + } + + int var6 = d.e; + if (!var4) { + if (d.e == 1) { + return; + } + + var6 = 2; + } + + d.e = var6; + if (!var4) { + return; + } + } + + int var7 = d.e; + if (!var4) { + if (d.e == 3) { + return; + } + + var7 = 4; + } + + d.e = var7; + } +} diff --git a/testData/results/custom-jars/SnakeGame/b.dec b/testData/results/custom-jars/SnakeGame/b.dec new file mode 100644 index 00000000..a51326c9 --- /dev/null +++ b/testData/results/custom-jars/SnakeGame/b.dec @@ -0,0 +1,20 @@ +import java.awt.Color; +import java.util.ArrayList; + +public class b { + ArrayList a = new ArrayList(); + int b; + f c; + + public b(int var1) { + this.a.add(Color.darkGray); + this.a.add(Color.BLUE); + this.a.add(Color.white); + this.b = var1; + this.c = new f((Color)this.a.get(this.b)); + } + + public void a(int var1) { + this.c.a(new Object[]{(Color)this.a.get(var1)}); + } +} diff --git a/testData/results/custom-jars/SnakeGame/c.dec b/testData/results/custom-jars/SnakeGame/c.dec new file mode 100644 index 00000000..3c884015 --- /dev/null +++ b/testData/results/custom-jars/SnakeGame/c.dec @@ -0,0 +1,23 @@ +public class c { + public int a; + public int b; + public static boolean c; + + public c(int var1, int var2) { + this.a = var1; + this.b = var2; + } + + public void a(int var1, int var2) { + this.a = var1; + this.b = var2; + } + + public int a(Object[] var1) { + return this.a; + } + + public int b(Object[] var1) { + return this.b; + } +} diff --git a/testData/results/custom-jars/SnakeGame/d.dec b/testData/results/custom-jars/SnakeGame/d.dec new file mode 100644 index 00000000..d4c724ab --- /dev/null +++ b/testData/results/custom-jars/SnakeGame/d.dec @@ -0,0 +1,1011 @@ +import java.util.ArrayList; +import java.util.Iterator; + +public class d extends Thread { + ArrayList> a = new ArrayList(); + c b; + int c; + long d; + public static int e; + ArrayList f; + c g; + public static boolean h; + private static final String[] i; + private static final String[] j; + private static final long[] k; + private static final Integer[] l; + private static final long m; + + d(long var1, c var3) { + this.c = a(20214, 210489315596258668L ^ var1); + this.d = m; + this.f = new ArrayList(); + this.a = e.a; + boolean var10000 = h; + this.b = new c(var3.a, var3.b); + e = 1; + c var5 = new c(this.b.a(new Object[0]), this.b.b(new Object[0])); + boolean var4 = var10000; + this.f.add(var5); + this.g = new c(e.c - 1, e.b - 1); + this.d(new Object[]{this.g}); + var10000 = var4; + if (var1 > 0L) { + if (!var4) { + return; + } + + var10000 = c.c; + } + + if (var1 >= 0L) { + var10000 = !var10000; + } + + c.c = var10000; + } + + public void run() { + long var1 = 89995196843699L; + long var3 = 12972172530972L; + long var5 = 121593940001805L; + long var7 = 41896598891982L; + long var10002 = 78566231858904L; + short var9 = 18292; + var10002 = 78566231858904L; + int var10 = -1604886824; + + while (true) { + int var10001 = e; + Object[] var10004 = new Object[]{null, var7}; + var10004[0] = var10001; + this.e(var10004); + this.b(new Object[]{var5}); + this.f(new Object[]{var3}); + var10004 = new Object[]{null, var10}; + var10004[0] = Integer.valueOf(var9); + this.g(var10004); + this.a(new Object[0]); + } + } + + private void a(Object[] var1) { + try { + sleep(this.d); + } catch (InterruptedException var3) { + var3.printStackTrace(); + } + } + + // $VF: Irreducible bytecode was duplicated to produce valid code + private void b(long var1) { + long var4 = var1 ^ 110402980100581L; + long var6 = var1 ^ 34179827676109L; + int var10000 = h; + c var9 = (c)this.f.get(this.f.size() - 1); + byte var8 = (byte)var10000; + int var10 = 0; + + int var17; + byte var10002; + label96: { + label95: + while (true) { + c var10001; + if (var10 <= this.f.size() - 2) { + var10000 = var9.a(new Object[0]); + var10001 = (c)this.f.get(var10); + } else { + var10000 = var9.a(new Object[0]); + var10001 = this.g; + if (var1 > 0L) { + var17 = this.g.b; + break; + } + } + + do { + var17 = var10001.a(new Object[0]); + var10002 = var8; + if (var1 <= 0L) { + break label96; + } + + if (var8 != 0) { + break label95; + } + + if (var8 == 0) { + if (var10000 == var17) { + var10000 = var9.b(new Object[0]); + if (var8 == 0) { + var10000 = var10000 == ((c)this.f.get(var10)).b(new Object[0]) ? 1 : 0; + } + } else { + var10000 = 0; + } + } else { + var10000 = var10000 == var17 ? 1 : 0; + } + + int var11 = var10000; + byte var15 = var8; + if (var1 > 0L) { + if (var8 == 0) { + if (var11 != 0) { + this.c(new Object[]{var6}); + } + + var10++; + } + + var15 = var8; + } + + if (var15 == 0) { + continue label95; + } + + var10000 = var9.a(new Object[0]); + var10001 = this.g; + } while (var1 <= 0L); + + var17 = this.g.b; + break; + } + + var10002 = var8; + } + + label66: { + label65: { + if (var10002 == 0) { + if (var10000 != var17) { + break label65; + } + + var10000 = var9.b(new Object[0]); + if (var8 != 0) { + break label66; + } + + var17 = this.g.a; + } + + if (var10000 == var17) { + var10000 = 1; + break label66; + } + } + + var10000 = 0; + } + + label102: { + var10 = var10000; + var10000 = var8; + if (var1 > 0L) { + if (var8 != 0) { + break label102; + } + + var10000 = var10; + } + + if (var10000 == 0) { + return; + } + + System.out.println(a(879106065, -879064062, (int)var1)); + this.c++; + this.g = this.a(new Object[]{var4}); + } + + this.d(new Object[]{this.g}); + } + + private void c(long var1) { + System.out.println(a(672771037, -672779940, (int)var1)); + + while (true) { + this.a(new Object[0]); + } + } + + private void d(c var1) { + ((b)((ArrayList)this.a.get(var1.a)).get(var1.b)).a(new Object[]{1}); + } + + // $VF: Irreducible bytecode was duplicated to produce valid code + private c a(long var1) { + int var10000 = h; + int var6 = 0 + (int)(Math.random() * 19.0); + int var7 = 0 + (int)(Math.random() * 19.0); + c var5 = new c(var6, var7); + byte var4 = (byte)var10000; + int var10 = 0; + + label53: + while (true) { + if (var10 <= this.f.size() - 1) { + var11 = var5; + int var10001 = var4; + if (var1 >= 0L) { + if (var4 != 0) { + break; + } + + var10001 = 0; + } + + label58: { + var10000 = var5.b(new Object[var10001]); + var10001 = ((c)this.f.get(var10)).a(new Object[0]); + byte var10002 = var4; + if (var1 >= 0L) { + if (var4 == 0) { + if (var10000 != var10001) { + break label58; + } + + var10000 = var5.a(new Object[0]); + var10001 = ((c)this.f.get(var10)).b(new Object[0]); + var10002 = var4; + } else { + var10002 = var4; + } + } + + if (var10002 == 0) { + if (var10000 != var10001) { + break label58; + } + + var6 = 0 + (int)(Math.random() * 19.0); + var10000 = 0; + var10001 = (int)(Math.random() * 19.0); + } + + var7 = var10000 + var10001; + var5 = new c(var6, var7); + var10 = 0; + } + + var10++; + if (var4 == 0) { + continue; + } + } + + while (var1 <= 0L) { + var10 = 0; + var10++; + if (var4 == 0) { + continue label53; + } + } + + var11 = var5; + break; + } + + return var11; + } + + private void e(int var1, long var2) { + label106: { + byte var5; + d var10; + label101: { + label107: { + label99: { + var5 = h; + int var10000 = var1; + if (var2 >= 0L) { + if (var5 == 0) { + switch (var1) { + case 1: + break label106; + case 2: + break label107; + case 3: + break label99; + case 4: + c var6 = this.b; + int var10001 = this.b.a; + Object[] var10004 = new Object[]{null, (this.b.b + 1) % a(29246, 1908309985901173826L ^ var2)}; + var10004[0] = var10001; + var6.a(var10004); + this.f.add(new c(this.b.a, this.b.b)); + break; + default: + return; + } + } + + var10000 = var5; + } + + if (var10000 == 0) { + return; + } + } + + label108: { + label86: { + c var7 = this.b; + int var15 = var5; + if (var2 >= 0L) { + if (var5 == 0) { + label110: { + var8 = this.b.b - 1; + if (var2 >= 0L) { + if (var8 >= 0) { + break label110; + } + + c var9 = this.b; + var15 = this.b.a; + Object[] var20 = new Object[]{null, a(23257, 8351649413545882788L ^ var2)}; + var20[0] = var15; + var9.a(var20); + var8 = var5; + } + + if (var2 <= 0L) { + break label108; + } + + if (var8 == 0) { + break label86; + } + } + + var7 = this.b; + } + + var15 = this.b.a; + } + + Object[] var21 = new Object[]{null, Math.abs(this.b.b - 1) % a(12965, 6421566126420663514L ^ var2)}; + var21[0] = var15; + var7.a(var21); + } + + var10 = this; + if (var2 < 0L) { + break label101; + } + + this.f.add(new c(this.b.a, this.b.b)); + var8 = var5; + } + + if (var8 == 0) { + return; + } + } + + var10 = this; + } + + label64: { + label63: { + c var11 = var10.b; + int var17 = var5; + if (var2 >= 0L) { + if (var5 == 0) { + label112: { + var12 = var10.b.a - 1; + if (var2 > 0L) { + if (var12 >= 0) { + break label112; + } + + c var13 = this.b; + var17 = a(15174, 2782928937078887741L ^ var2); + Object[] var22 = new Object[]{null, this.b.b}; + var22[0] = var17; + var13.a(var22); + var12 = var5; + } + + if (var2 < 0L) { + break label64; + } + + if (var12 == 0) { + break label63; + } + } + + var11 = this.b; + } + + var17 = Math.abs(this.b.a - 1) % a(12965, 6421566126420663514L ^ var2); + } + + Object[] var23 = new Object[]{null, this.b.b}; + var23[0] = var17; + var11.a(var23); + } + + this.f.add(new c(this.b.a, this.b.b)); + var12 = var5; + } + + if (var2 < 0L || var12 == 0) { + return; + } + } + + c var14 = this.b; + int var19 = Math.abs(this.b.a + 1) % a(12965, 6421566126420663514L ^ var2); + Object[] var24 = new Object[]{null, this.b.b}; + var24[0] = var19; + var14.a(var24); + this.f.add(new c(this.b.a, this.b.b)); + } + + private void f(long var1) { + boolean var10000 = h; + Iterator var5 = this.f.iterator(); + boolean var4 = var10000; + + while (var5.hasNext()) { + c var6 = (c)var5.next(); + int var7 = var6.a(new Object[0]); + int var8 = var6.b(new Object[0]); + ((b)((ArrayList)this.a.get(var8)).get(var7)).a(new Object[]{0}); + if (var4) { + break; + } + } + } + + private void g(int param1, int param2) { + // $VF: Couldn't be decompiled + // Please report this to the Vineflower issue tracker, at https://github.com/Vineflower/vineflower/issues with a copy of the class file (if you have the rights to distribute it!) + // java.lang.IllegalStateException: Could not find destination nodes for stat id {Do}:48 from source 40_tail + // at org.jetbrains.java.decompiler.modules.decompiler.flow.FlattenStatementsHelper.setEdges(FlattenStatementsHelper.java:563) + // at org.jetbrains.java.decompiler.modules.decompiler.flow.FlattenStatementsHelper.buildDirectGraph(FlattenStatementsHelper.java:50) + // at org.jetbrains.java.decompiler.modules.decompiler.sforms.SFormsConstructor.splitVariables(SFormsConstructor.java:72) + // at org.jetbrains.java.decompiler.modules.decompiler.StackVarsProcessor.simplifyStackVars(StackVarsProcessor.java:52) + // at org.jetbrains.java.decompiler.modules.decompiler.StackVarsProcessor.simplifyStackVars(StackVarsProcessor.java:40) + // at org.jetbrains.java.decompiler.main.rels.MethodProcessor.codeToJava(MethodProcessor.java:292) + // + // Bytecode: + // 00: iload 1 + // 01: i2l + // 02: bipush 32 + // 04: lshl + // 05: iload 2 + // 06: i2l + // 07: bipush 32 + // 09: lshl + // 0a: bipush 32 + // 0c: lushr + // 0d: lor + // 0e: pop2 + // 0f: getstatic d.h Z + // 12: aload 0 + // 13: getfield d.c I + // 16: istore 7 + // 18: aload 0 + // 19: getfield d.f Ljava/util/ArrayList; + // 1c: invokevirtual java/util/ArrayList.size ()I + // 1f: bipush 1 + // 20: isub + // 21: istore 8 + // 23: istore 6 + // 25: iload 8 + // 27: iflt 80 + // 2a: iload 7 + // 2c: iload 6 + // 2e: ifne 93 + // 31: ifne 75 + // 34: aload 0 + // 35: getfield d.f Ljava/util/ArrayList; + // 38: iload 8 + // 3a: invokevirtual java/util/ArrayList.get (I)Ljava/lang/Object; + // 3d: checkcast c + // 40: astore 9 + // 42: aload 0 + // 43: getfield d.a Ljava/util/ArrayList; + // 46: aload 9 + // 48: getfield c.b I + // 4b: invokevirtual java/util/ArrayList.get (I)Ljava/lang/Object; + // 4e: checkcast java/util/ArrayList + // 51: aload 9 + // 53: getfield c.a I + // 56: invokevirtual java/util/ArrayList.get (I)Ljava/lang/Object; + // 59: checkcast b + // 5c: bipush 2 + // 5d: bipush 1 + // 5e: anewarray 67 + // 61: dup_x1 + // 62: swap + // 63: invokestatic java/lang/Integer.valueOf (I)Ljava/lang/Integer; + // 66: bipush 0 + // 67: swap + // 68: aastore + // 69: invokevirtual b.a ([Ljava/lang/Object;)V + // 6c: iload 6 + // 6e: iload 2 + // 6f: ifge 7d + // 72: ifeq 78 + // 75: iinc 7 -1 + // 78: iinc 8 -1 + // 7b: iload 6 + // 7d: ifeq 25 + // 80: aload 0 + // 81: getfield d.c I + // 84: istore 7 + // 86: aload 0 + // 87: getfield d.f Ljava/util/ArrayList; + // 8a: invokevirtual java/util/ArrayList.size ()I + // 8d: bipush 1 + // 8e: iload 1 + // 8f: ifle 2e + // 92: isub + // 93: istore 8 + // 95: iload 8 + // 97: iflt c1 + // 9a: iload 7 + // 9c: iload 1 + // 9d: ifle af + // a0: ifne b6 + // a3: aload 0 + // a4: getfield d.f Ljava/util/ArrayList; + // a7: iload 8 + // a9: invokevirtual java/util/ArrayList.remove (I)Ljava/lang/Object; + // ac: pop + // ad: iload 6 + // af: iload 1 + // b0: iflt be + // b3: ifeq b9 + // b6: iinc 7 -1 + // b9: iinc 8 -1 + // bc: iload 6 + // be: ifeq 95 + // c1: iload 2 + // c2: ifgt b6 + // c5: return + } + + // $VF: Irreducible bytecode was duplicated to produce valid code + static { + String[] var13 = new String[2]; + int var11 = 0; + String var10 = "úÑ\u0017tµ9\u000b_ÉÛ.\u0003º·y³ß\u0081"; + byte var12 = 18; + char var9 = 6; + int var8 = -1; + + while (true) { + char[] var30; + label56: { + char[] var10001 = var10.substring(++var8, var8 + var9).toCharArray(); + int var10003 = var10001.length; + int var14 = 0; + var30 = var10001; + int var19 = var10003; + char[] var39; + int var10004; + if (var10003 <= 1) { + var39 = var10001; + var10004 = var14; + } else { + var30 = var10001; + var19 = var10003; + if (var10003 <= var14) { + break label56; + } + + var39 = var10001; + var10004 = var14; + } + + while (true) { + var39[var10004] = (char)(var39[var10004] ^ switch (var14 % 7) { + case 0 -> 10; + case 1 -> 70; + case 2 -> 22; + case 3 -> 48; + case 4 -> 44; + case 5 -> 80; + default -> 36; + }); + var14++; + if (var19 == 0) { + var10004 = var19; + var39 = var30; + } else { + if (var19 <= var14) { + break; + } + + var39 = var30; + var10004 = var14; + } + } + } + + String var46 = new String(var30).intern(); + int var23 = -1; + var13[var11++] = var46; + if ((var8 += var9) >= var12) { + i = var13; + j = new String[2]; + long var0 = 107634029375693L; + long[] var6 = new long[5]; + int var3 = 0; + String var4 = ":Q o5\u000eÁÍg¡ù¢Xɽ\u0088sÊUÂÈò©´"; + byte var5 = 24; + byte var2 = 0; + + label40: + while (true) { + var23 = var2; + var2 += 8; + byte[] var7 = var4.substring(var23, var2).getBytes("ISO-8859-1"); + long[] var10000 = var6; + var23 = var3++; + long var35 = ((long)var7[0] & 255L) << 56 + | ((long)var7[1] & 255L) << 48 + | ((long)var7[2] & 255L) << 40 + | ((long)var7[3] & 255L) << 32 + | ((long)var7[4] & 255L) << 24 + | ((long)var7[5] & 255L) << 16 + | ((long)var7[6] & 255L) << 8 + | (long)var7[7] & 255L; + byte var47 = -1; + + while (true) { + long var50 = var35 ^ var0; + switch (var47) { + case 0: + var10000[var23] = var50; + if (var2 >= var5) { + k = var6; + l = new Integer[5]; + long var27 = 107634029375743L; + byte var28 = -1; + m = 50L; + return; + } + break; + default: + var10000[var23] = var50; + if (var2 < var5) { + continue label40; + } + + var4 = ">\u0099\u0092í\u0001\n\u0081U\u008a±Å\u001bæLÈ-"; + var5 = 16; + var2 = 0; + } + + byte var26 = var2; + var2 += 8; + var7 = var4.substring(var26, var2).getBytes("ISO-8859-1"); + var10000 = var6; + var23 = var3++; + var35 = ((long)var7[0] & 255L) << 56 + | ((long)var7[1] & 255L) << 48 + | ((long)var7[2] & 255L) << 40 + | ((long)var7[3] & 255L) << 32 + | ((long)var7[4] & 255L) << 24 + | ((long)var7[5] & 255L) << 16 + | ((long)var7[6] & 255L) << 8 + | (long)var7[7] & 255L; + var47 = 0; + } + } + } + + var9 = var10.charAt(var8); + } + } + + private static String a(int var0, int var1, int var2) { + int var3 = (var0 ^ var2 ^ -9188) & 65535; + if (j[var3] == null) { + char[] var4 = i[var3].toCharArray(); + + short var5 = switch (var4[0] & 0xFF) { + case 0 -> 197; + case 1 -> 149; + case 2 -> 246; + case 3 -> 142; + case 4 -> 144; + case 5 -> 165; + case 6 -> 232; + case 7 -> 71; + case 8 -> 18; + case 9 -> 216; + case 10 -> 198; + case 11 -> 124; + case 12 -> 191; + case 13 -> 24; + case 14 -> 40; + case 15 -> 0; + case 16 -> 247; + case 17 -> 41; + case 18 -> 121; + case 19 -> 38; + case 20 -> 139; + case 21 -> 75; + case 22 -> 53; + case 23 -> 70; + case 24 -> 222; + case 25 -> 152; + case 26 -> 229; + case 27 -> 239; + case 28 -> 25; + case 29 -> 181; + case 30 -> 12; + case 31 -> 166; + case 32 -> 59; + case 33 -> 192; + case 34 -> 89; + case 35 -> 217; + case 36 -> 230; + case 37 -> 219; + case 38 -> 93; + case 39 -> 81; + case 40 -> 23; + case 41 -> 243; + case 42 -> 63; + case 43 -> 57; + case 44 -> 34; + case 45 -> 184; + case 46 -> 167; + case 47 -> 22; + case 48 -> 21; + case 49 -> 169; + case 50 -> 255; + case 51 -> 7; + case 52 -> 103; + case 53 -> 47; + case 54 -> 187; + case 55 -> 133; + case 56 -> 37; + case 57 -> 91; + case 58 -> 178; + case 59 -> 163; + case 60 -> 238; + case 61 -> 225; + case 62 -> 164; + case 63 -> 79; + case 64 -> 249; + case 65 -> 196; + case 66 -> 159; + case 67 -> 180; + case 68 -> 92; + case 69 -> 101; + case 70 -> 28; + case 71 -> 10; + case 72 -> 205; + case 73 -> 244; + case 74 -> 83; + case 75 -> 55; + case 76 -> 56; + case 77 -> 27; + case 78 -> 200; + case 79 -> 132; + case 80 -> 175; + case 81 -> 99; + case 82 -> 126; + case 83 -> 35; + case 84 -> 250; + case 85 -> 134; + case 86 -> 123; + case 87 -> 26; + case 88 -> 29; + case 89 -> 68; + case 90 -> 104; + case 91 -> 179; + case 92 -> 78; + case 93 -> 147; + case 94 -> 111; + case 95 -> 114; + case 96 -> 130; + case 97 -> 15; + case 98 -> 6; + case 99 -> 85; + case 100 -> 86; + case 101 -> 186; + case 102 -> 135; + case 103 -> 210; + case 104 -> 131; + case 105 -> 67; + case 106 -> 36; + case 107 -> 146; + case 108 -> 90; + case 109 -> 20; + case 110 -> 182; + case 111 -> 189; + case 112 -> 19; + case 113 -> 168; + case 114 -> 236; + case 115 -> 45; + case 116 -> 141; + case 117 -> 127; + case 118 -> 153; + case 119 -> 80; + case 120 -> 1; + case 121 -> 190; + case 122 -> 5; + case 123 -> 72; + case 124 -> 11; + case 125 -> 203; + case 126 -> 194; + case 127 -> 110; + case 128 -> 116; + case 129 -> 82; + case 130 -> 43; + case 131 -> 154; + case 132 -> 30; + case 133 -> 151; + case 134 -> 113; + case 135 -> 16; + case 136 -> 254; + case 137 -> 226; + case 138 -> 145; + case 139 -> 69; + case 140 -> 49; + case 141 -> 119; + case 142 -> 108; + case 143 -> 248; + case 144 -> 235; + case 145 -> 77; + case 146 -> 157; + case 147 -> 117; + case 148 -> 138; + case 149 -> 65; + case 150 -> 201; + case 151 -> 252; + case 152 -> 54; + case 153 -> 136; + case 154 -> 115; + case 155 -> 212; + case 156 -> 253; + case 157 -> 106; + case 158 -> 173; + case 159 -> 87; + case 160 -> 125; + case 161 -> 88; + case 162 -> 220; + case 163 -> 209; + case 164 -> 221; + case 165 -> 118; + case 166 -> 33; + case 167 -> 241; + case 168 -> 66; + case 169 -> 172; + case 170 -> 245; + case 171 -> 185; + case 172 -> 207; + case 173 -> 237; + case 174 -> 94; + case 175 -> 183; + case 176 -> 206; + case 177 -> 44; + case 178 -> 112; + case 179 -> 177; + case 180 -> 62; + case 181 -> 160; + case 182 -> 97; + case 183 -> 148; + case 184 -> 42; + case 185 -> 64; + case 186 -> 120; + case 187 -> 223; + case 188 -> 204; + case 189 -> 60; + case 190 -> 171; + case 191 -> 156; + case 192 -> 218; + case 193 -> 228; + case 194 -> 73; + case 195 -> 234; + case 196 -> 161; + case 197 -> 128; + case 198 -> 158; + case 199 -> 227; + case 200 -> 162; + case 201 -> 58; + case 202 -> 52; + case 203 -> 95; + case 204 -> 17; + case 205 -> 242; + case 206 -> 76; + case 207 -> 155; + case 208 -> 107; + case 209 -> 208; + case 210 -> 51; + case 211 -> 211; + case 212 -> 48; + case 213 -> 195; + case 214 -> 39; + case 215 -> 122; + case 216 -> 50; + case 217 -> 8; + case 218 -> 188; + case 219 -> 14; + case 220 -> 193; + case 221 -> 96; + case 222 -> 46; + case 223 -> 240; + case 224 -> 2; + case 225 -> 213; + case 226 -> 13; + case 227 -> 231; + case 228 -> 202; + case 229 -> 214; + case 230 -> 3; + case 231 -> 9; + case 232 -> 109; + case 233 -> 84; + case 234 -> 31; + case 235 -> 74; + case 236 -> 100; + case 237 -> 98; + case 238 -> 4; + case 239 -> 199; + case 240 -> 102; + case 241 -> 170; + case 242 -> 233; + case 243 -> 150; + case 244 -> 140; + case 245 -> 215; + case 246 -> 32; + case 247 -> 224; + case 248 -> 251; + case 249 -> 176; + case 250 -> 61; + case 251 -> 105; + case 252 -> 143; + case 253 -> 129; + case 254 -> 137; + default -> 174; + }; + int var10; + int var6 = ((var10 = var1 ^ var2) & 0xFF) - var5; + if (var6 < 0) { + var6 += 256; + } + + int var7 = ((var10 & 65535) >>> 8) - var5; + if (var7 < 0) { + var7 += 256; + } + + for (int var8 = 0; var8 < var4.length; var8++) { + int var9 = var8 % 2; + char var10002 = var4[var8]; + if (var9 == 0) { + var4[var8] = (char)(var10002 ^ var6); + var6 = ((var6 >>> 3 | var6 << 5) ^ var4[var8]) & 0xFF; + } else { + var4[var8] = (char)(var10002 ^ var7); + var7 = ((var7 >>> 3 | var7 << 5) ^ var4[var8]) & 0xFF; + } + } + + j[var3] = new String(var4).intern(); + } + + return j[var3]; + } + + private static int a(int var0, long var1) { + int var3 = var0 ^ (int)(var1 & 32767L) ^ 17329; + if (l[var3] == null) { + l[var3] = (int)(k[var3] ^ var1); + } + + return l[var3]; + } +} diff --git a/testData/results/custom-jars/SnakeGame/e.dec b/testData/results/custom-jars/SnakeGame/e.dec new file mode 100644 index 00000000..f6cce4e3 --- /dev/null +++ b/testData/results/custom-jars/SnakeGame/e.dec @@ -0,0 +1,175 @@ +import java.awt.GridLayout; +import java.util.ArrayList; +import javax.swing.JFrame; + +class e extends JFrame { + private static final long serialVersionUID; + public static ArrayList> a; + public static int b; + public static int c; + private static final long[] d; + private static final Integer[] e; + + public e() { + long var1 = 71224974300475L; + long var3 = 61070374780970L; + byte var10000 = d.h; + super(); + a = new ArrayList(); + boolean var5 = (boolean)var10000; + int var7 = 0; + + while (true) { + if (var7 < b) { + ArrayList var6 = new ArrayList(); + var10000 = 0; + if (var5) { + break; + } + + int var8 = 0; + + label61: { + while (var8 < c) { + b var9 = new b(2); + var6.add(var9); + var8++; + if (var5) { + break label61; + } + + if (var5) { + break; + } + } + + a.add(var6); + var7++; + } + + if (!var5) { + continue; + } + } + + this.getContentPane().setLayout(new GridLayout(a(25254, 3466615061930824381L), a(11993, 4420636720690273987L), 0, 0)); + var10000 = 0; + break; + } + + var7 = var10000; + + while (var7 < b) { + int var12 = 0; + + while (true) { + if (var12 < c) { + this.getContentPane().add(((b)((ArrayList)a.get(var7)).get(var12)).c); + var12++; + if (var5) { + break; + } + + if (!var5) { + continue; + } + } + + var7++; + break; + } + + if (var5) { + break; + } + } + + c var11 = new c(a(22258, 1025605264567789290L), a(22910, 5940865096142252391L)); + d var13 = new d(var3, var11); + var13.start(); + this.addKeyListener(new a()); + if (c.c) { + d.h = !var5; + } + } + + static { + long var8 = 116018857672281L; + long[] var6 = new long[4]; + int var3 = 0; + String var4 = "2!\u0099\u0007\u008cß\u00174\u0095F7÷\\\u0099\u0018¹"; + byte var5 = 16; + byte var2 = 0; + + label20: + while (true) { + int var10001 = var2; + var2 += 8; + byte[] var7 = var4.substring(var10001, var2).getBytes("ISO-8859-1"); + long[] var10000 = var6; + var10001 = var3++; + long var10002 = ((long)var7[0] & 255L) << 56 + | ((long)var7[1] & 255L) << 48 + | ((long)var7[2] & 255L) << 40 + | ((long)var7[3] & 255L) << 32 + | ((long)var7[4] & 255L) << 24 + | ((long)var7[5] & 255L) << 16 + | ((long)var7[6] & 255L) << 8 + | (long)var7[7] & 255L; + byte var10003 = -1; + + while (true) { + long var17 = var10002 ^ var8; + switch (var10003) { + case 0: + var10000[var10001] = var17; + if (var2 >= var5) { + d = var6; + e = new Integer[4]; + long var13 = -2542116333815373351L; + byte var14 = -1; + long var0 = -2542001418764869760L; + serialVersionUID = var0; + b = a(11993, 4420636720690273987L); + c = a(11993, 4420636720690273987L); + return; + } + break; + default: + var10000[var10001] = var17; + if (var2 < var5) { + continue label20; + } + + var4 = "O=pJ\u0095«¬ð³éÃS·\u0006à\u008e"; + var5 = 16; + var2 = 0; + } + + byte var12 = var2; + var2 += 8; + var7 = var4.substring(var12, var2).getBytes("ISO-8859-1"); + var10000 = var6; + var10001 = var3++; + var10002 = ((long)var7[0] & 255L) << 56 + | ((long)var7[1] & 255L) << 48 + | ((long)var7[2] & 255L) << 40 + | ((long)var7[3] & 255L) << 32 + | ((long)var7[4] & 255L) << 24 + | ((long)var7[5] & 255L) << 16 + | ((long)var7[6] & 255L) << 8 + | (long)var7[7] & 255L; + var10003 = 0; + } + } + } + + private static int a(int var0, long var1) { + int var3 = var0 ^ (int)(var1 & 32767L) ^ 12313; + if (e[var3] == null) { + e[var3] = (int)(d[var3] ^ var1); + } + + return e[var3]; + } +} diff --git a/testData/results/custom-jars/SnakeGame/f.dec b/testData/results/custom-jars/SnakeGame/f.dec new file mode 100644 index 00000000..15a458c4 --- /dev/null +++ b/testData/results/custom-jars/SnakeGame/f.dec @@ -0,0 +1,15 @@ +import java.awt.Color; +import javax.swing.JPanel; + +public class f extends JPanel { + private static final long serialVersionUID = 1L; + + public f(Color var1) { + this.setBackground(var1); + } + + public void a(Color var1) { + this.setBackground(var1); + this.repaint(); + } +}