format proxy code, allow to change swf on the fly

This commit is contained in:
honfika@gmail.com
2014-09-01 16:56:55 +02:00
parent 8325d07b24
commit ed53ba9d0f
37 changed files with 1847 additions and 2267 deletions

View File

@@ -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) {

View File

@@ -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 {

View File

@@ -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) {
}

View File

@@ -188,6 +188,11 @@ public class ActionDeobfuscatorSimple implements SWFDecompilerListener {
}
}
@Override
public byte[] proxyFileCatched(byte[] data) {
return null;
}
@Override
public void swfParsed(SWF swf) {
}

View File

@@ -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);

View File

@@ -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 {