mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-06-24 13:35:47 +00:00
AS3: insert instruction fix for try
This commit is contained in:
@@ -1847,16 +1847,16 @@ public class AVM2Code implements Cloneable {
|
||||
* @param pos
|
||||
* @param instruction
|
||||
*/
|
||||
public void insertInstruction(int pos, AVM2Instruction instruction) {
|
||||
insertInstruction(pos, instruction, true, false);
|
||||
public void insertInstruction(int pos, AVM2Instruction instruction, MethodBody body) {
|
||||
insertInstruction(pos, instruction, true, false, body);
|
||||
}
|
||||
|
||||
public void replaceInstruction(int idx, AVM2Instruction ins, MethodBody body) {
|
||||
insertInstruction(idx, ins, true, true);
|
||||
insertInstruction(idx, ins, true, true, body);
|
||||
removeInstruction(idx + 1, body);
|
||||
}
|
||||
|
||||
public void insertInstruction(int pos, AVM2Instruction instruction, boolean preRefsToThis, boolean postRefsToThis) {
|
||||
public void insertInstruction(int pos, AVM2Instruction instruction, boolean preRefsToThis, boolean postRefsToThis, MethodBody body) {
|
||||
if (pos < 0) {
|
||||
pos = 0;
|
||||
}
|
||||
@@ -1870,6 +1870,18 @@ public class AVM2Code implements Cloneable {
|
||||
instruction.offset = code.get(pos).offset;
|
||||
}
|
||||
|
||||
for (ABCException ex : body.exceptions) {
|
||||
if (ex.start > instruction.offset) {
|
||||
ex.start += byteCount;
|
||||
}
|
||||
if (ex.end > instruction.offset) {
|
||||
ex.end += byteCount;
|
||||
}
|
||||
if (ex.target > instruction.offset) {
|
||||
ex.target += byteCount;
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
for (int i = 0; i < pos; i++) {
|
||||
if (code.get(i).definition instanceof LookupSwitchIns) {
|
||||
|
||||
@@ -178,7 +178,7 @@ public class AVM2DeobfuscatorSimple implements SWFDecompilerListener {
|
||||
}
|
||||
AVM2Instruction ins = makePush(graphTargetItem.getResult(), cpool);
|
||||
if (ins != null) {
|
||||
code.insertInstruction(i + (idelta++), ins);
|
||||
code.insertInstruction(i + (idelta++), ins, body);
|
||||
//prevAction = ins;
|
||||
} else {
|
||||
throw new TranslateException("Cannot push: " + graphTargetItem);
|
||||
@@ -188,7 +188,7 @@ public class AVM2DeobfuscatorSimple implements SWFDecompilerListener {
|
||||
}
|
||||
|
||||
AVM2Instruction jump = new AVM2Instruction(0, new JumpIns(), new int[]{0});
|
||||
code.insertInstruction(i + (idelta++), jump);
|
||||
code.insertInstruction(i + (idelta++), jump, body);
|
||||
|
||||
jump.operands[0] = ((int) (target.offset - jump.offset - jump.getBytes().length));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user