bug fixes

This commit is contained in:
Konloch 2019-04-12 22:07:50 -06:00
parent 8d07bd5e96
commit 04874b3cf4
3 changed files with 24 additions and 4 deletions

View file

@ -140,6 +140,7 @@ public class BytecodeViewer
public static File krakatauTempDir; public static File krakatauTempDir;
public static File krakatauTempJar; public static File krakatauTempJar;
public static int krakatauHash; public static int krakatauHash;
public static boolean currentlyDumping = false;
public static boolean needsReDump = true; public static boolean needsReDump = true;
public static ArrayList<FileContainer> files = new ArrayList<FileContainer>(); //all of BCV's loaded files/classes/etc public static ArrayList<FileContainer> files = new ArrayList<FileContainer>(); //all of BCV's loaded files/classes/etc
private static int maxRecentFiles = 25; private static int maxRecentFiles = 25;
@ -1376,7 +1377,7 @@ public class BytecodeViewer
public static void dumpTempFile() public static void dumpTempFile()
{ {
/*int tempHash = classNodeLoaderHash(loader); /*int tempHash = fileContainersHash(files);
if(tempHash != krakatauHash && krakatauTempJar != null) if(tempHash != krakatauHash && krakatauTempJar != null)
{ {
@ -1412,12 +1413,14 @@ public class BytecodeViewer
if(krakatauTempJar != null || !passes) if(krakatauTempJar != null || !passes)
return; return;
currentlyDumping = true;
needsReDump = false; needsReDump = false;
//krakatauHash = tempHash; //krakatauHash = tempHash;
krakatauTempDir = new File(BytecodeViewer.tempDirectory + BytecodeViewer.fs + MiscUtils.randomString(32) + BytecodeViewer.fs); krakatauTempDir = new File(BytecodeViewer.tempDirectory + BytecodeViewer.fs + MiscUtils.randomString(32) + BytecodeViewer.fs);
krakatauTempDir.mkdir(); krakatauTempDir.mkdir();
krakatauTempJar = new File(BytecodeViewer.tempDirectory + BytecodeViewer.fs + "temp" + MiscUtils.randomString(32) + ".jar"); krakatauTempJar = new File(BytecodeViewer.tempDirectory + BytecodeViewer.fs + "temp" + MiscUtils.randomString(32) + ".jar");
JarUtils.saveAsJarClassesOnly(BytecodeViewer.getLoadedClasses(), krakatauTempJar.getAbsolutePath()); JarUtils.saveAsJarClassesOnly(BytecodeViewer.getLoadedClasses(), krakatauTempJar.getAbsolutePath());
currentlyDumping = false;
} }
public static void rtCheck() public static void rtCheck()
@ -1428,12 +1431,16 @@ public class BytecodeViewer
} }
} }
public static int classNodeLoaderHash(ClassNodeLoader loader) public static int fileContainersHash(ArrayList<FileContainer> fileContainers)
{ {
StringBuilder block = new StringBuilder(); 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(); return block.hashCode();

View file

@ -1699,6 +1699,18 @@ public class ClassViewer extends Viewer {
@Override @Override
public void run() public void run()
{ {
while(BytecodeViewer.currentlyDumping)
{
//wait until it's not dumping
try
{
Thread.sleep(100);
}
catch (InterruptedException e)
{
e.printStackTrace();
}
}
BytecodeViewer.dumpTempFile(); BytecodeViewer.dumpTempFile();
if (pane1 > 0) if (pane1 > 0)

View file

@ -1620,6 +1620,7 @@ public class MainViewerGUI extends JFrame implements FileChangeNotifier {
mnSettings.add(separator_38); mnSettings.add(separator_38);
decodeAPKResources.setSelected(false); decodeAPKResources.setSelected(false);
decodeAPKResources.setEnabled(false);
mnSettings.add(decodeAPKResources); mnSettings.add(decodeAPKResources);