diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/AVM2Code.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/AVM2Code.java index 90d8a4f59..375146ee3 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/AVM2Code.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/AVM2Code.java @@ -282,7 +282,6 @@ import com.jpexs.decompiler.graph.ScopeStack; import com.jpexs.decompiler.graph.TranslateException; import com.jpexs.decompiler.graph.TranslateStack; import com.jpexs.decompiler.graph.TypeItem; -import com.jpexs.decompiler.graph.model.ExitItem; import com.jpexs.decompiler.graph.model.LocalData; import com.jpexs.decompiler.graph.model.ScriptEndItem; import com.jpexs.helpers.Helper; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/ReturnValueIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/ReturnValueIns.java index ae6ebcf08..03b3ebac0 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/ReturnValueIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/ReturnValueIns.java @@ -50,5 +50,4 @@ public class ReturnValueIns extends InstructionDefinition { public boolean isExitInstruction() { return true; } - } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/FrameExporter.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/FrameExporter.java index 94097003c..ee57330cd 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/FrameExporter.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/FrameExporter.java @@ -27,6 +27,7 @@ import com.jpexs.decompiler.flash.exporters.commonshape.ExportRectangle; import com.jpexs.decompiler.flash.exporters.commonshape.Matrix; import com.jpexs.decompiler.flash.exporters.commonshape.SVGExporter; import com.jpexs.decompiler.flash.exporters.modes.FramesExportMode; +import com.jpexs.decompiler.flash.exporters.settings.ButtonExportSettings; import com.jpexs.decompiler.flash.exporters.settings.FramesExportSettings; import com.jpexs.decompiler.flash.exporters.shape.CanvasShapeExporter; import com.jpexs.decompiler.flash.helpers.BMPFile; @@ -86,6 +87,26 @@ public class FrameExporter { private static final Logger logger = Logger.getLogger(FrameExporter.class.getName()); + public List exportFrames(AbortRetryIgnoreHandler handler, String outdir, SWF swf, int containerId, List frames, ButtonExportSettings settings, EventListener evl) throws IOException { + FramesExportMode fem; + switch (settings.mode) { + case BMP: + fem = FramesExportMode.BMP; + break; + case PNG: + fem = FramesExportMode.PNG; + break; + case SVG: + fem = FramesExportMode.SVG; + break; + default: + throw new Error("Unsupported button export mode"); + } + + FramesExportSettings fes = new FramesExportSettings(fem, settings.zoom); + return exportFrames(handler, outdir, swf, containerId, frames, fes, evl); + } + public List exportFrames(AbortRetryIgnoreHandler handler, String outdir, final SWF swf, int containerId, List frames, final FramesExportSettings settings, final EventListener evl) throws IOException { final List ret = new ArrayList<>(); if (swf.tags.isEmpty()) { diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/modes/ButtonExportMode.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/modes/ButtonExportMode.java new file mode 100644 index 000000000..cbe5eca31 --- /dev/null +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/modes/ButtonExportMode.java @@ -0,0 +1,28 @@ +/* + * Copyright (C) 2010-2015 JPEXS, All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3.0 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. + */ +package com.jpexs.decompiler.flash.exporters.modes; + +/** + * + * @author JPEXS + */ +public enum ButtonExportMode { + + PNG, + SVG, + BMP +} diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/settings/ButtonExportSettings.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/settings/ButtonExportSettings.java new file mode 100644 index 000000000..35f04a0b2 --- /dev/null +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/settings/ButtonExportSettings.java @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2010-2015 JPEXS, All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3.0 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. + */ +package com.jpexs.decompiler.flash.exporters.settings; + +import com.jpexs.decompiler.flash.exporters.modes.ButtonExportMode; + +/** + * + * @author JPEXS + */ +public class ButtonExportSettings { + + public ButtonExportMode mode; + + public double zoom; + + public ButtonExportSettings(ButtonExportMode mode, double zoom) { + this.mode = mode; + this.zoom = zoom; + } +} diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/CharacterTag.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/CharacterTag.java index 81c8e4785..14e5efd25 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/CharacterTag.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/CharacterTag.java @@ -55,7 +55,7 @@ public abstract class CharacterTag extends Tag implements CharacterIdTag { @Override public String getExportFileName() { String result = super.getExportFileName(); - return result + (className != null ? "_" + className : ""); + return result + "_" + getCharacterId() + (exportName != null ? "_" + exportName : "") + (className != null ? "_" + className : ""); } public String getCharacterExportFileName() { diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/PlaceObjectTypeTag.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/PlaceObjectTypeTag.java index cac6e2af8..bff110857 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/PlaceObjectTypeTag.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/PlaceObjectTypeTag.java @@ -93,7 +93,7 @@ public abstract class PlaceObjectTypeTag extends Tag implements CharacterIdTag { @Override public String getExportFileName() { - String result = super.getExportFileName() + "_" + getCharacterId() + "_" + getDepth(); + String result = super.getExportFileName() + "_" + getCharacterId(); String exportName = swf.getExportName(getCharacterId()); if (exportName != null) { result += "_" + exportName; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/GraphSourceItemContainer.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/GraphSourceItemContainer.java index cc441370b..dafeaafa2 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/GraphSourceItemContainer.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/GraphSourceItemContainer.java @@ -1,18 +1,19 @@ /* * Copyright (C) 2010-2015 JPEXS, All rights reserved. - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3.0 of the License, or (at your option) any later version. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public - * License along with this library. */ + * License along with this library. + */ package com.jpexs.decompiler.graph; import com.jpexs.decompiler.flash.action.parser.pcode.FlasmLexer; diff --git a/src/com/jpexs/decompiler/flash/gui/ExportDialog.java b/src/com/jpexs/decompiler/flash/gui/ExportDialog.java index 931c636d0..1d32188ef 100644 --- a/src/com/jpexs/decompiler/flash/gui/ExportDialog.java +++ b/src/com/jpexs/decompiler/flash/gui/ExportDialog.java @@ -19,6 +19,7 @@ package com.jpexs.decompiler.flash.gui; import com.jpexs.decompiler.flash.abc.ScriptPack; import com.jpexs.decompiler.flash.configuration.Configuration; import com.jpexs.decompiler.flash.exporters.modes.BinaryDataExportMode; +import com.jpexs.decompiler.flash.exporters.modes.ButtonExportMode; import com.jpexs.decompiler.flash.exporters.modes.FontExportMode; import com.jpexs.decompiler.flash.exporters.modes.FramesExportMode; import com.jpexs.decompiler.flash.exporters.modes.ImageExportMode; @@ -33,6 +34,7 @@ import com.jpexs.decompiler.flash.gui.tagtree.TagTreeModel; import com.jpexs.decompiler.flash.tags.DefineBinaryDataTag; import com.jpexs.decompiler.flash.tags.DefineVideoStreamTag; import com.jpexs.decompiler.flash.tags.base.ASMSource; +import com.jpexs.decompiler.flash.tags.base.ButtonTag; import com.jpexs.decompiler.flash.tags.base.FontTag; import com.jpexs.decompiler.flash.tags.base.ImageTag; import com.jpexs.decompiler.flash.tags.base.MorphShapeTag; @@ -76,6 +78,7 @@ public class ExportDialog extends AppDialog { TagTreeModel.FOLDER_SCRIPTS, TagTreeModel.FOLDER_BINARY_DATA, TagTreeModel.FOLDER_FRAMES, + TagTreeModel.FOLDER_BUTTONS, TagTreeModel.FOLDER_FONTS, TagTreeModel.FOLDER_MORPHSHAPES, "symbolclass" @@ -91,6 +94,7 @@ public class ExportDialog extends AppDialog { {ASMSource.class, ScriptPack.class}, {DefineBinaryDataTag.class}, {Frame.class}, + {ButtonTag.class}, {FontTag.class}, {MorphShapeTag.class}, {SymbolClassTypeTag.class} @@ -106,6 +110,7 @@ public class ExportDialog extends AppDialog { ScriptExportMode.class, BinaryDataExportMode.class, FramesExportMode.class, + ButtonExportMode.class, FontExportMode.class, MorphShapeExportMode.class, SymbolClassExportMode.class diff --git a/src/com/jpexs/decompiler/flash/gui/MainPanel.java b/src/com/jpexs/decompiler/flash/gui/MainPanel.java index 2d1119fcd..c41437e8f 100644 --- a/src/com/jpexs/decompiler/flash/gui/MainPanel.java +++ b/src/com/jpexs/decompiler/flash/gui/MainPanel.java @@ -40,6 +40,7 @@ import com.jpexs.decompiler.flash.exporters.SoundExporter; import com.jpexs.decompiler.flash.exporters.SymbolClassExporter; import com.jpexs.decompiler.flash.exporters.TextExporter; import com.jpexs.decompiler.flash.exporters.modes.BinaryDataExportMode; +import com.jpexs.decompiler.flash.exporters.modes.ButtonExportMode; import com.jpexs.decompiler.flash.exporters.modes.FontExportMode; import com.jpexs.decompiler.flash.exporters.modes.FramesExportMode; import com.jpexs.decompiler.flash.exporters.modes.ImageExportMode; @@ -51,6 +52,7 @@ import com.jpexs.decompiler.flash.exporters.modes.SoundExportMode; import com.jpexs.decompiler.flash.exporters.modes.TextExportMode; import com.jpexs.decompiler.flash.exporters.script.AS2ScriptExporter; import com.jpexs.decompiler.flash.exporters.settings.BinaryDataExportSettings; +import com.jpexs.decompiler.flash.exporters.settings.ButtonExportSettings; import com.jpexs.decompiler.flash.exporters.settings.FontExportSettings; import com.jpexs.decompiler.flash.exporters.settings.FramesExportSettings; import com.jpexs.decompiler.flash.exporters.settings.ImageExportSettings; @@ -995,6 +997,7 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec List images = new ArrayList<>(); List shapes = new ArrayList<>(); List morphshapes = new ArrayList<>(); + List buttons = new ArrayList<>(); List movies = new ArrayList<>(); List sounds = new ArrayList<>(); List texts = new ArrayList<>(); @@ -1030,6 +1033,9 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec if (nodeType == TreeNodeType.SHAPE) { shapes.add((Tag) d); } + if (nodeType == TreeNodeType.BUTTON) { + buttons.add((Tag) d); + } if (nodeType == TreeNodeType.MORPH_SHAPE) { morphshapes.add((Tag) d); } @@ -1111,6 +1117,15 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec ret.addAll(frameExporter.exportFrames(handler, selFile + File.separator + subFolder, swf, containerId, entry.getValue(), fes, evl)); } + ButtonExportSettings bes = new ButtonExportSettings(export.getValue(ButtonExportMode.class), export.getZoom()); + for (Tag tag : buttons) { + ButtonTag button = (ButtonTag) tag; + String subFolder = "buttons"; + List frameNums = new ArrayList<>(); + frameNums.add(0); // todo: export all frames + ret.addAll(frameExporter.exportFrames(handler, selFile + File.separator + subFolder, swf, button.getCharacterId(), frameNums, bes, evl)); + } + boolean parallel = Configuration.parallelSpeedUp.get(); String scriptsFolder = Path.combine(selFile, "scripts"); Path.createDirectorySafe(new File(scriptsFolder)); diff --git a/src/com/jpexs/decompiler/flash/gui/locales/ExportDialog.properties b/src/com/jpexs/decompiler/flash/gui/locales/ExportDialog.properties index 151589d36..adbd44053 100644 --- a/src/com/jpexs/decompiler/flash/gui/locales/ExportDialog.properties +++ b/src/com/jpexs/decompiler/flash/gui/locales/ExportDialog.properties @@ -66,6 +66,11 @@ frames.canvas = HTML5 Canvas frames.pdf = PDF frames.bmp = BMP +buttons = Buttons +buttons.png = PNG +buttons.svg = SVG +buttons.bmp = BMP + fonts = Fonts fonts.ttf = TTF fonts.woff = WOFF diff --git a/src/com/jpexs/decompiler/flash/gui/locales/ExportDialog_hu.properties b/src/com/jpexs/decompiler/flash/gui/locales/ExportDialog_hu.properties index 4e00b3774..ec8965a77 100644 --- a/src/com/jpexs/decompiler/flash/gui/locales/ExportDialog_hu.properties +++ b/src/com/jpexs/decompiler/flash/gui/locales/ExportDialog_hu.properties @@ -66,6 +66,11 @@ frames.canvas = HTML5 V\u00e1szon frames.pdf = PDF frames.bmp = BMP +buttons = Gombok +buttons.png = PNG +buttons.svg = SVG +buttons.bmp = BMP + fonts = Bet\u0171t\u00edpusok fonts.ttf = TTF fonts.woff = WOFF diff --git a/src/com/jpexs/decompiler/flash/gui/tagtree/TagTree.java b/src/com/jpexs/decompiler/flash/gui/tagtree/TagTree.java index de22875b5..39faff8b2 100644 --- a/src/com/jpexs/decompiler/flash/gui/tagtree/TagTree.java +++ b/src/com/jpexs/decompiler/flash/gui/tagtree/TagTree.java @@ -535,6 +535,9 @@ public class TagTree extends JTree { if (nodeType == TreeNodeType.MORPH_SHAPE) { ret.add(d); } + if (nodeType == TreeNodeType.BUTTON) { + ret.add(d); + } if (nodeType == TreeNodeType.AS) { ret.add(d); }