mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-09-23 07:22:25 +00:00
Do not create subswf if the file with same hash is already opened.
This commit is contained in:
@@ -52,7 +52,6 @@ import com.jpexs.decompiler.flash.SWF;
|
||||
import com.jpexs.decompiler.flash.configuration.Configuration;
|
||||
import com.jpexs.decompiler.graph.DottedChain;
|
||||
import com.jpexs.helpers.Helper;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
@@ -84,7 +83,6 @@ public class DebuggerSession {
|
||||
|
||||
private DebuggerCommands commands = null;
|
||||
|
||||
//private List<InSwfInfo.SwfInfo> swfs = new ArrayList<>();
|
||||
private boolean paused = true;
|
||||
|
||||
private Map<Integer, String> modulePaths = new HashMap<>();
|
||||
@@ -260,22 +258,6 @@ public class DebuggerSession {
|
||||
modulePaths.put(file, name);
|
||||
scriptToModule.put(name, file);
|
||||
moduleToSwfIndex.put(file, swfIndex);
|
||||
/*if (!"main".equals(swfHash)) {
|
||||
SWF swf = Main.getSwfByHash(swfHash);
|
||||
debuggedSwfs.put(swfIndex, swf);
|
||||
}*/
|
||||
/*if (swfIndex > debuggedSwfs.size() - 1) {
|
||||
SWF swf = Main.getSwfByHash(swfHash);
|
||||
if (swf == null) {
|
||||
Logger.getLogger(DebuggerSession.class.getName()).log(Level.WARNING, "SWF with hash {0} not found", swfHash);
|
||||
} else {
|
||||
Logger.getLogger(DebuggerSession.class.getName()).log(Level.FINE, "adding {0} to debugSwfs", swfIndex);
|
||||
swfIndicesCommitted.add(swfIndex);
|
||||
debuggedSwfs.add(swf);
|
||||
}
|
||||
} else {
|
||||
Logger.getLogger(DebuggerSession.class.getName()).log(Level.FINE, "Swf index already committed");
|
||||
}*/
|
||||
swfIndicesCommitted.add(swfIndex);
|
||||
}
|
||||
con.dropMessage(sc);
|
||||
@@ -344,16 +326,6 @@ public class DebuggerSession {
|
||||
try {
|
||||
for (InSwfInfo.SwfInfo s : t.swfInfos) {
|
||||
try {
|
||||
/*try {
|
||||
con.sendMessageWithTimeout(new OutGetSwf(con, (int) s.index), InGetSwf.class);
|
||||
con.sendMessageWithTimeout(new OutGetSwd(con, (int) s.index), InGetSwd.class);
|
||||
} catch (IOException ex) {
|
||||
//ignore
|
||||
}*/
|
||||
/*if (s.scriptCount == 0) {
|
||||
continue;
|
||||
}*/
|
||||
|
||||
InGetSwf inGetSwf = con.sendMessage(new OutGetSwf(con, (int) s.index), InGetSwf.class);
|
||||
Logger.getLogger(DebuggerSession.class.getName()).fine("Received SWF");
|
||||
Logger.getLogger(DebuggerSession.class.getName()).log(Level.FINE, "Received SWF.URL = {0}", s.url);
|
||||
@@ -499,14 +471,14 @@ public class DebuggerSession {
|
||||
if (moduleToSwfIndex.containsKey(message.file)) {
|
||||
SWF swf = debuggedSwfs.get(moduleToSwfIndex.get(message.file));
|
||||
userSwfName = swf.toString();
|
||||
} else if(!debuggedSwfs.isEmpty()) {
|
||||
} else if (!debuggedSwfs.isEmpty()) {
|
||||
userSwfName = debuggedSwfs.get(debuggedSwfs.size() - 1).toString();
|
||||
}
|
||||
|
||||
|
||||
if (modulePaths.containsKey(message.file)) {
|
||||
newBreakScriptName = modulePaths.get(message.file);
|
||||
userBreakScriptName = newBreakScriptName;
|
||||
if (newBreakScriptName.contains(":")) {
|
||||
if (newBreakScriptName.contains(":")) {
|
||||
userBreakScriptName = userSwfName + ": " + newBreakScriptName.substring(newBreakScriptName.indexOf(":") + 1);
|
||||
}
|
||||
} else if (reasonInt != InBreakReason.REASON_SCRIPT_LOADED) {
|
||||
|
||||
@@ -270,14 +270,7 @@ public class Main {
|
||||
hashSha256 = origKey;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (hashSha256.startsWith("loaded_")) {
|
||||
hashSha256 = hashSha256.substring("loaded_".length());
|
||||
}
|
||||
if (hashSha256.startsWith("imported_")) {
|
||||
hashSha256 = hashSha256.substring("loaded_".length());
|
||||
}
|
||||
}
|
||||
|
||||
for (SWF swf : mainFrame.getPanel().getAllSwfs()) {
|
||||
Logger.getLogger(Main.class.getName()).log(Level.FINE, "Checking {0} with hash {1}", new Object[]{swf.toString(), swf.getHashSha256()});
|
||||
@@ -681,7 +674,7 @@ public class Main {
|
||||
SWF.decompress(new ByteArrayInputStream(impData), baos);
|
||||
Helper.writeFile(newTempFile.getAbsolutePath(), impData);
|
||||
tempFiles.add(newTempFile);
|
||||
prepareSwf("imported_" + sha256(baos.toByteArray()), prep, newTempFile, importedFile, tempFilesDir, tempFiles);
|
||||
prepareSwf(sha256(baos.toByteArray()), prep, newTempFile, importedFile, tempFilesDir, tempFiles);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3047,7 +3040,7 @@ public class Main {
|
||||
fos.write(inputData);
|
||||
}
|
||||
Logger.getLogger(Main.class.getName()).log(Level.FINE, "preparing for load: {0}", hash);
|
||||
prepareSwf("loaded_" + hash, runningPreparation, tempFile, mainSWF.getFile() == null ? null : new File(mainSWF.getFile()), tempRunDir, runTempFiles);
|
||||
prepareSwf(hash, runningPreparation, tempFile, mainSWF.getFile() == null ? null : new File(mainSWF.getFile()), tempRunDir, runTempFiles);
|
||||
byte[] outputData = Helper.readFileEx(tempFile.getAbsolutePath());
|
||||
tempFile.delete();
|
||||
Logger.getLogger(Main.class.getName()).log(Level.FINE, "calling datamodified");
|
||||
@@ -3991,7 +3984,7 @@ public class Main {
|
||||
}*/
|
||||
String tit = swf.getTitleOrShortFileName();
|
||||
if (tit != null && tit.contains(":")) {
|
||||
return "loaded_" + tit.substring(tit.lastIndexOf(":") + 1);
|
||||
return tit.substring(tit.lastIndexOf(":") + 1);
|
||||
}
|
||||
return swf.getHashSha256();
|
||||
}
|
||||
@@ -4013,13 +4006,6 @@ public class Main {
|
||||
}
|
||||
}
|
||||
|
||||
if (hashSha256.startsWith("loaded_")) {
|
||||
hashSha256 = hashSha256.substring("loaded_".length());
|
||||
}
|
||||
if (hashSha256.startsWith("imported_")) {
|
||||
hashSha256 = hashSha256.substring("imported_".length());
|
||||
}
|
||||
|
||||
for (OpenableList sl : Main.getMainFrame().getPanel().getSwfs()) {
|
||||
for (int s = 0; s < sl.size(); s++) {
|
||||
Openable op = sl.get(s);
|
||||
|
||||
Reference in New Issue
Block a user