From 14aca37e80d8269797c157918e1a3d46bf9c19a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jindra=20Pet=C5=99=C3=ADk?= Date: Sat, 2 Aug 2025 13:21:53 +0200 Subject: [PATCH] Some Actions do not require Charset parameter --- .../com/jpexs/decompiler/flash/SWFInputStream.java | 8 ++++---- .../decompiler/flash/action/ActionListReader.java | 6 +++--- .../flash/action/model/clauses/TryActionItem.java | 6 +++--- .../flash/action/parser/pcode/ASMParser.java | 12 ++++++------ .../action/parser/script/ActionSourceGenerator.java | 6 +++--- .../decompiler/flash/action/special/ActionEnd.java | 6 +++--- .../decompiler/flash/action/special/ActionNop.java | 8 ++++---- .../decompiler/flash/action/swf4/ActionEquals.java | 6 +++--- .../flash/action/swf5/ActionPushDuplicate.java | 6 +++--- .../flash/action/swf5/ActionStackSwap.java | 6 +++--- 10 files changed, 35 insertions(+), 35 deletions(-) diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWFInputStream.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWFInputStream.java index 1a0ace13d..69160e588 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWFInputStream.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWFInputStream.java @@ -1928,7 +1928,7 @@ public class SWFInputStream implements AutoCloseable { try { actionCode = readUI8("actionCode"); if (actionCode == 0) { - return new ActionEnd(getCharset()); + return new ActionEnd(); } if (actionCode == -1) { return null; @@ -1980,7 +1980,7 @@ public class SWFInputStream implements AutoCloseable { case 0x0D: return new ActionDivide(); case 0x0E: - return new ActionEquals(getCharset()); + return new ActionEquals(); case 0x0F: return new ActionLess(); case 0x10: @@ -2115,11 +2115,11 @@ public class SWFInputStream implements AutoCloseable { case 0x50: return new ActionIncrement(); case 0x4C: - return new ActionPushDuplicate(getCharset()); + return new ActionPushDuplicate(); case 0x3E: return new ActionReturn(); case 0x4D: - return new ActionStackSwap(getCharset()); + return new ActionStackSwap(); case 0x87: return new ActionStoreRegister(actionLength, this); // SWF6 Actions diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/ActionListReader.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/ActionListReader.java index 50f8de995..81d794dae 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/ActionListReader.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/ActionListReader.java @@ -144,7 +144,7 @@ public class ActionListReader { Action lastAction = actionMap.get(addresses.get(addresses.size() - 1)); long endAddress; if (!(lastAction instanceof ActionEnd)) { - Action aEnd = new ActionEnd(sis.getCharset()); + Action aEnd = new ActionEnd(); aEnd.setAddress(nextOffsets.get(lastAction.getAddress())); endAddress = aEnd.getAddress(); actionMap.put(aEnd.getAddress(), aEnd); @@ -703,7 +703,7 @@ public class ActionListReader { long startIp = actions.get(0).getAddress(); Action lastAction = actions.get(actions.size() - 1); if (!(lastAction instanceof ActionEnd)) { - Action aEnd = new ActionEnd(actions.getCharset()); + Action aEnd = new ActionEnd(); aEnd.setAddress(lastAction.getAddress() + lastAction.getTotalActionLength()); actions.add(aEnd); lastAction = aEnd; @@ -769,7 +769,7 @@ public class ActionListReader { long startIp = actions.get(0).getAddress(); Action lastAction = actions.get(actions.size() - 1); if (!(lastAction instanceof ActionEnd)) { - Action aEnd = new ActionEnd(actions.getCharset()); + Action aEnd = new ActionEnd(); aEnd.setAddress(lastAction.getAddress() + lastAction.getTotalActionLength()); actions.add(aEnd); lastAction = aEnd; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/clauses/TryActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/clauses/TryActionItem.java index 7f725876b..2c64c41e2 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/clauses/TryActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/clauses/TryActionItem.java @@ -284,14 +284,14 @@ public class TryActionItem extends ActionItem implements Block { fullCatchBody.addAll(0, GraphTargetItem.toSourceMerge(localData, generator, new DirectValueActionItem(new RegisterNumber(catchRegister)), ename, - new ActionStackSwap(charset), + new ActionStackSwap(), new ActionDefineLocal(), ebody )); } else { List ifBody = GraphTargetItem.toSourceMerge(localData, generator, ename, - new ActionStackSwap(charset), + new ActionStackSwap(), new ActionDefineLocal(), ebody); fullCatchBody.add(0, new ActionPop()); @@ -306,7 +306,7 @@ public class TryActionItem extends ActionItem implements Block { etype, new ActionPush(new RegisterNumber(catchRegister), charset), new ActionCastOp(), - new ActionPushDuplicate(charset), + new ActionPushDuplicate(), new ActionPush(Null.INSTANCE, charset), new ActionEquals2(), new ActionIf(ifBodySize, charset) diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/parser/pcode/ASMParser.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/parser/pcode/ASMParser.java index 795c9833d..18ba839f6 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/parser/pcode/ASMParser.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/parser/pcode/ASMParser.java @@ -193,7 +193,7 @@ public class ASMParser { } else if (instructionName.compareToIgnoreCase("EndDrag") == 0) { a = new ActionEndDrag(); } else if (instructionName.compareToIgnoreCase("Equals") == 0) { - a = new ActionEquals(charset); + a = new ActionEquals(); } else if (instructionName.compareToIgnoreCase("GetProperty") == 0) { a = new ActionGetProperty(); } else if (instructionName.compareToIgnoreCase("GetTime") == 0) { @@ -311,13 +311,13 @@ public class ASMParser { } else if (instructionName.compareToIgnoreCase("NewObject") == 0) { a = new ActionNewObject(); } else if (instructionName.compareToIgnoreCase("PushDuplicate") == 0) { - a = new ActionPushDuplicate(charset); + a = new ActionPushDuplicate(); } else if (instructionName.compareToIgnoreCase("Return") == 0) { a = new ActionReturn(); } else if (instructionName.compareToIgnoreCase("SetMember") == 0) { a = new ActionSetMember(); } else if (instructionName.compareToIgnoreCase("StackSwap") == 0) { - a = new ActionStackSwap(charset); + a = new ActionStackSwap(); } else if (instructionName.compareToIgnoreCase("StoreRegister") == 0) { a = new ActionStoreRegister(lexer, charset); } else if (instructionName.compareToIgnoreCase("TargetPath") == 0) { @@ -357,9 +357,9 @@ public class ASMParser { } else if (instructionName.compareToIgnoreCase("StrictMode") == 0) { a = new ActionStrictMode(lexer, charset); } else if (instructionName.compareToIgnoreCase("Nop") == 0) { - a = new ActionNop(charset); + a = new ActionNop(); } else if (instructionName.compareToIgnoreCase("End") == 0) { - a = new ActionEnd(charset); + a = new ActionEnd(); } else if (instructionName.compareToIgnoreCase("FFDec_DeobfuscatePop") == 0) { a = new ActionDeobfuscatePop(); } else if (instructionName.compareToIgnoreCase("FFDec_DeobfuscateJump") == 0) { @@ -595,7 +595,7 @@ public class ASMParser { } if (ret.size() == 0 || !(ret.get(ret.size() - 1) instanceof ActionEnd)) { - ret.add(new ActionEnd(charset)); + ret.add(new ActionEnd()); } return ret; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/parser/script/ActionSourceGenerator.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/parser/script/ActionSourceGenerator.java index 8fcbf7b60..8df5a0e7a 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/parser/script/ActionSourceGenerator.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/parser/script/ActionSourceGenerator.java @@ -769,7 +769,7 @@ public class ActionSourceGenerator implements SourceGenerator { public List generate(SourceGeneratorLocalData localData, AndItem item) throws CompilationException { List ret = new ArrayList<>(); ret.addAll(generateToActionList(localData, item.leftSide)); - ret.add(new ActionPushDuplicate(charset)); + ret.add(new ActionPushDuplicate()); ret.add(new ActionNot()); List andExpr = generateToActionList(localData, item.rightSide); andExpr.add(0, new ActionPop()); @@ -784,7 +784,7 @@ public class ActionSourceGenerator implements SourceGenerator { public List generate(SourceGeneratorLocalData localData, OrItem item) throws CompilationException { List ret = new ArrayList<>(); ret.addAll(generateToActionList(localData, item.leftSide)); - ret.add(new ActionPushDuplicate(charset)); + ret.add(new ActionPushDuplicate()); List orExpr = generateToActionList(localData, item.rightSide); orExpr.add(0, new ActionPop()); int orExprLen = Action.actionsToBytes(orExpr, false, SWF.DEFAULT_VERSION).length; @@ -1016,7 +1016,7 @@ public class ActionSourceGenerator implements SourceGenerator { @Override public List generate(SourceGeneratorLocalData localData, DuplicateItem item) { List ret = new ArrayList<>(); - ret.add(new ActionPushDuplicate(charset)); + ret.add(new ActionPushDuplicate()); return ret; } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/special/ActionEnd.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/special/ActionEnd.java index 7cba01b17..fca3d3d17 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/special/ActionEnd.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/special/ActionEnd.java @@ -24,6 +24,7 @@ import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SecondPassData; import com.jpexs.decompiler.graph.TranslateStack; +import com.jpexs.helpers.utf8.Utf8Helper; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -38,10 +39,9 @@ public class ActionEnd extends Action { /** * Constructor. - * @param charset Charset */ - public ActionEnd(String charset) { - super(0, 0, charset); + public ActionEnd() { + super(0, 0, Utf8Helper.charsetName); setIgnored(true, 0); } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/special/ActionNop.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/special/ActionNop.java index ffc45f5c7..66e6acc8f 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/special/ActionNop.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/special/ActionNop.java @@ -23,6 +23,7 @@ import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SecondPassData; import com.jpexs.decompiler.graph.TranslateStack; +import com.jpexs.helpers.utf8.Utf8Helper; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -36,11 +37,10 @@ import java.util.Set; public class ActionNop extends Action { /** - * Constructor. - * @param charset Charset + * Constructor. */ - public ActionNop(String charset) { - super(-1, 0, charset); + public ActionNop() { + super(-1, 0, Utf8Helper.charsetName); } /** diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf4/ActionEquals.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf4/ActionEquals.java index 02cb6ffad..c449ca3ab 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf4/ActionEquals.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf4/ActionEquals.java @@ -26,6 +26,7 @@ import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SecondPassData; import com.jpexs.decompiler.graph.TranslateStack; +import com.jpexs.helpers.utf8.Utf8Helper; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -42,10 +43,9 @@ public class ActionEquals extends Action { /** * Constructor. * - * @param charset Charset */ - public ActionEquals(String charset) { - super(0x0E, 0, charset); + public ActionEquals() { + super(0x0E, 0, Utf8Helper.charsetName); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf5/ActionPushDuplicate.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf5/ActionPushDuplicate.java index bc6988f48..d826d617e 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf5/ActionPushDuplicate.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf5/ActionPushDuplicate.java @@ -28,6 +28,7 @@ import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SecondPassData; import com.jpexs.decompiler.graph.TranslateStack; import com.jpexs.decompiler.graph.model.DuplicateItem; +import com.jpexs.helpers.utf8.Utf8Helper; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -44,10 +45,9 @@ public class ActionPushDuplicate extends Action { /** * Constructor. * - * @param charset Charset */ - public ActionPushDuplicate(String charset) { - super(0x4C, 0, charset); + public ActionPushDuplicate() { + super(0x4C, 0, Utf8Helper.charsetName); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf5/ActionStackSwap.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf5/ActionStackSwap.java index e918a2ad7..e0c7f0974 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf5/ActionStackSwap.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf5/ActionStackSwap.java @@ -26,6 +26,7 @@ import com.jpexs.decompiler.graph.GraphSourceItemPos; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SecondPassData; import com.jpexs.decompiler.graph.TranslateStack; +import com.jpexs.helpers.utf8.Utf8Helper; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -42,10 +43,9 @@ public class ActionStackSwap extends Action { /** * Constructor. * - * @param charset Charset */ - public ActionStackSwap(String charset) { - super(0x4D, 0, charset); + public ActionStackSwap() { + super(0x4D, 0, Utf8Helper.charsetName); } @Override