diff --git a/trunk/src/com/jpexs/decompiler/flash/Main.java b/trunk/src/com/jpexs/decompiler/flash/Main.java index 88dcb36e3..abaeca90c 100644 --- a/trunk/src/com/jpexs/decompiler/flash/Main.java +++ b/trunk/src/com/jpexs/decompiler/flash/Main.java @@ -645,7 +645,7 @@ public class Main { } if (SystemTray.isSupported()) { SystemTray tray = SystemTray.getSystemTray(); - trayIcon = new TrayIcon(View.loadImage("com/jpexs/decompiler/flash/gui/graphics/proxy16.png"), "JP ASDec Proxy"); + trayIcon = new TrayIcon(View.loadImage("proxy16"), "JP ASDec Proxy"); trayIcon.setImageAutoSize(true); PopupMenu trayPopup = new PopupMenu(); diff --git a/trunk/src/com/jpexs/decompiler/flash/SWF.java b/trunk/src/com/jpexs/decompiler/flash/SWF.java index 7f468e6f5..ed596c60d 100644 --- a/trunk/src/com/jpexs/decompiler/flash/SWF.java +++ b/trunk/src/com/jpexs/decompiler/flash/SWF.java @@ -17,7 +17,7 @@ package com.jpexs.decompiler.flash; import SevenZip.Compression.LZMA.Encoder; -import com.jpexs.decompiler.flash.action.TagNode; +import com.jpexs.decompiler.flash.gui.TagNode; import com.jpexs.decompiler.flash.tags.DefineBitsJPEG2Tag; import com.jpexs.decompiler.flash.tags.DefineBitsJPEG3Tag; import com.jpexs.decompiler.flash.tags.DefineBitsJPEG4Tag; @@ -381,7 +381,7 @@ public class SWF { list2.addAll(tags); List list = TagNode.createTagList(list2); TagNode.setExport(list, true); - return TagNode.exportNode(list, outdir, isPcode); + return TagNode.exportNodeAS(list, outdir, isPcode); } return asV3Found; } @@ -435,6 +435,9 @@ public class SWF { } public static void exportShapes(String outdir, List tags) throws IOException { + if (!(new File(outdir)).exists()) { + (new File(outdir)).mkdirs(); + } for (Tag t : tags) { if (t instanceof ShapeTag) { int characterID = 0; @@ -459,6 +462,9 @@ public class SWF { } public static void exportImages(String outdir, List tags, JPEGTablesTag jtt) throws IOException { + if (!(new File(outdir)).exists()) { + (new File(outdir)).mkdirs(); + } for (Tag t : tags) { if ((t instanceof DefineBitsJPEG2Tag) || (t instanceof DefineBitsJPEG3Tag) || (t instanceof DefineBitsJPEG4Tag)) { byte imageData[] = null; diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/graph/AVM2Graph.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/graph/AVM2Graph.java index fc58b19a3..fa14dc521 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/graph/AVM2Graph.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/graph/AVM2Graph.java @@ -1312,7 +1312,7 @@ public class AVM2Graph extends Graph { if (part.getHeight() >= 3) { if (code.code.get(part.getPosAt(part.getHeight() - 2)).definition instanceof KillIns) { if (code.code.get(part.getPosAt(part.getHeight() - 3)).definition instanceof GetLocalTypeIns) { - if (!output.isEmpty()) { + if (output.size() >= 2) { if (output.get(output.size() - 2) instanceof SetLocalTreeItem) { ret = new ArrayList(); ret.addAll(output); @@ -1539,4 +1539,20 @@ public class AVM2Graph extends Graph { } } } + + @Override + protected boolean isEmpty(List output) { + if (super.isEmpty(output)) { + return true; + } + for (GraphTargetItem i : output) { + if (i instanceof SetLocalTreeItem) { + if (code.isKilled(((SetLocalTreeItem) i).regIndex, 0, code.code.size() - 1)) { + continue; + } + } + return false; + } + return true; + } } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/GetScopeObjectIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/GetScopeObjectIns.java index 185253750..06b200e7d 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/GetScopeObjectIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/GetScopeObjectIns.java @@ -36,9 +36,6 @@ public class GetScopeObjectIns extends InstructionDefinition { @Override public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { int index = ins.operands[0]; - if (scopeStack.size() <= index) { - System.out.println("uuu"); - } stack.push(scopeStack.get(index)); } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/gui/ABCPanel.java b/trunk/src/com/jpexs/decompiler/flash/abc/gui/ABCPanel.java index 38b452e1e..9ad44abd8 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/gui/ABCPanel.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/gui/ABCPanel.java @@ -55,6 +55,8 @@ public class ABCPanel extends JPanel implements ItemListener, ActionListener { public JLabel decLabel = new JLabel("ActionScript source"); public DetailPanel detailPanel; public JTextField filterField = new JTextField(""); + public JPanel navPanel; + public JTabbedPane tabbedPane; private JTable autoResizeColWidth(JTable table, TableModel model) { table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); @@ -153,13 +155,13 @@ public class ABCPanel extends JPanel implements ItemListener, ActionListener { } public void initSplits() { - splitPaneTreeVSNavigator.setDividerLocation(splitPaneTreeVSNavigator.getHeight() / 2); + //splitPaneTreeVSNavigator.setDividerLocation(splitPaneTreeVSNavigator.getHeight() / 2); try { Thread.sleep(100); } catch (InterruptedException ex) { Logger.getLogger(ABCPanel.class.getName()).log(Level.SEVERE, null, ex); } - splitPaneTreeNavVSDecompiledDetail.setDividerLocation(splitPaneTreeNavVSDecompiledDetail.getWidth() * 1 / 3); + //splitPaneTreeNavVSDecompiledDetail.setDividerLocation(splitPaneTreeNavVSDecompiledDetail.getWidth() * 1 / 3); try { Thread.sleep(100); } catch (InterruptedException ex) { @@ -210,12 +212,12 @@ public class ABCPanel extends JPanel implements ItemListener, ActionListener { navigator.setABC(list, abc); - JPanel navPanel = new JPanel(new BorderLayout()); + navPanel = new JPanel(new BorderLayout()); JLabel traitsLabel = new JLabel("Traits"); navPanel.add(traitsLabel, BorderLayout.NORTH); traitsLabel.setBorder(new BevelBorder(BevelBorder.RAISED)); - navPanel.add(new JScrollPane(navigator), BorderLayout.CENTER); + //navPanel.add(new JScrollPane(navigator), BorderLayout.CENTER); Main.startWork("Building script tree..."); @@ -250,7 +252,7 @@ public class ABCPanel extends JPanel implements ItemListener, ActionListener { JPanel searchPanel = new JPanel(); searchPanel.setLayout(new BorderLayout()); searchPanel.add(filterField, BorderLayout.CENTER); - JLabel picLabel = new JLabel(new ImageIcon(View.loadImage("com/jpexs/decompiler/flash/gui/graphics/search.png"))); + JLabel picLabel = new JLabel(View.getIcon("search16")); searchPanel.add(picLabel, BorderLayout.EAST); treePanel.add(searchPanel, BorderLayout.NORTH); @@ -259,27 +261,27 @@ public class ABCPanel extends JPanel implements ItemListener, ActionListener { navPanel); splitPaneTreeVSNavigator.setResizeWeight(0.5); splitPaneTreeVSNavigator.setContinuousLayout(true); - JTabbedPane tabbedPane = new JTabbedPane(); - tabbedPane.addTab("Scripts", splitPaneTreeVSNavigator); + tabbedPane = new JTabbedPane(); + tabbedPane.addTab("Traits", new JScrollPane(navigator)); //tabbedPane.setTabPlacement(JTabbedPane.BOTTOM); - pan2.add(tabbedPane, BorderLayout.CENTER); + //pan2.add(tabbedPane, BorderLayout.CENTER); abcComboBox.addItemListener(this); + /* - - splitPaneTreeNavVSDecompiledDetail = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, - pan2, - splitPaneDecompiledVSDetail); - splitPaneTreeNavVSDecompiledDetail.setResizeWeight(0); - splitPaneTreeNavVSDecompiledDetail.setContinuousLayout(true); - //pan2.setPreferredSize(new Dimension(300, 200)); + splitPaneTreeNavVSDecompiledDetail = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, + pan2, + splitPaneDecompiledVSDetail); + splitPaneTreeNavVSDecompiledDetail.setResizeWeight(0); + splitPaneTreeNavVSDecompiledDetail.setContinuousLayout(true); + //pan2.setPreferredSize(new Dimension(300, 200)); - add(splitPaneTreeNavVSDecompiledDetail, BorderLayout.CENTER); - + add(splitPaneTreeNavVSDecompiledDetail, BorderLayout.CENTER);*/ + add(splitPaneDecompiledVSDetail, BorderLayout.CENTER); JPanel panConstants = new JPanel(); panConstants.setLayout(new BorderLayout()); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/gui/ClassesListTree.java b/trunk/src/com/jpexs/decompiler/flash/abc/gui/ClassesListTree.java index 7c66d998b..8f625da38 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/gui/ClassesListTree.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/gui/ClassesListTree.java @@ -19,11 +19,11 @@ package com.jpexs.decompiler.flash.abc.gui; import com.jpexs.decompiler.flash.Main; import com.jpexs.decompiler.flash.abc.types.traits.Trait; import com.jpexs.decompiler.flash.abc.types.traits.TraitClass; +import com.jpexs.decompiler.flash.gui.View; import com.jpexs.decompiler.flash.tags.DoABCTag; import java.util.ArrayList; import java.util.HashMap; import java.util.List; -import javax.swing.ImageIcon; import javax.swing.JTree; import javax.swing.event.TreeSelectionEvent; import javax.swing.event.TreeSelectionListener; @@ -53,9 +53,7 @@ public class ClassesListTree extends JTree implements TreeSelectionListener { addTreeSelectionListener(this); DefaultTreeCellRenderer treeRenderer = new DefaultTreeCellRenderer(); ClassLoader cldr = this.getClass().getClassLoader(); - java.net.URL imageURL = cldr.getResource("com/jpexs/decompiler/flash/gui/graphics/as16.png"); - ImageIcon leafIcon = new ImageIcon(imageURL); - treeRenderer.setLeafIcon(leafIcon); + treeRenderer.setLeafIcon(View.getIcon("as16")); setCellRenderer(treeRenderer); } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/gui/ClassesListTreeModel.java b/trunk/src/com/jpexs/decompiler/flash/abc/gui/ClassesListTreeModel.java index d8ace2912..02c7bc971 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/gui/ClassesListTreeModel.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/gui/ClassesListTreeModel.java @@ -141,4 +141,9 @@ public class ClassesListTreeModel implements TreeModel { public void removeTreeModelListener(TreeModelListener l) { } + + @Override + public String toString() { + return "scripts"; + } } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/gui/GraphFrame.java b/trunk/src/com/jpexs/decompiler/flash/abc/gui/GraphFrame.java index a8b18a050..5fab88f89 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/gui/GraphFrame.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/gui/GraphFrame.java @@ -51,7 +51,11 @@ public class GraphFrame extends JFrame { protected void paintComponent(Graphics g) { super.paintComponent(g); g.setColor(Color.black); - paintPart(g, graph.heads.get(0), 0, getPartWidth(graph.heads.get(0), new HashSet()) * (BLOCK_WIDTH + SPACE_HORIZONTAL) / 2, new HashMap()); + GraphPart h = graph.heads.get(0); + if (graph.heads.size() > 3) { + h = graph.heads.get(3); + } + paintPart(g, h, 0, getPartWidth(graph.heads.get(0), new HashSet()) * (BLOCK_WIDTH + SPACE_HORIZONTAL) / 2, new HashMap()); } private void paintPart(Graphics g, GraphPart part, int y, int x, HashMap used) { diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/gui/IconListRenderer.java b/trunk/src/com/jpexs/decompiler/flash/abc/gui/IconListRenderer.java index b39a7c9fa..cd8445efb 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/gui/IconListRenderer.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/gui/IconListRenderer.java @@ -16,6 +16,7 @@ */ package com.jpexs.decompiler.flash.abc.gui; +import com.jpexs.decompiler.flash.gui.View; import java.awt.Component; import javax.swing.*; @@ -33,9 +34,9 @@ public class IconListRenderer } public IconListRenderer() { - constIcon = loadIcon("com/jpexs/decompiler/flash/abc/gui/graphics/constant.png"); - functionIcon = loadIcon("com/jpexs/decompiler/flash/abc/gui/graphics/function.png"); - variableIcon = loadIcon("com/jpexs/decompiler/flash/abc/gui/graphics/variable.png"); + constIcon = View.getIcon("constant"); + functionIcon = View.getIcon("function"); + variableIcon = View.getIcon("variable"); } @Override diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/gui/graphics/constant.png b/trunk/src/com/jpexs/decompiler/flash/abc/gui/graphics/constant.png deleted file mode 100644 index c6ddca761..000000000 Binary files a/trunk/src/com/jpexs/decompiler/flash/abc/gui/graphics/constant.png and /dev/null differ diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/gui/graphics/function.png b/trunk/src/com/jpexs/decompiler/flash/abc/gui/graphics/function.png deleted file mode 100644 index 2c1b83afc..000000000 Binary files a/trunk/src/com/jpexs/decompiler/flash/abc/gui/graphics/function.png and /dev/null differ diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/gui/graphics/variable.png b/trunk/src/com/jpexs/decompiler/flash/abc/gui/graphics/variable.png deleted file mode 100644 index 0fe224d56..000000000 Binary files a/trunk/src/com/jpexs/decompiler/flash/abc/gui/graphics/variable.png and /dev/null differ diff --git a/trunk/src/com/jpexs/decompiler/flash/action/TagNode.java b/trunk/src/com/jpexs/decompiler/flash/action/TagNode.java deleted file mode 100644 index df9f6a0b8..000000000 --- a/trunk/src/com/jpexs/decompiler/flash/action/TagNode.java +++ /dev/null @@ -1,182 +0,0 @@ -/* - * Copyright (C) 2010-2013 JPEXS - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package com.jpexs.decompiler.flash.action; - -import com.jpexs.decompiler.flash.EventListener; -import com.jpexs.decompiler.flash.SWF; -import com.jpexs.decompiler.flash.helpers.Highlighting; -import com.jpexs.decompiler.flash.tags.DefineButton2Tag; -import com.jpexs.decompiler.flash.tags.DefineButtonTag; -import com.jpexs.decompiler.flash.tags.DefineSpriteTag; -import com.jpexs.decompiler.flash.tags.DoInitActionTag; -import com.jpexs.decompiler.flash.tags.ExportAssetsTag; -import com.jpexs.decompiler.flash.tags.ShowFrameTag; -import com.jpexs.decompiler.flash.tags.Tag; -import com.jpexs.decompiler.flash.tags.base.ASMSource; -import com.jpexs.decompiler.flash.tags.base.Container; -import java.io.File; -import java.io.FileOutputStream; -import java.util.ArrayList; -import java.util.List; - -public class TagNode { - - public List subItems; - public Object tag; - public boolean export = false; - - public TagNode(Object tag) { - this.tag = tag; - this.subItems = new ArrayList(); - } - - @Override - public String toString() { - return tag.toString(); - } - - public static List createTagList(List list) { - List ret = new ArrayList(); - int frame = 1; - List frames = new ArrayList(); - - List exportAssetsTags = new ArrayList(); - for (Object t : list) { - if (t instanceof ExportAssetsTag) { - exportAssetsTags.add((ExportAssetsTag) t); - } - if (t instanceof ShowFrameTag) { - TagNode tti = new TagNode("frame" + frame); - - for (int r = ret.size() - 1; r >= 0; r--) { - if (!(ret.get(r).tag instanceof DefineSpriteTag)) { - if (!(ret.get(r).tag instanceof DefineButtonTag)) { - if (!(ret.get(r).tag instanceof DefineButton2Tag)) { - if (!(ret.get(r).tag instanceof DoInitActionTag)) { - tti.subItems.add(ret.get(r)); - ret.remove(r); - } - } - } - } - } - frame++; - frames.add(tti); - } else if (t instanceof ASMSource) { - TagNode tti = new TagNode(t); - ret.add(tti); - } else if (t instanceof Container) { - if (((Container) t).getItemCount() > 0) { - - TagNode tti = new TagNode(t); - List subItems = ((Container) t).getSubItems(); - - tti.subItems = createTagList(subItems); - ret.add(tti); - } - } - - } - ret.addAll(frames); - for (int i = ret.size() - 1; i >= 0; i--) { - if (ret.get(i).tag instanceof DefineSpriteTag) { - ((DefineSpriteTag) ret.get(i).tag).exportAssetsTags = exportAssetsTags; - } - if (ret.get(i).tag instanceof DefineButtonTag) { - ((DefineButtonTag) ret.get(i).tag).exportAssetsTags = exportAssetsTags; - } - if (ret.get(i).tag instanceof DefineButton2Tag) { - ((DefineButton2Tag) ret.get(i).tag).exportAssetsTags = exportAssetsTags; - } - if (ret.get(i).tag instanceof DoInitActionTag) { - ((DoInitActionTag) ret.get(i).tag).exportAssetsTags = exportAssetsTags; - } - if (ret.get(i).tag instanceof ASMSource) { - ASMSource ass = (ASMSource) ret.get(i).tag; - if (ass.containsSource()) { - continue; - } - } - if (ret.get(i).subItems.isEmpty()) { - ret.remove(i); - } - } - return ret; - } - - public static void setExport(List nodeList, boolean export) { - for (TagNode node : nodeList) { - node.export = export; - setExport(node.subItems, export); - } - } - - public static boolean exportNode(List nodeList, String outdir, boolean isPcode) { - return exportNode(nodeList, outdir, isPcode, null); - } - - public static boolean exportNode(List nodeList, String outdir, boolean isPcode, EventListener ev) { - File dir = new File(outdir); - List existingNames = new ArrayList(); - for (TagNode node : nodeList) { - String name = ""; - if (node.tag instanceof Tag) { - name = ((Tag) node.tag).getExportName(); - } else { - name = node.tag.toString(); - } - int i = 1; - String baseName = name; - while (existingNames.contains(name)) { - i++; - name = baseName + "_" + i; - } - existingNames.add(name); - if (node.subItems.isEmpty()) { - if ((node.tag instanceof ASMSource) && (node.export)) { - if (!dir.exists()) { - dir.mkdirs(); - } - try { - String f = outdir + File.separatorChar + name + ".as"; - if (ev != null) { - ev.handleEvent("export", "Exporting " + f + " ..."); - } - String ret; - if (isPcode) { - ret = Highlighting.stripHilights(((ASMSource) node.tag).getASMSource(SWF.DEFAULT_VERSION)); - } else { - List as = ((ASMSource) node.tag).getActions(SWF.DEFAULT_VERSION); - com.jpexs.decompiler.flash.action.Action.setActionsAddresses(as, 0, SWF.DEFAULT_VERSION); - ret = (Highlighting.stripHilights(com.jpexs.decompiler.flash.action.Action.actionsToSource(as, SWF.DEFAULT_VERSION))); - } - - - FileOutputStream fos = new FileOutputStream(f); - fos.write(ret.getBytes()); - fos.close(); - } catch (Exception ex) { - } - } - } else { - exportNode(node.subItems, outdir + File.separatorChar + name, isPcode, ev); - } - - } - return true; - } -} diff --git a/trunk/src/com/jpexs/decompiler/flash/action/gui/ActionPanel.java b/trunk/src/com/jpexs/decompiler/flash/action/gui/ActionPanel.java index 9ea8766e4..e8327f929 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/gui/ActionPanel.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/gui/ActionPanel.java @@ -21,7 +21,6 @@ import com.jpexs.decompiler.flash.SWF; import com.jpexs.decompiler.flash.abc.gui.GraphFrame; import com.jpexs.decompiler.flash.abc.gui.LineMarkedEditorPane; import com.jpexs.decompiler.flash.action.ActionGraph; -import com.jpexs.decompiler.flash.action.TagNode; import com.jpexs.decompiler.flash.action.parser.ASMParser; import com.jpexs.decompiler.flash.action.parser.ParseException; import com.jpexs.decompiler.flash.helpers.Highlighting; @@ -41,15 +40,10 @@ import javax.swing.*; import javax.swing.border.BevelBorder; import javax.swing.event.CaretEvent; import javax.swing.event.CaretListener; -import javax.swing.event.TreeSelectionEvent; -import javax.swing.event.TreeSelectionListener; -import javax.swing.tree.DefaultTreeCellRenderer; -import javax.swing.tree.TreePath; import jsyntaxpane.DefaultSyntaxKit; -public class ActionPanel extends JPanel implements TreeSelectionListener, ActionListener { +public class ActionPanel extends JPanel implements ActionListener { - public JTree tagTree; public LineMarkedEditorPane editor; public LineMarkedEditorPane decompiledEditor; public List list; @@ -65,26 +59,47 @@ public class ActionPanel extends JPanel implements TreeSelectionListener, Action public JLabel decLabel = new JLabel("ActionScript source"); public List decompiledHilights = new ArrayList(); public List disassembledHilights = new ArrayList(); - private String lastDisasm = ""; + public String lastDisasm = ""; private boolean ignoreCarret = false; private boolean editMode = false; private List lastCode; + private ASMSource src; - public ActionPanel(List list) { + public void setSource(ASMSource src) { + this.src = src; + Main.startWork("Decompiling..."); + final ASMSource asm = (ASMSource) src; + (new Thread() { + @Override + public void run() { + lastDisasm = asm.getASMSource(SWF.DEFAULT_VERSION); + disassembledHilights = Highlighting.getInstrHighlights(lastDisasm); + lastDisasm = Highlighting.stripHilights(lastDisasm); + editor.setText(lastDisasm); + if (Main.DO_DECOMPILE) { + List as = asm.getActions(SWF.DEFAULT_VERSION); + lastCode = as; + com.jpexs.decompiler.flash.action.Action.setActionsAddresses(as, 0, SWF.DEFAULT_VERSION); + decompiledEditor.setText("//Decompiling..."); + String s = com.jpexs.decompiler.flash.action.Action.actionsToSource(as, SWF.DEFAULT_VERSION); + decompiledHilights = Highlighting.getInstrHighlights(s); + decompiledEditor.setText(Highlighting.stripHilights(s)); + } + setEditMode(false); + Main.stopWork(); + } + }).start(); + } + + public ActionPanel() { this.list = list; DefaultSyntaxKit.initKit(); editor = new LineMarkedEditorPane(); editor.setEditable(false); decompiledEditor = new LineMarkedEditorPane(); decompiledEditor.setEditable(false); - tagTree = new JTree(new TagTreeModel(list)); - DefaultTreeCellRenderer treeRenderer = new DefaultTreeCellRenderer(); - ClassLoader cldr = this.getClass().getClassLoader(); - java.net.URL imageURL = cldr.getResource("com/jpexs/decompiler/flash/gui/graphics/as16.png"); - ImageIcon leafIcon = new ImageIcon(imageURL); - treeRenderer.setLeafIcon(leafIcon); - tagTree.setCellRenderer(treeRenderer); + JPanel panB = new JPanel(); panB.setLayout(new BorderLayout()); @@ -131,15 +146,16 @@ public class ActionPanel extends JPanel implements TreeSelectionListener, Action setLayout(new BorderLayout()); - add(splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, new JScrollPane(tagTree), splitPane2 = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, panA, panB)), BorderLayout.CENTER); - splitPane.setResizeWeight(0.5); + //add(splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, new JScrollPane(tagTree), splitPane2 = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, panA, panB)), BorderLayout.CENTER); + add(splitPane2 = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, panA, panB), BorderLayout.CENTER); +// splitPane.setResizeWeight(0.5); splitPane2.setResizeWeight(0.5); editor.setContentType("text/flasm"); editor.setFont(new Font("Monospaced", Font.PLAIN, editor.getFont().getSize())); decompiledEditor.setContentType("text/actionscript"); decompiledEditor.setFont(new Font("Monospaced", Font.PLAIN, decompiledEditor.getFont().getSize())); - tagTree.addTreeSelectionListener(this); + //tagTree.addTreeSelectionListener(this); editor.addCaretListener(new CaretListener() { @Override public void caretUpdate(CaretEvent e) { @@ -196,42 +212,8 @@ public class ActionPanel extends JPanel implements TreeSelectionListener, Action } public void initSplits() { - splitPane.setDividerLocation(getWidth() / 3); - splitPane2.setDividerLocation(getWidth() / 3); - } - - public void valueChanged(TreeSelectionEvent e) { - if (Main.isWorking()) { - return; - } - Object obj = tagTree.getLastSelectedPathComponent(); - if (obj instanceof TagNode) { - obj = ((TagNode) obj).tag; - if (obj instanceof ASMSource) { - Main.startWork("Decompiling..."); - final ASMSource asm = (ASMSource) obj; - (new Thread() { - @Override - public void run() { - lastDisasm = asm.getASMSource(SWF.DEFAULT_VERSION); - disassembledHilights = Highlighting.getInstrHighlights(lastDisasm); - lastDisasm = Highlighting.stripHilights(lastDisasm); - editor.setText(lastDisasm); - if (Main.DO_DECOMPILE) { - List as = asm.getActions(SWF.DEFAULT_VERSION); - lastCode = as; - com.jpexs.decompiler.flash.action.Action.setActionsAddresses(as, 0, SWF.DEFAULT_VERSION); - decompiledEditor.setText("//Decompiling..."); - String s = com.jpexs.decompiler.flash.action.Action.actionsToSource(as, SWF.DEFAULT_VERSION); - decompiledHilights = Highlighting.getInstrHighlights(s); - decompiledEditor.setText(Highlighting.stripHilights(s)); - } - setEditMode(false); - Main.stopWork(); - } - }).start(); - } - } + //splitPane.setDividerLocation(getWidth() / 3); + splitPane2.setDividerLocation(getWidth() / 2); } public void display() { @@ -240,19 +222,6 @@ public class ActionPanel extends JPanel implements TreeSelectionListener, Action splitPane2.setDividerLocation(0.5); } - public List getSelectedNodes() { - List ret = new ArrayList(); - TreePath tps[] = tagTree.getSelectionPaths(); - if (tps == null) { - return ret; - } - for (TreePath tp : tps) { - TagNode te = (TagNode) tp.getLastPathComponent(); - ret.add(te); - } - return ret; - } - public void setEditMode(boolean val) { if (val) { editor.setEditable(true); @@ -282,17 +251,12 @@ public class ActionPanel extends JPanel implements TreeSelectionListener, Action setEditMode(false); editor.setText(lastDisasm); } else if (e.getActionCommand().equals("SAVEACTION")) { - TagNode ti = (TagNode) tagTree.getLastSelectedPathComponent(); - if (ti.tag instanceof ASMSource) { - ASMSource dat = (ASMSource) ti.tag; - try { - dat.setActions(ASMParser.parse(new ByteArrayInputStream(editor.getText().getBytes()), SWF.DEFAULT_VERSION), SWF.DEFAULT_VERSION); - valueChanged(null); - JOptionPane.showMessageDialog(this, "Code successfully saved"); - } catch (IOException ex) { - } catch (ParseException ex) { - JOptionPane.showMessageDialog(this, "" + ex.text + " on line " + ex.line, "Error", JOptionPane.ERROR_MESSAGE); - } + try { + src.setActions(ASMParser.parse(new ByteArrayInputStream(editor.getText().getBytes()), SWF.DEFAULT_VERSION), SWF.DEFAULT_VERSION); + JOptionPane.showMessageDialog(this, "Code successfully saved"); + } catch (IOException ex) { + } catch (ParseException ex) { + JOptionPane.showMessageDialog(this, "" + ex.text + " on line " + ex.line, "Error", JOptionPane.ERROR_MESSAGE); } saveButton.setVisible(false); editButton.setVisible(true); diff --git a/trunk/src/com/jpexs/decompiler/flash/action/gui/TagTreeModel.java b/trunk/src/com/jpexs/decompiler/flash/action/gui/TagTreeModel.java deleted file mode 100644 index 86d3fddd1..000000000 --- a/trunk/src/com/jpexs/decompiler/flash/action/gui/TagTreeModel.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright (C) 2010-2013 JPEXS - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package com.jpexs.decompiler.flash.action.gui; - -import com.jpexs.decompiler.flash.action.TagNode; -import com.jpexs.decompiler.flash.tags.*; -import java.util.ArrayList; -import java.util.List; -import javax.swing.event.TreeModelListener; -import javax.swing.tree.TreeModel; -import javax.swing.tree.TreePath; - -public class TagTreeModel implements TreeModel { - - private String root = ""; - private List list = new ArrayList(); - - public TagTreeModel(List list) { - List list2 = new ArrayList(); - list2.addAll(list); - this.list = TagNode.createTagList(list2); - } - - public List getNodeList() { - return list; - } - - public Object getRoot() { - return root; - } - - public Object getChild(Object parent, int index) { - if (parent == root) { - return list.get(index); - } else { - return ((TagNode) parent).subItems.get(index); - } - } - - public int getChildCount(Object parent) { - if (parent == root) { - return list.size(); - } else { - return ((TagNode) parent).subItems.size(); - } - } - - public boolean isLeaf(Object node) { - return (getChildCount(node) == 0); - } - - public void valueForPathChanged(TreePath path, Object newValue) { - } - - public int getIndexOfChild(Object parent, Object child) { - if (parent == root) { - for (int t = 0; t < list.size(); t++) { - if (list.get(t) == child) { - return t; - } - } - return -1; - } else { - List subTags = ((TagNode) parent).subItems; - for (int t = 0; t < subTags.size(); t++) { - if (subTags.get(t) == child) { - return t; - } - } - return -1; - } - } - - public void addTreeModelListener(TreeModelListener l) { - } - - public void removeTreeModelListener(TreeModelListener l) { - } -} diff --git a/trunk/src/com/jpexs/decompiler/flash/graph/Graph.java b/trunk/src/com/jpexs/decompiler/flash/graph/Graph.java index 753b07102..3246e8b54 100644 --- a/trunk/src/com/jpexs/decompiler/flash/graph/Graph.java +++ b/trunk/src/com/jpexs/decompiler/flash/graph/Graph.java @@ -81,7 +81,7 @@ public class Graph { int pos = -1; for (GraphPart r : uniqueRefs) { pos++; - if (r.path.startsWith("e")) { + if (r.path.startsWith("e") && !part.path.startsWith("e")) { continue; } if (part.leadsTo(r, new ArrayList())) { @@ -345,6 +345,13 @@ public class Graph { } } + protected boolean isEmpty(List output) { + if (output.isEmpty()) { + return true; + } + return false; + } + protected List check(List localData, List allParts, Stack stack, GraphPart parent, GraphPart part, GraphPart stopPart, List loops, List output, HashMap> forFinalCommands) { return null; } @@ -458,14 +465,14 @@ public class Graph { a.firstPart = ((AndItem) second).firstPart; } if (second instanceof OrItem) { - a.firstPart = ((AndItem) second).firstPart; + a.firstPart = ((OrItem) second).firstPart; } } else { OrItem o = new OrItem(null, first, second); stack.push(o); o.firstPart = part; - if (second instanceof OrItem) { - o.firstPart = ((OrItem) second).firstPart; + if (second instanceof AndItem) { + o.firstPart = ((AndItem) second).firstPart; } if (second instanceof OrItem) { o.firstPart = ((OrItem) second).firstPart; @@ -939,8 +946,7 @@ public class Graph { System.err.println("/ONFALSE (inside " + part + ")"); } } - - if (onTrue.isEmpty() && onFalse.isEmpty() && (trueStack.size() > stackSizeBefore) && (falseStack.size() > stackSizeBefore)) { + if (isEmpty(onTrue) && isEmpty(onFalse) && (trueStack.size() > stackSizeBefore) && (falseStack.size() > stackSizeBefore)) { stack.push(new TernarOpItem(null, expr, trueStack.pop(), falseStack.pop())); } else { List retw = retx; diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/AboutDialog.java b/trunk/src/com/jpexs/decompiler/flash/gui/AboutDialog.java index 507a87fab..1829d725c 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/AboutDialog.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/AboutDialog.java @@ -94,7 +94,7 @@ public class AboutDialog extends JDialog { setVisible(false); } }); - + getRootPane().setDefaultButton(okButton); setModal(true); View.centerScreen(this); View.setWindowIcon(this); diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/ExportDialog.java b/trunk/src/com/jpexs/decompiler/flash/gui/ExportDialog.java new file mode 100644 index 000000000..188801efb --- /dev/null +++ b/trunk/src/com/jpexs/decompiler/flash/gui/ExportDialog.java @@ -0,0 +1,89 @@ +package com.jpexs.decompiler.flash.gui; + +import java.awt.Container; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import javax.swing.JButton; +import javax.swing.JComboBox; +import javax.swing.JDialog; +import javax.swing.JLabel; + +/** + * + * @author JPEXS + */ +public class ExportDialog extends JDialog { + + JComboBox images; + JComboBox shapes; + JComboBox actionScript; + boolean cancelled = false; + + public ExportDialog() { + setTitle("Export..."); + addWindowListener(new WindowAdapter() { + @Override + public void windowClosing(WindowEvent e) { + cancelled = true; + } + }); + setSize(200, 175); + setLayout(null); + JLabel shapesLabel = new JLabel("Shapes"); + shapesLabel.setBounds(10, 10, 60, 25); + shapes = new JComboBox(new String[]{"SVG"}); + shapes.setBounds(75, 10, 95, 25); + + JLabel imagesLabel = new JLabel("Images"); + imagesLabel.setBounds(10, 35, 60, 25); + images = new JComboBox(new String[]{"PNG/JPEG"}); + images.setBounds(75, 35, 95, 25); + + JLabel actionScriptLabel = new JLabel("ActionScript"); + actionScriptLabel.setBounds(10, 60, 60, 25); + actionScript = new JComboBox(new String[]{"AS", "PCODE"}); + actionScript.setBounds(75, 60, 95, 25); + + JButton okButton = new JButton("OK"); + okButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + setVisible(false); + } + }); + okButton.setBounds(20, 95, 75, 25); + + JButton cancelButton = new JButton("Cancel"); + cancelButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + cancelled = true; + setVisible(false); + } + }); + cancelButton.setBounds(95, 95, 75, 25); + Container cnt = getContentPane(); + cnt.add(shapes); + cnt.add(shapesLabel); + cnt.add(images); + cnt.add(imagesLabel); + cnt.add(actionScript); + cnt.add(actionScriptLabel); + cnt.add(okButton); + cnt.add(cancelButton); + View.centerScreen(this); + View.setWindowIcon(this); + getRootPane().setDefaultButton(okButton); + setModal(true); + } + + @Override + public void setVisible(boolean b) { + if (b) { + cancelled = false; + } + super.setVisible(b); + } +} diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/FrameNode.java b/trunk/src/com/jpexs/decompiler/flash/gui/FrameNode.java new file mode 100644 index 000000000..ba3e00bb3 --- /dev/null +++ b/trunk/src/com/jpexs/decompiler/flash/gui/FrameNode.java @@ -0,0 +1,35 @@ +package com.jpexs.decompiler.flash.gui; + +/** + * + * @author JPEXS + */ +public class FrameNode { + + private int frame; + private Object parent; + private boolean display; + + public FrameNode(int frame, Object parent, boolean display) { + this.frame = frame; + this.parent = parent; + this.display = display; + } + + public boolean isDisplayed() { + return display; + } + + @Override + public String toString() { + return "frame " + frame; + } + + public int getFrame() { + return frame; + } + + public Object getParent() { + return parent; + } +} diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/LoadingPanel.java b/trunk/src/com/jpexs/decompiler/flash/gui/LoadingPanel.java index 458bf11df..af529c3c4 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/LoadingPanel.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/LoadingPanel.java @@ -42,7 +42,7 @@ public class LoadingPanel extends JPanel { public LoadingPanel(int iconWidth, int iconHeight) { this.iconWidth = iconWidth; this.iconHeight = iconHeight; - ImageIcon icon = (new ImageIcon(this.getClass().getResource("/com/jpexs/decompiler/flash/gui/graphics/loading.png"))); + ImageIcon icon = View.getIcon("loading"); animationImage = icon.getImage(); java.util.Timer timer = new java.util.Timer(); timer.schedule(new java.util.TimerTask() { diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/MainFrame.java b/trunk/src/com/jpexs/decompiler/flash/gui/MainFrame.java index 92edc069b..bdfc762d1 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/MainFrame.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/MainFrame.java @@ -19,10 +19,15 @@ package com.jpexs.decompiler.flash.gui; import com.jpexs.decompiler.flash.Configuration; import com.jpexs.decompiler.flash.Main; import com.jpexs.decompiler.flash.SWF; +import com.jpexs.decompiler.flash.SWFOutputStream; import com.jpexs.decompiler.flash.abc.gui.ABCPanel; import com.jpexs.decompiler.flash.abc.gui.DeobfuscationDialog; +import com.jpexs.decompiler.flash.abc.gui.TreeElement; import com.jpexs.decompiler.flash.abc.gui.TreeLeafScript; +import com.jpexs.decompiler.flash.abc.types.traits.Trait; +import com.jpexs.decompiler.flash.abc.types.traits.TraitClass; import com.jpexs.decompiler.flash.action.gui.ActionPanel; +import com.jpexs.decompiler.flash.gui.player.FlashPlayerPanel; import com.jpexs.decompiler.flash.helpers.Helper; import com.jpexs.decompiler.flash.tags.DefineBitsJPEG2Tag; import com.jpexs.decompiler.flash.tags.DefineBitsJPEG3Tag; @@ -48,28 +53,44 @@ import com.jpexs.decompiler.flash.tags.DefineText2Tag; import com.jpexs.decompiler.flash.tags.DefineTextTag; import com.jpexs.decompiler.flash.tags.DoABCTag; import com.jpexs.decompiler.flash.tags.DoInitActionTag; +import com.jpexs.decompiler.flash.tags.EndTag; import com.jpexs.decompiler.flash.tags.ExportAssetsTag; import com.jpexs.decompiler.flash.tags.JPEGTablesTag; +import com.jpexs.decompiler.flash.tags.PlaceObject2Tag; +import com.jpexs.decompiler.flash.tags.SetBackgroundColorTag; import com.jpexs.decompiler.flash.tags.ShowFrameTag; import com.jpexs.decompiler.flash.tags.Tag; import com.jpexs.decompiler.flash.tags.base.ASMSource; +import com.jpexs.decompiler.flash.tags.base.AloneTag; +import com.jpexs.decompiler.flash.tags.base.BoundedTag; +import com.jpexs.decompiler.flash.tags.base.CharacterTag; import com.jpexs.decompiler.flash.tags.base.Container; -import com.jpexs.decompiler.flash.tags.base.ShapeTag; +import com.jpexs.decompiler.flash.tags.base.FontTag; +import com.jpexs.decompiler.flash.types.GLYPHENTRY; +import com.jpexs.decompiler.flash.types.MATRIX; +import com.jpexs.decompiler.flash.types.RECT; +import com.jpexs.decompiler.flash.types.RGB; +import com.jpexs.decompiler.flash.types.TEXTRECORD; import java.awt.BorderLayout; +import java.awt.CardLayout; +import java.awt.Color; import java.awt.Component; import java.awt.Dimension; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileOutputStream; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; +import java.util.Set; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.Icon; -import javax.swing.ImageIcon; import javax.swing.JCheckBoxMenuItem; import javax.swing.JFileChooser; import javax.swing.JFrame; @@ -80,16 +101,26 @@ import javax.swing.JMenuItem; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JProgressBar; +import javax.swing.JScrollPane; +import javax.swing.JSplitPane; import javax.swing.JTabbedPane; +import javax.swing.JTree; import javax.swing.SwingConstants; import javax.swing.SwingWorker; import javax.swing.border.BevelBorder; +import javax.swing.event.TreeSelectionEvent; +import javax.swing.event.TreeSelectionListener; +import javax.swing.tree.DefaultTreeCellRenderer; +import javax.swing.tree.TreeCellRenderer; +import javax.swing.tree.TreeModel; +import javax.swing.tree.TreePath; +import javax.swing.tree.TreeSelectionModel; /** * * @author Jindra */ -public class MainFrame extends JFrame implements ActionListener { +public class MainFrame extends JFrame implements ActionListener, TreeSelectionListener { private SWF swf; public ABCPanel abcPanel; @@ -100,6 +131,22 @@ public class MainFrame extends JFrame implements ActionListener { public JPanel statusPanel = new JPanel(); public JProgressBar progressBar = new JProgressBar(0, 100); private DeobfuscationDialog deobfuscationDialog; + public JTree tagTree; + public FlashPlayerPanel flashPanel; + public JPanel displayPanel; + public ImagePanel imagePanel; + final static String CARDFLASHPANEL = "Flash card"; + final static String CARDIMAGEPANEL = "Image card"; + final static String CARDEMPTYPANEL = "Empty card"; + final static String CARDACTIONSCRIPTPANEL = "ActionScript card"; + final static String DETAILCARDAS3NAVIGATOR = "Traits list"; + final static String DETAILCARDEMPTYPANEL = "Empty card"; + private JPEGTablesTag jtt; + private HashMap characters; + private List abcList; + JSplitPane splitPane1; + JSplitPane splitPane2; + private JPanel detailPanel; public void setPercent(int percent) { progressBar.setValue(percent); @@ -112,6 +159,14 @@ public class MainFrame extends JFrame implements ActionListener { } } + static { + try { + File.createTempFile("temp", ".swf").delete(); //First call to this is slow, so make it first + } catch (IOException ex) { + Logger.getLogger(MainFrame.class.getName()).log(Level.SEVERE, null, ex); + } + } + private static void addTab(JTabbedPane tabbedPane, Component tab, String title, Icon icon) { tabbedPane.add(tab); @@ -135,13 +190,6 @@ public class MainFrame extends JFrame implements ActionListener { } statusLabel.setText(s); } - private TagPanel imagesTagPanel; - private TagPanel shapesTagPanel; - private TagPanel morphshapesTagPanel; - private TagPanel spritesTagPanel; - private TagPanel textsTagPanel; - private TagPanel buttonsTagPanel; - private TagPanel fontsTagPanel; public MainFrame(SWF swf) { setSize(1000, 700); @@ -163,68 +211,27 @@ public class MainFrame extends JFrame implements ActionListener { JMenu menuFile = new JMenu("File"); JMenuItem miOpen = new JMenuItem("Open..."); - miOpen.setIcon(new ImageIcon(View.loadImage("com/jpexs/decompiler/flash/gui/graphics/open16.png"))); + miOpen.setIcon(View.getIcon("open16")); miOpen.setActionCommand("OPEN"); miOpen.addActionListener(this); JMenuItem miSave = new JMenuItem("Save"); - miSave.setIcon(new ImageIcon(View.loadImage("com/jpexs/decompiler/flash/gui/graphics/save16.png"))); + miSave.setIcon(View.getIcon("save16")); miSave.setActionCommand("SAVE"); miSave.addActionListener(this); JMenuItem miSaveAs = new JMenuItem("Save as..."); - miSaveAs.setIcon(new ImageIcon(View.loadImage("com/jpexs/decompiler/flash/gui/graphics/saveas16.png"))); + miSaveAs.setIcon(View.getIcon("saveas16")); miSaveAs.setActionCommand("SAVEAS"); miSaveAs.addActionListener(this); - JMenu menuExportAll = new JMenu("Export all"); - JMenuItem miExportAllAS = new JMenuItem("ActionScript..."); - miExportAllAS.setIcon(new ImageIcon(View.loadImage("com/jpexs/decompiler/flash/gui/graphics/as16.png"))); - miExportAllAS.setActionCommand("EXPORT"); - miExportAllAS.addActionListener(this); + JMenuItem menuExportAll = new JMenuItem("Export all"); + menuExportAll.setActionCommand("EXPORT"); + menuExportAll.addActionListener(this); + JMenuItem menuExportSel = new JMenuItem("Export selection"); + menuExportSel.setActionCommand("EXPORTSEL"); + menuExportSel.addActionListener(this); + menuExportAll.setIcon(View.getIcon("export16")); + menuExportSel.setIcon(View.getIcon("exportsel16")); - JMenuItem miExportAllPCode = new JMenuItem("PCode..."); - miExportAllPCode.setIcon(new ImageIcon(View.loadImage("com/jpexs/decompiler/flash/gui/graphics/pcode16.png"))); - miExportAllPCode.setActionCommand("EXPORTPCODE"); - miExportAllPCode.addActionListener(this); - JMenuItem miExportImages = new JMenuItem("Images..."); - miExportImages.setIcon(new ImageIcon(View.loadImage("com/jpexs/decompiler/flash/gui/graphics/image16.png"))); - miExportImages.setActionCommand("EXPORTIMAGES"); - miExportImages.addActionListener(this); - - JMenuItem miExportShapes = new JMenuItem("Shapes..."); - miExportShapes.setIcon(new ImageIcon(View.loadImage("com/jpexs/decompiler/flash/gui/graphics/shape16.png"))); - miExportShapes.setActionCommand("EXPORTSHAPES"); - miExportShapes.addActionListener(this); - - menuExportAll.add(miExportAllAS); - menuExportAll.add(miExportAllPCode); - menuExportAll.add(miExportImages); - menuExportAll.add(miExportShapes); - - JMenu menuExportSel = new JMenu("Export selection"); - JMenuItem miExportSelAS = new JMenuItem("ActionScript..."); - miExportSelAS.setIcon(new ImageIcon(View.loadImage("com/jpexs/decompiler/flash/gui/graphics/as16.png"))); - miExportSelAS.setActionCommand("EXPORTSEL"); - miExportSelAS.addActionListener(this); - - JMenuItem miExportSelPCode = new JMenuItem("PCode..."); - miExportSelPCode.setIcon(new ImageIcon(View.loadImage("com/jpexs/decompiler/flash/gui/graphics/pcode16.png"))); - miExportSelPCode.setActionCommand("EXPORTPCODESEL"); - miExportSelPCode.addActionListener(this); - - JMenuItem miExportSelImages = new JMenuItem("Images..."); - miExportSelImages.setIcon(new ImageIcon(View.loadImage("com/jpexs/decompiler/flash/gui/graphics/image16.png"))); - miExportSelImages.setActionCommand("EXPORTIMAGESSEL"); - miExportSelImages.addActionListener(this); - - JMenuItem miExportSelShapes = new JMenuItem("Shapes..."); - miExportSelShapes.setIcon(new ImageIcon(View.loadImage("com/jpexs/decompiler/flash/gui/graphics/shape16.png"))); - miExportSelShapes.setActionCommand("EXPORTSHAPESSEL"); - miExportSelShapes.addActionListener(this); - - menuExportSel.add(miExportSelAS); - menuExportSel.add(miExportSelPCode); - menuExportSel.add(miExportSelImages); - menuExportSel.add(miExportSelShapes); menuFile.add(miOpen); menuFile.add(miSave); @@ -233,12 +240,13 @@ public class MainFrame extends JFrame implements ActionListener { menuFile.add(menuExportSel); menuFile.addSeparator(); JMenuItem miClose = new JMenuItem("Exit"); - miClose.setIcon(new ImageIcon(View.loadImage("com/jpexs/decompiler/flash/gui/graphics/exit16.png"))); + miClose.setIcon(View.getIcon("exit16")); miClose.setActionCommand("EXIT"); miClose.addActionListener(this); menuFile.add(miClose); menuBar.add(menuFile); JMenu menuDeobfuscation = new JMenu("Deobfuscation"); + menuDeobfuscation.setIcon(View.getIcon("deobfuscate16")); JMenuItem miDeobfuscation = new JMenuItem("PCode deobfuscation..."); miDeobfuscation.setActionCommand("DEOBFUSCATE"); @@ -276,6 +284,7 @@ public class MainFrame extends JFrame implements ActionListener { miControlFlowAll.setActionCommand("RESTORECONTROLFLOWALL"); miControlFlowAll.addActionListener(this); + menuDeobfuscation.add(miRenameIdentifiers); //menuDeobfuscation.add(miSubLimiter); menuDeobfuscation.add(miDeobfuscation); @@ -291,7 +300,7 @@ public class MainFrame extends JFrame implements ActionListener { JMenu menuTools = new JMenu("Tools"); JMenuItem miProxy = new JMenuItem("Proxy"); miProxy.setActionCommand("SHOWPROXY"); - miProxy.setIcon(new ImageIcon(View.loadImage("com/jpexs/decompiler/flash/gui/graphics/proxy16.png"))); + miProxy.setIcon(View.getIcon("proxy16")); miProxy.addActionListener(this); menuTools.add(miProxy); @@ -301,72 +310,97 @@ public class MainFrame extends JFrame implements ActionListener { JMenu menuHelp = new JMenu("Help"); JMenuItem miAbout = new JMenuItem("About..."); + miAbout.setIcon(View.getIcon("about16")); + miAbout.setActionCommand("ABOUT"); miAbout.addActionListener(this); JMenuItem miCheckUpdates = new JMenuItem("Check for updates..."); miCheckUpdates.setActionCommand("CHECKUPDATES"); + miCheckUpdates.setIcon(View.getIcon("update16")); miCheckUpdates.addActionListener(this); - menuHelp.add(miAbout); + + JMenuItem miDonate = new JMenuItem("Donate..."); + miDonate.setActionCommand("DONATE"); + miDonate.setIcon(View.getIcon("donate16")); + miDonate.addActionListener(this); + + menuHelp.add(miCheckUpdates); + menuHelp.add(miDonate); + menuHelp.add(miAbout); menuBar.add(menuHelp); setJMenuBar(menuBar); List objs = new ArrayList(); objs.addAll(swf.tags); + + this.swf = swf; - getContentPane().setLayout(new BorderLayout()); - List shapes = new ArrayList(); - List images = new ArrayList(); - List morphShapes = new ArrayList(); - List sprites = new ArrayList(); - List fonts = new ArrayList(); - List texts = new ArrayList(); - List buttons = new ArrayList(); - List abcList = new ArrayList(); - getShapes(objs, shapes); - getImages(objs, images); - getMorphShapes(objs, morphShapes); - getSprites(objs, sprites); - getFonts(objs, fonts); - getTexts(objs, texts); - getButtons(objs, buttons); + java.awt.Container cnt = getContentPane(); + cnt.setLayout(new BorderLayout()); + + + detailPanel = new JPanel(); + detailPanel.setLayout(new CardLayout()); + JPanel whitePanel = new JPanel(); + whitePanel.setBackground(Color.white); + detailPanel.add(whitePanel, DETAILCARDEMPTYPANEL); + CardLayout cl2 = (CardLayout) (detailPanel.getLayout()); + cl2.show(detailPanel, DETAILCARDEMPTYPANEL); + + + abcList = new ArrayList(); getActionScript3(objs, abcList); - - getContentPane().add(tabPane, BorderLayout.CENTER); - if (!abcList.isEmpty()) { - addTab(tabPane, abcPanel = new ABCPanel(abcList), "ActionScript3", new ImageIcon(this.getClass().getClassLoader().getResource("com/jpexs/decompiler/flash/gui/graphics/as16.png"))); + addTab(tabPane, abcPanel = new ABCPanel(abcList), "ActionScript3", View.getIcon("as16")); + detailPanel.add(abcPanel.tabbedPane, DETAILCARDAS3NAVIGATOR); } else { - actionPanel = new ActionPanel(swf.tags); - if (actionPanel.tagTree.getRowCount() > 1) { - addTab(tabPane, actionPanel, "ActionScript", new ImageIcon(this.getClass().getClassLoader().getResource("com/jpexs/decompiler/flash/gui/graphics/as16.png"))); - } + actionPanel = new ActionPanel(); + addTab(tabPane, actionPanel, "ActionScript", View.getIcon("as16")); + menuDeobfuscation.setEnabled(false); } - if (!shapes.isEmpty()) { - addTab(tabPane, shapesTagPanel = new TagPanel(this, shapes, swf), "Shapes", new ImageIcon(this.getClass().getClassLoader().getResource("com/jpexs/decompiler/flash/gui/graphics/shape16.png"))); - } - if (!morphShapes.isEmpty()) { - addTab(tabPane, morphshapesTagPanel = new TagPanel(this, morphShapes, swf), "MorphShapes", new ImageIcon(this.getClass().getClassLoader().getResource("com/jpexs/decompiler/flash/gui/graphics/morphshape16.png"))); - } - if (!images.isEmpty()) { - addTab(tabPane, imagesTagPanel = new TagPanel(this, images, swf), "Images", new ImageIcon(this.getClass().getClassLoader().getResource("com/jpexs/decompiler/flash/gui/graphics/image16.png"))); - } - if (!sprites.isEmpty()) { - addTab(tabPane, spritesTagPanel = new TagPanel(this, sprites, swf), "Sprites", new ImageIcon(this.getClass().getClassLoader().getResource("com/jpexs/decompiler/flash/gui/graphics/sprite16.png"))); - } - if (!fonts.isEmpty()) { - addTab(tabPane, fontsTagPanel = new TagPanel(this, fonts, swf), "Fonts", new ImageIcon(this.getClass().getClassLoader().getResource("com/jpexs/decompiler/flash/gui/graphics/font16.png"))); - } - if (!texts.isEmpty()) { - addTab(tabPane, textsTagPanel = new TagPanel(this, texts, swf), "Texts", new ImageIcon(this.getClass().getClassLoader().getResource("com/jpexs/decompiler/flash/gui/graphics/text16.png"))); - } - if (!buttons.isEmpty()) { - addTab(tabPane, buttonsTagPanel = new TagPanel(this, buttons, swf), "Buttons", new ImageIcon(this.getClass().getClassLoader().getResource("com/jpexs/decompiler/flash/gui/graphics/button16.png"))); - } + tagTree = new JTree(new TagTreeModel(createTagList(objs, null), (new File(Main.file)).getName())); + tagTree.addTreeSelectionListener(this); + TreeCellRenderer tcr = new DefaultTreeCellRenderer() { + @Override + public Component getTreeCellRendererComponent( + JTree tree, + Object value, + boolean sel, + boolean expanded, + boolean leaf, + int row, + boolean hasFocus) { + + super.getTreeCellRendererComponent( + tree, value, sel, + expanded, leaf, row, + hasFocus); + Object val = value; + if (val instanceof TagNode) { + val = ((TagNode) val).tag; + } + String type = getTagType(val); + if (row == 0) { + setIcon(View.getIcon("flash16")); + } else if (type != null) { + if (type.equals("folder") && expanded) { + type = "folderopen"; + } + setIcon(View.getIcon(type + "16")); + //setToolTipText("This book is in the Tutorial series."); + } else { + //setToolTipText(null); //no tool tip + } + return this; + } + }; + + tagTree.setCellRenderer(tcr); loadingPanel.setPreferredSize(new Dimension(30, 30)); statusPanel = new JPanel(); statusPanel.setPreferredSize(new Dimension(1, 30)); @@ -375,7 +409,48 @@ public class MainFrame extends JFrame implements ActionListener { statusPanel.add(loadingPanel, BorderLayout.WEST); statusPanel.add(statusLabel, BorderLayout.CENTER); loadingPanel.setVisible(false); - add(statusPanel, BorderLayout.SOUTH); + cnt.add(statusPanel, BorderLayout.SOUTH); + + for (Tag t : swf.tags) { + if (t instanceof JPEGTablesTag) { + jtt = (JPEGTablesTag) t; + } + } + characters = new HashMap(); + List list2 = new ArrayList(); + list2.addAll(swf.tags); + parseCharacters(list2); + + //setLayout(new BorderLayout()); + try { + flashPanel = new FlashPlayerPanel(this); + } catch (FlashUnsupportedException fue) { + } + displayPanel = new JPanel(new CardLayout()); + if (flashPanel != null) { + displayPanel.add(flashPanel, CARDFLASHPANEL); + } else { + JPanel swtPanel = new JPanel(new BorderLayout()); + swtPanel.add(new JLabel("
Preview of this object is not available on this platform. (Windows only)
", JLabel.CENTER), BorderLayout.CENTER); + swtPanel.setBackground(Color.white); + displayPanel.add(swtPanel, CARDFLASHPANEL); + } + imagePanel = new ImagePanel(); + displayPanel.add(imagePanel, CARDIMAGEPANEL); + displayPanel.add(new JPanel(), CARDEMPTYPANEL); + if (actionPanel != null) { + displayPanel.add(actionPanel, CARDACTIONSCRIPTPANEL); + } + if (abcPanel != null) { + displayPanel.add(abcPanel, CARDACTIONSCRIPTPANEL); + } + CardLayout cl = (CardLayout) (displayPanel.getLayout()); + cl.show(displayPanel, CARDEMPTYPANEL); + //displayPanel.setBorder(BorderFactory.createLineBorder(Color.black)); + splitPane2 = new JSplitPane(JSplitPane.VERTICAL_SPLIT, new JScrollPane(tagTree), detailPanel); + splitPane1 = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, splitPane2, displayPanel); + cnt.add(splitPane1, BorderLayout.CENTER); + splitPane1.setDividerLocation(0.5); View.centerScreen(this); @@ -391,6 +466,19 @@ public class MainFrame extends JFrame implements ActionListener { if (actionPanel != null) { actionPanel.initSplits(); } + splitPane1.setDividerLocation(getWidth() / 3); + splitPane2.setDividerLocation(splitPane2.getHeight() * 3 / 5); + } + } + + private void parseCharacters(List list) { + for (Object t : list) { + if (t instanceof CharacterTag) { + characters.put(((CharacterTag) t).getCharacterID(), (CharacterTag) t); + } + if (t instanceof Container) { + parseCharacters(((Container) t).getSubItems()); + } } } @@ -495,79 +583,238 @@ public class MainFrame extends JFrame implements ActionListener { } } - public static List createTagList(List list) { + public static List createASTagList(List list, Object parent) { List ret = new ArrayList(); int frame = 1; List frames = new ArrayList(); - List shapes = new ArrayList(); - List morphShapes = new ArrayList(); - List sprites = new ArrayList(); - List buttons = new ArrayList(); - List images = new ArrayList(); - List fonts = new ArrayList(); - List texts = new ArrayList(); - List exportAssetsTags = new ArrayList(); for (Object t : list) { if (t instanceof ExportAssetsTag) { exportAssetsTags.add((ExportAssetsTag) t); } - if ((t instanceof DefineFontTag) - || (t instanceof DefineFont2Tag) - || (t instanceof DefineFont3Tag) - || (t instanceof DefineFont4Tag)) { - fonts.add(new TagNode(t)); - } - if ((t instanceof DefineTextTag) - || (t instanceof DefineText2Tag) - || (t instanceof DefineEditTextTag)) { - texts.add(new TagNode(t)); - } - - if ((t instanceof DefineBitsTag) - || (t instanceof DefineBitsJPEG2Tag) - || (t instanceof DefineBitsJPEG3Tag) - || (t instanceof DefineBitsJPEG4Tag) - || (t instanceof DefineBitsLosslessTag) - || (t instanceof DefineBitsLossless2Tag)) { - images.add(new TagNode(t)); - } - if ((t instanceof DefineShapeTag) - || (t instanceof DefineShape2Tag) - || (t instanceof DefineShape3Tag) - || (t instanceof DefineShape4Tag)) { - shapes.add(new TagNode(t)); - } - - if ((t instanceof DefineMorphShapeTag) || (t instanceof DefineMorphShape2Tag)) { - morphShapes.add(new TagNode(t)); - } - - if (t instanceof DefineSpriteTag) { - sprites.add(new TagNode(t)); - } - if ((t instanceof DefineButtonTag) || (t instanceof DefineButton2Tag)) { - buttons.add(new TagNode(t)); - } if (t instanceof ShowFrameTag) { - TagNode tti = new TagNode("frame" + frame); + TagNode tti = new TagNode(new FrameNode(frame, parent, false)); - /* for (int r = ret.size() - 1; r >= 0; r--) { - if (!(ret.get(r).tag instanceof DefineSpriteTag)) { - if (!(ret.get(r).tag instanceof DefineButtonTag)) { - if (!(ret.get(r).tag instanceof DefineButton2Tag)) { - if (!(ret.get(r).tag instanceof DoInitActionTag)) { - tti.subItems.add(ret.get(r)); - ret.remove(r); - } - } - } - } - }*/ + for (int r = ret.size() - 1; r >= 0; r--) { + if (!(ret.get(r).tag instanceof DefineSpriteTag)) { + if (!(ret.get(r).tag instanceof DefineButtonTag)) { + if (!(ret.get(r).tag instanceof DefineButton2Tag)) { + if (!(ret.get(r).tag instanceof DoInitActionTag)) { + tti.subItems.add(ret.get(r)); + ret.remove(r); + } + } + } + } + } frame++; frames.add(tti); - } /*if (t instanceof ASMSource) { + } else if (t instanceof ASMSource) { + TagNode tti = new TagNode(t); + ret.add(tti); + } else if (t instanceof Container) { + if (((Container) t).getItemCount() > 0) { + + TagNode tti = new TagNode(t); + List subItems = ((Container) t).getSubItems(); + + tti.subItems = createASTagList(subItems, t); + ret.add(tti); + } + } + + } + ret.addAll(frames); + for (int i = ret.size() - 1; i >= 0; i--) { + if (ret.get(i).tag instanceof DefineSpriteTag) { + ((DefineSpriteTag) ret.get(i).tag).exportAssetsTags = exportAssetsTags; + } + if (ret.get(i).tag instanceof DefineButtonTag) { + ((DefineButtonTag) ret.get(i).tag).exportAssetsTags = exportAssetsTags; + } + if (ret.get(i).tag instanceof DefineButton2Tag) { + ((DefineButton2Tag) ret.get(i).tag).exportAssetsTags = exportAssetsTags; + } + if (ret.get(i).tag instanceof DoInitActionTag) { + ((DoInitActionTag) ret.get(i).tag).exportAssetsTags = exportAssetsTags; + } + if (ret.get(i).tag instanceof ASMSource) { + ASMSource ass = (ASMSource) ret.get(i).tag; + if (ass.containsSource()) { + continue; + } + } + if (ret.get(i).subItems.isEmpty()) { + ret.remove(i); + } + } + return ret; + } + + public List getSelectedNodes() { + List ret = new ArrayList(); + TreePath tps[] = tagTree.getSelectionPaths(); + if (tps == null) { + return ret; + } + for (TreePath tp : tps) { + TagNode te = (TagNode) tp.getLastPathComponent(); + ret.add(te); + } + return ret; + } + + public String getTagType(Object t) { + if ((t instanceof DefineFontTag) + || (t instanceof DefineFont2Tag) + || (t instanceof DefineFont3Tag) + || (t instanceof DefineFont4Tag)) { + return "font"; + } + if ((t instanceof DefineTextTag) + || (t instanceof DefineText2Tag) + || (t instanceof DefineEditTextTag)) { + return "text"; + } + + if ((t instanceof DefineBitsTag) + || (t instanceof DefineBitsJPEG2Tag) + || (t instanceof DefineBitsJPEG3Tag) + || (t instanceof DefineBitsJPEG4Tag) + || (t instanceof DefineBitsLosslessTag) + || (t instanceof DefineBitsLossless2Tag)) { + return "image"; + } + if ((t instanceof DefineShapeTag) + || (t instanceof DefineShape2Tag) + || (t instanceof DefineShape3Tag) + || (t instanceof DefineShape4Tag)) { + return "shape"; + } + + if ((t instanceof DefineMorphShapeTag) || (t instanceof DefineMorphShape2Tag)) { + return "morphshape"; + } + + if (t instanceof DefineSpriteTag) { + return "sprite"; + } + if ((t instanceof DefineButtonTag) || (t instanceof DefineButton2Tag)) { + return "button"; + } + if (t instanceof ASMSource) { + return "as"; + } + if (t instanceof TreeElement) { + TreeElement te = (TreeElement) t; + if (te.getItem() instanceof TreeLeafScript) { + return "as"; + } else { + return "package"; + } + } + if (t instanceof FrameNode) { + return "frame"; + } + if (t instanceof ShowFrameTag) { + return "showframe"; + } + return "folder"; + } + + public List getTagsWithType(List list, String type) { + List ret = new ArrayList(); + for (Object o : list) { + String ttype = getTagType(o); + if (type.equals(ttype)) { + ret.add(o); + } + } + return ret; + } + + public List getTagNodesWithType(List list, String type, Object parent, boolean display) { + List ret = new ArrayList(); + int frameCnt = 0; + for (Object o : list) { + String ttype = getTagType(o); + if ("showframe".equals(ttype) && "frame".equals(type)) { + frameCnt++; + ret.add(new TagNode(new FrameNode(frameCnt, parent, display))); + } else if (type.equals(ttype)) { + ret.add(new TagNode(o)); + } + } + return ret; + } + + public List getAllSubs(JTree tree, Object o) { + TreeModel tm = tree.getModel(); + List ret = new ArrayList(); + for (int i = 0; i < tm.getChildCount(o); i++) { + Object c = tm.getChild(o, i); + ret.add(c); + ret.addAll(getAllSubs(tree, c)); + } + return ret; + } + + public List getAllSelected(JTree tree) { + TreeSelectionModel tsm = tree.getSelectionModel(); + TreePath tps[] = tsm.getSelectionPaths(); + List ret = new ArrayList(); + if (tps == null) { + return ret; + } + + for (TreePath tp : tps) { + Object o = tp.getLastPathComponent(); + ret.add(o); + ret.addAll(getAllSubs(tree, o)); + } + return ret; + } + + public TagNode getASTagNode(JTree tree) { + TreeModel tm = tree.getModel(); + Object root = tm.getRoot(); + for (int i = 0; i < tm.getChildCount(root); i++) { + Object node = tm.getChild(root, i); + if (node instanceof TagNode) { + Object tag = ((TagNode) tm.getChild(root, i)).tag; + if (tag != null) { + if (tag.equals("scripts")) { + return (TagNode) node; + } + } + } + } + return null; + } + + public List createTagList(List list, Object parent) { + List ret = new ArrayList(); + List frames = getTagNodesWithType(list, "frame", parent, true); + List shapes = getTagNodesWithType(list, "shape", parent, true); + List morphShapes = getTagNodesWithType(list, "morphshape", parent, true); + List sprites = getTagNodesWithType(list, "sprite", parent, true); + List buttons = getTagNodesWithType(list, "button", parent, true); + List images = getTagNodesWithType(list, "image", parent, true); + List fonts = getTagNodesWithType(list, "font", parent, true); + List texts = getTagNodesWithType(list, "text", parent, true); + List actionScript = new ArrayList(); + + for (TagNode n : sprites) { + n.subItems = getTagNodesWithType(new ArrayList(((DefineSpriteTag) n.tag).subTags), "frame", n.tag, true); + } + + List exportAssetsTags = new ArrayList(); + for (Object t : list) { + if (t instanceof ExportAssetsTag) { + exportAssetsTags.add((ExportAssetsTag) t); + } + /*if (t instanceof ASMSource) { TagNode tti = new TagNode(t); ret.add(tti); } else */ @@ -575,12 +822,13 @@ public class MainFrame extends JFrame implements ActionListener { TagNode tti = new TagNode(t); if (((Container) t).getItemCount() > 0) { List subItems = ((Container) t).getSubItems(); - tti.subItems = createTagList(subItems); + tti.subItems = createTagList(subItems, parent); } //ret.add(tti); } } + actionScript = createASTagList(list, null); TagNode textsNode = new TagNode("texts"); textsNode.subItems.addAll(texts); @@ -605,37 +853,44 @@ public class MainFrame extends JFrame implements ActionListener { TagNode framesNode = new TagNode("frames"); framesNode.subItems.addAll(frames); - ret.add(shapesNode); - ret.add(morphShapesNode);; - ret.add(spritesNode); - ret.add(textsNode); - ret.add(imagesNode); - ret.add(buttonsNode); - ret.add(fontsNode); - ret.add(framesNode); - for (int i = ret.size() - 1; i >= 0; i--) { - if (ret.get(i).tag instanceof DefineSpriteTag) { - ((DefineSpriteTag) ret.get(i).tag).exportAssetsTags = exportAssetsTags; - } - if (ret.get(i).tag instanceof DefineButtonTag) { - ((DefineButtonTag) ret.get(i).tag).exportAssetsTags = exportAssetsTags; - } - if (ret.get(i).tag instanceof DefineButton2Tag) { - ((DefineButton2Tag) ret.get(i).tag).exportAssetsTags = exportAssetsTags; - } - if (ret.get(i).tag instanceof DoInitActionTag) { - ((DoInitActionTag) ret.get(i).tag).exportAssetsTags = exportAssetsTags; - } - if (ret.get(i).tag instanceof ASMSource) { - ASMSource ass = (ASMSource) ret.get(i).tag; - if (ass.containsSource()) { - continue; - } - } - if (ret.get(i).subItems.isEmpty()) { - //ret.remove(i); - } + + TagNode actionScriptNode = new TagNode("scripts"); + actionScriptNode.subItems.addAll(actionScript); + + if (!shapesNode.subItems.isEmpty()) { + ret.add(shapesNode); } + if (!morphShapesNode.subItems.isEmpty()) { + ret.add(morphShapesNode); + } + if (!spritesNode.subItems.isEmpty()) { + ret.add(spritesNode); + } + if (!textsNode.subItems.isEmpty()) { + ret.add(textsNode); + } + if (!imagesNode.subItems.isEmpty()) { + ret.add(imagesNode); + } + if (!buttonsNode.subItems.isEmpty()) { + ret.add(buttonsNode); + } + if (!fontsNode.subItems.isEmpty()) { + ret.add(fontsNode); + } + if (!framesNode.subItems.isEmpty()) { + ret.add(framesNode); + } + + + if (abcPanel != null) { + actionScriptNode.subItems.clear(); + actionScriptNode.tag = abcPanel.classTree.getModel(); + } + if ((!actionScriptNode.subItems.isEmpty()) || (abcPanel != null)) { + ret.add(actionScriptNode); + } + return ret; } @@ -692,108 +947,108 @@ public class MainFrame extends JFrame implements ActionListener { } if (e.getActionCommand().startsWith("EXPORT")) { - JFileChooser chooser = new JFileChooser(); - chooser.setCurrentDirectory(new java.io.File((String) Configuration.getConfig("lastExportDir", "."))); - chooser.setDialogTitle("Select directory to export"); - chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); - chooser.setAcceptAllFileFilterUsed(false); - if (chooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) { - final long timeBefore = System.currentTimeMillis(); - Main.startWork("Exporting..."); - final String selFile = chooser.getSelectedFile().getAbsolutePath(); - Configuration.setConfig("lastExportDir", chooser.getSelectedFile().getParentFile().getAbsolutePath()); - final boolean isPcode = e.getActionCommand().startsWith("EXPORTPCODE"); - final boolean onlySel = e.getActionCommand().endsWith("SEL"); - final boolean images = e.getActionCommand().startsWith("EXPORTIMAGES"); - final boolean shapes = e.getActionCommand().startsWith("EXPORTSHAPES"); - (new Thread() { - @Override - public void run() { - try { - if (onlySel) { - if (images) { - if (imagesTagPanel != null) { - List list = new ArrayList(); + ExportDialog export = new ExportDialog(); + export.setVisible(true); + if (!export.cancelled) { + JFileChooser chooser = new JFileChooser(); + chooser.setCurrentDirectory(new java.io.File((String) Configuration.getConfig("lastExportDir", "."))); + chooser.setDialogTitle("Select directory to export"); + chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); + chooser.setAcceptAllFileFilterUsed(false); + if (chooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) { + final long timeBefore = System.currentTimeMillis(); + Main.startWork("Exporting..."); + final String selFile = chooser.getSelectedFile().getAbsolutePath(); + Configuration.setConfig("lastExportDir", chooser.getSelectedFile().getParentFile().getAbsolutePath()); + final boolean isPcode = export.actionScript.getSelectedIndex() == 1; //e.getActionCommand().startsWith("EXPORTPCODE"); + final boolean onlySel = e.getActionCommand().endsWith("SEL"); + //final boolean images = e.getActionCommand().startsWith("EXPORTIMAGES"); + //final boolean shapes = e.getActionCommand().startsWith("EXPORTSHAPES"); + (new Thread() { + @Override + public void run() { + try { + if (onlySel) { + List sel = getAllSelected(tagTree); - Object lob[] = imagesTagPanel.tagList.getSelectedValues(); - for (Object o : lob) { - if (o instanceof Tag) { - list.add((Tag) o); + List tlsList = new ArrayList(); + JPEGTablesTag jtt = null; + for (Tag t : swf.tags) { + if (t instanceof JPEGTablesTag) { + jtt = (JPEGTablesTag) t; + break; + } + } + List images = new ArrayList(); + List shapes = new ArrayList(); + List actionNodes = new ArrayList(); + for (Object d : sel) { + if (d instanceof TagNode) { + TagNode n = (TagNode) d; + if ("image".equals(getTagType(n.tag))) { + images.add((Tag) n.tag); + } + if ("shape".equals(getTagType(n.tag))) { + shapes.add((Tag) n.tag); + } + if ("as".equals(getTagType(n.tag))) { + actionNodes.add(n); } } - JPEGTablesTag jtt = null; - for (Tag t : swf.tags) { - if (t instanceof JPEGTablesTag) { - jtt = (JPEGTablesTag) t; - break; + if (d instanceof TreeElement) { + if (((TreeElement) d).isLeaf()) { + tlsList.add((TreeLeafScript) ((TreeElement) d).getItem()); } } - SWF.exportImages(selFile, list, jtt); } - } else if (shapes) { - List list = new ArrayList(); - Object lob[] = shapesTagPanel.tagList.getSelectedValues(); - for (Object o : lob) { - if (o instanceof ShapeTag) { - list.add((Tag) o); + SWF.exportImages(selFile + File.separator + "images", images, jtt); + SWF.exportShapes(selFile + File.separator + "shapes", shapes); + if (abcPanel != null) { + for (int i = 0; i < tlsList.size(); i++) { + TreeLeafScript tls = tlsList.get(i); + Main.startWork("Exporting " + (i + 1) + "/" + tlsList.size() + " " + tls.abc.script_info[tls.scriptIndex].getPath(tls.abc) + " ..."); + tls.abc.script_info[tls.scriptIndex].export(tls.abc, abcPanel.list, selFile, isPcode); + } + } else { + List allNodes = new ArrayList(); + TagNode asn = getASTagNode(tagTree); + if (asn != null) { + allNodes.add(asn); + TagNode.setExport(allNodes, false); + TagNode.setExport(actionNodes, true); + TagNode.exportNodeAS(allNodes, selFile, isPcode); } } - SWF.exportShapes(selFile, list); - } else if (abcPanel != null) { - List tlsList = abcPanel.classTree.getSelectedScripts(); - if (tlsList.isEmpty()) { - JOptionPane.showMessageDialog(null, "No script selected!"); - } - for (int i = 0; i < tlsList.size(); i++) { - TreeLeafScript tls = tlsList.get(i); - Main.startWork("Exporting " + (i + 1) + "/" + tlsList.size() + " " + tls.abc.script_info[tls.scriptIndex].getPath(tls.abc) + " ..."); - tls.abc.script_info[tls.scriptIndex].export(tls.abc, abcPanel.list, selFile, isPcode); - } - } else if (actionPanel != null) { - List nodes = actionPanel.getSelectedNodes(); - if (nodes.isEmpty()) { - JOptionPane.showMessageDialog(null, "No nodes selected!"); - } - com.jpexs.decompiler.flash.action.gui.TagTreeModel ttm = (com.jpexs.decompiler.flash.action.gui.TagTreeModel) actionPanel.tagTree.getModel(); - List allnodes = ttm.getNodeList(); - com.jpexs.decompiler.flash.action.TagNode.setExport(allnodes, false); - com.jpexs.decompiler.flash.action.TagNode.setExport(nodes, true); - com.jpexs.decompiler.flash.action.TagNode.exportNode(allnodes, selFile, isPcode); - } - } else { - if (images) { - Main.swf.exportImages(selFile); - } else if (shapes) { - Main.swf.exportShapes(selFile); } else { + Main.swf.exportImages(selFile + File.separator + "images"); + Main.swf.exportShapes(selFile + File.separator + "shapes"); Main.swf.exportActionScript(selFile, isPcode); } + } catch (Exception ignored) { + ignored.printStackTrace(); + JOptionPane.showMessageDialog(null, "Cannot write to the file"); } - } catch (Exception ignored) { - ignored.printStackTrace(); - JOptionPane.showMessageDialog(null, "Cannot write to the file"); + Main.stopWork(); + long timeAfter = System.currentTimeMillis(); + long timeMs = timeAfter - timeBefore; + long timeS = timeMs / 1000; + timeMs = timeMs % 1000; + long timeM = timeS / 60; + timeS = timeS % 60; + long timeH = timeM / 60; + timeM = timeM % 60; + String timeStr = ""; + if (timeH > 0) { + timeStr += Helper.padZeros(timeH, 2) + ":"; + } + timeStr += Helper.padZeros(timeM, 2) + ":"; + timeStr += Helper.padZeros(timeS, 2) + "." + Helper.padZeros(timeMs, 3); + setStatus("Exported in " + timeStr); } - Main.stopWork(); - long timeAfter = System.currentTimeMillis(); - long timeMs = timeAfter - timeBefore; - long timeS = timeMs / 1000; - timeMs = timeMs % 1000; - long timeM = timeS / 60; - timeS = timeS % 60; - long timeH = timeM / 60; - timeM = timeM % 60; - String timeStr = ""; - if (timeH > 0) { - timeStr += Helper.padZeros(timeH, 2) + ":"; - } - timeStr += Helper.padZeros(timeM, 2) + ":"; - timeStr += Helper.padZeros(timeS, 2) + "." + Helper.padZeros(timeMs, 3); - setStatus("Exported in " + timeStr); - } - }).start(); + }).start(); + } } - } if (e.getActionCommand().equals("CHECKUPDATES")) { @@ -802,6 +1057,20 @@ public class MainFrame extends JFrame implements ActionListener { } } + if (e.getActionCommand().equals("DONATE")) { + String donateURL = Main.projectPage + "/donate.html"; + if (java.awt.Desktop.isDesktopSupported()) { + java.awt.Desktop desktop = java.awt.Desktop.getDesktop(); + try { + java.net.URI uri = new java.net.URI(donateURL); + desktop.browse(uri); + } catch (Exception ex) { + } + } else { + JOptionPane.showMessageDialog(null, "Please visit\r\n" + donateURL + "\r\nfor details."); + } + } + if (e.getActionCommand().startsWith("RESTORECONTROLFLOW")) { Main.startWork("Restoring control flow..."); final boolean all = e.getActionCommand().endsWith("ALL"); @@ -953,4 +1222,253 @@ public class MainFrame extends JFrame implements ActionListener { } } } + + public void showDetail(String card) { + CardLayout cl = (CardLayout) (detailPanel.getLayout()); + cl.show(detailPanel, card); + } + + public void showCard(String card) { + CardLayout cl = (CardLayout) (displayPanel.getLayout()); + cl.show(displayPanel, card); + } + private Object oldValue; + private File tempFile; + + @Override + public void valueChanged(TreeSelectionEvent e) { + Object tagObj = tagTree.getLastSelectedPathComponent(); + if (tagObj == null) { + return; + } + + if (tagObj instanceof TagNode) { + tagObj = ((TagNode) tagObj).tag; + } + if (tagObj instanceof TreeElement) { + tagObj = ((TreeElement) tagObj).getItem(); + } + + if (tagObj == oldValue) { + return; + } + oldValue = tagObj; + + if (tagObj instanceof TreeLeafScript) { + final TreeLeafScript scriptLeaf = (TreeLeafScript) tagObj; + if (!Main.isWorking()) { + Main.startWork("Decompiling..."); + (new Thread() { + @Override + public void run() { + int classIndex = -1; + for (Trait t : scriptLeaf.abc.script_info[scriptLeaf.scriptIndex].traits.traits) { + if (t instanceof TraitClass) { + classIndex = ((TraitClass) t).class_info; + break; + } + } + abcPanel.navigator.setABC(abcList, scriptLeaf.abc); + abcPanel.navigator.setClassIndex(classIndex); + abcPanel.setAbc(scriptLeaf.abc); + abcPanel.decompiledTextArea.setScript(scriptLeaf.abc.script_info[scriptLeaf.scriptIndex], scriptLeaf.abc, abcList); + abcPanel.decompiledTextArea.setClassIndex(classIndex); + abcPanel.decompiledTextArea.setNoTrait(); + abcPanel.detailPanel.methodTraitPanel.methodCodePanel.setCode(""); + Main.stopWork(); + } + }).start(); + } + showDetail(DETAILCARDAS3NAVIGATOR); + showCard(CARDACTIONSCRIPTPANEL); + return; + } else { + showDetail(DETAILCARDEMPTYPANEL); + } + if (tagObj instanceof ASMSource) { + showCard(CARDACTIONSCRIPTPANEL); + actionPanel.setSource((ASMSource) tagObj); + } else if (tagObj instanceof DefineBitsTag) { + showCard(CARDIMAGEPANEL); + imagePanel.setImage(((DefineBitsTag) tagObj).getFullImageData(jtt)); + } else if (tagObj instanceof DefineBitsJPEG2Tag) { + showCard(CARDIMAGEPANEL); + imagePanel.setImage(((DefineBitsJPEG2Tag) tagObj).imageData); + } else if (tagObj instanceof DefineBitsJPEG3Tag) { + showCard(CARDIMAGEPANEL); + imagePanel.setImage(((DefineBitsJPEG3Tag) tagObj).imageData); + } else if (tagObj instanceof DefineBitsJPEG4Tag) { + showCard(CARDIMAGEPANEL); + imagePanel.setImage(((DefineBitsJPEG4Tag) tagObj).imageData); + } else if (tagObj instanceof DefineBitsLosslessTag) { + showCard(CARDIMAGEPANEL); + imagePanel.setImage(((DefineBitsLosslessTag) tagObj).getImage()); + } else if (tagObj instanceof DefineBitsLossless2Tag) { + showCard(CARDIMAGEPANEL); + imagePanel.setImage(((DefineBitsLossless2Tag) tagObj).getImage()); + } else if ((tagObj instanceof FrameNode && ((FrameNode) tagObj).isDisplayed()) || (((tagObj instanceof CharacterTag) || (tagObj instanceof FontTag)) && (tagObj instanceof Tag))) { + try { + + if (tempFile != null) { + tempFile.delete(); + } + tempFile = File.createTempFile("temp", ".swf"); + tempFile.deleteOnExit(); + + FileOutputStream fos = new FileOutputStream(tempFile); + SWFOutputStream sos = new SWFOutputStream(fos, 10); + sos.write("FWS".getBytes()); + sos.write(13); + + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + SWFOutputStream sos2 = new SWFOutputStream(baos, 10); + int width = swf.displayRect.Xmax - swf.displayRect.Xmin; + int height = swf.displayRect.Ymax - swf.displayRect.Ymin; + sos2.writeRECT(swf.displayRect); + sos2.writeUI8(0); + sos2.writeUI8(swf.frameRate); + sos2.writeUI16(100); //framecnt + sos2.writeTag(new SetBackgroundColorTag(new RGB(255, 255, 255))); + + if (tagObj instanceof FrameNode) { + FrameNode fn = (FrameNode) tagObj; + Object parent = fn.getParent(); + List subs = new ArrayList(); + if (parent == null) { + subs.addAll(swf.tags); + } else { + if (parent instanceof Container) { + subs = ((Container) parent).getSubItems(); + } + } + List doneCharacters = new ArrayList(); + int frameCnt = 1; + for (Object o : subs) { + if (o instanceof ShowFrameTag) { + frameCnt++; + continue; + } + if (frameCnt > fn.getFrame()) { + break; + } + Tag t = (Tag) o; + if (frameCnt == fn.getFrame()) { + Set needed = t.getNeededCharacters(); + for (int n : needed) { + if (!doneCharacters.contains(n)) { + sos2.writeTag(characters.get(n)); + doneCharacters.add(n); + } + } + if (t instanceof CharacterTag) { + doneCharacters.add(((CharacterTag) t).getCharacterID()); + } + } + sos2.writeTag(t); + } + sos2.writeTag(new ShowFrameTag()); + } else { + + if (tagObj instanceof DefineBitsTag) { + if (jtt != null) { + sos2.writeTag(jtt); + } + } else if (tagObj instanceof AloneTag) { + } else { + Set needed = ((Tag) tagObj).getNeededCharacters(); + for (int n : needed) { + sos2.writeTag(characters.get(n)); + } + } + + sos2.writeTag(((Tag) tagObj)); + + int chtId = 0; + if (tagObj instanceof CharacterTag) { + chtId = ((CharacterTag) tagObj).getCharacterID(); + } + + MATRIX mat = new MATRIX(); + mat.hasRotate = false; + mat.hasScale = false; + mat.translateX = 0; + mat.translateY = 0; + if (tagObj instanceof BoundedTag) { + RECT r = ((BoundedTag) tagObj).getRect(characters); + mat.translateX = -r.Xmin; + mat.translateY = -r.Ymin; + mat.translateX = mat.translateX + width / 2 - r.getWidth() / 2; + mat.translateY = mat.translateY + height / 2 - r.getHeight() / 2; + } else { + mat.translateX = width / 4; + mat.translateY = height / 4; + } + if (tagObj instanceof FontTag) { + + int countGlyphs = ((FontTag) tagObj).getGlyphShapeTable().length; + int fontId = ((FontTag) tagObj).getFontId(); + int sloupcu = (int) Math.ceil(Math.sqrt(countGlyphs)); + int radku = (int) Math.ceil(((float) countGlyphs) / ((float) sloupcu)); + int x = 0; + int y = 1; + for (int f = 0; f < countGlyphs; f++) { + if (x >= sloupcu) { + x = 0; + y++; + } + List rec = new ArrayList(); + TEXTRECORD tr = new TEXTRECORD(); + int textHeight = height / radku; + tr.fontId = fontId; + tr.styleFlagsHasFont = true; + tr.textHeight = textHeight; + tr.glyphEntries = new GLYPHENTRY[1]; + tr.styleFlagsHasColor = true; + tr.textColor = new RGB(0, 0, 0); + tr.glyphEntries[0] = new GLYPHENTRY(); + tr.glyphEntries[0].glyphAdvance = 0; + tr.glyphEntries[0].glyphIndex = f; + rec.add(tr); + mat.translateX = x * width / sloupcu; + mat.translateY = y * height / radku; + sos2.writeTag(new DefineTextTag(999 + f, new RECT(0, width, 0, height), new MATRIX(), SWFOutputStream.getNeededBitsU(countGlyphs - 1), SWFOutputStream.getNeededBitsU(0), rec)); + sos2.writeTag(new PlaceObject2Tag(false, false, false, true, false, true, true, false, 1 + f, 999 + f, mat, null, 0, null, 0, null)); + x++; + } + sos2.writeTag(new ShowFrameTag()); + } else if ((tagObj instanceof DefineMorphShapeTag) || (tagObj instanceof DefineMorphShape2Tag)) { + sos2.writeTag(new PlaceObject2Tag(false, false, false, true, false, true, true, false, 1, chtId, mat, null, 0, null, 0, null)); + sos2.writeTag(new ShowFrameTag()); + int numFrames = 100; + for (int ratio = 0; ratio < 65536; ratio += 65536 / numFrames) { + sos2.writeTag(new PlaceObject2Tag(false, false, false, true, false, true, false, true, 1, chtId, mat, null, ratio, null, 0, null)); + sos2.writeTag(new ShowFrameTag()); + } + } else { + sos2.writeTag(new PlaceObject2Tag(false, false, false, true, false, true, true, false, 1, chtId, mat, null, 0, null, 0, null)); + sos2.writeTag(new ShowFrameTag()); + } + }//not showframe + + sos2.writeTag(new EndTag()); + byte data[] = baos.toByteArray(); + + sos.writeUI32(sos.getPos() + data.length + 4); + sos.write(data); + fos.close(); + showCard(CARDFLASHPANEL); + if (flashPanel != null) { + if (flashPanel instanceof FlashPlayerPanel) { + flashPanel.displaySWF(tempFile.getAbsolutePath()); + } + } + + } catch (Exception ex) { + Logger.getLogger(MainFrame.class.getName()).log(Level.SEVERE, null, ex); + } + + } else { + showCard(CARDEMPTYPANEL); + } + } } diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/ModeFrame.java b/trunk/src/com/jpexs/decompiler/flash/gui/ModeFrame.java index 2bc0749a9..ea94a01ff 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/ModeFrame.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/ModeFrame.java @@ -23,7 +23,6 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; -import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; @@ -46,18 +45,18 @@ public class ModeFrame extends JFrame implements ActionListener { setSize(350, 200); openButton.addActionListener(this); openButton.setActionCommand("OPEN"); - openButton.setIcon(new ImageIcon(View.loadImage("com/jpexs/decompiler/flash/gui/graphics/open24.png"))); + openButton.setIcon(View.getIcon("open24")); proxyButton.addActionListener(this); proxyButton.setActionCommand("PROXY"); - proxyButton.setIcon(new ImageIcon(View.loadImage("com/jpexs/decompiler/flash/gui/graphics/proxy24.png"))); + proxyButton.setIcon(View.getIcon("proxy24")); exitButton.addActionListener(this); exitButton.setActionCommand("EXIT"); - exitButton.setIcon(new ImageIcon(View.loadImage("com/jpexs/decompiler/flash/gui/graphics/exit24.png"))); + exitButton.setIcon(View.getIcon("exit24")); setResizable(false); Container cont = getContentPane(); cont.setLayout(new GridLayout(4, 1)); JLabel logoLabel = new JLabel(); - logoLabel.setIcon(new ImageIcon(View.loadImage("com/jpexs/decompiler/flash/gui/graphics/logo.png"))); + logoLabel.setIcon(View.getIcon("logo")); cont.add(logoLabel); cont.add(openButton); cont.add(proxyButton); diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/TagNode.java b/trunk/src/com/jpexs/decompiler/flash/gui/TagNode.java index f5c44a6d2..3ba80e11d 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/TagNode.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/TagNode.java @@ -16,6 +16,10 @@ */ package com.jpexs.decompiler.flash.gui; +import com.jpexs.decompiler.flash.EventListener; +import com.jpexs.decompiler.flash.SWF; +import com.jpexs.decompiler.flash.action.Action; +import com.jpexs.decompiler.flash.helpers.Highlighting; import com.jpexs.decompiler.flash.tags.DefineBitsJPEG2Tag; import com.jpexs.decompiler.flash.tags.DefineBitsJPEG3Tag; import com.jpexs.decompiler.flash.tags.DefineBitsJPEG4Tag; @@ -41,8 +45,11 @@ import com.jpexs.decompiler.flash.tags.DefineTextTag; import com.jpexs.decompiler.flash.tags.DoInitActionTag; import com.jpexs.decompiler.flash.tags.ExportAssetsTag; import com.jpexs.decompiler.flash.tags.ShowFrameTag; +import com.jpexs.decompiler.flash.tags.Tag; import com.jpexs.decompiler.flash.tags.base.ASMSource; import com.jpexs.decompiler.flash.tags.base.Container; +import java.io.File; +import java.io.FileOutputStream; import java.util.ArrayList; import java.util.List; @@ -50,6 +57,16 @@ public class TagNode { public List subItems; public Object tag; + public boolean export = false; + + public List getAllSubs() { + List ret = new ArrayList(); + ret.addAll(subItems); + for (TagNode n : subItems) { + ret.addAll(n.getAllSubs()); + } + return ret; + } public TagNode(Object tag) { this.tag = tag; @@ -204,4 +221,66 @@ public class TagNode { } return ret; } + + public static void setExport(List nodeList, boolean export) { + for (TagNode node : nodeList) { + node.export = export; + setExport(node.subItems, export); + } + } + + public static boolean exportNodeAS(List nodeList, String outdir, boolean isPcode) { + return exportNodeAS(nodeList, outdir, isPcode, null); + } + + public static boolean exportNodeAS(List nodeList, String outdir, boolean isPcode, EventListener ev) { + File dir = new File(outdir); + List existingNames = new ArrayList(); + for (TagNode node : nodeList) { + String name = ""; + if (node.tag instanceof Tag) { + name = ((Tag) node.tag).getExportName(); + } else { + name = node.tag.toString(); + } + int i = 1; + String baseName = name; + while (existingNames.contains(name)) { + i++; + name = baseName + "_" + i; + } + existingNames.add(name); + if (node.subItems.isEmpty()) { + if ((node.tag instanceof ASMSource) && (node.export)) { + if (!dir.exists()) { + dir.mkdirs(); + } + try { + String f = outdir + File.separatorChar + name + ".as"; + if (ev != null) { + ev.handleEvent("export", "Exporting " + f + " ..."); + } + String ret; + if (isPcode) { + ret = Highlighting.stripHilights(((ASMSource) node.tag).getASMSource(SWF.DEFAULT_VERSION)); + } else { + List as = ((ASMSource) node.tag).getActions(SWF.DEFAULT_VERSION); + Action.setActionsAddresses(as, 0, SWF.DEFAULT_VERSION); + ret = (Highlighting.stripHilights(Action.actionsToSource(as, SWF.DEFAULT_VERSION))); + } + + + FileOutputStream fos = new FileOutputStream(f); + fos.write(ret.getBytes()); + fos.close(); + } catch (Exception ex) { + } + } + } else { + exportNodeAS(node.subItems, outdir + File.separatorChar + name, isPcode, ev); + } + + } + return true; + } } diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/TagPanel.java b/trunk/src/com/jpexs/decompiler/flash/gui/TagPanel.java deleted file mode 100644 index 9143f6374..000000000 --- a/trunk/src/com/jpexs/decompiler/flash/gui/TagPanel.java +++ /dev/null @@ -1,300 +0,0 @@ -/* - * Copyright (C) 2010-2013 JPEXS - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package com.jpexs.decompiler.flash.gui; - -import com.jpexs.decompiler.flash.SWF; -import com.jpexs.decompiler.flash.SWFOutputStream; -import com.jpexs.decompiler.flash.gui.player.FlashPlayerPanel; -import com.jpexs.decompiler.flash.tags.DefineBitsJPEG2Tag; -import com.jpexs.decompiler.flash.tags.DefineBitsJPEG3Tag; -import com.jpexs.decompiler.flash.tags.DefineBitsJPEG4Tag; -import com.jpexs.decompiler.flash.tags.DefineBitsLossless2Tag; -import com.jpexs.decompiler.flash.tags.DefineBitsLosslessTag; -import com.jpexs.decompiler.flash.tags.DefineBitsTag; -import com.jpexs.decompiler.flash.tags.DefineMorphShape2Tag; -import com.jpexs.decompiler.flash.tags.DefineMorphShapeTag; -import com.jpexs.decompiler.flash.tags.DefineTextTag; -import com.jpexs.decompiler.flash.tags.EndTag; -import com.jpexs.decompiler.flash.tags.JPEGTablesTag; -import com.jpexs.decompiler.flash.tags.PlaceObject2Tag; -import com.jpexs.decompiler.flash.tags.SetBackgroundColorTag; -import com.jpexs.decompiler.flash.tags.ShowFrameTag; -import com.jpexs.decompiler.flash.tags.Tag; -import com.jpexs.decompiler.flash.tags.base.AloneTag; -import com.jpexs.decompiler.flash.tags.base.BoundedTag; -import com.jpexs.decompiler.flash.tags.base.CharacterTag; -import com.jpexs.decompiler.flash.tags.base.Container; -import com.jpexs.decompiler.flash.tags.base.FontTag; -import com.jpexs.decompiler.flash.types.GLYPHENTRY; -import com.jpexs.decompiler.flash.types.MATRIX; -import com.jpexs.decompiler.flash.types.RECT; -import com.jpexs.decompiler.flash.types.RGB; -import com.jpexs.decompiler.flash.types.TEXTRECORD; -import java.awt.BorderLayout; -import java.awt.CardLayout; -import java.awt.Color; -import java.io.ByteArrayOutputStream; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Set; -import java.util.logging.Level; -import java.util.logging.Logger; -import javax.swing.BorderFactory; -import javax.swing.JFrame; -import javax.swing.JLabel; -import javax.swing.JList; -import javax.swing.JPanel; -import javax.swing.JScrollPane; -import javax.swing.event.ListSelectionEvent; -import javax.swing.event.ListSelectionListener; - -/** - * - * @author JPEXS - */ -public class TagPanel extends JPanel implements ListSelectionListener { - - public JList tagList; - public FlashPlayerPanel flashPanel; - public JPanel displayPanel; - public ImagePanel imagePanel; - private SWF swf; - final static String CARDFLASHPANEL = "Flash card"; - final static String CARDIMAGEPANEL = "Image card"; - final static String CARDEMPTYPANEL = "Empty card"; - private JPEGTablesTag jtt; - private HashMap characters; - - static { - try { - File.createTempFile("temp", ".swf").delete(); //First call to this is slow, so make it first - } catch (IOException ex) { - Logger.getLogger(TagPanel.class.getName()).log(Level.SEVERE, null, ex); - } - } - - private void parseCharacters(List list) { - for (Object t : list) { - if (t instanceof CharacterTag) { - characters.put(((CharacterTag) t).getCharacterID(), (CharacterTag) t); - } - if (t instanceof Container) { - parseCharacters(((Container) t).getSubItems()); - } - } - } - private JFrame frame; - - public TagPanel(JFrame frame, List list, SWF swf) { - this.frame = frame; - this.swf = swf; - for (Tag t : swf.tags) { - if (t instanceof JPEGTablesTag) { - jtt = (JPEGTablesTag) t; - } - } - characters = new HashMap(); - List list2 = new ArrayList(); - list2.addAll(swf.tags); - parseCharacters(list2); - tagList = new JList(list.toArray(new Tag[list.size()])); - tagList.addListSelectionListener(this); - - setLayout(new BorderLayout()); - try { - flashPanel = new FlashPlayerPanel(frame); - } catch (FlashUnsupportedException fue) { - } - displayPanel = new JPanel(new CardLayout()); - if (flashPanel != null) { - displayPanel.add(flashPanel, CARDFLASHPANEL); - } else { - JPanel swtPanel = new JPanel(new BorderLayout()); - swtPanel.add(new JLabel("
Preview of this object is not available on this platform. (Windows only)
", JLabel.CENTER), BorderLayout.CENTER); - swtPanel.setBackground(Color.white); - displayPanel.add(swtPanel, CARDFLASHPANEL); - } - imagePanel = new ImagePanel(); - displayPanel.add(imagePanel, CARDIMAGEPANEL); - displayPanel.add(new JPanel(), CARDEMPTYPANEL); - CardLayout cl = (CardLayout) (displayPanel.getLayout()); - cl.show(displayPanel, CARDEMPTYPANEL); - tagList.setBorder(BorderFactory.createLoweredBevelBorder()); - displayPanel.setBorder(BorderFactory.createLineBorder(Color.black)); - add(new JScrollPane(tagList), BorderLayout.WEST); - add(displayPanel, BorderLayout.CENTER); - } - private File tempFile; - - public void showCard(String card) { - CardLayout cl = (CardLayout) (displayPanel.getLayout()); - cl.show(displayPanel, card); - } - private Object oldValue; - - @Override - public void valueChanged(ListSelectionEvent e) { - Tag tagObj = (Tag) tagList.getSelectedValue(); - if (tagObj == oldValue) { - return; - } - oldValue = tagObj; - if (tagObj instanceof DefineBitsTag) { - showCard(CARDIMAGEPANEL); - imagePanel.setImage(((DefineBitsTag) tagObj).getFullImageData(jtt)); - } else if (tagObj instanceof DefineBitsJPEG2Tag) { - showCard(CARDIMAGEPANEL); - imagePanel.setImage(((DefineBitsJPEG2Tag) tagObj).imageData); - } else if (tagObj instanceof DefineBitsJPEG3Tag) { - showCard(CARDIMAGEPANEL); - imagePanel.setImage(((DefineBitsJPEG3Tag) tagObj).imageData); - } else if (tagObj instanceof DefineBitsJPEG4Tag) { - showCard(CARDIMAGEPANEL); - imagePanel.setImage(((DefineBitsJPEG4Tag) tagObj).imageData); - } else if (tagObj instanceof DefineBitsLosslessTag) { - showCard(CARDIMAGEPANEL); - imagePanel.setImage(((DefineBitsLosslessTag) tagObj).getImage()); - } else if (tagObj instanceof DefineBitsLossless2Tag) { - showCard(CARDIMAGEPANEL); - imagePanel.setImage(((DefineBitsLossless2Tag) tagObj).getImage()); - } else if (((tagObj instanceof CharacterTag) || (tagObj instanceof FontTag)) && (tagObj instanceof Tag)) { - try { - - if (tempFile != null) { - tempFile.delete(); - } - tempFile = File.createTempFile("temp", ".swf"); - tempFile.deleteOnExit(); - - FileOutputStream fos = new FileOutputStream(tempFile); - SWFOutputStream sos = new SWFOutputStream(fos, 10); - sos.write("FWS".getBytes()); - sos.write(13); - - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - SWFOutputStream sos2 = new SWFOutputStream(baos, 10); - int width = swf.displayRect.Xmax - swf.displayRect.Xmin; - int height = swf.displayRect.Ymax - swf.displayRect.Ymin; - sos2.writeRECT(swf.displayRect); - sos2.writeUI8(0); - sos2.writeUI8(swf.frameRate); - sos2.writeUI16(100); //framecnt - sos2.writeTag(new SetBackgroundColorTag(new RGB(255, 255, 255))); - if (tagObj instanceof DefineBitsTag) { - if (jtt != null) { - sos2.writeTag(jtt); - } - } else if (tagObj instanceof AloneTag) { - } else { - Set needed = tagObj.getNeededCharacters(); - for (int n : needed) { - sos2.writeTag(characters.get(n)); - } - } - - sos2.writeTag(tagObj); - - int chtId = 0; - if (tagObj instanceof CharacterTag) { - chtId = ((CharacterTag) tagObj).getCharacterID(); - } - - MATRIX mat = new MATRIX(); - mat.hasRotate = false; - mat.hasScale = false; - mat.translateX = 0; - mat.translateY = 0; - if (tagObj instanceof BoundedTag) { - RECT r = ((BoundedTag) tagObj).getRect(characters); - mat.translateX = -r.Xmin; - mat.translateY = -r.Ymin; - mat.translateX = mat.translateX + width / 2 - r.getWidth() / 2; - mat.translateY = mat.translateY + height / 2 - r.getHeight() / 2; - } else { - mat.translateX = width / 4; - mat.translateY = height / 4; - } - if (tagObj instanceof FontTag) { - - int countGlyphs = ((FontTag) tagObj).getGlyphShapeTable().length; - int fontId = ((FontTag) tagObj).getFontId(); - int sloupcu = (int) Math.ceil(Math.sqrt(countGlyphs)); - int radku = (int) Math.ceil(((float) countGlyphs) / ((float) sloupcu)); - int x = 0; - int y = 1; - for (int f = 0; f < countGlyphs; f++) { - if (x >= sloupcu) { - x = 0; - y++; - } - List rec = new ArrayList(); - TEXTRECORD tr = new TEXTRECORD(); - int textHeight = height / radku; - tr.fontId = fontId; - tr.styleFlagsHasFont = true; - tr.textHeight = textHeight; - tr.glyphEntries = new GLYPHENTRY[1]; - tr.styleFlagsHasColor = true; - tr.textColor = new RGB(0, 0, 0); - tr.glyphEntries[0] = new GLYPHENTRY(); - tr.glyphEntries[0].glyphAdvance = 0; - tr.glyphEntries[0].glyphIndex = f; - rec.add(tr); - mat.translateX = x * width / sloupcu; - mat.translateY = y * height / radku; - sos2.writeTag(new DefineTextTag(999 + f, new RECT(0, width, 0, height), new MATRIX(), SWFOutputStream.getNeededBitsU(countGlyphs - 1), SWFOutputStream.getNeededBitsU(0), rec)); - sos2.writeTag(new PlaceObject2Tag(false, false, false, true, false, true, true, false, 1 + f, 999 + f, mat, null, 0, null, 0, null)); - x++; - } - sos2.writeTag(new ShowFrameTag()); - } else if ((tagObj instanceof DefineMorphShapeTag) || (tagObj instanceof DefineMorphShape2Tag)) { - sos2.writeTag(new PlaceObject2Tag(false, false, false, true, false, true, true, false, 1, chtId, mat, null, 0, null, 0, null)); - sos2.writeTag(new ShowFrameTag()); - int numFrames = 100; - for (int ratio = 0; ratio < 65536; ratio += 65536 / numFrames) { - sos2.writeTag(new PlaceObject2Tag(false, false, false, true, false, true, false, true, 1, chtId, mat, null, ratio, null, 0, null)); - sos2.writeTag(new ShowFrameTag()); - } - } else { - sos2.writeTag(new PlaceObject2Tag(false, false, false, true, false, true, true, false, 1, chtId, mat, null, 0, null, 0, null)); - sos2.writeTag(new ShowFrameTag()); - } - - sos2.writeTag(new EndTag()); - byte data[] = baos.toByteArray(); - - sos.writeUI32(sos.getPos() + data.length + 4); - sos.write(data); - fos.close(); - showCard(CARDFLASHPANEL); - if (flashPanel != null) { - if (flashPanel instanceof FlashPlayerPanel) { - flashPanel.displaySWF(tempFile.getAbsolutePath()); - } - } - - } catch (Exception ex) { - Logger.getLogger(TagPanel.class.getName()).log(Level.SEVERE, null, ex); - } - - } - } -} diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/TagTreeModel.java b/trunk/src/com/jpexs/decompiler/flash/gui/TagTreeModel.java index 5bae9c716..3f2b95513 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/TagTreeModel.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/TagTreeModel.java @@ -16,7 +16,8 @@ */ package com.jpexs.decompiler.flash.gui; -import com.jpexs.decompiler.flash.tags.*; +import com.jpexs.decompiler.flash.abc.gui.ClassesListTreeModel; +import com.jpexs.decompiler.flash.abc.gui.TreeElement; import java.util.ArrayList; import java.util.List; import javax.swing.event.TreeModelListener; @@ -28,10 +29,13 @@ public class TagTreeModel implements TreeModel { private String root = ""; private List list = new ArrayList(); - public TagTreeModel(List list) { - List list2 = new ArrayList(); - list2.addAll(list); - this.list = TagNode.createTagList(list2); + public TagTreeModel(List list, String rootName) { + this.root = rootName; + this.list = list; + } + + public List getNodeList() { + return list; } public Object getRoot() { @@ -39,6 +43,14 @@ public class TagTreeModel implements TreeModel { } public Object getChild(Object parent, int index) { + if (parent instanceof TagNode) { + if (((TagNode) parent).tag instanceof ClassesListTreeModel) { + ClassesListTreeModel clt = (ClassesListTreeModel) ((TagNode) parent).tag; + return clt.getChild(clt.getRoot(), index); + } + } else if (parent instanceof TreeElement) { + return ((TreeElement) parent).getChild(index); + } if (parent == root) { return list.get(index); } else { @@ -50,7 +62,17 @@ public class TagTreeModel implements TreeModel { if (parent == root) { return list.size(); } else { - return ((TagNode) parent).subItems.size(); + if (parent instanceof TagNode) { + if (((TagNode) parent).tag instanceof ClassesListTreeModel) { + ClassesListTreeModel clt = (ClassesListTreeModel) ((TagNode) parent).tag; + return clt.getChildCount(clt.getRoot()); + } + return ((TagNode) parent).subItems.size(); + } else if (parent instanceof TreeElement) { + return ((TreeElement) parent).getChildCount(); + } + return 0; + } } @@ -62,6 +84,12 @@ public class TagTreeModel implements TreeModel { } public int getIndexOfChild(Object parent, Object child) { + if (parent instanceof TagNode) { + if (((TagNode) parent).tag instanceof ClassesListTreeModel) { + ClassesListTreeModel clt = (ClassesListTreeModel) ((TagNode) parent).tag; + return clt.getIndexOfChild(clt.getRoot(), child); + } + } if (parent == root) { for (int t = 0; t < list.size(); t++) { if (list.get(t) == child) { @@ -70,12 +98,18 @@ public class TagTreeModel implements TreeModel { } return -1; } else { - List subTags = ((TagNode) parent).subItems; - for (int t = 0; t < subTags.size(); t++) { - if (subTags.get(t) == child) { - return t; + if (parent instanceof TagNode) { + List subTags = ((TagNode) parent).subItems; + for (int t = 0; t < subTags.size(); t++) { + if (subTags.get(t) == child) { + return t; + } } } + if (parent instanceof TreeElement) { + return ((TreeElement) parent).getIndexOfChild((TreeElement) child); + } + return -1; } } diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/View.java b/trunk/src/com/jpexs/decompiler/flash/gui/View.java index 888f3058e..d9d7fb4e0 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/View.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/View.java @@ -18,6 +18,7 @@ package com.jpexs.decompiler.flash.gui; import java.awt.*; import java.util.ArrayList; +import javax.swing.ImageIcon; import javax.swing.JDialog; import javax.swing.JFrame; import javax.swing.UIManager; @@ -52,12 +53,11 @@ public class View { /** * Loads image from resources * - * @param path Path to image without starting slash + * @param name Name of the image * @return loaded Image */ - public static Image loadImage(String path) { - ClassLoader cldr = (new Object()).getClass().getClassLoader(); - java.net.URL imageURL = (new Object()).getClass().getResource("/" + path); + public static Image loadImage(String name) { + java.net.URL imageURL = View.class.getResource("/com/jpexs/decompiler/flash/gui/graphics/" + name + ".png"); return Toolkit.getDefaultToolkit().createImage(imageURL); } @@ -68,9 +68,9 @@ public class View { */ public static void setWindowIcon(Window f) { java.util.List images = new ArrayList(); - images.add(loadImage("com/jpexs/decompiler/flash/gui/graphics/icon16.png")); - images.add(loadImage("com/jpexs/decompiler/flash/gui/graphics/icon32.png")); - images.add(loadImage("com/jpexs/decompiler/flash/gui/graphics/icon48.png")); + images.add(loadImage("icon16")); + images.add(loadImage("icon32")); + images.add(loadImage("icon48")); f.setIconImages(images); } @@ -85,4 +85,8 @@ public class View { f.setLocation((dim.width - abounds.width) / 2, (dim.height - abounds.height) / 2); } + + public static ImageIcon getIcon(String name) { + return new ImageIcon(View.class.getClassLoader().getResource("com/jpexs/decompiler/flash/gui/graphics/" + name + ".png")); + } } diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/graphics/about16.png b/trunk/src/com/jpexs/decompiler/flash/gui/graphics/about16.png new file mode 100644 index 000000000..12cd1aef9 Binary files /dev/null and b/trunk/src/com/jpexs/decompiler/flash/gui/graphics/about16.png differ diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/graphics/as16.png b/trunk/src/com/jpexs/decompiler/flash/gui/graphics/as16.png index fd5fa2834..0c76bd129 100644 Binary files a/trunk/src/com/jpexs/decompiler/flash/gui/graphics/as16.png and b/trunk/src/com/jpexs/decompiler/flash/gui/graphics/as16.png differ diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/graphics/button16.png b/trunk/src/com/jpexs/decompiler/flash/gui/graphics/button16.png index e10f88049..2386b4b72 100644 Binary files a/trunk/src/com/jpexs/decompiler/flash/gui/graphics/button16.png and b/trunk/src/com/jpexs/decompiler/flash/gui/graphics/button16.png differ diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/graphics/constant.png b/trunk/src/com/jpexs/decompiler/flash/gui/graphics/constant.png new file mode 100644 index 000000000..15a188d56 Binary files /dev/null and b/trunk/src/com/jpexs/decompiler/flash/gui/graphics/constant.png differ diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/graphics/deobfuscate16.png b/trunk/src/com/jpexs/decompiler/flash/gui/graphics/deobfuscate16.png new file mode 100644 index 000000000..2d5fb90ec Binary files /dev/null and b/trunk/src/com/jpexs/decompiler/flash/gui/graphics/deobfuscate16.png differ diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/graphics/donate16.png b/trunk/src/com/jpexs/decompiler/flash/gui/graphics/donate16.png new file mode 100644 index 000000000..d9ee53e59 Binary files /dev/null and b/trunk/src/com/jpexs/decompiler/flash/gui/graphics/donate16.png differ diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/graphics/exit16.png b/trunk/src/com/jpexs/decompiler/flash/gui/graphics/exit16.png index dfd42e6f3..2541d2bcb 100644 Binary files a/trunk/src/com/jpexs/decompiler/flash/gui/graphics/exit16.png and b/trunk/src/com/jpexs/decompiler/flash/gui/graphics/exit16.png differ diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/graphics/export16.png b/trunk/src/com/jpexs/decompiler/flash/gui/graphics/export16.png new file mode 100644 index 000000000..7e62a924b Binary files /dev/null and b/trunk/src/com/jpexs/decompiler/flash/gui/graphics/export16.png differ diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/graphics/exportsel16.png b/trunk/src/com/jpexs/decompiler/flash/gui/graphics/exportsel16.png new file mode 100644 index 000000000..4e021666f Binary files /dev/null and b/trunk/src/com/jpexs/decompiler/flash/gui/graphics/exportsel16.png differ diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/graphics/flash16.png b/trunk/src/com/jpexs/decompiler/flash/gui/graphics/flash16.png new file mode 100644 index 000000000..5769120b1 Binary files /dev/null and b/trunk/src/com/jpexs/decompiler/flash/gui/graphics/flash16.png differ diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/graphics/folder16.png b/trunk/src/com/jpexs/decompiler/flash/gui/graphics/folder16.png new file mode 100644 index 000000000..784e8fa48 Binary files /dev/null and b/trunk/src/com/jpexs/decompiler/flash/gui/graphics/folder16.png differ diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/graphics/folderopen16.png b/trunk/src/com/jpexs/decompiler/flash/gui/graphics/folderopen16.png new file mode 100644 index 000000000..75f11488c Binary files /dev/null and b/trunk/src/com/jpexs/decompiler/flash/gui/graphics/folderopen16.png differ diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/graphics/font16.png b/trunk/src/com/jpexs/decompiler/flash/gui/graphics/font16.png index 17774c02f..b7960db9d 100644 Binary files a/trunk/src/com/jpexs/decompiler/flash/gui/graphics/font16.png and b/trunk/src/com/jpexs/decompiler/flash/gui/graphics/font16.png differ diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/graphics/frame16.png b/trunk/src/com/jpexs/decompiler/flash/gui/graphics/frame16.png new file mode 100644 index 000000000..b0ce7bb19 Binary files /dev/null and b/trunk/src/com/jpexs/decompiler/flash/gui/graphics/frame16.png differ diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/graphics/function.png b/trunk/src/com/jpexs/decompiler/flash/gui/graphics/function.png new file mode 100644 index 000000000..f8ced8c3b Binary files /dev/null and b/trunk/src/com/jpexs/decompiler/flash/gui/graphics/function.png differ diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/graphics/image16.png b/trunk/src/com/jpexs/decompiler/flash/gui/graphics/image16.png index 81c0d8101..4a158fef7 100644 Binary files a/trunk/src/com/jpexs/decompiler/flash/gui/graphics/image16.png and b/trunk/src/com/jpexs/decompiler/flash/gui/graphics/image16.png differ diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/graphics/morphshape16.png b/trunk/src/com/jpexs/decompiler/flash/gui/graphics/morphshape16.png index af2435ea0..b4a4e3b78 100644 Binary files a/trunk/src/com/jpexs/decompiler/flash/gui/graphics/morphshape16.png and b/trunk/src/com/jpexs/decompiler/flash/gui/graphics/morphshape16.png differ diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/graphics/open16.png b/trunk/src/com/jpexs/decompiler/flash/gui/graphics/open16.png index aa2c99b1d..14d6b6181 100644 Binary files a/trunk/src/com/jpexs/decompiler/flash/gui/graphics/open16.png and b/trunk/src/com/jpexs/decompiler/flash/gui/graphics/open16.png differ diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/graphics/package16.png b/trunk/src/com/jpexs/decompiler/flash/gui/graphics/package16.png new file mode 100644 index 000000000..da3c2a2d7 Binary files /dev/null and b/trunk/src/com/jpexs/decompiler/flash/gui/graphics/package16.png differ diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/graphics/save16.png b/trunk/src/com/jpexs/decompiler/flash/gui/graphics/save16.png index 97f5a5b84..99d532e8b 100644 Binary files a/trunk/src/com/jpexs/decompiler/flash/gui/graphics/save16.png and b/trunk/src/com/jpexs/decompiler/flash/gui/graphics/save16.png differ diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/graphics/saveas16.png b/trunk/src/com/jpexs/decompiler/flash/gui/graphics/saveas16.png index 0e5808ddf..58fd1a2b3 100644 Binary files a/trunk/src/com/jpexs/decompiler/flash/gui/graphics/saveas16.png and b/trunk/src/com/jpexs/decompiler/flash/gui/graphics/saveas16.png differ diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/graphics/search.png b/trunk/src/com/jpexs/decompiler/flash/gui/graphics/search16.png similarity index 100% rename from trunk/src/com/jpexs/decompiler/flash/gui/graphics/search.png rename to trunk/src/com/jpexs/decompiler/flash/gui/graphics/search16.png diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/graphics/shape16.png b/trunk/src/com/jpexs/decompiler/flash/gui/graphics/shape16.png index c1d9b7a60..33af04609 100644 Binary files a/trunk/src/com/jpexs/decompiler/flash/gui/graphics/shape16.png and b/trunk/src/com/jpexs/decompiler/flash/gui/graphics/shape16.png differ diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/graphics/sprite16.png b/trunk/src/com/jpexs/decompiler/flash/gui/graphics/sprite16.png index bbcaa5fb0..7851cf34c 100644 Binary files a/trunk/src/com/jpexs/decompiler/flash/gui/graphics/sprite16.png and b/trunk/src/com/jpexs/decompiler/flash/gui/graphics/sprite16.png differ diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/graphics/text16.png b/trunk/src/com/jpexs/decompiler/flash/gui/graphics/text16.png index 5080b323e..d37e7304e 100644 Binary files a/trunk/src/com/jpexs/decompiler/flash/gui/graphics/text16.png and b/trunk/src/com/jpexs/decompiler/flash/gui/graphics/text16.png differ diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/graphics/update16.png b/trunk/src/com/jpexs/decompiler/flash/gui/graphics/update16.png new file mode 100644 index 000000000..6e0015df4 Binary files /dev/null and b/trunk/src/com/jpexs/decompiler/flash/gui/graphics/update16.png differ diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/graphics/variable.png b/trunk/src/com/jpexs/decompiler/flash/gui/graphics/variable.png new file mode 100644 index 000000000..a3b44b5cf Binary files /dev/null and b/trunk/src/com/jpexs/decompiler/flash/gui/graphics/variable.png differ diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/proxy/ProxyFrame.java b/trunk/src/com/jpexs/decompiler/flash/gui/proxy/ProxyFrame.java index 3e6da6293..148c2c5bb 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/proxy/ProxyFrame.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/proxy/ProxyFrame.java @@ -154,10 +154,10 @@ public class ProxyFrame extends JFrame implements ActionListener, CatchedListene } }); java.util.List images = new ArrayList(); - images.add(View.loadImage("com/jpexs/decompiler/flash/gui/graphics/proxy16.png")); - images.add(View.loadImage("com/jpexs/decompiler/flash/gui/graphics/proxy24.png")); - images.add(View.loadImage("com/jpexs/decompiler/flash/gui/graphics/proxy32.png")); - images.add(View.loadImage("com/jpexs/decompiler/flash/gui/graphics/proxy48.png")); + images.add(View.loadImage("proxy16")); + images.add(View.loadImage("proxy24")); + images.add(View.loadImage("proxy32")); + images.add(View.loadImage("proxy48")); setIconImages(images); }