mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-06-28 07:55:56 +00:00
Configurable sub limiter
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
package com.jpexs.asdec;
|
||||
|
||||
import com.jpexs.asdec.abc.NotSameException;
|
||||
import com.jpexs.asdec.abc.avm2.AVM2Code;
|
||||
import com.jpexs.asdec.gui.AboutDialog;
|
||||
import com.jpexs.asdec.gui.LoadingDialog;
|
||||
import com.jpexs.asdec.gui.ModeFrame;
|
||||
@@ -83,6 +84,9 @@ public class Main {
|
||||
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;
|
||||
@@ -98,6 +102,15 @@ public class Main {
|
||||
public static java.util.List<Replacement> replacements = new ArrayList<Replacement>();
|
||||
|
||||
|
||||
public static void setSubLimiter(boolean value)
|
||||
{
|
||||
if(value){
|
||||
AVM2Code.toSourceLimit=Main.SUBLIMITER;
|
||||
}else{
|
||||
AVM2Code.toSourceLimit=-1;
|
||||
}
|
||||
}
|
||||
|
||||
private static String getASDecHome() {
|
||||
String dir = ".";//System.getProperty("user.home");
|
||||
if (!dir.endsWith(File.separator)) dir += File.separator;
|
||||
|
||||
@@ -60,6 +60,8 @@ import java.util.regex.Pattern;
|
||||
|
||||
public class AVM2Code {
|
||||
|
||||
|
||||
public static int toSourceLimit=-1;
|
||||
public ArrayList<AVM2Instruction> code = new ArrayList<AVM2Instruction>();
|
||||
public static boolean DEBUG_REWRITE=false;
|
||||
public static final int OPT_U30 = 0x100;
|
||||
@@ -1042,8 +1044,10 @@ public HashMap<Integer,String> getLocalRegNamesFromDebug(ABC abc){
|
||||
System.out.println("OPEN SubSource:" + start + "-" + end + " " + code.get(start).toString() + " to " + code.get(end).toString());
|
||||
//if(true) return "";
|
||||
toSourceCount++;
|
||||
if (toSourceCount > 255) {
|
||||
throw new ConvertException("StackOverflow", start);
|
||||
if(toSourceLimit>0){
|
||||
if (toSourceCount > toSourceLimit) {
|
||||
throw new ConvertException("Limit of subs("+toSourceLimit+") was reached", start);
|
||||
}
|
||||
}
|
||||
List<TreeItem> output = new ArrayList();
|
||||
String ret = "";
|
||||
|
||||
@@ -19,6 +19,7 @@ package com.jpexs.asdec.abc.gui;
|
||||
|
||||
import com.jpexs.asdec.Main;
|
||||
import com.jpexs.asdec.abc.ABC;
|
||||
import com.jpexs.asdec.abc.avm2.AVM2Code;
|
||||
import com.jpexs.asdec.abc.gui.tablemodels.*;
|
||||
import com.jpexs.asdec.gui.LoadingPanel;
|
||||
import com.jpexs.asdec.gui.View;
|
||||
@@ -289,6 +290,13 @@ public class MainFrame extends JFrame implements ActionListener, ItemListener {
|
||||
menuFile.add(miClose);
|
||||
menuBar.add(menuFile);
|
||||
|
||||
JMenu menuOptions = new JMenu("Options");
|
||||
JCheckBoxMenuItem miSubLimiter = new JCheckBoxMenuItem ("Enable sub limiter");
|
||||
miSubLimiter.setActionCommand("SUBLIMITER");
|
||||
miSubLimiter.addActionListener(this);
|
||||
menuOptions.add(miSubLimiter);
|
||||
menuBar.add(menuOptions);
|
||||
|
||||
JMenu menuTools = new JMenu("Tools");
|
||||
JMenuItem miProxy = new JMenuItem("Proxy");
|
||||
miProxy.setActionCommand("SHOWPROXY");
|
||||
@@ -356,7 +364,15 @@ public class MainFrame extends JFrame implements ActionListener, ItemListener {
|
||||
|
||||
if (e.getActionCommand().equals("SHOWPROXY")) {
|
||||
Main.showProxy();
|
||||
}
|
||||
}
|
||||
|
||||
if (e.getActionCommand().equals("SUBLIMITER")) {
|
||||
if(e.getSource() instanceof JCheckBoxMenuItem){
|
||||
Main.setSubLimiter(((JCheckBoxMenuItem)e.getSource()).getState());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (e.getActionCommand().equals("SAVE")) {
|
||||
try {
|
||||
Main.saveFile(Main.file);
|
||||
|
||||
Reference in New Issue
Block a user