diff --git a/trunk/src/com/jpexs/decompiler/flash/SWF.java b/trunk/src/com/jpexs/decompiler/flash/SWF.java index acce9f07e..4a2d91a17 100644 --- a/trunk/src/com/jpexs/decompiler/flash/SWF.java +++ b/trunk/src/com/jpexs/decompiler/flash/SWF.java @@ -38,7 +38,6 @@ import com.jpexs.decompiler.flash.action.swf5.ActionNewObject; import com.jpexs.decompiler.flash.action.swf5.ActionSetMember; import com.jpexs.decompiler.flash.action.swf7.ActionDefineFunction2; import com.jpexs.decompiler.flash.action.treemodel.ConstantPool; -import com.jpexs.decompiler.flash.action.treemodel.DefineLocalTreeItem; import com.jpexs.decompiler.flash.action.treemodel.DirectValueTreeItem; import com.jpexs.decompiler.flash.flv.AUDIODATA; import com.jpexs.decompiler.flash.flv.FLVOutputStream; @@ -791,8 +790,8 @@ public class SWF { public static final String validNextCharacters = validFirstCharacters + "0123456789"; public static final String fooCharacters = "bcdfghjklmnpqrstvwz"; public static final String fooJoinCharacters = "aeiouy"; - private HashMap allVariableNames = new HashMap(); - private HashSet allVariableNamesStr=new HashSet(); + private HashMap allVariableNames = new HashMap(); + private HashSet allVariableNamesStr = new HashSet(); private List allFunctions = new ArrayList(); private String fooString(String orig, boolean firstUppercase, int rndSize) { @@ -868,7 +867,7 @@ public class SWF { return null; } - private static void getVariables(ConstantPool constantPool, List localData, Stack stack, List output, ActionGraphSource code, int ip, int lastIp, HashMap variables,List functions, List visited) { + private static void getVariables(ConstantPool constantPool, List localData, Stack stack, List output, ActionGraphSource code, int ip, int lastIp, HashMap variables, List functions, List visited) { boolean debugMode = false; while ((ip > -1) && ip < code.size()) { if (visited.contains(ip)) { @@ -883,24 +882,23 @@ public class SWF { GraphTargetItem name = null; if ((ins instanceof ActionGetVariable) - ||(ins instanceof ActionGetMember) - ||(ins instanceof ActionDefineLocal2) - ||(ins instanceof ActionNewMethod) - ||(ins instanceof ActionNewObject) - ||(ins instanceof ActionCallMethod) - ||(ins instanceof ActionCallFunction) - ) { + || (ins instanceof ActionGetMember) + || (ins instanceof ActionDefineLocal2) + || (ins instanceof ActionNewMethod) + || (ins instanceof ActionNewObject) + || (ins instanceof ActionCallMethod) + || (ins instanceof ActionCallFunction)) { name = stack.peek(); } - - if((ins instanceof ActionDefineFunction)||(ins instanceof ActionDefineFunction2)){ + + if ((ins instanceof ActionDefineFunction) || (ins instanceof ActionDefineFunction2)) { functions.add(ins); } - if ((ins instanceof ActionSetVariable)||(ins instanceof ActionSetMember)||(ins instanceof ActionDefineLocal)) { + if ((ins instanceof ActionSetVariable) || (ins instanceof ActionSetMember) || (ins instanceof ActionDefineLocal)) { name = stack.get(stack.size() - 2); } if (name instanceof DirectValueTreeItem) { - variables.put((DirectValueTreeItem)name,constantPool); + variables.put((DirectValueTreeItem) name, constantPool); } //for..in return @@ -919,7 +917,7 @@ public class SWF { if (ins.isBranch() || ins.isJump()) { - if (false){ //ins instanceof ActionIf && !stack.isEmpty() && (stack.peek().isCompileTime())) { + if (false) { //ins instanceof ActionIf && !stack.isEmpty() && (stack.peek().isCompileTime())) { boolean condition = stack.peek().toBoolean(); if (debugMode) { if (condition) { @@ -929,7 +927,7 @@ public class SWF { } } stack.pop(); - getVariables(constantPool, localData, stack, output, code, condition ? (code.adr2pos(((ActionIf) ins).getAddress() + ((ActionIf) ins).getBytes(code.version).length + ((ActionIf) ins).offset)) : ip + 1, ip, variables,functions, visited); + getVariables(constantPool, localData, stack, output, code, condition ? (code.adr2pos(((ActionIf) ins).getAddress() + ((ActionIf) ins).getBytes(code.version).length + ((ActionIf) ins).offset)) : ip + 1, ip, variables, functions, visited); } else { if (ins instanceof ActionIf) { stack.pop(); @@ -939,7 +937,7 @@ public class SWF { for (int b : branches) { Stack brStack = (Stack) stack.clone(); if (b >= 0) { - getVariables(constantPool, localData, brStack, output, code, b, ip, variables, functions,visited); + getVariables(constantPool, localData, brStack, output, code, b, ip, variables, functions, visited); } else { if (debugMode) { System.out.println("Negative branch:" + b); @@ -953,29 +951,28 @@ public class SWF { }; } - private static void getVariables(HashMap variables,List functions,ActionGraphSource code, int addr) { + private static void getVariables(HashMap variables, List functions, ActionGraphSource code, int addr) { List localData = Helper.toList(new HashMap(), new HashMap(), new HashMap()); - try{ - getVariables(null, localData, new Stack(), new ArrayList(), code, code.adr2pos(addr), 0, variables,functions, new ArrayList()); - }catch(Exception ex){ - Logger.getLogger(SWF.class.getName()).log(Level.SEVERE, "Getting variables error",ex); + try { + getVariables(null, localData, new Stack(), new ArrayList(), code, code.adr2pos(addr), 0, variables, functions, new ArrayList()); + } catch (Exception ex) { + Logger.getLogger(SWF.class.getName()).log(Level.SEVERE, "Getting variables error", ex); } } - private HashMap getVariables(HashMap variables,List functions,ASMSource src){ - HashMap ret=new HashMap(); + private HashMap getVariables(HashMap variables, List functions, ASMSource src) { + HashMap ret = new HashMap(); List actions = src.getActions(version); actionsMap.put(src, actions); - getVariables(variables,functions,new ActionGraphSource(actions, version, new HashMap(), new HashMap(), new HashMap()),0); + getVariables(variables, functions, new ActionGraphSource(actions, version, new HashMap(), new HashMap(), new HashMap()), 0); return ret; } - - private HashMap> actionsMap=new HashMap>(); - + private HashMap> actionsMap = new HashMap>(); + private void getVariables(List objs) { for (Object o : objs) { if (o instanceof ASMSource) { - getVariables(allVariableNames,allFunctions,(ASMSource) o); + getVariables(allVariableNames, allFunctions, (ASMSource) o); } if (o instanceof Container) { getVariables(((Container) o).getSubItems()); @@ -984,48 +981,48 @@ public class SWF { } public int deobfuscateAS2Identifiers() { - actionsMap=new HashMap>(); + actionsMap = new HashMap>(); allFunctions = new ArrayList(); - allVariableNames=new HashMap(); + allVariableNames = new HashMap(); List objs = new ArrayList(); - int ret=0; + int ret = 0; objs.addAll(tags); - getVariables(objs); - for(GraphSourceItem fun:allFunctions){ - if(fun instanceof ActionDefineFunction){ - ActionDefineFunction f=(ActionDefineFunction)fun; - String changed=deobfuscateName(deobfuscated, f.functionName, false); - if(changed!=null){ - f.replacedFunctionName=changed; + getVariables(objs); + for (GraphSourceItem fun : allFunctions) { + if (fun instanceof ActionDefineFunction) { + ActionDefineFunction f = (ActionDefineFunction) fun; + String changed = deobfuscateName(deobfuscated, f.functionName, false); + if (changed != null) { + f.replacedFunctionName = changed; } } - if(fun instanceof ActionDefineFunction2){ - ActionDefineFunction2 f=(ActionDefineFunction2)fun; - String changed=deobfuscateName(deobfuscated, f.functionName, false); - if(changed!=null){ - f.replacedFunctionName=changed; + if (fun instanceof ActionDefineFunction2) { + ActionDefineFunction2 f = (ActionDefineFunction2) fun; + String changed = deobfuscateName(deobfuscated, f.functionName, false); + if (changed != null) { + f.replacedFunctionName = changed; } } } - for(DirectValueTreeItem ti:allVariableNames.keySet()){ - String name=ti.toStringNoH(allVariableNames.get(ti)); + for (DirectValueTreeItem ti : allVariableNames.keySet()) { + String name = ti.toStringNoH(allVariableNames.get(ti)); allVariableNamesStr.add(name); } - for(DirectValueTreeItem ti:allVariableNames.keySet()){ - String name=ti.toStringNoH(allVariableNames.get(ti)); - String changed=deobfuscateName(deobfuscated, name, false); - if(changed!=null){ - ActionPush pu=(ActionPush)ti.src; - if(pu.replacement==null){ - pu.replacement=new ArrayList(); + for (DirectValueTreeItem ti : allVariableNames.keySet()) { + String name = ti.toStringNoH(allVariableNames.get(ti)); + String changed = deobfuscateName(deobfuscated, name, false); + if (changed != null) { + ActionPush pu = (ActionPush) ti.src; + if (pu.replacement == null) { + pu.replacement = new ArrayList(); pu.replacement.addAll(pu.values); } - pu.replacement.set(ti.pos,changed); + pu.replacement.set(ti.pos, changed); ret++; - } + } } - for(ASMSource src:actionsMap.keySet()){ - actionsMap.put(src,Action.removeNops(actionsMap.get(src), version)); + for (ASMSource src : actionsMap.keySet()) { + actionsMap.put(src, Action.removeNops(actionsMap.get(src), version)); src.setActions(actionsMap.get(src), version); } return ret; diff --git a/trunk/src/com/jpexs/decompiler/flash/SWFInputStream.java b/trunk/src/com/jpexs/decompiler/flash/SWFInputStream.java index ef69c70ec..1be51f3ba 100644 --- a/trunk/src/com/jpexs/decompiler/flash/SWFInputStream.java +++ b/trunk/src/com/jpexs/decompiler/flash/SWFInputStream.java @@ -495,7 +495,7 @@ public class SWFInputStream extends InputStream { return readActionList(rri, version, 0); } - private static void getConstantPool(List localData, Stack stack, List output, ActionGraphSource code, int ip, int lastIp, List constantPools, List visited) { + private static void getConstantPool(ConstantPool cpool, List localData, Stack stack, List output, ActionGraphSource code, int ip, int lastIp, List constantPools, List visited) { boolean debugMode = false; while ((ip > -1) && ip < code.size()) { if (visited.contains(ip)) { @@ -504,11 +504,34 @@ public class SWFInputStream extends InputStream { lastIp = ip; GraphSourceItem ins = code.get(ip); + + if (ins instanceof ActionPush) { + if (cpool != null) { + ((ActionPush) ins).constantPool = cpool.constants; + cpool.count++; + } + } + if (ins instanceof ActionDefineFunction) { + if (cpool != null) { + ((ActionDefineFunction) ins).setConstantPool(cpool.constants); + cpool.count++; + } + } + if (ins instanceof ActionDefineFunction2) { + if (cpool != null) { + ((ActionDefineFunction2) ins).setConstantPool(cpool.constants); + cpool.count++; + } + } if (debugMode) { - System.out.println("Visit " + ip + ": " + ins + " stack:" + Highlighting.stripHilights(stack.toString())); + System.out.println("getConstantPool ip " + ip + ": " + ins + " stack:" + Highlighting.stripHilights(stack.toString())); } if (ins instanceof ActionConstantPool) { constantPools.add(new ConstantPool(((ActionConstantPool) ins).constantPool)); + if (cpool == null) { + cpool = new ConstantPool(); + } + cpool.setNew(((ActionConstantPool) ins).constantPool); } //for..in return @@ -532,7 +555,7 @@ public class SWFInputStream extends InputStream { } } stack.pop(); - getConstantPool(localData, stack, output, code, condition ? (code.adr2pos(((ActionIf) ins).getAddress() + ((ActionIf) ins).getBytes(code.version).length + ((ActionIf) ins).offset)) : ip + 1, ip, constantPools, visited); + getConstantPool(cpool, localData, stack, output, code, condition ? (code.adr2pos(((ActionIf) ins).getAddress() + ((ActionIf) ins).getBytes(code.version).length + ((ActionIf) ins).offset)) : ip + 1, ip, constantPools, visited); } else { if (ins instanceof ActionIf) { stack.pop(); @@ -542,7 +565,7 @@ public class SWFInputStream extends InputStream { for (int b : branches) { Stack brStack = (Stack) stack.clone(); if (b >= 0) { - getConstantPool(localData, brStack, output, code, b, ip, constantPools, visited); + getConstantPool(cpool, localData, brStack, output, code, b, ip, constantPools, visited); } else { if (debugMode) { System.out.println("Negative branch:" + b); @@ -562,10 +585,10 @@ public class SWFInputStream extends InputStream { public static List getConstantPool(ActionGraphSource code, int addr) { List ret = new ArrayList(); List localData = Helper.toList(new HashMap(), new HashMap(), new HashMap()); - try{ - getConstantPool(localData, new Stack(), new ArrayList(), code, code.adr2pos(addr), 0, ret, new ArrayList()); - }catch(Exception ex){ - log.log(Level.SEVERE, "Error during getting constantpool",ex); + try { + getConstantPool(null, localData, new Stack(), new ArrayList(), code, code.adr2pos(addr), 0, ret, new ArrayList()); + } catch (Exception ex) { + log.log(Level.SEVERE, "Error during getting constantpool", ex); } return ret; } @@ -589,12 +612,14 @@ public class SWFInputStream extends InputStream { SWFInputStream sis = new SWFInputStream(rri, version); boolean goesPrev = false; int method = 1; - try { - goesPrev = readActionListAtPos(false, localData, stack, cpool, sis, rri, ip, retdups, ip); - } catch (Exception ex) { - method = 2; - goesPrev = readActionListAtPos(true, localData, stack, cpool, sis, rri, ip, retdups, ip); - } + /*try { + goesPrev = readActionListAtPos(false, localData, stack, cpool, sis, rri, ip, retdups, ip); + } catch (Exception ex) { + method = 2; + goesPrev = readActionListAtPos(true, localData, stack, cpool, sis, rri, ip, retdups, ip); + }*/ + goesPrev = readActionListAtPos(true, localData, stack, cpool, sis, rri, ip, retdups, ip); + if (goesPrev) { } else { if (!retdups.isEmpty()) { @@ -625,7 +650,7 @@ public class SWFInputStream extends InputStream { List pools = new ArrayList(); pools = getConstantPool(new ActionGraphSource(ret, version, new HashMap(), new HashMap(), new HashMap()), ip); - + if (pools.size() == 1) { Action.setConstantPool(ret, pools.get(0)); } @@ -639,7 +664,7 @@ public class SWFInputStream extends InputStream { } String s = null; //Action.setConstantPool(ret, cpool); - + try { s = Highlighting.stripHilights(Action.actionsToString(ret, null, version, false)); ret = ASMParser.parse(false, new ByteArrayInputStream(s.getBytes()), SWF.DEFAULT_VERSION); @@ -681,7 +706,7 @@ public class SWFInputStream extends InputStream { } if (debugMode) { //if(a instanceof ActionIf){ - System.out.println(" ip: " + (ip - startIp) + " action(len " + a.actionLength + "): " + a + " stack:" + Highlighting.stripHilights(stack.toString()) + " " + Helper.byteArrToString(a.getBytes(SWF.DEFAULT_VERSION))); + System.out.println("readActionListAtPos ip: " + (ip - startIp) + " action(len " + a.actionLength + "): " + a + " stack:" + Highlighting.stripHilights(stack.toString()) + " " + Helper.byteArrToString(a.getBytes(SWF.DEFAULT_VERSION))); //} } /*if(a instanceof ActionConstantPool){ @@ -801,14 +826,21 @@ public class SWFInputStream extends InputStream { //rri.setPos(newip); //} } else { - //return in for..in + //return in for..in, TODO:Handle this better way if (((a instanceof ActionEquals) || (a instanceof ActionEquals2)) && (stack.size() == 1) && (stack.peek() instanceof DirectValueTreeItem)) { stack.push(new DirectValueTreeItem(null, 0, new Null(), new ArrayList())); } + if ((a instanceof ActionStoreRegister) && stack.isEmpty()) { + stack.push(new DirectValueTreeItem(null, 0, new Null(), new ArrayList())); + } a.translate(localData, stack, output); } - } catch (Exception ex) { + } catch (RuntimeException ex) { + if (!enableVariables) { + throw ex; + } log.log(Level.SEVERE, "Disassembly exception", ex); + break; } int nopos = -1; for (int i = 0; i < actionLen; i++) { @@ -843,7 +875,8 @@ public class SWFInputStream extends InputStream { filePos = rri.getPos(); if (goaif) { int oldPos = rri.getPos(); - if (readActionListAtPos(enableVariables, localData, stack, cpool, sis, rri, rri.getPos() + aif.offset, ret, startIp)) { + Stack substack = (Stack) stack.clone(); + if (readActionListAtPos(enableVariables, localData, substack, cpool, sis, rri, rri.getPos() + aif.offset, ret, startIp)) { retv = true; } rri.setPos(oldPos); diff --git a/trunk/src/com/jpexs/decompiler/flash/action/Action.java b/trunk/src/com/jpexs/decompiler/flash/action/Action.java index e3d142fa8..d6ebfc21c 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/Action.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/Action.java @@ -398,7 +398,7 @@ public class Action implements GraphSourceItem { } //if (!(a instanceof ActionNop)) { ret += Highlighting.hilighOffset("", offset) + a.getASMSourceReplaced(importantOffsets, constantPool, version, hex) + (a.ignored ? "; ignored" : "") + "\r\n"; - + //} if (a.afterInsert != null) { ret += a.afterInsert.getASMSource(importantOffsets, constantPool, version, hex) + "\r\n"; @@ -1063,8 +1063,8 @@ public class Action implements GraphSourceItem { } } } - - public String getASMSourceReplaced(List knownAddreses, List constantPool, int version, boolean hex) { + + public String getASMSourceReplaced(List knownAddreses, List constantPool, int version, boolean hex) { return getASMSource(knownAddreses, constantPool, version, hex); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf3/ActionGetURL.java b/trunk/src/com/jpexs/decompiler/flash/action/swf3/ActionGetURL.java index c2f5dc42f..ff4a3a820 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf3/ActionGetURL.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf3/ActionGetURL.java @@ -44,7 +44,7 @@ public class ActionGetURL extends Action { } public ActionGetURL(FlasmLexer lexer) throws IOException, ParseException { - super(0x83, -1); + super(0x83, 0); urlString = lexString(lexer); targetString = lexString(lexer); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf3/ActionGotoFrame.java b/trunk/src/com/jpexs/decompiler/flash/action/swf3/ActionGotoFrame.java index f1077d1fb..9fe72fc6f 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf3/ActionGotoFrame.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf3/ActionGotoFrame.java @@ -56,7 +56,7 @@ public class ActionGotoFrame extends Action { } public ActionGotoFrame(FlasmLexer lexer) throws IOException, ParseException { - super(0x81, -1); + super(0x81, 0); frame = (int) lexLong(lexer); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionJump.java b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionJump.java index 96a5886d5..699529c9c 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionJump.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionJump.java @@ -74,7 +74,7 @@ public class ActionJump extends Action { } public ActionJump(FlasmLexer lexer) throws IOException, ParseException { - super(0x99, -1); + super(0x99, 0); identifier = lexIdentifier(lexer); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionPush.java b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionPush.java index 2d36d5f28..82bc98dcf 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionPush.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf4/ActionPush.java @@ -33,7 +33,6 @@ import java.util.HashMap; import java.util.List; import java.util.Stack; - public class ActionPush extends Action { public List values; @@ -143,7 +142,7 @@ public class ActionPush extends Action { } public ActionPush(FlasmLexer lexer, List constantPool) throws IOException, ParseException { - super(0x96, -1); + super(0x96, 0); this.constantPool = constantPool; values = new ArrayList(); int count = 0; @@ -186,15 +185,16 @@ public class ActionPush extends Action { @Override public String getASMSourceReplaced(List knownAddreses, List constantPool, int version, boolean hex) { - if(replacement == null || replacement.size() oldVal=values; - values=replacement; - String ts=toString(); - values=oldVal; + List oldVal = values; + values = replacement; + String ts = toString(); + values = oldVal; return ts; } + @Override public String toString() { String ret = "Push "; diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionConstantPool.java b/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionConstantPool.java index b18e3bd96..53abdaa5c 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionConstantPool.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionConstantPool.java @@ -45,7 +45,7 @@ public class ActionConstantPool extends Action { } public ActionConstantPool(FlasmLexer lexer) throws IOException, ParseException { - super(0x88, -1); + super(0x88, 0); while (true) { ParsedSymbol symb = lexer.yylex(); if (symb.type == ParsedSymbol.TYPE_STRING) { diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionDefineFunction.java b/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionDefineFunction.java index 7c1d42aa8..3e557afaa 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionDefineFunction.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionDefineFunction.java @@ -170,23 +170,21 @@ public class ActionDefineFunction extends Action implements ActionContainer { @Override public String getASMSourceReplaced(List knownAddreses, List constantPool, int version, boolean hex) { - List oldParamNames=paramNames; - if(replacedParamNames!=null){ - paramNames=replacedParamNames; + List oldParamNames = paramNames; + if (replacedParamNames != null) { + paramNames = replacedParamNames; } - String oldFunctionName=functionName; - if(replacedFunctionName!=null){ - functionName=replacedFunctionName; + String oldFunctionName = functionName; + if (replacedFunctionName != null) { + functionName = replacedFunctionName; } - String ret=getASMSource(knownAddreses, constantPool, version, hex); - paramNames=oldParamNames; - functionName=oldFunctionName; + String ret = getASMSource(knownAddreses, constantPool, version, hex); + paramNames = oldParamNames; + functionName = oldFunctionName; return ret; - + } - - @Override public List getAllRefs(int version) { return Action.getActionsAllRefs(code, version); diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionStoreRegister.java b/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionStoreRegister.java index 0ff77f08e..2689139af 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionStoreRegister.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf5/ActionStoreRegister.java @@ -40,7 +40,7 @@ public class ActionStoreRegister extends Action { } public ActionStoreRegister(FlasmLexer lexer) throws IOException, ParseException { - super(0x87, -1); + super(0x87, 0); registerNumber = (int) lexLong(lexer); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf7/ActionDefineFunction2.java b/trunk/src/com/jpexs/decompiler/flash/action/swf7/ActionDefineFunction2.java index 7ed4a50b9..3832b1b29 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf7/ActionDefineFunction2.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf7/ActionDefineFunction2.java @@ -226,22 +226,22 @@ public class ActionDefineFunction2 extends Action implements ActionContainer { super.setAddress(address, version); Action.setActionsAddresses(code, address + getPreLen(version), version); } - + @Override public String getASMSourceReplaced(List knownAddreses, List constantPool, int version, boolean hex) { - List oldParamNames=paramNames; - if(replacedParamNames!=null){ - paramNames=replacedParamNames; + List oldParamNames = paramNames; + if (replacedParamNames != null) { + paramNames = replacedParamNames; } - String oldFunctionName=functionName; - if(replacedFunctionName!=null){ - functionName=replacedFunctionName; + String oldFunctionName = functionName; + if (replacedFunctionName != null) { + functionName = replacedFunctionName; } - String ret=getASMSource(knownAddreses, constantPool, version, hex); - paramNames=oldParamNames; - functionName=oldFunctionName; + String ret = getASMSource(knownAddreses, constantPool, version, hex); + paramNames = oldParamNames; + functionName = oldFunctionName; return ret; - + } @Override diff --git a/trunk/src/com/jpexs/decompiler/flash/action/swf7/ActionExtends.java b/trunk/src/com/jpexs/decompiler/flash/action/swf7/ActionExtends.java index 3f90c240d..bfaf9ae31 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/swf7/ActionExtends.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/swf7/ActionExtends.java @@ -26,7 +26,7 @@ import java.util.Stack; public class ActionExtends extends Action { public ActionExtends() { - super(0x69, -1); + super(0x69, 0); } @Override diff --git a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/DirectValueTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/DirectValueTreeItem.java index 50f7909ad..258b0ee16 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/treemodel/DirectValueTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/treemodel/DirectValueTreeItem.java @@ -17,6 +17,7 @@ package com.jpexs.decompiler.flash.action.treemodel; import com.jpexs.decompiler.flash.action.swf4.ConstantIndex; +import com.jpexs.decompiler.flash.action.swf4.Null; import com.jpexs.decompiler.flash.graph.GraphSourceItem; import com.jpexs.decompiler.flash.helpers.Helper; import java.util.List; @@ -107,7 +108,7 @@ public class DirectValueTreeItem extends TreeItem { } return value.toString(); } - + @Override public String toString(ConstantPool constants) { if (value instanceof Double) { @@ -131,6 +132,6 @@ public class DirectValueTreeItem extends TreeItem { @Override public boolean isCompileTime() { - return (value instanceof Double) || (value instanceof Float) || (value instanceof Boolean) || (value instanceof Long); + return (value instanceof Double) || (value instanceof Float) || (value instanceof Boolean) || (value instanceof Long) || (value instanceof Null); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/MainFrame.java b/trunk/src/com/jpexs/decompiler/flash/gui/MainFrame.java index ad6e0f06b..a2106633b 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/MainFrame.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/MainFrame.java @@ -1322,7 +1322,7 @@ public class MainFrame extends JFrame implements ActionListener, TreeSelectionLi cnt = swf.deobfuscateAS2Identifiers(); Main.stopWork(); JOptionPane.showMessageDialog(null, "Identifiers renamed: " + cnt); - if(abcPanel!=null){ + if (abcPanel != null) { abcPanel.reload(); } doFilter(); @@ -1406,10 +1406,11 @@ public class MainFrame extends JFrame implements ActionListener, TreeSelectionLi private File tempFile; @Override - public void valueChanged(TreeSelectionEvent e) { + public void valueChanged(TreeSelectionEvent e) { reload(false); } - public void reload(boolean forceReload){ + + public void reload(boolean forceReload) { Object tagObj = tagTree.getLastSelectedPathComponent(); if (tagObj == null) { return;