mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-06-01 19:04:38 +00:00
removetraps...this fix
graph path fix
This commit is contained in:
@@ -1175,7 +1175,7 @@ public class AVM2Code implements Serializable {
|
||||
visited[ip] = true;
|
||||
AVM2Instruction ins = code.get(ip);
|
||||
if (debugMode) {
|
||||
System.out.println("translating ip " + ip + " ins " + ins.toString() + " stack:" + Highlighting.stripHilights(stack.toString()) + " scopeStack:" + Highlighting.stripHilights(scopeStack.toString()));
|
||||
System.err.println("translating ip " + ip + " ins " + ins.toString() + " stack:" + Highlighting.stripHilights(stack.toString()) + " scopeStack:" + Highlighting.stripHilights(scopeStack.toString()));
|
||||
}
|
||||
if (ins.definition instanceof NewFunctionIns) {
|
||||
if (ip + 1 <= end) {
|
||||
|
||||
@@ -42,6 +42,10 @@ public class GetLocal0Ins extends InstructionDefinition implements GetLocalTypeI
|
||||
|
||||
@Override
|
||||
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> stack, java.util.Stack<GraphTargetItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<GraphTargetItem> output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
|
||||
if ((classIndex >= abc.instance_info.length) || classIndex < 0) {
|
||||
stack.push(new ThisTreeItem(null));
|
||||
return;
|
||||
}
|
||||
if (isStatic) {
|
||||
stack.push(new ClassTreeItem(abc.instance_info[classIndex].getName(constants)));
|
||||
} else {
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.action.swf4;
|
||||
|
||||
import com.jpexs.decompiler.flash.EndOfStreamException;
|
||||
import com.jpexs.decompiler.flash.SWFInputStream;
|
||||
import com.jpexs.decompiler.flash.SWFOutputStream;
|
||||
import com.jpexs.decompiler.flash.action.Action;
|
||||
@@ -33,6 +34,8 @@ import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Stack;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
public class ActionPush extends Action {
|
||||
|
||||
@@ -46,46 +49,49 @@ public class ActionPush extends Action {
|
||||
int type;
|
||||
values = new ArrayList<Object>();
|
||||
sis = new SWFInputStream(new ByteArrayInputStream(sis.readBytes(actionLength)), version);
|
||||
while ((type = sis.readUI8()) > -1) {
|
||||
switch (type) {
|
||||
case 0:
|
||||
values.add(sis.readString());
|
||||
break;
|
||||
case 1:
|
||||
values.add(sis.readFLOAT());
|
||||
break;
|
||||
case 2:
|
||||
values.add(new Null());
|
||||
break;
|
||||
case 3:
|
||||
values.add(new Undefined());
|
||||
break;
|
||||
case 4:
|
||||
values.add(new RegisterNumber(sis.readUI8()));
|
||||
break;
|
||||
case 5:
|
||||
int b = sis.readUI8();
|
||||
if (b == 0) {
|
||||
values.add((Boolean) false);
|
||||
} else {
|
||||
values.add((Boolean) true);
|
||||
}
|
||||
try {
|
||||
while ((type = sis.readUI8()) > -1) {
|
||||
switch (type) {
|
||||
case 0:
|
||||
values.add(sis.readString());
|
||||
break;
|
||||
case 1:
|
||||
values.add(sis.readFLOAT());
|
||||
break;
|
||||
case 2:
|
||||
values.add(new Null());
|
||||
break;
|
||||
case 3:
|
||||
values.add(new Undefined());
|
||||
break;
|
||||
case 4:
|
||||
values.add(new RegisterNumber(sis.readUI8()));
|
||||
break;
|
||||
case 5:
|
||||
int b = sis.readUI8();
|
||||
if (b == 0) {
|
||||
values.add((Boolean) false);
|
||||
} else {
|
||||
values.add((Boolean) true);
|
||||
}
|
||||
|
||||
break;
|
||||
case 6:
|
||||
values.add(sis.readDOUBLE());
|
||||
break;
|
||||
case 7:
|
||||
long el = sis.readSI32();
|
||||
values.add((Long) el);
|
||||
break;
|
||||
case 8:
|
||||
values.add(new ConstantIndex(sis.readUI8()));
|
||||
break;
|
||||
case 9:
|
||||
values.add(new ConstantIndex(sis.readUI16()));
|
||||
break;
|
||||
break;
|
||||
case 6:
|
||||
values.add(sis.readDOUBLE());
|
||||
break;
|
||||
case 7:
|
||||
long el = sis.readSI32();
|
||||
values.add((Long) el);
|
||||
break;
|
||||
case 8:
|
||||
values.add(new ConstantIndex(sis.readUI8()));
|
||||
break;
|
||||
case 9:
|
||||
values.add(new ConstantIndex(sis.readUI16()));
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch (EndOfStreamException ex) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -99,7 +99,7 @@ public class Graph {
|
||||
break loopi;
|
||||
}
|
||||
if (lastpref == null) {
|
||||
lastpref = r.path.parent(i - 1);
|
||||
lastpref = r.path.parent(i);
|
||||
} else {
|
||||
if (!r.path.startsWith(lastpref)) {
|
||||
i--;
|
||||
@@ -112,7 +112,7 @@ public class Graph {
|
||||
i = part.path.length();
|
||||
}
|
||||
if (modify && ((uniqueRefs.size() > 1) && (prvni >= 0))) {
|
||||
GraphPath newpath = uniqueRefs.get(prvni).path.parent(i - 1);
|
||||
GraphPath newpath = uniqueRefs.get(prvni).path.parent(i);
|
||||
if (!part.path.equals(newpath)) {
|
||||
if (part.path.startsWith(newpath)) {
|
||||
GraphPath origPath = part.path;
|
||||
@@ -466,7 +466,7 @@ public class Graph {
|
||||
}
|
||||
if (part == null) {
|
||||
//return ret;
|
||||
} else if (part.leadsTo(code, part, getLoopsContinues(loops))) {
|
||||
} else if ((part.nextParts.size() == 1) && part.leadsTo(code, part, getLoopsContinues(loops))) {
|
||||
Loop l = new Loop(loops.size(), part, null);
|
||||
List<GraphTargetItem> trueExp = new ArrayList<GraphTargetItem>();
|
||||
trueExp.add(new TrueItem(null));
|
||||
@@ -548,7 +548,7 @@ public class Graph {
|
||||
|
||||
if (part.nextParts.size() == 2) {
|
||||
|
||||
if ((stack.size() >= 2) && (stack.get(stack.size() - 1) instanceof NotItem) && (((NotItem) (stack.get(stack.size() - 1))).getOriginal() == stack.get(stack.size() - 2))) {
|
||||
if ((stack.size() >= 2) && (stack.get(stack.size() - 1) instanceof NotItem) && (((NotItem) (stack.get(stack.size() - 1))).getOriginal().getNotCoerced() == stack.get(stack.size() - 2).getNotCoerced())) {
|
||||
ret.addAll(output);
|
||||
GraphPart sp0 = getNextNoJump(part.nextParts.get(0));
|
||||
GraphPart sp1 = getNextNoJump(part.nextParts.get(1));
|
||||
@@ -596,7 +596,7 @@ public class Graph {
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
} else if ((stack.size() >= 2) && (stack.get(stack.size() - 1) == stack.get(stack.size() - 2))) {
|
||||
} else if ((stack.size() >= 2) && (stack.get(stack.size() - 1).getNotCoerced() == stack.get(stack.size() - 2).getNotCoerced())) {
|
||||
ret.addAll(output);
|
||||
GraphPart sp0 = getNextNoJump(part.nextParts.get(0));
|
||||
GraphPart sp1 = getNextNoJump(part.nextParts.get(1));
|
||||
@@ -765,19 +765,23 @@ public class Graph {
|
||||
}
|
||||
}
|
||||
List<GraphTargetItem> onFalse = new ArrayList<GraphTargetItem>();
|
||||
if (lopFalse != null) {
|
||||
onFalse.add(lopFalse);
|
||||
if ((!onTrue.isEmpty()) && onTrue.get(onTrue.size() - 1) instanceof ExitItem) {
|
||||
next = part.nextParts.get(0);
|
||||
} else {
|
||||
if (debugMode) {
|
||||
System.err.println("ONFALSE: (inside " + part + ")");
|
||||
}
|
||||
if ((next == part.nextParts.get(0)) || (part.nextParts.get(0).path.equals(part.path) || part.nextParts.get(0).path.length() < part.path.length())) {
|
||||
onFalse = new ArrayList<GraphTargetItem>();
|
||||
if (lopFalse != null) {
|
||||
onFalse.add(lopFalse);
|
||||
} else {
|
||||
onFalse = (printGraph(prepareBranchLocalData(localData), falseStack, allParts, part, part.nextParts.get(0), next == null ? stopPart : next, loops, forFinalCommands));
|
||||
}
|
||||
if (debugMode) {
|
||||
System.err.println("/ONFALSE (inside " + part + ")");
|
||||
if (debugMode) {
|
||||
System.err.println("ONFALSE: (inside " + part + ")");
|
||||
}
|
||||
if ((next == part.nextParts.get(0)) || (part.nextParts.get(0).path.equals(part.path) || part.nextParts.get(0).path.length() < part.path.length())) {
|
||||
onFalse = new ArrayList<GraphTargetItem>();
|
||||
} else {
|
||||
onFalse = (printGraph(prepareBranchLocalData(localData), falseStack, allParts, part, part.nextParts.get(0), next == null ? stopPart : next, loops, forFinalCommands));
|
||||
}
|
||||
if (debugMode) {
|
||||
System.err.println("/ONFALSE (inside " + part + ")");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isEmpty(onTrue) && isEmpty(onFalse) && (trueStack.size() > stackSizeBefore) && (falseStack.size() > stackSizeBefore)) {
|
||||
|
||||
Reference in New Issue
Block a user