mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-06-12 01:54:18 +00:00
Fixed: Correct AS/P-code matching in editor for AS3 after using deobfuscation
This commit is contained in:
@@ -2937,4 +2937,10 @@ public class AVM2Code implements Cloneable {
|
||||
throw new RuntimeException();
|
||||
}
|
||||
}
|
||||
|
||||
public void markVirtualAddresses() {
|
||||
for (AVM2Instruction ins : code) {
|
||||
ins.setVirtualAddress(ins.getAddress());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,6 +63,8 @@ public class AVM2Instruction implements Cloneable, GraphSourceItem {
|
||||
|
||||
private String file;
|
||||
|
||||
private long virtualAddress = -1;
|
||||
|
||||
@Override
|
||||
public long getFileOffset() {
|
||||
return -1;
|
||||
@@ -530,4 +532,13 @@ public class AVM2Instruction implements Cloneable, GraphSourceItem {
|
||||
body.setModified();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getVirtualAddress() {
|
||||
return virtualAddress;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setVirtualAddress(long virtualAddress) {
|
||||
this.virtualAddress = virtualAddress;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,8 @@
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library.
|
||||
* License along with this library.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.abc.types;
|
||||
|
||||
import com.jpexs.decompiler.flash.SWFInputStream;
|
||||
@@ -384,6 +385,7 @@ public final class MethodBody implements Cloneable {
|
||||
public MethodBody convertMethodBody(ConvertData convertData, String path, boolean isStatic, int scriptIndex, int classIndex, ABC abc, Trait trait, ScopeStack scopeStack, boolean isStaticInitializer, List<DottedChain> fullyQualifiedNames, List<Traits> initTraits) throws InterruptedException {
|
||||
MethodBody body = clone();
|
||||
AVM2Code code = body.getCode();
|
||||
code.markVirtualAddresses();
|
||||
code.fixJumps(path, body);
|
||||
|
||||
if (convertData.deobfuscationMode != 0) {
|
||||
|
||||
@@ -127,6 +127,8 @@ public abstract class Action implements GraphSourceItem {
|
||||
|
||||
private long address;
|
||||
|
||||
private long virtualAddress = -1;
|
||||
|
||||
@Override
|
||||
public long getLineOffset() {
|
||||
return fileOffset;
|
||||
@@ -1232,4 +1234,14 @@ public abstract class Action implements GraphSourceItem {
|
||||
public String getFile() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getVirtualAddress() {
|
||||
return virtualAddress;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setVirtualAddress(long virtualAddress) {
|
||||
this.virtualAddress = virtualAddress;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,8 @@
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library.
|
||||
* License along with this library.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.helpers;
|
||||
|
||||
import com.jpexs.decompiler.flash.configuration.Configuration;
|
||||
@@ -201,7 +202,12 @@ public class HighlightedTextWriter extends GraphTextWriter {
|
||||
HighlightData ndata = new HighlightData();
|
||||
ndata.merge(itemPos.data);
|
||||
ndata.merge(data);
|
||||
ndata.merge(data);
|
||||
long virtualAddress = src.getVirtualAddress();
|
||||
if (virtualAddress != -1) {
|
||||
ndata.offset = virtualAddress + pos;
|
||||
} else {
|
||||
ndata.offset = src.getAddress() + pos;
|
||||
}
|
||||
ndata.fileOffset = src.getFileOffset();
|
||||
if (itemPos.startLineItem != null) {
|
||||
ndata.firstLineOffset = itemPos.startLineItem.getLineOffset();
|
||||
|
||||
@@ -59,4 +59,20 @@ public interface GraphSourceItem extends Serializable, Cloneable {
|
||||
public String getFile();
|
||||
|
||||
public abstract int getBytesLength();
|
||||
|
||||
/**
|
||||
* Gets virtual address. A virtual adress can be used for storing original
|
||||
* address before applying deobfuscation
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public long getVirtualAddress();
|
||||
|
||||
/**
|
||||
* Sets virtual address. A virtual adress can be used for storing original
|
||||
* address before applying deobfuscation
|
||||
*
|
||||
* @param virtualAddress
|
||||
*/
|
||||
public void setVirtualAddress(long virtualAddress);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user