Remove "static operation".

This commit is contained in:
Jindra Petřík
2024-08-07 18:38:32 +02:00
parent f3da12e032
commit 38bcab878b
14 changed files with 17 additions and 42 deletions

View File

@@ -1869,7 +1869,7 @@ public final class SWF implements SWFContainerItem, Timelined, Openable {
sos.writeFIXED8(frameRate);
sos.writeUI16(frameCount);
sos.writeTags(includeImported ? getTags() : getLocalTags());
sos.writeTags(getTags());
if (hasEndTag) {
sos.writeUI16(0);
}
@@ -3729,7 +3729,7 @@ public final class SWF implements SWFContainerItem, Timelined, Openable {
if (ins instanceof ActionConstantPool) {
constantPool = new ConstantPool(((ActionConstantPool) ins).constantPool);
}
int staticOperation = Graph.SOP_USE_STATIC; //(Boolean) Configuration.getConfig("autoDeobfuscate", true) ? Graph.SOP_SKIP_STATIC : Graph.SOP_USE_STATIC;
int staticOperation = 0;
int requiredStackSize = ins.getStackPopCount(localData, stack);
if (stack.size() < requiredStackSize) {
@@ -4069,7 +4069,7 @@ public final class SWF implements SWFContainerItem, Timelined, Openable {
classNameParts = new String[]{className};
}
}
int staticOperation = Graph.SOP_USE_STATIC; //(Boolean) Configuration.getConfig("autoDeobfuscate", true) ? Graph.SOP_SKIP_STATIC : Graph.SOP_USE_STATIC;
int staticOperation = 0;
List<GraphTargetItem> dec;
try {
dec = Action.actionsToTree(new HashMap<>() /*??*/, true /*Yes, inside doInitAction*/, false, dia.getActions(), version, staticOperation, ""/*FIXME*/, getCharset());
@@ -5138,25 +5138,7 @@ public final class SWF implements SWFContainerItem, Timelined, Openable {
}
return readOnlyTags;
}
/**
* Gets (readonly) list of all local tags in the SWF file. local = not
* imported.
*
* @return Tags
* @deprecated The tags from getTags method call are all local by default
* now.
*/
public ReadOnlyTagList getLocalTags() {
/*List<Tag> localTags = new ArrayList<>();
for (Tag t : tags) {
if (!t.isImported()) {
localTags.add(t);
}
}*/
return new ReadOnlyTagList(tags);
}
}
/**
* Adds a tag to the SWF.

View File

@@ -230,7 +230,7 @@ public class AVM2DeobfuscatorGetSet extends SWFDecompilerAdapter {
return;
}
ins.translate(localData, stack, output, Graph.SOP_USE_STATIC, "");
ins.translate(localData, stack, output, 0, "");
}
boolean ok = false;

View File

@@ -317,7 +317,7 @@ public class AVM2DeobfuscatorRegistersOld extends AVM2DeobfuscatorSimpleOld {
continue outer;
}
ins.translate(localData, stack, output, Graph.SOP_USE_STATIC, "");
ins.translate(localData, stack, output, 0, "");
if (def instanceof SetLocalTypeIns) {
int regId = ((SetLocalTypeIns) def).getRegisterId(ins);
if (!ignored.contains(regId)) {

View File

@@ -363,7 +363,7 @@ public class AVM2DeobfuscatorSimpleOld extends AVM2DeobfuscatorZeroJumpsNullPush
}
}
ins.translate(localData, stack, output, Graph.SOP_USE_STATIC, "");
ins.translate(localData, stack, output, 0, "");
}
if (inlineIns.contains(ins)) {

View File

@@ -471,7 +471,7 @@ public final class MethodBody implements Cloneable {
HashMap<Integer, String> localRegNames = getLocalRegNames(abc);
List<GraphTargetItem> convertedItems1;
try (Statistics s = new Statistics("AVM2Code.toGraphTargetItems")) {
convertedItems1 = converted.getCode().toGraphTargetItems(callStack, abcIndex, convertData.thisHasDefaultToPrimitive, convertData, path, methodIndex, isStatic, scriptIndex, classIndex, abc, converted, localRegNames, scopeStack, initializerType, fullyQualifiedNames, initTraits, Graph.SOP_USE_STATIC, new HashMap<>()); //converted.getCode().visitCode(converted)
convertedItems1 = converted.getCode().toGraphTargetItems(callStack, abcIndex, convertData.thisHasDefaultToPrimitive, convertData, path, methodIndex, isStatic, scriptIndex, classIndex, abc, converted, localRegNames, scopeStack, initializerType, fullyQualifiedNames, initTraits, 0, new HashMap<>()); //converted.getCode().visitCode(converted)
}
try (Statistics s = new Statistics("Graph.graphToString")) {
Graph.graphToString(convertedItems1, writer, LocalData.create(callStack, abcIndex, abc, localRegNames, fullyQualifiedNames, seenMethods));

View File

@@ -987,7 +987,7 @@ public abstract class Action implements GraphSourceItem {
tree = CancellableWorker.call(new Callable<List<GraphTargetItem>>() {
@Override
public List<GraphTargetItem> call() throws Exception {
int staticOperation = Graph.SOP_USE_STATIC; //(Boolean) Configuration.getConfig("autoDeobfuscate", true) ? Graph.SOP_SKIP_STATIC : Graph.SOP_USE_STATIC;
int staticOperation = 0;
boolean insideDoInitAction = (asm instanceof DoInitActionTag);
List<GraphTargetItem> tree = actionsToTree(uninitializedClassTraits, insideDoInitAction, false, new HashMap<>(), new HashMap<>(), new HashMap<>(), actions, version, staticOperation, path, charset);
SWFDecompilerPlugin.fireActionTreeCreated(tree, swf);

View File

@@ -256,7 +256,7 @@ public class DoActionTag extends Tag implements ASMSource {
@Override
public List<GraphTargetItem> getActionsToTree() {
try {
return Action.actionsToTree(new HashMap<>(), false, false, getActions(), swf.version, Graph.SOP_USE_STATIC, "", swf.getCharset());
return Action.actionsToTree(new HashMap<>(), false, false, getActions(), swf.version, 0, "", swf.getCharset());
} catch (InterruptedException ex) {
return new ArrayList<>();
}

View File

@@ -298,7 +298,7 @@ public class DoInitActionTag extends Tag implements CharacterIdTag, ASMSource {
@Override
public List<GraphTargetItem> getActionsToTree() {
try {
return Action.actionsToTree(swf.getUninitializedAs2ClassTraits(), true, false, getActions(), swf.version, Graph.SOP_USE_STATIC, "", swf.getCharset());
return Action.actionsToTree(swf.getUninitializedAs2ClassTraits(), true, false, getActions(), swf.version, 0, "", swf.getCharset());
} catch (InterruptedException ex) {
return new ArrayList<>();
}

View File

@@ -224,7 +224,7 @@ public class ButtonAction implements ASMSource {
@Override
public List<GraphTargetItem> getActionsToTree() {
try {
return Action.actionsToTree(new HashMap<>(), false, false, getActions(), buttonTag.getSwf().version, Graph.SOP_USE_STATIC, "", buttonTag.getSwf().getCharset());
return Action.actionsToTree(new HashMap<>(), false, false, getActions(), buttonTag.getSwf().version, 0, "", buttonTag.getSwf().getCharset());
} catch (InterruptedException ex) {
return new ArrayList<>();
}

View File

@@ -379,7 +379,7 @@ public class BUTTONCONDACTION implements ASMSource, Serializable, HasSwfAndTag {
@Override
public List<GraphTargetItem> getActionsToTree() {
try {
return Action.actionsToTree(new HashMap<>(), false, false, getActions(), swf.version, Graph.SOP_USE_STATIC, "", swf.getCharset());
return Action.actionsToTree(new HashMap<>(), false, false, getActions(), swf.version, 0, "", swf.getCharset());
} catch (InterruptedException ex) {
return new ArrayList<>();
}

View File

@@ -367,7 +367,7 @@ public class CLIPACTIONRECORD implements ASMSource, Serializable, HasSwfAndTag {
@Override
public List<GraphTargetItem> getActionsToTree() {
try {
return Action.actionsToTree(new HashMap<>(), false, false, getActions(), swf.version, Graph.SOP_USE_STATIC, "", swf.getCharset());
return Action.actionsToTree(new HashMap<>(), false, false, getActions(), swf.version, 0, "", swf.getCharset());
} catch (InterruptedException ex) {
return new ArrayList<>();
}

View File

@@ -95,14 +95,7 @@ public class Graph {
* Exceptions in the graph
*/
private final List<GraphException> exceptions;
/**
* Constant not used anymore
*
* @deprecated not used.
*/
public static final int SOP_USE_STATIC = 0;
/**
* Debug flag to print all parts
*/

View File

@@ -544,7 +544,7 @@ public class Main {
}
if (instrSWF != null) {
if (origFile != null) {
for (Tag t : instrSWF.getLocalTags()) {
for (Tag t : instrSWF.getTags()) {
if (t instanceof ImportTag) {
ImportTag it = (ImportTag) t;
String url = it.getUrl();

View File

@@ -563,7 +563,7 @@ public class FlashPlayerTest {
ActionLocalData localData = new ActionLocalData(null, false, new HashMap<>());
TranslateStack stack = new TranslateStack("");
for (Action a : newActions) {
a.translate(localData, stack, output, Graph.SOP_USE_STATIC, "");
a.translate(localData, stack, output, 0, "");
}
String ffdecTranslateResult;