mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-06-12 16:12:14 +00:00
format proxy code, allow to change swf on the fly
This commit is contained in:
@@ -79,6 +79,7 @@ import com.jpexs.decompiler.flash.exporters.settings.ShapeExportSettings;
|
||||
import com.jpexs.decompiler.flash.exporters.settings.SoundExportSettings;
|
||||
import com.jpexs.decompiler.flash.exporters.settings.TextExportSettings;
|
||||
import com.jpexs.decompiler.flash.exporters.shape.CanvasShapeExporter;
|
||||
import com.jpexs.decompiler.flash.helpers.SWFDecompilerPlugin;
|
||||
import com.jpexs.decompiler.flash.helpers.collections.MyEntry;
|
||||
import com.jpexs.decompiler.flash.tags.ABCContainerTag;
|
||||
import com.jpexs.decompiler.flash.tags.DefineButton2Tag;
|
||||
@@ -572,6 +573,8 @@ public final class SWF implements TreeItem, Timelined {
|
||||
assignClassesToSymbols();
|
||||
findFileAttributes();
|
||||
findABCTags();
|
||||
|
||||
SWFDecompilerPlugin.fireSwfParsed(this);
|
||||
} else {
|
||||
boolean hasNonUnknownTag = false;
|
||||
for (Tag tag : tags) {
|
||||
|
||||
@@ -53,6 +53,7 @@ import com.jpexs.decompiler.flash.abc.usages.MethodParamsMultinameUsage;
|
||||
import com.jpexs.decompiler.flash.abc.usages.MethodReturnTypeMultinameUsage;
|
||||
import com.jpexs.decompiler.flash.abc.usages.MultinameUsage;
|
||||
import com.jpexs.decompiler.flash.abc.usages.TypeNameMultinameUsage;
|
||||
import com.jpexs.decompiler.flash.helpers.SWFDecompilerPlugin;
|
||||
import com.jpexs.decompiler.flash.helpers.collections.MyEntry;
|
||||
import com.jpexs.decompiler.flash.tags.ABCContainerTag;
|
||||
import com.jpexs.helpers.MemoryInputStream;
|
||||
@@ -561,6 +562,8 @@ public class ABC {
|
||||
method_info.get(mb.method_info).setBody(mb);
|
||||
bodyIdxFromMethodIdx.set(mb.method_info, i);
|
||||
ais.endDumpLevel();
|
||||
|
||||
SWFDecompilerPlugin.fireMethodBodyParsed(mb, swf);
|
||||
}
|
||||
loadNamespaceMap();
|
||||
/*for(int i=0;i<script_count;i++){
|
||||
@@ -574,6 +577,8 @@ public class ABC {
|
||||
System.out.println(""+t.toString());
|
||||
}
|
||||
System.exit(0);*/
|
||||
|
||||
SWFDecompilerPlugin.fireAbcParsed(this, swf);
|
||||
}
|
||||
|
||||
public void saveToStream(OutputStream os) throws IOException {
|
||||
|
||||
@@ -472,6 +472,11 @@ public class ActionDeobfuscator implements SWFDecompilerListener {
|
||||
return results;
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] proxyFileCatched(byte[] data) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void swfParsed(SWF swf) {
|
||||
}
|
||||
|
||||
@@ -188,6 +188,11 @@ public class ActionDeobfuscatorSimple implements SWFDecompilerListener {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] proxyFileCatched(byte[] data) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void swfParsed(SWF swf) {
|
||||
}
|
||||
|
||||
@@ -27,6 +27,8 @@ import com.jpexs.decompiler.flash.action.ActionList;
|
||||
*/
|
||||
public interface SWFDecompilerListener {
|
||||
|
||||
byte[] proxyFileCatched(byte[] data);
|
||||
|
||||
void swfParsed(SWF swf);
|
||||
|
||||
void actionListParsed(ActionList actions, SWF swf);
|
||||
|
||||
@@ -80,6 +80,22 @@ public class SWFDecompilerPlugin {
|
||||
}
|
||||
}
|
||||
|
||||
public static byte[] fireProxyFileCatched(byte[] data) {
|
||||
byte[] result = null;
|
||||
for (SWFDecompilerListener listener : listeners) {
|
||||
try {
|
||||
byte[] newResult = listener.proxyFileCatched(data);
|
||||
if (newResult != null) {
|
||||
result = newResult;
|
||||
data = newResult;
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
logger.log(Level.SEVERE, "Failed to call plugin method proxyFileCatched.", e);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public static boolean fireSwfParsed(SWF swf) {
|
||||
for (SWFDecompilerListener listener : listeners) {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user