From 39243bdea201a7aee096689d3af6fc335d90493c Mon Sep 17 00:00:00 2001 From: "honfika@gmail.com" Date: Sun, 3 May 2015 13:03:48 +0200 Subject: [PATCH] tag saving fix --- libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWF.java | 4 ++++ .../com/jpexs/decompiler/flash/tags/DefineSpriteTag.java | 8 ++++++++ src/com/jpexs/decompiler/flash/gui/MainFrameMenu.java | 1 + src/com/jpexs/decompiler/flash/gui/PreviewPanel.java | 5 +++++ .../jpexs/decompiler/flash/gui/action/ActionPanel.java | 1 + 5 files changed, 19 insertions(+) diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWF.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWF.java index 324bdf93c..ad559c5ac 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWF.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWF.java @@ -659,6 +659,7 @@ public final class SWF implements SWFContainerItem, Timelined { if (hasEndTag) { sos.writeUI16(0); } + sos.close(); os.write(Utf8Helper.getBytes(getHeaderBytes(compression, gfx))); os.write(version); @@ -711,6 +712,7 @@ public final class SWF implements SWFContainerItem, Timelined { } else if (compression == SWFCompression.ZLIB) { os = new DeflaterOutputStream(os); } + os.write(data); } finally { if (os != null) { @@ -2028,11 +2030,13 @@ public final class SWF implements SWFContainerItem, Timelined { ret++; } } + for (ASMSource src : actionsMap.keySet()) { actionsMap.get(src).removeNops(); src.setActions(actionsMap.get(src)); src.setModified(); } + deobfuscation.deobfuscateInstanceNames(false, deobfuscated, renameType, tags, selected); return ret; } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineSpriteTag.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineSpriteTag.java index 221100093..518c35f72 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineSpriteTag.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineSpriteTag.java @@ -282,6 +282,14 @@ public class DefineSpriteTag extends CharacterTag implements DrawableTag, Timeli super.setModified(value); } + @Override + public void createOriginalData() { + super.createOriginalData(); + for (Tag subTag : subTags) { + subTag.createOriginalData(); + } + } + public static void clearCache() { rectCache.clear(); } diff --git a/src/com/jpexs/decompiler/flash/gui/MainFrameMenu.java b/src/com/jpexs/decompiler/flash/gui/MainFrameMenu.java index e201fb817..93303dc6e 100644 --- a/src/com/jpexs/decompiler/flash/gui/MainFrameMenu.java +++ b/src/com/jpexs/decompiler/flash/gui/MainFrameMenu.java @@ -120,6 +120,7 @@ public abstract class MainFrameMenu { } if (saved) { swf.clearModified(); + mainFrame.getPanel().refreshTree(swf); } return true; diff --git a/src/com/jpexs/decompiler/flash/gui/PreviewPanel.java b/src/com/jpexs/decompiler/flash/gui/PreviewPanel.java index cf0b158df..4c83dc17a 100644 --- a/src/com/jpexs/decompiler/flash/gui/PreviewPanel.java +++ b/src/com/jpexs/decompiler/flash/gui/PreviewPanel.java @@ -56,6 +56,7 @@ import com.jpexs.decompiler.flash.tags.base.SoundStreamHeadTypeTag; import com.jpexs.decompiler.flash.tags.base.TextTag; import com.jpexs.decompiler.flash.tags.gfx.DefineCompactedFont; import com.jpexs.decompiler.flash.timeline.Frame; +import com.jpexs.decompiler.flash.timeline.TagScript; import com.jpexs.decompiler.flash.timeline.Timelined; import com.jpexs.decompiler.flash.treeitems.TreeItem; import com.jpexs.decompiler.flash.types.GLYPHENTRY; @@ -1142,6 +1143,10 @@ public class PreviewPanel extends JSplitPane { return; } + if (item instanceof TagScript) { + item = ((TagScript) item).getTag(); + } + if (item instanceof Tag) { genericEditButton.setVisible(false); genericSaveButton.setVisible(true); diff --git a/src/com/jpexs/decompiler/flash/gui/action/ActionPanel.java b/src/com/jpexs/decompiler/flash/gui/action/ActionPanel.java index f45d447e5..d8838ecfd 100644 --- a/src/com/jpexs/decompiler/flash/gui/action/ActionPanel.java +++ b/src/com/jpexs/decompiler/flash/gui/action/ActionPanel.java @@ -758,6 +758,7 @@ public class ActionPanel extends JPanel implements SearchListener