From 04874b3cf46a076235e9e908e6847ad0c89ccb18 Mon Sep 17 00:00:00 2001 From: Konloch Date: Fri, 12 Apr 2019 22:07:50 -0600 Subject: [PATCH] bug fixes --- .../club/bytecodeviewer/BytecodeViewer.java | 15 +++++++++++---- .../club/bytecodeviewer/gui/ClassViewer.java | 12 ++++++++++++ .../club/bytecodeviewer/gui/MainViewerGUI.java | 1 + 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/src/the/bytecode/club/bytecodeviewer/BytecodeViewer.java b/src/the/bytecode/club/bytecodeviewer/BytecodeViewer.java index f54da950..c010a13f 100644 --- a/src/the/bytecode/club/bytecodeviewer/BytecodeViewer.java +++ b/src/the/bytecode/club/bytecodeviewer/BytecodeViewer.java @@ -140,6 +140,7 @@ public class BytecodeViewer public static File krakatauTempDir; public static File krakatauTempJar; public static int krakatauHash; + public static boolean currentlyDumping = false; public static boolean needsReDump = true; public static ArrayList files = new ArrayList(); //all of BCV's loaded files/classes/etc private static int maxRecentFiles = 25; @@ -1376,7 +1377,7 @@ public class BytecodeViewer public static void dumpTempFile() { - /*int tempHash = classNodeLoaderHash(loader); + /*int tempHash = fileContainersHash(files); if(tempHash != krakatauHash && krakatauTempJar != null) { @@ -1412,12 +1413,14 @@ public class BytecodeViewer if(krakatauTempJar != null || !passes) return; + currentlyDumping = true; needsReDump = false; //krakatauHash = tempHash; krakatauTempDir = new File(BytecodeViewer.tempDirectory + BytecodeViewer.fs + MiscUtils.randomString(32) + BytecodeViewer.fs); krakatauTempDir.mkdir(); krakatauTempJar = new File(BytecodeViewer.tempDirectory + BytecodeViewer.fs + "temp" + MiscUtils.randomString(32) + ".jar"); JarUtils.saveAsJarClassesOnly(BytecodeViewer.getLoadedClasses(), krakatauTempJar.getAbsolutePath()); + currentlyDumping = false; } public static void rtCheck() @@ -1428,12 +1431,16 @@ public class BytecodeViewer } } - public static int classNodeLoaderHash(ClassNodeLoader loader) + public static int fileContainersHash(ArrayList fileContainers) { StringBuilder block = new StringBuilder(); - for(ClassNode node : loader.getAll()) + for(FileContainer container : fileContainers) { - block.append(node.name); + block.append(container.name); + for(ClassNode node : container.classes) + { + block.append(node.name); + } } return block.hashCode(); diff --git a/src/the/bytecode/club/bytecodeviewer/gui/ClassViewer.java b/src/the/bytecode/club/bytecodeviewer/gui/ClassViewer.java index b4aef28f..f657b37c 100644 --- a/src/the/bytecode/club/bytecodeviewer/gui/ClassViewer.java +++ b/src/the/bytecode/club/bytecodeviewer/gui/ClassViewer.java @@ -1699,6 +1699,18 @@ public class ClassViewer extends Viewer { @Override public void run() { + while(BytecodeViewer.currentlyDumping) + { + //wait until it's not dumping + try + { + Thread.sleep(100); + } + catch (InterruptedException e) + { + e.printStackTrace(); + } + } BytecodeViewer.dumpTempFile(); if (pane1 > 0) diff --git a/src/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI.java b/src/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI.java index 4f80ac94..b24e3006 100644 --- a/src/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI.java +++ b/src/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI.java @@ -1620,6 +1620,7 @@ public class MainViewerGUI extends JFrame implements FileChangeNotifier { mnSettings.add(separator_38); decodeAPKResources.setSelected(false); + decodeAPKResources.setEnabled(false); mnSettings.add(decodeAPKResources);