diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/Action.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/Action.java index 85d62cf4c..254c39771 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/Action.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/Action.java @@ -594,11 +594,13 @@ public abstract class Action implements GraphSourceItem { writer.appendNoHilight(Helper.constants).newLine(); for (Action a : list) { if (a instanceof ActionConstantPool) { + if (poolIdx > 0) { + writer.appendNoHilight("---").newLine(); + } + ActionConstantPool cPool = (ActionConstantPool) a; int constIdx = 0; for (String c : cPool.constantPool) { - writer.appendNoHilight(poolIdx); - writer.appendNoHilight("|"); writer.appendNoHilight(constIdx); writer.appendNoHilight("|"); writer.appendNoHilight(c); diff --git a/libsrc/ffdec_lib/src/com/jpexs/helpers/Helper.java b/libsrc/ffdec_lib/src/com/jpexs/helpers/Helper.java index 5e7b1677e..932f80875 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/helpers/Helper.java +++ b/libsrc/ffdec_lib/src/com/jpexs/helpers/Helper.java @@ -848,6 +848,28 @@ public class Helper { return data; } + public static List> getConstantPoolsFromText(String text) { + Scanner scanner = new Scanner(text); + scanner.nextLine(); // ignore first line + List> result = new ArrayList<>(); + List cPool = new ArrayList<>(); + result.add(cPool); + while (scanner.hasNextLine()) { + String line = scanner.nextLine(); + if (line.startsWith("---")) { + cPool = new ArrayList<>(); + result.add(cPool); + } + + String[] parts = line.split("\\|", 2); + if (parts.length >= 2) { + cPool.add(parts[1]); + } + } + + return result; + } + public static boolean contains(int[] array, int value) { if (array == null) { return false; diff --git a/src/com/jpexs/decompiler/flash/gui/action/ActionPanel.java b/src/com/jpexs/decompiler/flash/gui/action/ActionPanel.java index 7c4e12520..51e1627fa 100644 --- a/src/com/jpexs/decompiler/flash/gui/action/ActionPanel.java +++ b/src/com/jpexs/decompiler/flash/gui/action/ActionPanel.java @@ -30,6 +30,7 @@ import com.jpexs.decompiler.flash.action.parser.script.ParsedSymbol; import com.jpexs.decompiler.flash.action.parser.script.SymbolType; import com.jpexs.decompiler.flash.action.swf4.ActionPush; import com.jpexs.decompiler.flash.action.swf4.ConstantIndex; +import com.jpexs.decompiler.flash.action.swf5.ActionConstantPool; import com.jpexs.decompiler.flash.configuration.Configuration; import com.jpexs.decompiler.flash.exporters.modes.ScriptExportMode; import com.jpexs.decompiler.flash.gui.AppStrings; @@ -773,7 +774,7 @@ public class ActionPanel extends JPanel implements SearchListener> constantPools) { + try { + ActionList actions = src.getActions(); + int poolIdx = 0; + for (Action action : actions) { + if (action instanceof ActionConstantPool) { + ActionConstantPool cPool = (ActionConstantPool) action; + List constantPool = constantPools.get(poolIdx); + cPool.constantPool = constantPool; + + poolIdx++; + if (constantPools.size() <= poolIdx) { + break; + } + } + } + + src.setActions(actions); + } catch (InterruptedException ex) { + Logger.getLogger(ActionPanel.class.getName()).log(Level.SEVERE, null, ex); + } + } + private void editDecompiledButtonActionPerformed(ActionEvent evt) { if (View.showConfirmDialog(null, AppStrings.translate("message.confirm.experimental.function"), AppStrings.translate("message.warning"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE, Configuration.warningExperimentalAS12Edit, JOptionPane.OK_OPTION) == JOptionPane.OK_OPTION) { setDecompiledEditMode(true);