diff --git a/trunk/build.xml b/trunk/build.xml
index 773b331b3..6775ec079 100644
--- a/trunk/build.xml
+++ b/trunk/build.xml
@@ -13,7 +13,7 @@
-
+
@@ -40,11 +40,6 @@
-
-
-
-
-
+
diff --git a/trunk/src/com/jpexs/decompiler/flash/Configuration.java b/trunk/src/com/jpexs/decompiler/flash/Configuration.java
index df3bfe6ec..d43b36a67 100644
--- a/trunk/src/com/jpexs/decompiler/flash/Configuration.java
+++ b/trunk/src/com/jpexs/decompiler/flash/Configuration.java
@@ -18,104 +18,51 @@ package com.jpexs.decompiler.flash;
import com.jpexs.proxy.Replacement;
import java.io.*;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import java.util.logging.Logger;
import javax.swing.JOptionPane;
public class Configuration {
- private static final String CONFIG_NAME = "config.bin";
- private static final String REPLACEMENTS_NAME = "replacements.cfg";
+ public static final boolean DISPLAY_FILENAME = true;
+ public static boolean DEBUG_COPY = false;
+
+ public static boolean dump_tags = false;
+
+ /**
+ * Debug mode = throwing an error when comparing original file and
+ * recompiled
+ */
+ public static boolean debugMode = false;
+ /**
+ * Turn off reading unsafe tags (tags which can cause problems with
+ * recompiling)
+ */
+ public static boolean DISABLE_DANGEROUS = false;
+ /**
+ * Turn off resolving constants in ActionScript 2
+ */
+ public static final boolean RESOLVE_CONSTANTS = true;
+ /**
+ * Turn off decompiling if needed
+ */
+ public static final boolean DO_DECOMPILE = true;
+ /**
+ * Find latest constant pool in the code
+ */
+ public static final boolean LATEST_CONSTANTPOOL_HACK = false;
+
+ /**
+ * Limit of code subs (for obfuscated code)
+ */
+ public static final int SUBLIMITER = 500;
+ //using parameter names in decompiling may cause problems because oficial programs like Flash CS 5.5 inserts wrong parameter names indices
+ public static final boolean PARAM_NAMES_ENABLE = false;
+
private static HashMap config = new HashMap();
- private static final File unspecifiedFile = new File("unspecified");
- private static File directory = unspecifiedFile;
-
- private enum OSId {
-
- WINDOWS, OSX, UNIX
- }
-
- private static OSId getOSId() {
- PrivilegedAction doGetOSName = new PrivilegedAction() {
- @Override
- public String run() {
- return System.getProperty("os.name");
- }
- };
- OSId id = OSId.UNIX;
- String osName = AccessController.doPrivileged(doGetOSName);
- if (osName != null) {
- if (osName.toLowerCase().startsWith("mac os x")) {
- id = OSId.OSX;
- } else if (osName.contains("Windows")) {
- id = OSId.WINDOWS;
- }
- }
- return id;
- }
-
- public static String getASDecHome() {
- if (directory == unspecifiedFile) {
- directory = null;
- String userHome = null;
- try {
- userHome = System.getProperty("user.home");
- } catch (SecurityException ignore) {
- }
- if (userHome != null) {
- String applicationId = Main.shortApplicationName;
- OSId osId = getOSId();
- if (osId == OSId.WINDOWS) {
- File appDataDir = null;
- try {
- String appDataEV = System.getenv("APPDATA");
- if ((appDataEV != null) && (appDataEV.length() > 0)) {
- appDataDir = new File(appDataEV);
- }
- } catch (SecurityException ignore) {
- }
- String vendorId = Main.vendor;
- if ((appDataDir != null) && appDataDir.isDirectory()) {
- // ${APPDATA}\{vendorId}\${applicationId}
- String path = vendorId + "\\" + applicationId + "\\";
- directory = new File(appDataDir, path);
- } else {
- // ${userHome}\Application Data\${vendorId}\${applicationId}
- String path = "Application Data\\" + vendorId + "\\" + applicationId + "\\";
- directory = new File(userHome, path);
- }
- } else if (osId == OSId.OSX) {
- // ${userHome}/Library/Application Support/${applicationId}
- String path = "Library/Application Support/" + applicationId + "/";
- directory = new File(userHome, path);
- } else {
- // ${userHome}/.${applicationId}/
- String path = "." + applicationId + "/";
- directory = new File(userHome, path);
- }
- }
- }
- if (!directory.exists()) {
- directory.mkdirs();
- }
- String ret = directory.getAbsolutePath();
- if (!ret.endsWith(File.separator)) {
- ret += File.separator;
- }
- return ret;
- }
-
- private static String getReplacementsFile() {
- return getASDecHome() + REPLACEMENTS_NAME;
- }
-
- private static String getConfigFile() {
- return getASDecHome() + CONFIG_NAME;
- }
/**
* List of replacements
*/
@@ -124,19 +71,15 @@ public class Configuration {
/**
* Saves replacements to file for future use
*/
- private static void saveReplacements() {
+ private static void saveReplacements(String replacementsFile) {
try {
if (replacements.isEmpty()) {
- File rf = new File(getReplacementsFile());
+ File rf = new File(replacementsFile);
if (rf.exists()) {
rf.delete();
}
} else {
- File f = new File(getASDecHome());
- if (!f.exists()) {
- f.mkdir();
- }
- PrintWriter pw = new PrintWriter(new FileWriter(getReplacementsFile()));
+ PrintWriter pw = new PrintWriter(new FileWriter(replacementsFile));
for (Replacement r : replacements) {
pw.println(r.urlPattern);
pw.println(r.targetFile);
@@ -150,10 +93,10 @@ public class Configuration {
/**
* Load replacements from file
*/
- private static void loadReplacements() {
+ private static void loadReplacements(String replacementsFile) {
replacements = new ArrayList();
try {
- BufferedReader br = new BufferedReader(new FileReader(getReplacementsFile()));
+ BufferedReader br = new BufferedReader(new FileReader(replacementsFile));
String s;
while ((s = br.readLine()) != null) {
Replacement r = new Replacement(s, br.readLine());
@@ -179,10 +122,15 @@ public class Configuration {
return config.put(cfg, value);
}
- public static void load() {
+ public static void loadFromMap(Map map) {
+ config.clear();
+ config.putAll(map);
+ }
+
+ public static void loadFromFile(String file, String replacementsFile) {
ObjectInputStream ois = null;
try {
- ois = new ObjectInputStream(new FileInputStream(getConfigFile()));
+ ois = new ObjectInputStream(new FileInputStream(file));
config = (HashMap) ois.readObject();
} catch (FileNotFoundException ex) {
} catch (ClassNotFoundException cnf) {
@@ -196,17 +144,15 @@ public class Configuration {
}
}
}
- loadReplacements();
+ if (replacementsFile != null) {
+ loadReplacements(replacementsFile);
+ }
}
- public static void save() {
- File f = new File(getASDecHome());
- if (!f.exists()) {
- f.mkdir();
- }
+ public static void saveToFile(String file, String replacementsFile) {
ObjectOutputStream oos = null;
try {
- oos = new ObjectOutputStream(new FileOutputStream(getConfigFile()));
+ oos = new ObjectOutputStream(new FileOutputStream(file));
oos.writeObject(config);
} catch (IOException ex) {
JOptionPane.showMessageDialog(null, "Cannot save configuration.", "Error", JOptionPane.ERROR_MESSAGE);
@@ -220,7 +166,9 @@ public class Configuration {
}
}
}
- saveReplacements();
+ if (replacementsFile != null) {
+ saveReplacements(replacementsFile);
+ }
}
public static List getReplacements() {
diff --git a/trunk/src/com/jpexs/decompiler/flash/FrameNode.java b/trunk/src/com/jpexs/decompiler/flash/FrameNode.java
new file mode 100644
index 000000000..fc73a6159
--- /dev/null
+++ b/trunk/src/com/jpexs/decompiler/flash/FrameNode.java
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 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;
+
+/**
+ *
+ * @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/SWF.java b/trunk/src/com/jpexs/decompiler/flash/SWF.java
index c4b098548..9ce81460a 100644
--- a/trunk/src/com/jpexs/decompiler/flash/SWF.java
+++ b/trunk/src/com/jpexs/decompiler/flash/SWF.java
@@ -48,8 +48,6 @@ import com.jpexs.decompiler.flash.flv.VIDEODATA;
import com.jpexs.decompiler.flash.graph.GraphSourceItem;
import com.jpexs.decompiler.flash.graph.GraphSourceItemContainer;
import com.jpexs.decompiler.flash.graph.GraphTargetItem;
-import com.jpexs.decompiler.flash.gui.FrameNode;
-import com.jpexs.decompiler.flash.gui.TagNode;
import com.jpexs.decompiler.flash.helpers.Cache;
import com.jpexs.decompiler.flash.helpers.Helper;
import com.jpexs.decompiler.flash.tags.ABCContainerTag;
@@ -1340,12 +1338,12 @@ public class SWF {
return ret;
}
- public void exportFla(String outfile, String swfName) {
- XFLConverter.convertSWF(this, swfName, outfile, true);
+ public void exportFla(String outfile, String swfName, String generator, String generatorVerName, String generatorVersion) {
+ XFLConverter.convertSWF(this, swfName, outfile, true, generator, generatorVerName, generatorVersion);
}
- public void exportXfl(String outfile, String swfName) {
- XFLConverter.convertSWF(this, swfName, outfile, false);
+ public void exportXfl(String outfile, String swfName, String generator, String generatorVerName, String generatorVersion) {
+ XFLConverter.convertSWF(this, swfName, outfile, false, generator, generatorVerName, generatorVersion);
}
public static float twipToPixel(int twip) {
diff --git a/trunk/src/com/jpexs/decompiler/flash/SWFInputStream.java b/trunk/src/com/jpexs/decompiler/flash/SWFInputStream.java
index 850c9b3a4..af95049eb 100644
--- a/trunk/src/com/jpexs/decompiler/flash/SWFInputStream.java
+++ b/trunk/src/com/jpexs/decompiler/flash/SWFInputStream.java
@@ -1145,7 +1145,7 @@ public class SWFInputStream extends InputStream {
break;
}
tags.add(tag);
- if (Main.dump_tags && level == 0) {
+ if (Configuration.dump_tags && level == 0) {
dumpTag(System.out, version, tag, level);
}
tag.previousTag = previousTag;
diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/TagNode.java b/trunk/src/com/jpexs/decompiler/flash/TagNode.java
similarity index 96%
rename from trunk/src/com/jpexs/decompiler/flash/gui/TagNode.java
rename to trunk/src/com/jpexs/decompiler/flash/TagNode.java
index bddbcecf1..f5638ab6c 100644
--- a/trunk/src/com/jpexs/decompiler/flash/gui/TagNode.java
+++ b/trunk/src/com/jpexs/decompiler/flash/TagNode.java
@@ -14,10 +14,8 @@
* 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;
+package com.jpexs.decompiler.flash;
-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;
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 256b3790d..9da64f6a7 100644
--- a/trunk/src/com/jpexs/decompiler/flash/abc/gui/ABCPanel.java
+++ b/trunk/src/com/jpexs/decompiler/flash/abc/gui/ABCPanel.java
@@ -16,10 +16,10 @@
*/
package com.jpexs.decompiler.flash.abc.gui;
-import com.jpexs.decompiler.flash.Main;
import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.ScriptPack;
import com.jpexs.decompiler.flash.abc.gui.tablemodels.*;
+import com.jpexs.decompiler.flash.gui.Main;
import com.jpexs.decompiler.flash.gui.TagTreeModel;
import com.jpexs.decompiler.flash.gui.View;
import com.jpexs.decompiler.flash.tags.ABCContainerTag;
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 3879f5fd6..d6ce2bd66 100644
--- a/trunk/src/com/jpexs/decompiler/flash/abc/gui/ClassesListTree.java
+++ b/trunk/src/com/jpexs/decompiler/flash/abc/gui/ClassesListTree.java
@@ -16,12 +16,12 @@
*/
package com.jpexs.decompiler.flash.abc.gui;
-import com.jpexs.decompiler.flash.Main;
import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.ScriptPack;
import com.jpexs.decompiler.flash.abc.types.ScriptInfo;
import com.jpexs.decompiler.flash.abc.types.traits.Trait;
import com.jpexs.decompiler.flash.abc.types.traits.TraitClass;
+import com.jpexs.decompiler.flash.gui.Main;
import com.jpexs.decompiler.flash.gui.View;
import com.jpexs.decompiler.flash.tags.ABCContainerTag;
import java.util.ArrayList;
diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/gui/MethodCodePanel.java b/trunk/src/com/jpexs/decompiler/flash/abc/gui/MethodCodePanel.java
index 81a28eacf..0203cc8d1 100644
--- a/trunk/src/com/jpexs/decompiler/flash/abc/gui/MethodCodePanel.java
+++ b/trunk/src/com/jpexs/decompiler/flash/abc/gui/MethodCodePanel.java
@@ -16,9 +16,9 @@
*/
package com.jpexs.decompiler.flash.abc.gui;
-import com.jpexs.decompiler.flash.Main;
import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
+import com.jpexs.decompiler.flash.gui.Main;
import com.jpexs.decompiler.flash.gui.View;
import java.awt.BorderLayout;
import java.awt.Font;
diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/gui/MethodInfoPanel.java b/trunk/src/com/jpexs/decompiler/flash/abc/gui/MethodInfoPanel.java
index afebd3f3e..758a4e05e 100644
--- a/trunk/src/com/jpexs/decompiler/flash/abc/gui/MethodInfoPanel.java
+++ b/trunk/src/com/jpexs/decompiler/flash/abc/gui/MethodInfoPanel.java
@@ -16,7 +16,7 @@
*/
package com.jpexs.decompiler.flash.abc.gui;
-import com.jpexs.decompiler.flash.Main;
+import com.jpexs.decompiler.flash.Configuration;
import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.methodinfo_parser.MethodInfoParser;
import com.jpexs.decompiler.flash.abc.methodinfo_parser.ParseException;
@@ -83,7 +83,7 @@ public class MethodInfoPanel extends JPanel {
if (p > 0) {
ret += ",\n";
}
- if (methodInfo.flagHas_paramnames() && Main.PARAM_NAMES_ENABLE) {
+ if (methodInfo.flagHas_paramnames() && Configuration.PARAM_NAMES_ENABLE) {
ret = ret + abc.constants.constant_string[methodInfo.paramNames[p]];
} else {
ret = ret + "param" + (p + 1);
diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/methodinfo_parser/MethodInfoParser.java b/trunk/src/com/jpexs/decompiler/flash/abc/methodinfo_parser/MethodInfoParser.java
index f3b16de90..ed60c0e51 100644
--- a/trunk/src/com/jpexs/decompiler/flash/abc/methodinfo_parser/MethodInfoParser.java
+++ b/trunk/src/com/jpexs/decompiler/flash/abc/methodinfo_parser/MethodInfoParser.java
@@ -16,7 +16,7 @@
*/
package com.jpexs.decompiler.flash.abc.methodinfo_parser;
-import com.jpexs.decompiler.flash.Main;
+import com.jpexs.decompiler.flash.Configuration;
import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.types.MethodInfo;
import com.jpexs.decompiler.flash.abc.types.ValueKind;
@@ -297,7 +297,7 @@ public class MethodInfoParser {
useParamNames = true;
}
}
- if (!Main.PARAM_NAMES_ENABLE) {
+ if (!Configuration.PARAM_NAMES_ENABLE) {
useParamNames = false;
}
if (useParamNames) {
diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/types/MethodBody.java b/trunk/src/com/jpexs/decompiler/flash/abc/types/MethodBody.java
index d36461fe0..cb1b32624 100644
--- a/trunk/src/com/jpexs/decompiler/flash/abc/types/MethodBody.java
+++ b/trunk/src/com/jpexs/decompiler/flash/abc/types/MethodBody.java
@@ -17,7 +17,6 @@
package com.jpexs.decompiler.flash.abc.types;
import com.jpexs.decompiler.flash.Configuration;
-import com.jpexs.decompiler.flash.Main;
import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.CodeStats;
@@ -80,7 +79,7 @@ public class MethodBody implements Cloneable, Serializable {
HashMap ret = new HashMap();
for (int i = 1; i <= abc.method_info[this.method_info].param_types.length; i++) {
String paramName = "param" + i;
- if (abc.method_info[this.method_info].flagHas_paramnames() && Main.PARAM_NAMES_ENABLE) {
+ if (abc.method_info[this.method_info].flagHas_paramnames() && Configuration.PARAM_NAMES_ENABLE) {
paramName = abc.constants.constant_string[abc.method_info[this.method_info].paramNames[i - 1]];
}
ret.put(i, paramName);
@@ -104,7 +103,7 @@ public class MethodBody implements Cloneable, Serializable {
public String toString(String path, boolean pcode, boolean isStatic, int scriptIndex, int classIndex, ABC abc, ConstantPool constants, MethodInfo method_info[], Stack scopeStack, boolean isStaticInitializer, boolean hilight, List fullyQualifiedNames, Traits initTraits) {
String s = "";
- if (!Main.DO_DECOMPILE) {
+ if (!Configuration.DO_DECOMPILE) {
s = "//NOT DECOMPILED";
if (hilight) {
s = Highlighting.hilighMethod(s, this.method_info);
diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/types/MethodInfo.java b/trunk/src/com/jpexs/decompiler/flash/abc/types/MethodInfo.java
index 62952aa72..a06c15a67 100644
--- a/trunk/src/com/jpexs/decompiler/flash/abc/types/MethodInfo.java
+++ b/trunk/src/com/jpexs/decompiler/flash/abc/types/MethodInfo.java
@@ -16,7 +16,7 @@
*/
package com.jpexs.decompiler.flash.abc.types;
-import com.jpexs.decompiler.flash.Main;
+import com.jpexs.decompiler.flash.Configuration;
import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.helpers.Helper;
@@ -241,7 +241,7 @@ public class MethodInfo {
}
if (!localRegNames.isEmpty()) {
paramStr += localRegNames.get(i + 1);
- } else if ((paramNames.length > i) && (paramNames[i] != 0) && Main.PARAM_NAMES_ENABLE) {
+ } else if ((paramNames.length > i) && (paramNames[i] != 0) && Configuration.PARAM_NAMES_ENABLE) {
paramStr += constants.constant_string[paramNames[i]];
} else {
paramStr += "param" + (i + 1);
diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/TraitClass.java b/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/TraitClass.java
index cccadf5c0..b548af51e 100644
--- a/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/TraitClass.java
+++ b/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/TraitClass.java
@@ -16,7 +16,7 @@
*/
package com.jpexs.decompiler.flash.abc.types.traits;
-import com.jpexs.decompiler.flash.Main;
+import com.jpexs.decompiler.flash.Configuration;
import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
@@ -406,7 +406,7 @@ public class TraitClass extends Trait implements TraitWithSlot {
String bodyStr = "";
bodyIndex = abc.findBodyIndex(abc.class_info[class_info].cinit_index);
if (bodyIndex != -1) {
- if (Main.DO_DECOMPILE) {
+ if (Configuration.DO_DECOMPILE) {
bodyStr = abc.bodies[bodyIndex].toString(packageName + "." + abc.instance_info[class_info].getName(abc.constants).getName(abc.constants, fullyQualifiedNames) + ".staticinitializer", pcode, true, scriptIndex, class_info, abc, abc.constants, abc.method_info, new Stack(), true, highlight, fullyQualifiedNames, abc.class_info[class_info].static_traits);
}
}
@@ -442,7 +442,7 @@ public class TraitClass extends Trait implements TraitWithSlot {
bodyStr = "";
bodyIndex = abc.findBodyIndex(abc.instance_info[class_info].iinit_index);
if (bodyIndex != -1) {
- if (Main.DO_DECOMPILE) {
+ if (Configuration.DO_DECOMPILE) {
bodyStr = ABC.addTabs(abc.bodies[bodyIndex].toString(packageName + "." + abc.instance_info[class_info].getName(abc.constants).getName(abc.constants, fullyQualifiedNames) + ".initializer", pcode, false, scriptIndex, class_info, abc, abc.constants, abc.method_info, new Stack(), false, highlight, fullyQualifiedNames, abc.instance_info[class_info].instance_traits), 3);
}
constructorParams = abc.method_info[abc.instance_info[class_info].iinit_index].getParamStr(abc.constants, abc.bodies[bodyIndex], abc, fullyQualifiedNames);
diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/TraitFunction.java b/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/TraitFunction.java
index 80d9c8c29..5b21451af 100644
--- a/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/TraitFunction.java
+++ b/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/TraitFunction.java
@@ -16,7 +16,7 @@
*/
package com.jpexs.decompiler.flash.abc.types.traits;
-import com.jpexs.decompiler.flash.Main;
+import com.jpexs.decompiler.flash.Configuration;
import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.graph.GraphTargetItem;
@@ -52,7 +52,7 @@ public class TraitFunction extends Trait implements TraitWithSlot {
@Override
public String convert(String path, List abcTags, ABC abc, boolean isStatic, boolean pcode, int scriptIndex, int classIndex, boolean highlight, List fullyQualifiedNames) {
- if (!Main.DO_DECOMPILE) {
+ if (!Configuration.DO_DECOMPILE) {
return "";
}
String header = convertHeader(path, abcTags, abc, isStatic, pcode, scriptIndex, classIndex, highlight, fullyQualifiedNames);
diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/TraitMethodGetterSetter.java b/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/TraitMethodGetterSetter.java
index dfada34e4..daf048fab 100644
--- a/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/TraitMethodGetterSetter.java
+++ b/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/TraitMethodGetterSetter.java
@@ -16,7 +16,7 @@
*/
package com.jpexs.decompiler.flash.abc.types.traits;
-import com.jpexs.decompiler.flash.Main;
+import com.jpexs.decompiler.flash.Configuration;
import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.graph.GraphTargetItem;
@@ -55,7 +55,7 @@ public class TraitMethodGetterSetter extends Trait {
@Override
public String convert(String path, List abcTags, ABC abc, boolean isStatic, boolean pcode, int scriptIndex, int classIndex, boolean highlight, List fullyQualifiedNames) {
- if (!Main.DO_DECOMPILE) {
+ if (!Configuration.DO_DECOMPILE) {
return "";
}
if (debugMode) {
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 24236726e..6fdbe3691 100644
--- a/trunk/src/com/jpexs/decompiler/flash/action/gui/ActionPanel.java
+++ b/trunk/src/com/jpexs/decompiler/flash/action/gui/ActionPanel.java
@@ -16,9 +16,10 @@
*/
package com.jpexs.decompiler.flash.action.gui;
+import com.jpexs.decompiler.flash.Configuration;
import com.jpexs.decompiler.flash.DisassemblyListener;
-import com.jpexs.decompiler.flash.Main;
import com.jpexs.decompiler.flash.SWF;
+import com.jpexs.decompiler.flash.TagNode;
import com.jpexs.decompiler.flash.abc.gui.LineMarkedEditorPane;
import com.jpexs.decompiler.flash.action.Action;
import com.jpexs.decompiler.flash.action.ActionGraph;
@@ -27,7 +28,7 @@ import com.jpexs.decompiler.flash.action.parser.pcode.ASMParser;
import com.jpexs.decompiler.flash.action.parser.script.ActionScriptParser;
import com.jpexs.decompiler.flash.graph.GraphTargetItem;
import com.jpexs.decompiler.flash.gui.GraphFrame;
-import com.jpexs.decompiler.flash.gui.TagNode;
+import com.jpexs.decompiler.flash.gui.Main;
import com.jpexs.decompiler.flash.gui.TagTreeModel;
import com.jpexs.decompiler.flash.gui.View;
import com.jpexs.decompiler.flash.helpers.Cache;
@@ -214,7 +215,7 @@ public class ActionPanel extends JPanel implements ActionListener {
@Override
public void run() {
editor.setText("; Disassembling...");
- if (Main.DO_DECOMPILE) {
+ if (Configuration.DO_DECOMPILE) {
decompiledEditor.setText("//Waiting for dissasembly...");
}
DisassemblyListener listener = new DisassemblyListener() {
@@ -242,7 +243,7 @@ public class ActionPanel extends JPanel implements ActionListener {
srcNoHex = Helper.stripComments(lastDisasm);
editor.setText("; Disassembling - setting");
setHex(hexButton.isSelected());
- if (Main.DO_DECOMPILE) {
+ if (Configuration.DO_DECOMPILE) {
decompiledEditor.setText("//Decompiling...");
String stripped = "";
if (!useCache) {
diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ConstantIndex.java b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ConstantIndex.java
index 6837af76b..824fb6ba8 100644
--- a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ConstantIndex.java
+++ b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ConstantIndex.java
@@ -16,7 +16,7 @@
*/
package com.jpexs.decompiler.flash.action.swf4;
-import com.jpexs.decompiler.flash.Main;
+import com.jpexs.decompiler.flash.Configuration;
import com.jpexs.decompiler.flash.helpers.Helper;
import java.util.ArrayList;
import java.util.List;
@@ -37,7 +37,7 @@ public class ConstantIndex {
}
public String toStringNoQ() {
- if (Main.RESOLVE_CONSTANTS) {
+ if (Configuration.RESOLVE_CONSTANTS) {
if (constantPool != null) {
if (index < constantPool.size()) {
return constantPool.get(index);
@@ -49,7 +49,7 @@ public class ConstantIndex {
@Override
public String toString() {
- if (Main.RESOLVE_CONSTANTS) {
+ if (Configuration.RESOLVE_CONSTANTS) {
if (constantPool != null) {
if (index < constantPool.size()) {
return "\"" + Helper.escapeString(constantPool.get(index)) + "\"";
diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/AboutDialog.java b/trunk/src/com/jpexs/decompiler/flash/gui/AboutDialog.java
index b8ebcdcbd..abf1e5b9c 100644
--- a/trunk/src/com/jpexs/decompiler/flash/gui/AboutDialog.java
+++ b/trunk/src/com/jpexs/decompiler/flash/gui/AboutDialog.java
@@ -16,7 +16,6 @@
*/
package com.jpexs.decompiler.flash.gui;
-import com.jpexs.decompiler.flash.Main;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/FrameNode.java b/trunk/src/com/jpexs/decompiler/flash/gui/FrameNode.java
deleted file mode 100644
index 56ef4d5c7..000000000
--- a/trunk/src/com/jpexs/decompiler/flash/gui/FrameNode.java
+++ /dev/null
@@ -1,35 +0,0 @@
-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/LoadingDialog.java b/trunk/src/com/jpexs/decompiler/flash/gui/LoadingDialog.java
index 7b084b53d..9728122ce 100644
--- a/trunk/src/com/jpexs/decompiler/flash/gui/LoadingDialog.java
+++ b/trunk/src/com/jpexs/decompiler/flash/gui/LoadingDialog.java
@@ -16,7 +16,6 @@
*/
package com.jpexs.decompiler.flash.gui;
-import com.jpexs.decompiler.flash.Main;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.event.WindowAdapter;
diff --git a/trunk/src/com/jpexs/decompiler/flash/Main.java b/trunk/src/com/jpexs/decompiler/flash/gui/Main.java
similarity index 86%
rename from trunk/src/com/jpexs/decompiler/flash/Main.java
rename to trunk/src/com/jpexs/decompiler/flash/gui/Main.java
index aaf478478..cc42789da 100644
--- a/trunk/src/com/jpexs/decompiler/flash/Main.java
+++ b/trunk/src/com/jpexs/decompiler/flash/gui/Main.java
@@ -14,15 +14,14 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
-package com.jpexs.decompiler.flash;
+package com.jpexs.decompiler.flash.gui;
+import com.jpexs.decompiler.flash.Configuration;
+import com.jpexs.decompiler.flash.EventListener;
+import com.jpexs.decompiler.flash.PercentListener;
+import com.jpexs.decompiler.flash.SWF;
+import com.jpexs.decompiler.flash.Version;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
-import com.jpexs.decompiler.flash.gui.AboutDialog;
-import com.jpexs.decompiler.flash.gui.LoadingDialog;
-import com.jpexs.decompiler.flash.gui.MainFrame;
-import com.jpexs.decompiler.flash.gui.ModeFrame;
-import com.jpexs.decompiler.flash.gui.NewVersionDialog;
-import com.jpexs.decompiler.flash.gui.View;
import com.jpexs.decompiler.flash.gui.player.FlashPlayerPanel;
import com.jpexs.decompiler.flash.gui.proxy.ProxyFrame;
import com.jpexs.decompiler.flash.helpers.Helper;
@@ -33,6 +32,8 @@ import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.io.*;
import java.net.Socket;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Properties;
@@ -96,40 +97,11 @@ public class Main {
public static boolean isCommandLineMode() {
return commandLineMode;
}
- public static final boolean DISPLAY_FILENAME = true;
- public static boolean DEBUG_COPY = false;
- /**
- * Debug mode = throwing an error when comparing original file and
- * recompiled
- */
- public static boolean debugMode = false;
- /**
- * Turn off reading unsafe tags (tags which can cause problems with
- * recompiling)
- */
- public static boolean DISABLE_DANGEROUS = false;
- /**
- * Turn off resolving constants in ActionScript 2
- */
- public static final boolean RESOLVE_CONSTANTS = true;
- /**
- * Turn off decompiling if needed
- */
- public static final boolean DO_DECOMPILE = true;
- /**
- * Find latest constant pool in the code
- */
- public static final boolean LATEST_CONSTANTPOOL_HACK = false;
/**
* Dump tags to stdout
*/
- public static boolean dump_tags = false;
- /**
- * Limit of code subs (for obfuscated code)
- */
- public static final int SUBLIMITER = 500;
- //using parameter names in decompiling may cause problems because oficial programs like Flash CS 5.5 inserts wrong parameter names indices
- public static final boolean PARAM_NAMES_ENABLE = false;
+ //
+
public static String getFileTitle() {
if (maskURL != null) {
@@ -140,7 +112,7 @@ public class Main {
public static void setSubLimiter(boolean value) {
if (value) {
- AVM2Code.toSourceLimit = Main.SUBLIMITER;
+ AVM2Code.toSourceLimit = Configuration.SUBLIMITER;
} else {
AVM2Code.toSourceLimit = -1;
}
@@ -228,16 +200,6 @@ public class Main {
Main.startWork("Reading SWF...");
swf = parseSWF(Main.file);
FileInputStream fis = new FileInputStream(file);
- DEBUG_COPY = true;
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- /*try {
- swf.saveTo(baos);
- } catch (NotSameException nse) {
- Logger.getLogger(Main.class.getName()).log(Level.FINE, null, nse);
- JOptionPane.showMessageDialog(null, "WARNING: The SWF decompiler may have problems saving this file. Recommended usage is READ ONLY.");
- }*/
- DEBUG_COPY = false;
- //DEBUG_COPY=true;
} catch (Exception ex) {
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
JOptionPane.showMessageDialog(null, "Cannot load SWF file.");
@@ -468,16 +430,16 @@ public class Main {
public static void main(String[] args) throws IOException {
loadProperties();
View.setLookAndFeel();
- Configuration.load();
+ Configuration.loadFromFile(getConfigFile(), getReplacementsFile());
int pos = 0;
if (args.length > 0) {
if (args[0].equals("-debug")) {
- debugMode = true;
+ Configuration.debugMode = true;
pos++;
}
}
- initLogging(debugMode);
+ initLogging(Configuration.debugMode);
if (args.length < pos + 1) {
autoCheckForUpdates();
showModeFrame();
@@ -599,10 +561,10 @@ public class Main {
exfile.exportTexts(outDir.getAbsolutePath(), false);
exportOK = true;
} else if (exportFormat.equals("fla")) {
- exfile.exportFla(outDir.getAbsolutePath(), inFile.getName());
+ exfile.exportFla(outDir.getAbsolutePath(), inFile.getName(), applicationName, applicationVerName, version);
exportOK = true;
} else if (exportFormat.equals("xfl")) {
- exfile.exportXfl(outDir.getAbsolutePath(), inFile.getName());
+ exfile.exportXfl(outDir.getAbsolutePath(), inFile.getName(), applicationName, applicationVerName, version);
exportOK = true;
} else {
exportOK = false;
@@ -647,7 +609,7 @@ public class Main {
badArguments();
}
try {
- dump_tags = true;
+ Configuration.dump_tags = true;
SWF swf = parseSWF(args[pos + 1]);
} catch (Exception ex) {
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
@@ -668,11 +630,11 @@ public class Main {
}
public static String tempFile(String url) {
- File f = new File(Configuration.getASDecHome() + "saved" + File.separator);
+ File f = new File(getFFDecHome() + "saved" + File.separator);
if (!f.exists()) {
f.mkdirs();
}
- return Configuration.getASDecHome() + "saved" + File.separator + "asdec_" + Integer.toHexString(url.hashCode()) + ".tmp";
+ return getFFDecHome() + "saved" + File.separator + "asdec_" + Integer.toHexString(url.hashCode()) + ".tmp";
}
@@ -761,7 +723,7 @@ public class Main {
}
public static void exit() {
- Configuration.save();
+ Configuration.saveToFile(getConfigFile(), getReplacementsFile());
FlashPlayerPanel.unload();
System.exit(0);
}
@@ -875,7 +837,7 @@ public class Main {
try {
Logger logger = Logger.getLogger("");
logger.setLevel(debug ? Level.CONFIG : Level.WARNING);
- FileHandler fileTxt = new FileHandler(Configuration.getASDecHome() + File.separator + "log.txt");
+ FileHandler fileTxt = new FileHandler(getFFDecHome() + File.separator + "log.txt");
SimpleFormatter formatterTxt = new SimpleFormatter();
fileTxt.setFormatter(formatterTxt);
@@ -891,4 +853,91 @@ public class Main {
throw new RuntimeException("Problems with creating the log files");
}
}
+ private static final String CONFIG_NAME = "config.bin";
+ private static final String REPLACEMENTS_NAME = "replacements.cfg";
+ private static final File unspecifiedFile = new File("unspecified");
+ private static File directory = unspecifiedFile;
+
+ private enum OSId {
+
+ WINDOWS, OSX, UNIX
+ }
+
+ private static OSId getOSId() {
+ PrivilegedAction doGetOSName = new PrivilegedAction() {
+ @Override
+ public String run() {
+ return System.getProperty("os.name");
+ }
+ };
+ OSId id = OSId.UNIX;
+ String osName = AccessController.doPrivileged(doGetOSName);
+ if (osName != null) {
+ if (osName.toLowerCase().startsWith("mac os x")) {
+ id = OSId.OSX;
+ } else if (osName.contains("Windows")) {
+ id = OSId.WINDOWS;
+ }
+ }
+ return id;
+ }
+
+ public static String getFFDecHome() {
+ if (directory == unspecifiedFile) {
+ directory = null;
+ String userHome = null;
+ try {
+ userHome = System.getProperty("user.home");
+ } catch (SecurityException ignore) {
+ }
+ if (userHome != null) {
+ String applicationId = Main.shortApplicationName;
+ OSId osId = getOSId();
+ if (osId == OSId.WINDOWS) {
+ File appDataDir = null;
+ try {
+ String appDataEV = System.getenv("APPDATA");
+ if ((appDataEV != null) && (appDataEV.length() > 0)) {
+ appDataDir = new File(appDataEV);
+ }
+ } catch (SecurityException ignore) {
+ }
+ String vendorId = Main.vendor;
+ if ((appDataDir != null) && appDataDir.isDirectory()) {
+ // ${APPDATA}\{vendorId}\${applicationId}
+ String path = vendorId + "\\" + applicationId + "\\";
+ directory = new File(appDataDir, path);
+ } else {
+ // ${userHome}\Application Data\${vendorId}\${applicationId}
+ String path = "Application Data\\" + vendorId + "\\" + applicationId + "\\";
+ directory = new File(userHome, path);
+ }
+ } else if (osId == OSId.OSX) {
+ // ${userHome}/Library/Application Support/${applicationId}
+ String path = "Library/Application Support/" + applicationId + "/";
+ directory = new File(userHome, path);
+ } else {
+ // ${userHome}/.${applicationId}/
+ String path = "." + applicationId + "/";
+ directory = new File(userHome, path);
+ }
+ }
+ }
+ if (!directory.exists()) {
+ directory.mkdirs();
+ }
+ String ret = directory.getAbsolutePath();
+ if (!ret.endsWith(File.separator)) {
+ ret += File.separator;
+ }
+ return ret;
+ }
+
+ private static String getReplacementsFile() {
+ return getFFDecHome() + REPLACEMENTS_NAME;
+ }
+
+ private static String getConfigFile() {
+ return getFFDecHome() + CONFIG_NAME;
+ }
}
diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/MainFrame.java b/trunk/src/com/jpexs/decompiler/flash/gui/MainFrame.java
index 09e625ad2..9f6be867b 100644
--- a/trunk/src/com/jpexs/decompiler/flash/gui/MainFrame.java
+++ b/trunk/src/com/jpexs/decompiler/flash/gui/MainFrame.java
@@ -17,9 +17,10 @@
package com.jpexs.decompiler.flash.gui;
import com.jpexs.decompiler.flash.Configuration;
-import com.jpexs.decompiler.flash.Main;
+import com.jpexs.decompiler.flash.FrameNode;
import com.jpexs.decompiler.flash.SWF;
import com.jpexs.decompiler.flash.SWFOutputStream;
+import com.jpexs.decompiler.flash.TagNode;
import com.jpexs.decompiler.flash.abc.ScriptPack;
import com.jpexs.decompiler.flash.abc.gui.ABCPanel;
import com.jpexs.decompiler.flash.abc.gui.ClassesListTreeModel;
@@ -251,7 +252,7 @@ public class MainFrame extends JFrame implements ActionListener, TreeSelectionLi
Main.exit();
}
});
- setTitle(Main.applicationVerName + (Main.DISPLAY_FILENAME ? " - " + Main.getFileTitle() : ""));
+ setTitle(Main.applicationVerName + (Configuration.DISPLAY_FILENAME ? " - " + Main.getFileTitle() : ""));
JMenuBar menuBar = new JMenuBar();
@@ -1360,7 +1361,7 @@ public class MainFrame extends JFrame implements ActionListener, TreeSelectionLi
}
if (e.getActionCommand().equals("SAVEAS")) {
if (Main.saveFileDialog()) {
- setTitle(Main.applicationVerName + (Main.DISPLAY_FILENAME ? " - " + Main.getFileTitle() : ""));
+ setTitle(Main.applicationVerName + (Configuration.DISPLAY_FILENAME ? " - " + Main.getFileTitle() : ""));
}
}
if (e.getActionCommand().equals("OPEN")) {
@@ -1414,9 +1415,9 @@ public class MainFrame extends JFrame implements ActionListener, TreeSelectionLi
@Override
public void run() {
if (compressed) {
- swf.exportFla(selfile.getAbsolutePath(), new File(Main.file).getName());
+ swf.exportFla(selfile.getAbsolutePath(), new File(Main.file).getName(), Main.applicationName, Main.applicationVerName, Main.version);
} else {
- swf.exportXfl(selfile.getAbsolutePath(), new File(Main.file).getName());
+ swf.exportXfl(selfile.getAbsolutePath(), new File(Main.file).getName(), Main.applicationName, Main.applicationVerName, Main.version);
}
Main.stopWork();
}
diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/ModeFrame.java b/trunk/src/com/jpexs/decompiler/flash/gui/ModeFrame.java
index d41b99e38..2a46d25fe 100644
--- a/trunk/src/com/jpexs/decompiler/flash/gui/ModeFrame.java
+++ b/trunk/src/com/jpexs/decompiler/flash/gui/ModeFrame.java
@@ -16,7 +16,6 @@
*/
package com.jpexs.decompiler.flash.gui;
-import com.jpexs.decompiler.flash.Main;
import java.awt.Container;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/NewVersionDialog.java b/trunk/src/com/jpexs/decompiler/flash/gui/NewVersionDialog.java
index 3a72c55ef..69c5d35d0 100644
--- a/trunk/src/com/jpexs/decompiler/flash/gui/NewVersionDialog.java
+++ b/trunk/src/com/jpexs/decompiler/flash/gui/NewVersionDialog.java
@@ -16,7 +16,6 @@
*/
package com.jpexs.decompiler.flash.gui;
-import com.jpexs.decompiler.flash.Main;
import com.jpexs.decompiler.flash.Version;
import java.awt.Container;
import java.awt.Dimension;
diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/TagTreeModel.java b/trunk/src/com/jpexs/decompiler/flash/gui/TagTreeModel.java
index 162b6ead2..a2a72ad92 100644
--- a/trunk/src/com/jpexs/decompiler/flash/gui/TagTreeModel.java
+++ b/trunk/src/com/jpexs/decompiler/flash/gui/TagTreeModel.java
@@ -16,6 +16,7 @@
*/
package com.jpexs.decompiler.flash.gui;
+import com.jpexs.decompiler.flash.TagNode;
import com.jpexs.decompiler.flash.abc.gui.ClassesListTreeModel;
import com.jpexs.decompiler.flash.abc.gui.TreeElement;
import java.util.ArrayList;
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 3876d2579..3698bc7c8 100644
--- a/trunk/src/com/jpexs/decompiler/flash/gui/proxy/ProxyFrame.java
+++ b/trunk/src/com/jpexs/decompiler/flash/gui/proxy/ProxyFrame.java
@@ -17,7 +17,7 @@
package com.jpexs.decompiler.flash.gui.proxy;
import com.jpexs.decompiler.flash.Configuration;
-import com.jpexs.decompiler.flash.Main;
+import com.jpexs.decompiler.flash.gui.Main;
import com.jpexs.decompiler.flash.gui.View;
import com.jpexs.proxy.CatchedListener;
import com.jpexs.proxy.ReplacedListener;
diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineButton2Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineButton2Tag.java
index c51671fca..7af68a61c 100644
--- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineButton2Tag.java
+++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineButton2Tag.java
@@ -16,8 +16,8 @@
*/
package com.jpexs.decompiler.flash.tags;
+import com.jpexs.decompiler.flash.Configuration;
import com.jpexs.decompiler.flash.Layer;
-import com.jpexs.decompiler.flash.Main;
import com.jpexs.decompiler.flash.SWF;
import com.jpexs.decompiler.flash.SWFInputStream;
import com.jpexs.decompiler.flash.SWFOutputStream;
@@ -107,7 +107,7 @@ public class DefineButton2Tag extends CharacterTag implements Container, Bounded
*/
@Override
public byte[] getData(int version) {
- if (Main.DISABLE_DANGEROUS) {
+ if (Configuration.DISABLE_DANGEROUS) {
return super.getData(version);
}
@@ -115,7 +115,7 @@ public class DefineButton2Tag extends CharacterTag implements Container, Bounded
ByteArrayOutputStream baos = new ByteArrayOutputStream();
OutputStream os = baos;
- if (Main.DEBUG_COPY) {
+ if (Configuration.DEBUG_COPY) {
os = new CopyOutputStream(os, bais);
}
SWFOutputStream sos = new SWFOutputStream(os, version);
@@ -127,7 +127,7 @@ public class DefineButton2Tag extends CharacterTag implements Container, Bounded
ByteArrayOutputStream baos2 = new ByteArrayOutputStream();
OutputStream os2 = baos2;
byte origbrdata[] = null;
- if (Main.DEBUG_COPY) {
+ if (Configuration.DEBUG_COPY) {
SWFInputStream sis = new SWFInputStream(bais, version);
int len = sis.readUI16();
if (len != 0) {
@@ -139,14 +139,14 @@ public class DefineButton2Tag extends CharacterTag implements Container, Bounded
sos2.writeBUTTONRECORDList(characters, true);
sos2.close();
byte brdata[] = baos2.toByteArray();
- if (Main.DEBUG_COPY) {
+ if (Configuration.DEBUG_COPY) {
if (origbrdata != null) {
if (origbrdata.length != brdata.length) {
/*throw nso*/
}
}
}
- if (Main.DEBUG_COPY) {
+ if (Configuration.DEBUG_COPY) {
sos = new SWFOutputStream(baos, version);
}
if ((actions == null) || (actions.isEmpty())) {
@@ -155,7 +155,7 @@ public class DefineButton2Tag extends CharacterTag implements Container, Bounded
sos.writeUI16(2 + brdata.length);
}
sos.write(brdata);
- if (Main.DEBUG_COPY) {
+ if (Configuration.DEBUG_COPY) {
sos = new SWFOutputStream(new CopyOutputStream(baos, bais), version);
}
sos.writeBUTTONCONDACTIONList(actions);
diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineButtonTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineButtonTag.java
index e1a4525a4..5cd2409c9 100644
--- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineButtonTag.java
+++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineButtonTag.java
@@ -19,7 +19,6 @@ package com.jpexs.decompiler.flash.tags;
import com.jpexs.decompiler.flash.Configuration;
import com.jpexs.decompiler.flash.DisassemblyListener;
import com.jpexs.decompiler.flash.Layer;
-import com.jpexs.decompiler.flash.Main;
import com.jpexs.decompiler.flash.ReReadableInputStream;
import com.jpexs.decompiler.flash.SWF;
import com.jpexs.decompiler.flash.SWFInputStream;
@@ -104,12 +103,12 @@ public class DefineButtonTag extends CharacterTag implements ASMSource, BoundedT
*/
@Override
public byte[] getData(int version) {
- if (Main.DISABLE_DANGEROUS) {
+ if (Configuration.DISABLE_DANGEROUS) {
return super.getData(version);
}
ByteArrayOutputStream baos = new ByteArrayOutputStream();
OutputStream os = baos;
- if (Main.DEBUG_COPY) {
+ if (Configuration.DEBUG_COPY) {
os = new CopyOutputStream(os, new ByteArrayInputStream(super.data));
}
SWFOutputStream sos = new SWFOutputStream(os, version);
diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineFont3Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineFont3Tag.java
index 0f706fd2d..70ba1d7ef 100644
--- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineFont3Tag.java
+++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineFont3Tag.java
@@ -16,7 +16,7 @@
*/
package com.jpexs.decompiler.flash.tags;
-import com.jpexs.decompiler.flash.Main;
+import com.jpexs.decompiler.flash.Configuration;
import com.jpexs.decompiler.flash.SWFInputStream;
import com.jpexs.decompiler.flash.SWFOutputStream;
import com.jpexs.decompiler.flash.abc.CopyOutputStream;
@@ -161,7 +161,7 @@ public class DefineFont3Tag extends CharacterTag implements FontTag {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
OutputStream os = baos;
SWFOutputStream sos = new SWFOutputStream(os, version);
- if (Main.DEBUG_COPY) {
+ if (Configuration.DEBUG_COPY) {
sos = new SWFOutputStream(new CopyOutputStream(sos, new ByteArrayInputStream(data)), 10);
}
try {
diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineSpriteTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineSpriteTag.java
index 1f8a03290..a0c462cd2 100644
--- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineSpriteTag.java
+++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineSpriteTag.java
@@ -16,7 +16,7 @@
*/
package com.jpexs.decompiler.flash.tags;
-import com.jpexs.decompiler.flash.Main;
+import com.jpexs.decompiler.flash.Configuration;
import com.jpexs.decompiler.flash.SWF;
import com.jpexs.decompiler.flash.SWFInputStream;
import com.jpexs.decompiler.flash.SWFOutputStream;
@@ -157,12 +157,12 @@ public class DefineSpriteTag extends CharacterTag implements Container, BoundedT
*/
@Override
public byte[] getData(int version) {
- if (Main.DISABLE_DANGEROUS) {
+ if (Configuration.DISABLE_DANGEROUS) {
return super.getData(version);
}
ByteArrayOutputStream baos = new ByteArrayOutputStream();
OutputStream os = baos;
- if (Main.DEBUG_COPY) {
+ if (Configuration.DEBUG_COPY) {
os = new CopyOutputStream(os, new ByteArrayInputStream(super.data));
}
SWFOutputStream sos = new SWFOutputStream(os, version);
diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DoABCDefineTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DoABCDefineTag.java
index 90d6a41ec..c53ce5f1e 100644
--- a/trunk/src/com/jpexs/decompiler/flash/tags/DoABCDefineTag.java
+++ b/trunk/src/com/jpexs/decompiler/flash/tags/DoABCDefineTag.java
@@ -16,7 +16,7 @@
*/
package com.jpexs.decompiler.flash.tags;
-import com.jpexs.decompiler.flash.Main;
+import com.jpexs.decompiler.flash.Configuration;
import com.jpexs.decompiler.flash.SWFInputStream;
import com.jpexs.decompiler.flash.SWFOutputStream;
import com.jpexs.decompiler.flash.abc.ABC;
@@ -80,7 +80,7 @@ public class DoABCDefineTag extends Tag implements ABCContainerTag {
try {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
OutputStream os = bos;
- if (Main.DEBUG_COPY) {
+ if (Configuration.DEBUG_COPY) {
os = new CopyOutputStream(os, new ByteArrayInputStream(super.data));
}
SWFOutputStream sos = new SWFOutputStream(os, version);
diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DoABCTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DoABCTag.java
index 30ece5454..8a09cf2c9 100644
--- a/trunk/src/com/jpexs/decompiler/flash/tags/DoABCTag.java
+++ b/trunk/src/com/jpexs/decompiler/flash/tags/DoABCTag.java
@@ -16,7 +16,7 @@
*/
package com.jpexs.decompiler.flash.tags;
-import com.jpexs.decompiler.flash.Main;
+import com.jpexs.decompiler.flash.Configuration;
import com.jpexs.decompiler.flash.SWFOutputStream;
import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.CopyOutputStream;
@@ -66,7 +66,7 @@ public class DoABCTag extends Tag implements ABCContainerTag {
try {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
OutputStream os = bos;
- if (Main.DEBUG_COPY) {
+ if (Configuration.DEBUG_COPY) {
os = new CopyOutputStream(os, new ByteArrayInputStream(super.data));
}
SWFOutputStream sos = new SWFOutputStream(os, version);
diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/PlaceObject2Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/PlaceObject2Tag.java
index a0076478d..cb53af1a8 100644
--- a/trunk/src/com/jpexs/decompiler/flash/tags/PlaceObject2Tag.java
+++ b/trunk/src/com/jpexs/decompiler/flash/tags/PlaceObject2Tag.java
@@ -16,7 +16,7 @@
*/
package com.jpexs.decompiler.flash.tags;
-import com.jpexs.decompiler.flash.Main;
+import com.jpexs.decompiler.flash.Configuration;
import com.jpexs.decompiler.flash.SWFInputStream;
import com.jpexs.decompiler.flash.SWFOutputStream;
import com.jpexs.decompiler.flash.abc.CopyOutputStream;
@@ -129,12 +129,12 @@ public class PlaceObject2Tag extends Tag implements Container, PlaceObjectTypeTa
*/
@Override
public byte[] getData(int version) {
- if (Main.DISABLE_DANGEROUS) {
+ if (Configuration.DISABLE_DANGEROUS) {
return super.getData(version);
}
ByteArrayOutputStream baos = new ByteArrayOutputStream();
OutputStream os = baos;
- if (Main.DEBUG_COPY) {
+ if (Configuration.DEBUG_COPY) {
os = new CopyOutputStream(os, new ByteArrayInputStream(super.data));
}
SWFOutputStream sos = new SWFOutputStream(os, version);
diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/PlaceObject3Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/PlaceObject3Tag.java
index cc5c8c9c6..c18d58858 100644
--- a/trunk/src/com/jpexs/decompiler/flash/tags/PlaceObject3Tag.java
+++ b/trunk/src/com/jpexs/decompiler/flash/tags/PlaceObject3Tag.java
@@ -16,8 +16,8 @@
*/
package com.jpexs.decompiler.flash.tags;
+import com.jpexs.decompiler.flash.Configuration;
import com.jpexs.decompiler.flash.EndOfStreamException;
-import com.jpexs.decompiler.flash.Main;
import com.jpexs.decompiler.flash.SWFInputStream;
import com.jpexs.decompiler.flash.SWFOutputStream;
import com.jpexs.decompiler.flash.abc.CopyOutputStream;
@@ -193,12 +193,12 @@ public class PlaceObject3Tag extends Tag implements Container, PlaceObjectTypeTa
*/
@Override
public byte[] getData(int version) {
- if (Main.DISABLE_DANGEROUS) {
+ if (Configuration.DISABLE_DANGEROUS) {
return super.getData(version);
}
ByteArrayOutputStream baos = new ByteArrayOutputStream();
OutputStream os = baos;
- if (Main.DEBUG_COPY) {
+ if (Configuration.DEBUG_COPY) {
os = new CopyOutputStream(os, new ByteArrayInputStream(super.data));
}
SWFOutputStream sos = new SWFOutputStream(os, version);
diff --git a/trunk/src/com/jpexs/decompiler/flash/xfl/XFLConverter.java b/trunk/src/com/jpexs/decompiler/flash/xfl/XFLConverter.java
index a702f9204..e5c9b6aba 100644
--- a/trunk/src/com/jpexs/decompiler/flash/xfl/XFLConverter.java
+++ b/trunk/src/com/jpexs/decompiler/flash/xfl/XFLConverter.java
@@ -16,7 +16,6 @@
*/
package com.jpexs.decompiler.flash.xfl;
-import com.jpexs.decompiler.flash.Main;
import com.jpexs.decompiler.flash.SWF;
import com.jpexs.decompiler.flash.SWFInputStream;
import com.jpexs.decompiler.flash.helpers.Highlighting;
@@ -2368,7 +2367,7 @@ public class XFLConverter {
return ret;
}
- public static void convertSWF(SWF swf, String swfFileName, String outfile, boolean compressed) {
+ public static void convertSWF(SWF swf, String swfFileName, String outfile, boolean compressed, String generator, String generatorVerName, String generatorVersion) {
String domDocument = "";
String baseName = swfFileName;
File f = new File(baseName);
@@ -2402,7 +2401,7 @@ public class XFLConverter {
backgroundColor = sbc.backgroundColor.toHexRGB();
}
}
- domDocument += "";