mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-05-28 18:55:37 +00:00
AS1/2: Properly handling of Flash7 scripts exported to Flash5/6 - ActionDefineFunction local registers
This commit is contained in:
@@ -2035,7 +2035,7 @@ public final class SWF implements SWFContainerItem, Timelined {
|
||||
ip = code.adr2pos(addr);
|
||||
addr += size;
|
||||
int nextip = code.adr2pos(addr);
|
||||
getVariables(aLocalData.insideDoInitAction, variables, functions, strings, usageTypes, new ActionGraphSource(path, aLocalData.insideDoInitAction, code.getActions().subList(ip, nextip), code.version, new HashMap<>(), new HashMap<>(), new HashMap<>()), 0, path + (cntName == null ? "" : "/" + cntName));
|
||||
getVariables(aLocalData.insideDoInitAction, variables, functions, strings, usageTypes, new ActionGraphSource(path, aLocalData.insideDoInitAction, (ins instanceof ActionDefineFunction), code.getActions().subList(ip, nextip), code.version, new HashMap<>(), new HashMap<>(), new HashMap<>()), 0, path + (cntName == null ? "" : "/" + cntName));
|
||||
ip = nextip;
|
||||
}
|
||||
List<List<GraphTargetItem>> r = new ArrayList<>();
|
||||
@@ -2131,35 +2131,35 @@ public final class SWF implements SWFContainerItem, Timelined {
|
||||
getVariables(null, localData, new TranslateStack(path), new ArrayList<>(), code, code.adr2pos(addr), variables, functions, strings, new ArrayList<>(), usageTypes, path);
|
||||
}
|
||||
|
||||
private List<MyEntry<DirectValueActionItem, ConstantPool>> getVariables(List<MyEntry<DirectValueActionItem, ConstantPool>> variables, HashMap<ASMSource, ActionList> actionsMap, List<GraphSourceItem> functions, HashMap<DirectValueActionItem, ConstantPool> strings, HashMap<DirectValueActionItem, String> usageTypes, ASMSource src, String path) throws InterruptedException {
|
||||
private List<MyEntry<DirectValueActionItem, ConstantPool>> getVariables(boolean insideDefineFunction1, List<MyEntry<DirectValueActionItem, ConstantPool>> variables, HashMap<ASMSource, ActionList> actionsMap, List<GraphSourceItem> functions, HashMap<DirectValueActionItem, ConstantPool> strings, HashMap<DirectValueActionItem, String> usageTypes, ASMSource src, String path) throws InterruptedException {
|
||||
List<MyEntry<DirectValueActionItem, ConstantPool>> ret = new ArrayList<>();
|
||||
ActionList actions = src.getActions();
|
||||
actionsMap.put(src, actions);
|
||||
boolean insideDoInitAction = src instanceof DoInitActionTag;
|
||||
getVariables(insideDoInitAction, variables, functions, strings, usageTypes, new ActionGraphSource(path, insideDoInitAction, actions, version, new HashMap<>(), new HashMap<>(), new HashMap<>()), 0, path);
|
||||
getVariables(insideDoInitAction, variables, functions, strings, usageTypes, new ActionGraphSource(path, insideDoInitAction, insideDefineFunction1, actions, version, new HashMap<>(), new HashMap<>(), new HashMap<>()), 0, path);
|
||||
return ret;
|
||||
}
|
||||
|
||||
private void getVariables(Iterable<Tag> tags, String path, List<MyEntry<DirectValueActionItem, ConstantPool>> variables, HashMap<ASMSource, ActionList> actionsMap, List<GraphSourceItem> functions, HashMap<DirectValueActionItem, ConstantPool> strings, HashMap<DirectValueActionItem, String> usageTypes) throws InterruptedException {
|
||||
private void getVariables(boolean insideDefineFunction1, Iterable<Tag> tags, String path, List<MyEntry<DirectValueActionItem, ConstantPool>> variables, HashMap<ASMSource, ActionList> actionsMap, List<GraphSourceItem> functions, HashMap<DirectValueActionItem, ConstantPool> strings, HashMap<DirectValueActionItem, String> usageTypes) throws InterruptedException {
|
||||
List<String> processed = new ArrayList<>();
|
||||
for (Tag t : tags) {
|
||||
String subPath = path + "/" + t.toString();
|
||||
if (t instanceof ASMSource) {
|
||||
addVariable((ASMSource) t, subPath, processed, variables, actionsMap, functions, strings, usageTypes);
|
||||
addVariable(insideDefineFunction1, (ASMSource) t, subPath, processed, variables, actionsMap, functions, strings, usageTypes);
|
||||
}
|
||||
if (t instanceof ASMSourceContainer) {
|
||||
List<String> processed2 = new ArrayList<>();
|
||||
for (ASMSource asm : ((ASMSourceContainer) t).getSubItems()) {
|
||||
addVariable(asm, subPath + "/" + asm.toString(), processed2, variables, actionsMap, functions, strings, usageTypes);
|
||||
addVariable(insideDefineFunction1, asm, subPath + "/" + asm.toString(), processed2, variables, actionsMap, functions, strings, usageTypes);
|
||||
}
|
||||
}
|
||||
if (t instanceof DefineSpriteTag) {
|
||||
getVariables(((DefineSpriteTag) t).getTags(), path + "/" + t.toString(), variables, actionsMap, functions, strings, usageTypes);
|
||||
getVariables(insideDefineFunction1, ((DefineSpriteTag) t).getTags(), path + "/" + t.toString(), variables, actionsMap, functions, strings, usageTypes);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void addVariable(ASMSource asm, String path, List<String> processed, List<MyEntry<DirectValueActionItem, ConstantPool>> variables, HashMap<ASMSource, ActionList> actionsMap, List<GraphSourceItem> functions, HashMap<DirectValueActionItem, ConstantPool> strings, HashMap<DirectValueActionItem, String> usageTypes) throws InterruptedException {
|
||||
private void addVariable(boolean insideDefineFunction1, ASMSource asm, String path, List<String> processed, List<MyEntry<DirectValueActionItem, ConstantPool>> variables, HashMap<ASMSource, ActionList> actionsMap, List<GraphSourceItem> functions, HashMap<DirectValueActionItem, ConstantPool> strings, HashMap<DirectValueActionItem, String> usageTypes) throws InterruptedException {
|
||||
int pos = 1;
|
||||
String infPath2 = path;
|
||||
while (processed.contains(infPath2)) {
|
||||
@@ -2168,7 +2168,7 @@ public final class SWF implements SWFContainerItem, Timelined {
|
||||
}
|
||||
processed.add(infPath2);
|
||||
informListeners("getVariables", infPath2);
|
||||
getVariables(variables, actionsMap, functions, strings, usageTypes, asm, path);
|
||||
getVariables(insideDefineFunction1, variables, actionsMap, functions, strings, usageTypes, asm, path);
|
||||
}
|
||||
|
||||
public boolean as3StringConstantExists(String str) {
|
||||
@@ -2257,7 +2257,7 @@ public final class SWF implements SWFContainerItem, Timelined {
|
||||
HashMap<DirectValueActionItem, String> usageTypes = new HashMap<>();
|
||||
|
||||
int ret = 0;
|
||||
getVariables(getTags(), "", allVariableNames, actionsMap, allFunctions, allStrings, usageTypes);
|
||||
getVariables(false, getTags(), "", allVariableNames, actionsMap, allFunctions, allStrings, usageTypes);
|
||||
informListeners("rename", "");
|
||||
int fc = 0;
|
||||
for (MyEntry<DirectValueActionItem, ConstantPool> it : allVariableNames) {
|
||||
@@ -2292,7 +2292,7 @@ public final class SWF implements SWFContainerItem, Timelined {
|
||||
int staticOperation = Graph.SOP_USE_STATIC; //(Boolean) Configuration.getConfig("autoDeobfuscate", true) ? Graph.SOP_SKIP_STATIC : Graph.SOP_USE_STATIC;
|
||||
List<GraphTargetItem> dec;
|
||||
try {
|
||||
dec = Action.actionsToTree(true /*Yes, inside doInitAction*/, dia.getActions(), version, staticOperation, ""/*FIXME*/);
|
||||
dec = Action.actionsToTree(true /*Yes, inside doInitAction*/, false, dia.getActions(), version, staticOperation, ""/*FIXME*/);
|
||||
} catch (EmptyStackException ex) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user