mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-06-24 22:46:14 +00:00
some FindBugs refactorings (partially)
This commit is contained in:
@@ -68,10 +68,12 @@ public class Configuration {
|
||||
if (replacements.isEmpty()) {
|
||||
File rf = new File(replacementsFile);
|
||||
if (rf.exists()) {
|
||||
rf.delete();
|
||||
if (!rf.delete()) {
|
||||
Logger.getLogger(Configuration.class.getName()).log(Level.SEVERE, "Cannot delete replacements file");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
try (PrintWriter pw = new PrintWriter(new FileWriter(replacementsFile))) {
|
||||
try (PrintWriter pw = new PrintWriter(new OutputStreamWriter(new FileOutputStream(replacementsFile), "utf-8"))) {
|
||||
for (Replacement r : replacements) {
|
||||
pw.println(r.urlPattern);
|
||||
pw.println(r.targetFile);
|
||||
@@ -90,7 +92,7 @@ public class Configuration {
|
||||
return;
|
||||
}
|
||||
replacements = new ArrayList<>();
|
||||
try (BufferedReader br = new BufferedReader(new FileReader(replacementsFile))) {
|
||||
try (BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(replacementsFile), "utf-8"))) {
|
||||
String s;
|
||||
while ((s = br.readLine()) != null) {
|
||||
Replacement r = new Replacement(s, br.readLine());
|
||||
|
||||
@@ -67,7 +67,6 @@ import com.jpexs.decompiler.flash.tags.DefineVideoStreamTag;
|
||||
import com.jpexs.decompiler.flash.tags.DoInitActionTag;
|
||||
import com.jpexs.decompiler.flash.tags.ExportAssetsTag;
|
||||
import com.jpexs.decompiler.flash.tags.FileAttributesTag;
|
||||
import com.jpexs.decompiler.flash.tags.JPEGTablesTag;
|
||||
import com.jpexs.decompiler.flash.tags.PlaceObjectTypeTag;
|
||||
import com.jpexs.decompiler.flash.tags.SetBackgroundColorTag;
|
||||
import com.jpexs.decompiler.flash.tags.ShowFrameTag;
|
||||
@@ -109,6 +108,7 @@ import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
import java.util.Stack;
|
||||
@@ -270,7 +270,7 @@ public class SWF {
|
||||
public SWF(InputStream is, PercentListener listener, boolean paralelRead) throws IOException {
|
||||
byte hdr[] = new byte[3];
|
||||
is.read(hdr);
|
||||
String shdr = new String(hdr);
|
||||
String shdr = new String(hdr, "utf-8");
|
||||
if ((!shdr.equals("FWS")) && (!shdr.equals("CWS")) && (!shdr.equals("ZWS"))) {
|
||||
throw new IOException("Invalid SWF file");
|
||||
}
|
||||
@@ -285,7 +285,7 @@ public class SWF {
|
||||
|
||||
if (hdr[0] == 'Z') {
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
long outSize = sis.readUI32();
|
||||
sis.readUI32(); //outSize
|
||||
int propertiesSize = 5;
|
||||
lzmaProperties = new byte[propertiesSize];
|
||||
if (sis.read(lzmaProperties, 0, propertiesSize) != propertiesSize) {
|
||||
@@ -311,7 +311,7 @@ public class SWF {
|
||||
sis.setPercentMax(fileSize);
|
||||
displayRect = sis.readRECT();
|
||||
// FIXED8 (16 bit fixed point) frameRate
|
||||
int tmpFirstByetOfFrameRate = sis.readUI8();
|
||||
sis.readUI8(); //tmpFirstByetOfFrameRate
|
||||
frameRate = sis.readUI8();
|
||||
frameCount = sis.readUI16();
|
||||
tags = sis.readTagList(0, paralelRead);
|
||||
@@ -406,13 +406,13 @@ public class SWF {
|
||||
try {
|
||||
byte hdr[] = new byte[3];
|
||||
fis.read(hdr);
|
||||
String shdr = new String(hdr);
|
||||
String shdr = new String(hdr, "utf-8");
|
||||
if (shdr.equals("CWS")) {
|
||||
int version = fis.read();
|
||||
SWFInputStream sis = new SWFInputStream(fis, version, 4);
|
||||
long fileSize = sis.readUI32();
|
||||
SWFOutputStream sos = new SWFOutputStream(fos, version);
|
||||
sos.write("FWS".getBytes());
|
||||
sos.write("FWS".getBytes("utf-8"));
|
||||
sos.writeUI8(version);
|
||||
sos.writeUI32(fileSize);
|
||||
InflaterInputStream iis = new InflaterInputStream(fis);
|
||||
@@ -429,7 +429,7 @@ public class SWF {
|
||||
long fileSize = sis.readUI32();
|
||||
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
long outSize = sis.readUI32();
|
||||
sis.readUI32(); //outSize
|
||||
int propertiesSize = 5;
|
||||
byte lzmaProperties[] = new byte[propertiesSize];
|
||||
if (sis.read(lzmaProperties, 0, propertiesSize) != propertiesSize) {
|
||||
@@ -444,7 +444,7 @@ public class SWF {
|
||||
throw new IOException("LZMA:Error in data stream");
|
||||
}
|
||||
try (SWFOutputStream sos = new SWFOutputStream(fos, version)) {
|
||||
sos.write("FWS".getBytes());
|
||||
sos.write("FWS".getBytes("utf-8"));
|
||||
sos.write(version);
|
||||
sos.writeUI32(fileSize);
|
||||
sos.write(baos.toByteArray());
|
||||
@@ -657,9 +657,9 @@ public class SWF {
|
||||
if (ret.get(i).tag instanceof DefineButton2Tag) {
|
||||
((DefineButton2Tag) ret.get(i).tag).exportAssetsTags = exportAssetsTags;
|
||||
}
|
||||
if (ret.get(i).tag instanceof DoInitActionTag) {
|
||||
//((DoInitActionTag) ret.get(i).tag).exportAssetsTags = exportAssetsTags;
|
||||
}
|
||||
/*if (ret.get(i).tag instanceof DoInitActionTag) {
|
||||
//((DoInitActionTag) ret.get(i).tag).exportAssetsTags = exportAssetsTags;
|
||||
}*/
|
||||
if (ret.get(i).tag instanceof ASMSource) {
|
||||
ASMSource ass = (ASMSource) ret.get(i).tag;
|
||||
if (ass.containsSource()) {
|
||||
@@ -758,11 +758,6 @@ public class SWF {
|
||||
boolean mp3 = true;
|
||||
boolean wave = true;
|
||||
ByteArrayOutputStream fos = new ByteArrayOutputStream();
|
||||
int id = 0;
|
||||
if (t instanceof DefineSoundTag) {
|
||||
id = ((DefineSoundTag) t).soundId;
|
||||
}
|
||||
|
||||
|
||||
if (t instanceof DefineSoundTag) {
|
||||
DefineSoundTag st = (DefineSoundTag) t;
|
||||
@@ -843,20 +838,20 @@ public class SWF {
|
||||
writeLE(subChunk1Data, bitsPerSample, 2);
|
||||
|
||||
ByteArrayOutputStream chunks = new ByteArrayOutputStream();
|
||||
chunks.write("fmt ".getBytes());
|
||||
chunks.write("fmt ".getBytes("utf-8"));
|
||||
byte subChunk1DataBytes[] = subChunk1Data.toByteArray();
|
||||
writeLE(chunks, subChunk1DataBytes.length, 4);
|
||||
chunks.write(subChunk1DataBytes);
|
||||
|
||||
|
||||
chunks.write("data".getBytes());
|
||||
chunks.write("data".getBytes("utf-8"));
|
||||
writeLE(chunks, pcmData.length, 4);
|
||||
chunks.write(pcmData);
|
||||
|
||||
fos.write("RIFF".getBytes());
|
||||
fos.write("RIFF".getBytes("utf-8"));
|
||||
byte chunkBytes[] = chunks.toByteArray();
|
||||
writeLE(fos, 4 + chunkBytes.length, 4);
|
||||
fos.write("WAVE".getBytes());
|
||||
fos.write("WAVE".getBytes("utf-8"));
|
||||
fos.write(chunkBytes);
|
||||
//size1=>16bit*/
|
||||
} finally {
|
||||
@@ -876,9 +871,10 @@ public class SWF {
|
||||
return ret;
|
||||
}
|
||||
if (!(new File(outdir)).exists()) {
|
||||
(new File(outdir)).mkdirs();
|
||||
if (!(new File(outdir)).mkdirs()) {
|
||||
throw new IOException("Cannot create directory " + outdir);
|
||||
}
|
||||
}
|
||||
List<Object> os = new ArrayList<Object>(this.tags);
|
||||
for (Tag t : tags) {
|
||||
FileOutputStream fos = null;
|
||||
File file = null;
|
||||
@@ -903,9 +899,10 @@ public class SWF {
|
||||
} else {
|
||||
file = new File(outdir + File.separator + st.getCharacterExportFileName() + ".flv");
|
||||
fos = new FileOutputStream(file);
|
||||
FLVOutputStream flv = new FLVOutputStream(fos);
|
||||
flv.writeHeader(true, false);
|
||||
flv.writeTag(new FLVTAG(0, new AUDIODATA(st.soundFormat, st.soundRate, st.soundSize, st.soundType, st.soundData)));
|
||||
try (FLVOutputStream flv = new FLVOutputStream(fos)) {
|
||||
flv.writeHeader(true, false);
|
||||
flv.writeTag(new FLVTAG(0, new AUDIODATA(st.soundFormat, st.soundRate, st.soundSize, st.soundType, st.soundData)));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (t instanceof SoundStreamHeadTypeTag) {
|
||||
@@ -949,7 +946,7 @@ public class SWF {
|
||||
if (fos != null) {
|
||||
try {
|
||||
fos.close();
|
||||
} catch (Exception ex) {
|
||||
} catch (Exception ignore) {
|
||||
//ignore
|
||||
}
|
||||
}
|
||||
@@ -968,12 +965,9 @@ public class SWF {
|
||||
|
||||
|
||||
|
||||
long fileSize = 0;
|
||||
|
||||
//double ms = 1000.0f / ((float) frameRate);
|
||||
|
||||
ByteArrayOutputStream fos = new ByteArrayOutputStream();
|
||||
fos = new ByteArrayOutputStream();
|
||||
//CopyOutputStream cos = new CopyOutputStream(fos, new FileInputStream("f:\\trunk\\testdata\\xfl\\xfl\\_obj\\streamvideo 7.flv"));
|
||||
OutputStream tos = fos;
|
||||
FLVOutputStream flv = new FLVOutputStream(tos);
|
||||
@@ -1000,19 +994,19 @@ public class SWF {
|
||||
} else {
|
||||
frameType = 2; //inter
|
||||
}
|
||||
int qp = (int) sis.readUB(6);
|
||||
sis.readUB(6); //qp
|
||||
int marker = (int) sis.readUB(1);
|
||||
if (frameMode == 0) {
|
||||
int version = (int) sis.readUB(5);
|
||||
int version2 = (int) sis.readUB(2);
|
||||
boolean interlace = sis.readUB(1) == 1;//interlace
|
||||
sis.readUB(1);//interlace
|
||||
if (marker == 1 || version2 == 0) {
|
||||
sis.readUI16();//offset
|
||||
}
|
||||
int dim_y = sis.readUI8();
|
||||
int dim_x = sis.readUI8();
|
||||
int render_y = sis.readUI8();
|
||||
int render_x = sis.readUI8();
|
||||
sis.readUI8(); //render_y
|
||||
sis.readUI8(); //render_x
|
||||
horizontalAdjustment = (int) (dim_x * Math.ceil(((double) videoStream.width) / (double) dim_x)) - videoStream.width;
|
||||
verticalAdjustment = (int) (dim_y * Math.ceil(((double) videoStream.height) / (double) dim_y)) - videoStream.height;
|
||||
|
||||
@@ -1053,7 +1047,6 @@ public class SWF {
|
||||
baos.write(tag.videoData);
|
||||
flv.writeTag(new FLVTAG((int) Math.floor(i * 1000.0f / ((float) frameRate)), new VIDEODATA(frameType, videoStream.codecID, baos.toByteArray())));
|
||||
}
|
||||
fileSize = fos.toByteArray().length;
|
||||
return fos.toByteArray();
|
||||
}
|
||||
|
||||
@@ -1063,7 +1056,9 @@ public class SWF {
|
||||
return ret;
|
||||
}
|
||||
if (!(new File(outdir)).exists()) {
|
||||
(new File(outdir)).mkdirs();
|
||||
if (!(new File(outdir)).mkdirs()) {
|
||||
throw new IOException("Cannot create directory " + outdir);
|
||||
}
|
||||
}
|
||||
for (Tag t : tags) {
|
||||
if (t instanceof DefineVideoStreamTag) {
|
||||
@@ -1083,7 +1078,9 @@ public class SWF {
|
||||
return ret;
|
||||
}
|
||||
if (!(new File(outdir)).exists()) {
|
||||
(new File(outdir)).mkdirs();
|
||||
if (!(new File(outdir)).mkdirs()) {
|
||||
throw new IOException("Cannot create directory " + outdir);
|
||||
}
|
||||
}
|
||||
for (Tag t : tags) {
|
||||
if (t instanceof TextTag) {
|
||||
@@ -1111,7 +1108,9 @@ public class SWF {
|
||||
return ret;
|
||||
}
|
||||
if (!(new File(outdir)).exists()) {
|
||||
(new File(outdir)).mkdirs();
|
||||
if (!(new File(outdir)).mkdirs()) {
|
||||
throw new IOException("Cannot create directory " + outdir);
|
||||
}
|
||||
}
|
||||
for (Tag t : tags) {
|
||||
if (t instanceof ShapeTag) {
|
||||
@@ -1121,7 +1120,7 @@ public class SWF {
|
||||
}
|
||||
File file = new File(outdir + File.separator + characterID + ".svg");
|
||||
try (FileOutputStream fos = new FileOutputStream(file)) {
|
||||
fos.write(((ShapeTag) t).toSVG().getBytes());
|
||||
fos.write(((ShapeTag) t).toSVG().getBytes("utf-8"));
|
||||
}
|
||||
ret.add(file);
|
||||
}
|
||||
@@ -1135,14 +1134,13 @@ public class SWF {
|
||||
return ret;
|
||||
}
|
||||
if (!(new File(outdir)).exists()) {
|
||||
(new File(outdir)).mkdirs();
|
||||
if (!(new File(outdir)).mkdirs()) {
|
||||
throw new IOException("Cannot create directory " + outdir);
|
||||
}
|
||||
}
|
||||
for (Tag t : tags) {
|
||||
if (t instanceof DefineBinaryDataTag) {
|
||||
int characterID = 0;
|
||||
if (t instanceof CharacterTag) {
|
||||
characterID = ((CharacterTag) t).getCharacterID();
|
||||
}
|
||||
int characterID = ((DefineBinaryDataTag) t).getCharacterID();
|
||||
File file = new File(outdir + File.separator + characterID + ".bin");
|
||||
try (FileOutputStream fos = new FileOutputStream(file)) {
|
||||
fos.write(((DefineBinaryDataTag) t).binaryData);
|
||||
@@ -1159,12 +1157,14 @@ public class SWF {
|
||||
return ret;
|
||||
}
|
||||
if (!(new File(outdir)).exists()) {
|
||||
(new File(outdir)).mkdirs();
|
||||
if (!(new File(outdir)).mkdirs()) {
|
||||
throw new IOException("Cannot create directory " + outdir);
|
||||
}
|
||||
}
|
||||
for (Tag t : tags) {
|
||||
if (t instanceof ImageTag) {
|
||||
File file = new File(outdir + File.separator + ((ImageTag) t).getCharacterID() + "." + ((ImageTag) t).getImageFormat());
|
||||
ImageIO.write(((ImageTag) t).getImage(this.tags), ((ImageTag) t).getImageFormat().toUpperCase(), file);
|
||||
ImageIO.write(((ImageTag) t).getImage(this.tags), ((ImageTag) t).getImageFormat().toUpperCase(Locale.ENGLISH), file);
|
||||
ret.add(file);
|
||||
}
|
||||
}
|
||||
@@ -1172,12 +1172,6 @@ public class SWF {
|
||||
}
|
||||
|
||||
public void exportImages(String outdir) throws IOException {
|
||||
JPEGTablesTag jtt = null;
|
||||
for (Tag t : tags) {
|
||||
if (t instanceof JPEGTablesTag) {
|
||||
jtt = (JPEGTablesTag) t;
|
||||
}
|
||||
}
|
||||
exportImages(outdir, tags);
|
||||
}
|
||||
|
||||
@@ -1232,7 +1226,7 @@ public class SWF {
|
||||
c = "" + fooJoinCharacters.charAt(rnd.nextInt(fooJoinCharacters.length()));
|
||||
}
|
||||
if (i == 0 && firstUppercase) {
|
||||
c = c.toUpperCase();
|
||||
c = c.toUpperCase(Locale.ENGLISH);
|
||||
}
|
||||
ret += c;
|
||||
}
|
||||
@@ -1313,14 +1307,12 @@ public class SWF {
|
||||
return null;
|
||||
}
|
||||
|
||||
private static void getVariables(ConstantPool constantPool, List<Object> localData, Stack<GraphTargetItem> stack, List<GraphTargetItem> output, ActionGraphSource code, int ip, int lastIp, HashMap<DirectValueTreeItem, ConstantPool> variables, List<GraphSourceItem> functions, HashMap<DirectValueTreeItem, ConstantPool> strings, List<Integer> visited, HashMap<DirectValueTreeItem, String> usageTypes) {
|
||||
private static void getVariables(ConstantPool constantPool, List<Object> localData, Stack<GraphTargetItem> stack, List<GraphTargetItem> output, ActionGraphSource code, int ip, HashMap<DirectValueTreeItem, ConstantPool> variables, List<GraphSourceItem> functions, HashMap<DirectValueTreeItem, ConstantPool> strings, List<Integer> visited, HashMap<DirectValueTreeItem, String> usageTypes) {
|
||||
boolean debugMode = false;
|
||||
while ((ip > -1) && ip < code.size()) {
|
||||
if (visited.contains(ip)) {
|
||||
break;
|
||||
}
|
||||
|
||||
lastIp = ip;
|
||||
GraphSourceItem ins = code.get(ip);
|
||||
|
||||
if (debugMode) {
|
||||
@@ -1447,7 +1439,7 @@ public class SWF {
|
||||
@SuppressWarnings("unchecked")
|
||||
Stack<GraphTargetItem> brStack = (Stack<GraphTargetItem>) stack.clone();
|
||||
if (b >= 0) {
|
||||
getVariables(constantPool, localData, brStack, output, code, b, ip, variables, functions, strings, visited, usageTypes);
|
||||
getVariables(constantPool, localData, brStack, output, code, b, variables, functions, strings, visited, usageTypes);
|
||||
} else {
|
||||
if (debugMode) {
|
||||
System.out.println("Negative branch:" + b);
|
||||
@@ -1464,7 +1456,7 @@ public class SWF {
|
||||
private static void getVariables(HashMap<DirectValueTreeItem, ConstantPool> variables, List<GraphSourceItem> functions, HashMap<DirectValueTreeItem, ConstantPool> strings, HashMap<DirectValueTreeItem, String> usageType, ActionGraphSource code, int addr) {
|
||||
List<Object> localData = Helper.toList(new HashMap<Integer, String>(), new HashMap<String, GraphTargetItem>(), new HashMap<String, GraphTargetItem>());
|
||||
try {
|
||||
getVariables(null, localData, new Stack<GraphTargetItem>(), new ArrayList<GraphTargetItem>(), code, code.adr2pos(addr), 0, variables, functions, strings, new ArrayList<Integer>(), usageType);
|
||||
getVariables(null, localData, new Stack<GraphTargetItem>(), new ArrayList<GraphTargetItem>(), code, code.adr2pos(addr), variables, functions, strings, new ArrayList<Integer>(), usageType);
|
||||
} catch (Exception ex) {
|
||||
Logger.getLogger(SWF.class.getName()).log(Level.SEVERE, "Getting variables error", ex);
|
||||
}
|
||||
@@ -1801,6 +1793,7 @@ public class SWF {
|
||||
private int width;
|
||||
private int height;
|
||||
private int type;
|
||||
public static final long serialVersionUID = 1L;
|
||||
|
||||
public CachedImage(BufferedImage img) {
|
||||
width = img.getWidth();
|
||||
@@ -1888,9 +1881,6 @@ public class SWF {
|
||||
}
|
||||
CharacterTag character = characters.get(layer.characterId);
|
||||
MATRIX mat = new MATRIX(layer.matrix);
|
||||
if (mat == null) {
|
||||
mat = new MATRIX();
|
||||
}
|
||||
mat.translateX /= 20;
|
||||
mat.translateY /= 20;
|
||||
|
||||
|
||||
@@ -58,6 +58,7 @@ import java.io.PrintStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Scanner;
|
||||
import java.util.Stack;
|
||||
import java.util.concurrent.Callable;
|
||||
@@ -534,7 +535,7 @@ public class SWFInputStream extends InputStream {
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private static void getConstantPool(List<DisassemblyListener> listeners, ConstantPool cpool, List<Object> localData, Stack<GraphTargetItem> stack, List<GraphTargetItem> output, ActionGraphSource code, int ip, int lastIp, List<ConstantPool> constantPools, List<Integer> visited, int version, int endIp) {
|
||||
private static void getConstantPool(List<DisassemblyListener> listeners, ConstantPool cpool, List<Object> localData, Stack<GraphTargetItem> stack, List<GraphTargetItem> output, ActionGraphSource code, int ip, List<ConstantPool> constantPools, List<Integer> visited, int version, int endIp) {
|
||||
boolean debugMode = false;
|
||||
boolean deobfuscate = (Boolean) Configuration.getConfig("autoDeobfuscate", true);
|
||||
while (((endIp == -1) || (endIp > ip)) && (ip > -1) && ip < code.size()) {
|
||||
@@ -544,7 +545,6 @@ public class SWFInputStream extends InputStream {
|
||||
for (int i = 0; i < listeners.size(); i++) {
|
||||
listeners.get(i).progress("constantpool", ip + 1, code.size());
|
||||
}
|
||||
lastIp = ip;
|
||||
GraphSourceItem ins = code.get(ip);
|
||||
if (ins.isIgnored()) {
|
||||
ip++;
|
||||
@@ -564,7 +564,7 @@ public class SWFInputStream extends InputStream {
|
||||
List<Object> localData2 = Helper.toList(new HashMap<Integer, String>(), new HashMap<String, GraphTargetItem>(), new HashMap<String, GraphTargetItem>());
|
||||
List<GraphTargetItem> output2 = new ArrayList<>();
|
||||
output2s.add(output2);
|
||||
getConstantPool(listeners, cpool, localData2, new Stack<GraphTargetItem>(), output2, code, code.adr2pos(endAddr), lastIp, constantPools, visited, version, code.adr2pos(endAddr + size));
|
||||
getConstantPool(listeners, cpool, localData2, new Stack<GraphTargetItem>(), output2, code, code.adr2pos(endAddr), constantPools, visited, version, code.adr2pos(endAddr + size));
|
||||
endAddr += size;
|
||||
}
|
||||
if (deobfuscate) {
|
||||
@@ -666,7 +666,7 @@ public class SWFInputStream extends InputStream {
|
||||
}
|
||||
}
|
||||
stack.pop();
|
||||
getConstantPool(listeners, cpool, localData, stack, output, code, condition ? (code.adr2pos(((ActionIf) ins).getAddress() + ((ActionIf) ins).getBytes(code.version).length + ((ActionIf) ins).getJumpOffset())) : ip + 1, ip, constantPools, visited, version, endIp);
|
||||
getConstantPool(listeners, cpool, localData, stack, output, code, condition ? (code.adr2pos(((ActionIf) ins).getAddress() + ((ActionIf) ins).getBytes(code.version).length + ((ActionIf) ins).getJumpOffset())) : ip + 1, constantPools, visited, version, endIp);
|
||||
} else {
|
||||
if (deobfuscate && ins instanceof ActionIf) {
|
||||
stack.pop();
|
||||
@@ -677,7 +677,7 @@ public class SWFInputStream extends InputStream {
|
||||
@SuppressWarnings("unchecked")
|
||||
Stack<GraphTargetItem> brStack = (Stack<GraphTargetItem>) stack.clone();
|
||||
if (b >= 0) {
|
||||
getConstantPool(listeners, cpool, localData, brStack, output, code, b, ip, constantPools, visited, version, endIp);
|
||||
getConstantPool(listeners, cpool, localData, brStack, output, code, b, constantPools, visited, version, endIp);
|
||||
} else {
|
||||
if (debugMode) {
|
||||
System.out.println("Negative branch:" + b);
|
||||
@@ -701,7 +701,7 @@ public class SWFInputStream extends InputStream {
|
||||
List<ConstantPool> ret = new ArrayList<>();
|
||||
List<Object> localData = Helper.toList(new HashMap<Integer, String>(), new HashMap<String, GraphTargetItem>(), new HashMap<String, GraphTargetItem>());
|
||||
try {
|
||||
getConstantPool(listeners, null, localData, new Stack<GraphTargetItem>(), new ArrayList<GraphTargetItem>(), code, code.adr2pos(addr), 0, ret, new ArrayList<Integer>(), version, -1);
|
||||
getConstantPool(listeners, null, localData, new Stack<GraphTargetItem>(), new ArrayList<GraphTargetItem>(), code, code.adr2pos(addr), ret, new ArrayList<Integer>(), version, -1);
|
||||
} catch (Exception ex) {
|
||||
log.log(Level.SEVERE, "Error during getting constantpool", ex);
|
||||
}
|
||||
@@ -751,7 +751,6 @@ public class SWFInputStream extends InputStream {
|
||||
}
|
||||
last = a;
|
||||
}
|
||||
int len = retdups.size();
|
||||
for (int i = 0; i < retdups.size(); i++) {
|
||||
Action a = retdups.get(i);
|
||||
if (a instanceof ActionEnd) {
|
||||
@@ -763,7 +762,7 @@ public class SWFInputStream extends InputStream {
|
||||
}
|
||||
}
|
||||
|
||||
List<ConstantPool> pools = new ArrayList<>();
|
||||
List<ConstantPool> pools;
|
||||
StringBuilder br = new StringBuilder();
|
||||
for (int i = 0; i < ret.size(); i++) {
|
||||
br.append(i);
|
||||
@@ -810,7 +809,7 @@ public class SWFInputStream extends InputStream {
|
||||
rri.setPos(ip);
|
||||
Action a;
|
||||
long filePos = rri.getPos();
|
||||
Scanner sc = new Scanner(System.in);
|
||||
Scanner sc = new Scanner(System.in, "utf-8");
|
||||
int prevIp = ip;
|
||||
while (((endip == -1) || (endip > ip)) && (a = sis.readAction(rri)) != null) {
|
||||
for (int i = 0; i < listeners.size(); i++) {
|
||||
@@ -827,10 +826,10 @@ public class SWFInputStream extends InputStream {
|
||||
int info = a.actionLength + 1 + ((a.actionCode > 0x80) ? 2 : 0);
|
||||
byte b[] = a.getBytes(sis.version);
|
||||
int infoCorrect = info;
|
||||
if (b.length != infoCorrect) {
|
||||
//throw new RuntimeException("Wrong length "+a.toString()+" info:"+infoCorrect+" actual:"+b.length+" datalen:"+(infoCorrect-info));
|
||||
}
|
||||
int actual = actual = a.getBytes(sis.version).length;
|
||||
/*if (b.length != infoCorrect) {
|
||||
throw new RuntimeException("Wrong length "+a.toString()+" info:"+infoCorrect+" actual:"+b.length+" datalen:"+(infoCorrect-info));
|
||||
}*/
|
||||
//int actual = a.getBytes(sis.version).length;
|
||||
if ((!(a instanceof ActionStore)) && (!(a instanceof GraphSourceItemContainer))) {
|
||||
int change = info - (rri.getPos() - ip);
|
||||
if (change > 0) {
|
||||
@@ -876,8 +875,8 @@ public class SWFInputStream extends InputStream {
|
||||
@SuppressWarnings("unchecked")
|
||||
HashMap<String, GraphTargetItem> vars = (HashMap<String, GraphTargetItem>) localData.get(1);
|
||||
System.err.print("variables: ");
|
||||
for (String v : vars.keySet()) {
|
||||
System.err.print("'" + v + "' = " + Highlighting.stripHilights(vars.get(v).toString(cpool)) + ", ");
|
||||
for (Entry<String, GraphTargetItem> v : vars.entrySet()) {
|
||||
System.err.print("'" + v + "' = " + Highlighting.stripHilights(v.getValue().toString(cpool)) + ", ");
|
||||
}
|
||||
System.err.println();
|
||||
String add = "";
|
||||
@@ -904,7 +903,6 @@ public class SWFInputStream extends InputStream {
|
||||
}
|
||||
cpool.setNew(((ActionConstantPool) a).constantPool);
|
||||
}
|
||||
Action beforeInsert = null;
|
||||
ActionIf aif = null;
|
||||
boolean goaif = false;
|
||||
if (!a.isIgnored()) {
|
||||
@@ -1031,11 +1029,6 @@ public class SWFInputStream extends InputStream {
|
||||
a.setAddress(a.getAddress() + 1, SWF.DEFAULT_VERSION);
|
||||
}
|
||||
|
||||
if (i == 0) {
|
||||
a.beforeInsert = beforeInsert;
|
||||
}
|
||||
} else {
|
||||
a.beforeInsert = beforeInsert;
|
||||
}
|
||||
ret.set(ip + i, a);
|
||||
}
|
||||
@@ -1746,9 +1739,9 @@ public class SWFInputStream extends InputStream {
|
||||
case 0x2A:
|
||||
return new ActionThrow();
|
||||
default:
|
||||
if (actionLength > 0) {
|
||||
//skip(actionLength);
|
||||
}
|
||||
/*if (actionLength > 0) {
|
||||
//skip(actionLength);
|
||||
}*/
|
||||
//throw new UnknownActionException(actionCode);
|
||||
Action r = new ActionNop();
|
||||
r.actionCode = actionCode;
|
||||
|
||||
@@ -316,11 +316,6 @@ public class SWFOutputStream extends OutputStream {
|
||||
* @throws IOException
|
||||
*/
|
||||
public void writeSB(int nBits, long value) throws IOException {
|
||||
long tmp = value & 0x7FFFFFFF;
|
||||
|
||||
if (value < 0) {
|
||||
tmp = tmp | (1L << (nBits - 1));
|
||||
}
|
||||
writeUB(nBits, value);
|
||||
}
|
||||
|
||||
@@ -436,9 +431,9 @@ public class SWFOutputStream extends OutputStream {
|
||||
* @return Number of bits
|
||||
*/
|
||||
public static int getNeededBitsS(int v) {
|
||||
if (v == 0) {
|
||||
//return 0;
|
||||
}
|
||||
/*if (v == 0) {
|
||||
//return 0;
|
||||
}*/
|
||||
int counter = 32;
|
||||
int mask = 0x80000000;
|
||||
final int val = (v < 0) ? -v : v;
|
||||
@@ -456,13 +451,6 @@ public class SWFOutputStream extends OutputStream {
|
||||
return (long) Math.floor(value);
|
||||
}
|
||||
|
||||
private static double getFloatPart(double value) {
|
||||
if (value < 0) {
|
||||
return value - getIntPart(value);
|
||||
}
|
||||
return value + getIntPart(value);
|
||||
}
|
||||
|
||||
public static int unsignedSize(final int value) {
|
||||
|
||||
final int val = (value < 0) ? -value - 1 : value;
|
||||
@@ -490,14 +478,6 @@ public class SWFOutputStream extends OutputStream {
|
||||
return getNeededBitsS(k) + 16;
|
||||
}
|
||||
|
||||
private int enlargeBitCountU(int currentBitCount, int value) {
|
||||
int neededNew = getNeededBitsU(value);
|
||||
if (neededNew > currentBitCount) {
|
||||
return neededNew;
|
||||
}
|
||||
return currentBitCount;
|
||||
}
|
||||
|
||||
private int enlargeBitCountS(int currentBitCount, int value) {
|
||||
int neededNew = getNeededBitsS(value);
|
||||
if (neededNew > currentBitCount) {
|
||||
@@ -506,14 +486,6 @@ public class SWFOutputStream extends OutputStream {
|
||||
return currentBitCount;
|
||||
}
|
||||
|
||||
private int enlargeBitCountF(int currentBitCount, float value) {
|
||||
int neededNew = getNeededBitsF(value);
|
||||
if (neededNew > currentBitCount) {
|
||||
return neededNew;
|
||||
}
|
||||
return currentBitCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes MATRIX value to the stream
|
||||
*
|
||||
@@ -909,31 +881,29 @@ public class SWFOutputStream extends OutputStream {
|
||||
*/
|
||||
public void writeFILTER(FILTER value) throws IOException {
|
||||
writeUI8(value.id);
|
||||
switch (value.id) {
|
||||
case 0:
|
||||
writeDROPSHADOWFILTER((DROPSHADOWFILTER) value);
|
||||
break;
|
||||
case 1:
|
||||
writeBLURFILTER((BLURFILTER) value);
|
||||
break;
|
||||
case 2:
|
||||
writeGLOWFILTER((GLOWFILTER) value);
|
||||
break;
|
||||
case 3:
|
||||
writeBEVELFILTER((BEVELFILTER) value);
|
||||
break;
|
||||
case 4:
|
||||
writeGRADIENTGLOWFILTER((GRADIENTGLOWFILTER) value);
|
||||
break;
|
||||
case 5:
|
||||
writeCONVOLUTIONFILTER((CONVOLUTIONFILTER) value);
|
||||
break;
|
||||
case 6:
|
||||
writeCOLORMATRIXFILTER((COLORMATRIXFILTER) value);
|
||||
break;
|
||||
case 7:
|
||||
writeGRADIENTBEVELFILTER((GRADIENTBEVELFILTER) value);
|
||||
break;
|
||||
if (value instanceof DROPSHADOWFILTER) {
|
||||
writeDROPSHADOWFILTER((DROPSHADOWFILTER) value);
|
||||
}
|
||||
if (value instanceof BLURFILTER) {
|
||||
writeBLURFILTER((BLURFILTER) value);
|
||||
}
|
||||
if (value instanceof GLOWFILTER) {
|
||||
writeGLOWFILTER((GLOWFILTER) value);
|
||||
}
|
||||
if (value instanceof BEVELFILTER) {
|
||||
writeBEVELFILTER((BEVELFILTER) value);
|
||||
}
|
||||
if (value instanceof GRADIENTGLOWFILTER) {
|
||||
writeGRADIENTGLOWFILTER((GRADIENTGLOWFILTER) value);
|
||||
}
|
||||
if (value instanceof CONVOLUTIONFILTER) {
|
||||
writeCONVOLUTIONFILTER((CONVOLUTIONFILTER) value);
|
||||
}
|
||||
if (value instanceof COLORMATRIXFILTER) {
|
||||
writeCOLORMATRIXFILTER((COLORMATRIXFILTER) value);
|
||||
}
|
||||
if (value instanceof GRADIENTBEVELFILTER) {
|
||||
writeGRADIENTBEVELFILTER((GRADIENTBEVELFILTER) value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -40,7 +40,6 @@ import com.jpexs.decompiler.flash.tags.DefineShapeTag;
|
||||
import com.jpexs.decompiler.flash.tags.DefineSpriteTag;
|
||||
import com.jpexs.decompiler.flash.tags.DefineText2Tag;
|
||||
import com.jpexs.decompiler.flash.tags.DefineTextTag;
|
||||
import com.jpexs.decompiler.flash.tags.DoInitActionTag;
|
||||
import com.jpexs.decompiler.flash.tags.ExportAssetsTag;
|
||||
import com.jpexs.decompiler.flash.tags.ShowFrameTag;
|
||||
import com.jpexs.decompiler.flash.tags.Tag;
|
||||
@@ -205,9 +204,9 @@ public class TagNode {
|
||||
if (ret.get(i).tag instanceof DefineButton2Tag) {
|
||||
((DefineButton2Tag) ret.get(i).tag).exportAssetsTags = exportAssetsTags;
|
||||
}
|
||||
if (ret.get(i).tag instanceof DoInitActionTag) {
|
||||
//((DoInitActionTag) ret.get(i).tag).exportAssetsTags = exportAssetsTags;
|
||||
}
|
||||
/*if (ret.get(i).tag instanceof DoInitActionTag) {
|
||||
//((DoInitActionTag) ret.get(i).tag).exportAssetsTags = exportAssetsTags;
|
||||
}*/
|
||||
if (ret.get(i).tag instanceof ASMSource) {
|
||||
ASMSource ass = (ASMSource) ret.get(i).tag;
|
||||
if (ass.containsSource()) {
|
||||
@@ -256,7 +255,9 @@ public class TagNode {
|
||||
if (node.subItems.isEmpty()) {
|
||||
if ((node.tag instanceof ASMSource) && (node.export)) {
|
||||
if (!dir.exists()) {
|
||||
dir.mkdirs();
|
||||
if (!dir.mkdirs()) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
try {
|
||||
String f = outdir + name + ".as";
|
||||
|
||||
@@ -35,7 +35,9 @@ import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.Callable;
|
||||
@@ -62,7 +64,7 @@ public class ABC {
|
||||
public MethodBody bodies[];
|
||||
private int bodyIdxFromMethodIdx[];
|
||||
public long stringOffsets[];
|
||||
public static String IDENT_STRING = " ";
|
||||
public static final String IDENT_STRING = " ";
|
||||
public static final int MINORwithDECIMAL = 17;
|
||||
protected HashSet<EventListener> listeners = new HashSet<>();
|
||||
private static Logger logger = Logger.getLogger(ABC.class.getName());
|
||||
@@ -356,8 +358,7 @@ public class ABC {
|
||||
mb.init_scope_depth = ais.readU30();
|
||||
mb.max_scope_depth = ais.readU30();
|
||||
int code_length = ais.readU30();
|
||||
mb.codeBytes = new byte[code_length];
|
||||
ais.read(mb.codeBytes);
|
||||
mb.codeBytes = ais.readBytes(code_length);
|
||||
try {
|
||||
mb.code = new AVM2Code(new ByteArrayInputStream(mb.codeBytes));
|
||||
} catch (UnknownInstructionCode re) {
|
||||
@@ -473,13 +474,7 @@ public class ABC {
|
||||
aos.writeU30(bodies[i].max_scope_depth);
|
||||
byte codeBytes[] = bodies[i].code.getBytes();
|
||||
aos.writeU30(codeBytes.length);
|
||||
try {
|
||||
aos.write(codeBytes);
|
||||
} catch (NotSameException ex) {
|
||||
System.out.println(bodies[i].code.toString(constants));
|
||||
System.exit(0);
|
||||
return;
|
||||
}
|
||||
aos.write(codeBytes);
|
||||
aos.writeU30(bodies[i].exceptions.length);
|
||||
for (int j = 0; j < bodies[i].exceptions.length; j++) {
|
||||
aos.writeU30(bodies[i].exceptions[j].start);
|
||||
@@ -706,8 +701,8 @@ public class ABC {
|
||||
AtomicInteger cnt = new AtomicInteger(1);
|
||||
for (int i = 0; i < script_info.length; i++) {
|
||||
HashMap<ClassPath, ScriptPack> packs = script_info[i].getPacks(this, i);
|
||||
for (ClassPath path : packs.keySet()) {
|
||||
Future<File> future = executor.submit(new ExportPackTask(cnt, script_info.length, path, packs.get(path), directory, abcList, pcode, abcStr, paralel));
|
||||
for (Entry<ClassPath, ScriptPack> entry : packs.entrySet()) {
|
||||
Future<File> future = executor.submit(new ExportPackTask(cnt, script_info.length, entry.getKey(), entry.getValue(), directory, abcList, pcode, abcStr, paralel));
|
||||
futureResults.add(future);
|
||||
}
|
||||
}
|
||||
@@ -731,7 +726,13 @@ public class ABC {
|
||||
}
|
||||
|
||||
public void dump(OutputStream os) {
|
||||
PrintStream output = new PrintStream(os);
|
||||
PrintStream output;
|
||||
try {
|
||||
output = new PrintStream(os, false, "utf-8");
|
||||
} catch (UnsupportedEncodingException ex) {
|
||||
Logger.getLogger(ABC.class.getName()).log(Level.SEVERE, null, ex);
|
||||
return;
|
||||
}
|
||||
constants.dump(output);
|
||||
for (int i = 0; i < method_info.length; i++) {
|
||||
output.println("MethodInfo[" + i + "]:" + method_info[i].toString(constants, new ArrayList<String>()));
|
||||
@@ -798,7 +799,7 @@ public class ABC {
|
||||
c = "" + fooJoinCharacters.charAt(rnd.nextInt(fooJoinCharacters.length()));
|
||||
}
|
||||
if (i == 0 && firstUppercase) {
|
||||
c = c.toUpperCase();
|
||||
c = c.toUpperCase(Locale.ENGLISH);
|
||||
}
|
||||
ret += c;
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ public class ABCInputStream extends InputStream {
|
||||
private InputStream is;
|
||||
private long bytesRead = 0;
|
||||
private ByteArrayOutputStream bufferOs = null;
|
||||
public static boolean DEBUG_READ = false;
|
||||
public static final boolean DEBUG_READ = false;
|
||||
|
||||
public void startBuffer() {
|
||||
bufferOs = new ByteArrayOutputStream();
|
||||
@@ -225,8 +225,7 @@ public class ABCInputStream extends InputStream {
|
||||
params.add(readU30()); //multiname indices!
|
||||
}
|
||||
} else {
|
||||
System.err.println("Unknown kind of Multiname:0x" + Integer.toHexString(kind));
|
||||
System.exit(1);
|
||||
throw new IOException("Unknown kind of Multiname:0x" + Integer.toHexString(kind));
|
||||
}
|
||||
|
||||
return new Multiname(kind, name_index, namespace_index, namespace_set_index, qname_index, params);
|
||||
|
||||
@@ -101,7 +101,9 @@ public class ScriptPack {
|
||||
String packageName = getPathPackage();
|
||||
File outDir = new File(directory + File.separatorChar + makeDirPath(packageName));
|
||||
if (!outDir.exists()) {
|
||||
outDir.mkdirs();
|
||||
if (!outDir.mkdirs()) {
|
||||
throw new IOException("cannot create directory " + outDir);
|
||||
}
|
||||
}
|
||||
String fileName = outDir.toString() + File.separator + Helper.makeFileName(scriptName) + ".as";
|
||||
File file = new File(fileName);
|
||||
|
||||
@@ -26,7 +26,12 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.IfTypeIns;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.arithmetic.*;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.bitwise.*;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.comparsion.*;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.comparison.EqualsIns;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.comparison.GreaterEqualsIns;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.comparison.GreaterThanIns;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.comparison.LessEqualsIns;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.comparison.LessThanIns;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.comparison.StrictEqualsIns;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.construction.*;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.debug.DebugFileIns;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.debug.DebugIns;
|
||||
@@ -63,6 +68,7 @@ import java.util.logging.Logger;
|
||||
|
||||
public class AVM2Code implements Serializable {
|
||||
|
||||
public static final long serialVersionUID = 1L;
|
||||
private static final boolean DEBUG_MODE = false;
|
||||
public static int toSourceLimit = -1;
|
||||
public ArrayList<AVM2Instruction> code = new ArrayList<>();
|
||||
@@ -669,32 +675,25 @@ public class AVM2Code implements Serializable {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
String s = "";
|
||||
StringBuilder s = new StringBuilder();
|
||||
for (AVM2Instruction instruction : code) {
|
||||
s += instruction.toString() + "\r\n";
|
||||
s.append(instruction.toString());
|
||||
s.append("\r\n");
|
||||
}
|
||||
return s;
|
||||
return s.toString();
|
||||
}
|
||||
|
||||
public String toString(ConstantPool constants) {
|
||||
String s = "";
|
||||
StringBuilder s = new StringBuilder();
|
||||
int i = 0;
|
||||
for (AVM2Instruction instruction : code) {
|
||||
s += Helper.formatAddress(i) + " " + instruction.toString(constants, new ArrayList<String>()) + "\r\n";
|
||||
s.append(Helper.formatAddress(i));
|
||||
s.append(" ");
|
||||
s.append(instruction.toString(constants, new ArrayList<String>()));
|
||||
s.append("\r\n");
|
||||
i++;
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
private static String popStack(Stack<String> stack) {
|
||||
for (int i = stack.size() - 1; i >= 0; i--) {
|
||||
String s = stack.get(i);
|
||||
if (!s.startsWith("//")) {
|
||||
stack.remove(i);
|
||||
return s;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
return s.toString();
|
||||
}
|
||||
|
||||
public String toASMSource(ConstantPool constants, MethodBody body, boolean hex) {
|
||||
@@ -829,130 +828,8 @@ public class AVM2Code implements Serializable {
|
||||
public void invalidateCache() {
|
||||
cacheActual = false;
|
||||
}
|
||||
|
||||
private static String innerStackToString(List<Object> stack) {
|
||||
String ret = "";
|
||||
for (int d = 0; d < stack.size(); d++) {
|
||||
Object o = stack.get(d);
|
||||
ret += o.toString();
|
||||
if (d < stack.size() - 1) {
|
||||
if (!ret.endsWith("\r\n")) {
|
||||
ret += "\r\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
private class Loop {
|
||||
|
||||
public int loopContinue;
|
||||
public int loopBreak;
|
||||
public int continueCount = 0;
|
||||
public int breakCount = 0;
|
||||
|
||||
public Loop(int loopContinue, int loopBreak) {
|
||||
this.loopContinue = loopContinue;
|
||||
this.loopBreak = loopBreak;
|
||||
}
|
||||
}
|
||||
private List<Loop> loopList;
|
||||
private List<Integer> unknownJumps;
|
||||
private List<Integer> finallyJumps;
|
||||
private List<ABCException> parsedExceptions;
|
||||
private List<Integer> ignoredIns;
|
||||
|
||||
private String stripBrackets(String s) {
|
||||
if (s.startsWith("(") && (s.endsWith(")"))) {
|
||||
s = s.substring(1, s.length() - 1);
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
private int checkCatches(ABC abc, ConstantPool constants, MethodInfo method_info[], Stack<TreeItem> stack, Stack<TreeItem> scopeStack, List<TreeItem> output, MethodBody body, int ip) throws ConvertException {
|
||||
/*int newip = ip;
|
||||
loope:
|
||||
for (int e = 0; e < body.exceptions.length; e++) {
|
||||
if (pos2adr(ip) == body.exceptions[e].end) {
|
||||
for (int f = 0; f < e; f++) {
|
||||
if (body.exceptions[e].startServer == body.exceptions[f].startServer) {
|
||||
if (body.exceptions[e].end == body.exceptions[f].end) {
|
||||
continue loope;
|
||||
}
|
||||
}
|
||||
}
|
||||
output.add("}");
|
||||
if (!(code.get(ip).definition instanceof JumpIns)) {
|
||||
throw new ConvertException("No jump to skip catches");
|
||||
}
|
||||
int addrAfterCatches = pos2adr(ip + 1) + code.get(ip).operands[0];
|
||||
int posAfterCatches = adr2pos(addrAfterCatches);
|
||||
for (int g = 0; g < body.exceptions.length; g++) {
|
||||
if (body.exceptions[e].startServer == body.exceptions[g].startServer) {
|
||||
if (body.exceptions[e].end == body.exceptions[g].end) {
|
||||
if (body.exceptions[g].isFinally()) {
|
||||
output.add("finally");
|
||||
} else {
|
||||
output.add("catch(" + body.exceptions[g].getVarName(constants) + ":" + body.exceptions[g].getTypeName(constants) + ")");
|
||||
}
|
||||
output.add("{");
|
||||
|
||||
if (body.exceptions[g].isFinally()) {
|
||||
int jumppos = adr2pos(body.exceptions[g].target) - 1;
|
||||
AVM2Instruction jumpIns = code.get(jumppos);
|
||||
if (!(jumpIns.definition instanceof JumpIns)) {
|
||||
throw new ConvertException("No jump in finally block");
|
||||
}
|
||||
int nextAddr = pos2adr(jumppos + 1) + jumpIns.operands[0];
|
||||
int nextins = adr2pos(nextAddr);
|
||||
int pos = nextins;
|
||||
Integer uj = new Integer(nextins);
|
||||
if (unknownJumps.contains(uj)) {
|
||||
unknownJumps.remove(uj);
|
||||
}
|
||||
int endpos = 0;
|
||||
do {
|
||||
if (code.get(pos).definition instanceof LookupSwitchIns) {
|
||||
if (code.get(pos).operands[0] == 0) {
|
||||
if (adr2pos(pos2adr(pos) + code.get(pos).operands[2]) < pos) {
|
||||
endpos = pos - 1;
|
||||
newip = endpos + 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
pos++;
|
||||
} while (pos < code.size());
|
||||
output.addAll(toSource(stack, scopeStack, abc, constants, method_info, body, nextins, endpos).output);
|
||||
} else {
|
||||
|
||||
int pos = adr2pos(body.exceptions[g].target);
|
||||
int endpos = posAfterCatches - 1;
|
||||
for (int p = pos; p < posAfterCatches; p++) {
|
||||
if (code.get(p).definition instanceof JumpIns) {
|
||||
int nextAddr = pos2adr(p + 1) + code.get(p).operands[0];
|
||||
int nextPos = adr2pos(nextAddr);
|
||||
if (nextPos == posAfterCatches) {
|
||||
endpos = p - 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
Stack cstack = new Stack<TreeItem>();
|
||||
cstack.push("catched " + body.exceptions[g].getVarName(constants));
|
||||
List<Object> outcatch = toSource(cstack, new Stack<TreeItem>(), abc, constants, method_info, body, pos, endpos).output;
|
||||
output.addAll(outcatch);
|
||||
newip = endpos + 1;
|
||||
}
|
||||
output.add("}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return newip;*/
|
||||
return ip;
|
||||
}
|
||||
boolean isCatched = false;
|
||||
|
||||
public boolean isKilled(int regName, int start, int end) {
|
||||
@@ -967,32 +844,6 @@ public class AVM2Code implements Serializable {
|
||||
}
|
||||
private int toSourceCount = 0;
|
||||
|
||||
private int ipOfType(int from, boolean up, Class search, Class skipped, int start, int end) {
|
||||
if (up) {
|
||||
for (int i = from; i >= start; i--) {
|
||||
if (search.isInstance(code.get(i).definition)) {
|
||||
return i;
|
||||
} else if ((skipped != null) && skipped.isInstance(code.get(i).definition)) {
|
||||
//skipped
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (int i = from; i <= end; i++) {
|
||||
if (search.isInstance(code.get(i).definition)) {
|
||||
return i;
|
||||
} else if ((skipped != null) && skipped.isInstance(code.get(i).definition)) {
|
||||
//skipped
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public HashMap<Integer, String> getLocalRegNamesFromDebug(ABC abc) {
|
||||
HashMap<Integer, String> localRegNames = new HashMap<>();
|
||||
for (AVM2Instruction ins : code) {
|
||||
@@ -1052,7 +903,7 @@ public class AVM2Code implements Serializable {
|
||||
String ret = "";
|
||||
int ip = start;
|
||||
try {
|
||||
int addr;
|
||||
//int addr;
|
||||
iploop:
|
||||
while (ip <= end) {
|
||||
|
||||
@@ -1061,9 +912,9 @@ public class AVM2Code implements Serializable {
|
||||
continue;
|
||||
}
|
||||
boolean processTry = processJumps;
|
||||
addr = pos2adr(ip);
|
||||
//addr = pos2adr(ip);
|
||||
int ipfix = fixIPAfterDebugLine(ip);
|
||||
int addrfix = pos2adr(ipfix);
|
||||
//int addrfix = pos2adr(ipfix);
|
||||
int maxend = -1;
|
||||
|
||||
if (ip > end) {
|
||||
@@ -1071,7 +922,7 @@ public class AVM2Code implements Serializable {
|
||||
}
|
||||
|
||||
if (unknownJumps.contains(ip)) {
|
||||
unknownJumps.remove(new Integer(ip));
|
||||
unknownJumps.remove(Integer.valueOf(ip));
|
||||
throw new UnknownJumpException(stack, ip, output);
|
||||
}
|
||||
if (visited[ip]) {
|
||||
@@ -1159,7 +1010,7 @@ public class AVM2Code implements Serializable {
|
||||
}
|
||||
if (insAfter.definition instanceof ConvertBIns) { //SWF compiled with debug contain convert_b
|
||||
ip++;
|
||||
addr = pos2adr(ip);
|
||||
//addr = pos2adr(ip);
|
||||
insAfter = code.get(ip + 1);
|
||||
}
|
||||
|
||||
@@ -1220,7 +1071,7 @@ public class AVM2Code implements Serializable {
|
||||
} while (ins.definition instanceof DupIns);
|
||||
} else if ((ins.definition instanceof ReturnValueIns) || (ins.definition instanceof ReturnVoidIns) || (ins.definition instanceof ThrowIns)) {
|
||||
ins.definition.translate(isStatic, scriptIndex, classIndex, localRegs, stack, scopeStack, constants, ins, method_info, output, body, abc, localRegNames, fullyQualifiedNames);
|
||||
ip = end + 1;
|
||||
//ip = end + 1;
|
||||
break;
|
||||
} else if (ins.definition instanceof NewFunctionIns) {
|
||||
String functionName = "";
|
||||
@@ -1263,7 +1114,7 @@ public class AVM2Code implements Serializable {
|
||||
ins.definition.translate(isStatic, scriptIndex, classIndex, localRegs, stack, scopeStack, constants, ins, method_info, output, body, abc, localRegNames, fullyQualifiedNames);
|
||||
|
||||
ip++;
|
||||
addr = pos2adr(ip);
|
||||
//addr = pos2adr(ip);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1280,11 +1131,11 @@ public class AVM2Code implements Serializable {
|
||||
}
|
||||
|
||||
public String tabString(int len) {
|
||||
String ret = "";
|
||||
StringBuilder ret = new StringBuilder();
|
||||
for (int i = 0; i < len; i++) {
|
||||
ret += ABC.IDENT_STRING;
|
||||
ret.append(ABC.IDENT_STRING);
|
||||
}
|
||||
return ret;
|
||||
return ret.toString();
|
||||
}
|
||||
|
||||
public String toSource(String path, boolean isStatic, int scriptIndex, int classIndex, ABC abc, ConstantPool constants, MethodInfo method_info[], MethodBody body, HashMap<Integer, String> localRegNames, Stack<GraphTargetItem> scopeStack, boolean isStaticInitializer, List<String> fullyQualifiedNames, Traits initTraits) {
|
||||
@@ -1354,10 +1205,7 @@ public class AVM2Code implements Serializable {
|
||||
|
||||
public void initToSource() {
|
||||
toSourceCount = 0;
|
||||
loopList = new ArrayList<>();
|
||||
unknownJumps = new ArrayList<>();
|
||||
finallyJumps = new ArrayList<>();
|
||||
parsedExceptions = new ArrayList<>();
|
||||
ignoredIns = new ArrayList<>();
|
||||
}
|
||||
|
||||
@@ -1368,14 +1216,6 @@ public class AVM2Code implements Serializable {
|
||||
HashMap<Integer, GraphTargetItem> localRegs = new HashMap<>();
|
||||
|
||||
int regCount = getRegisterCount();
|
||||
int paramCount;
|
||||
if (body.method_info != -1) {
|
||||
MethodInfo mi = method_info[body.method_info];
|
||||
paramCount = mi.param_types.length;
|
||||
if (mi.flagNeed_rest()) {
|
||||
paramCount++;
|
||||
}
|
||||
}
|
||||
|
||||
//try {
|
||||
|
||||
@@ -1893,24 +1733,6 @@ public class AVM2Code implements Serializable {
|
||||
return ret;
|
||||
}
|
||||
|
||||
private int visitCodeTrap(MethodBody body, int visited[]) {
|
||||
int ret = 0;
|
||||
for (int i = 0; i < visited.length; i++) {
|
||||
visited[i] = 0;
|
||||
}
|
||||
ret += visitCodeTrap(0, visited, null, null);
|
||||
for (ABCException e : body.exceptions) {
|
||||
try {
|
||||
ret += visitCodeTrap(adr2pos(e.start), visited, null, null);
|
||||
ret += visitCodeTrap(adr2pos(e.target), visited, null, null);
|
||||
ret += visitCodeTrap(adr2pos(e.end), visited, null, null);
|
||||
} catch (ConvertException ex) {
|
||||
Logger.getLogger(AVM2Code.class.getName()).log(Level.FINE, null, ex);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
private static class ControlFlowTag {
|
||||
|
||||
public String name;
|
||||
@@ -1926,7 +1748,6 @@ public class AVM2Code implements Serializable {
|
||||
List<Object> buf = new ArrayList<>();
|
||||
boolean cont = false;
|
||||
int continueip = 0;
|
||||
AVM2Instruction prev = null;
|
||||
for (; ip < code.size(); ip++) {
|
||||
AVM2Instruction ins = code.get(ip);
|
||||
|
||||
@@ -2009,7 +1830,6 @@ public class AVM2Code implements Serializable {
|
||||
} else if (cont) {
|
||||
buf.add(ip);
|
||||
}
|
||||
prev = ins;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2162,7 +1982,7 @@ public class AVM2Code implements Serializable {
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private static int removeTraps(boolean secondPass, boolean useVisited, List<Object> localData, Stack<GraphTargetItem> stack, List<GraphTargetItem> output, AVM2GraphSource code, int ip, int lastIp, HashMap<Integer, Integer> visited, HashMap<Integer, HashMap<Integer, GraphTargetItem>> visitedStates, HashMap<GraphSourceItem, Decision> decisions) {
|
||||
private static int removeTraps(boolean secondPass, boolean useVisited, List<Object> localData, Stack<GraphTargetItem> stack, List<GraphTargetItem> output, AVM2GraphSource code, int ip, HashMap<Integer, Integer> visited, HashMap<Integer, HashMap<Integer, GraphTargetItem>> visitedStates, HashMap<GraphSourceItem, Decision> decisions) {
|
||||
boolean debugMode = false;
|
||||
int ret = 0;
|
||||
iploop:
|
||||
@@ -2189,7 +2009,6 @@ public class AVM2Code implements Serializable {
|
||||
visitedStates.put(ip, (HashMap<Integer, GraphTargetItem>) currentState.clone());
|
||||
|
||||
}
|
||||
lastIp = ip;
|
||||
GraphSourceItem ins = code.get(ip);
|
||||
if (ins.isIgnored()) {
|
||||
ip++;
|
||||
@@ -2198,60 +2017,6 @@ public class AVM2Code implements Serializable {
|
||||
if (debugMode) {
|
||||
System.out.println((useVisited ? "useV " : "") + (secondPass ? "secondPass " : "") + "Visit " + ip + ": " + ins + " stack:" + Highlighting.stripHilights(stack.toString()));
|
||||
}
|
||||
AVM2Instruction ains = (AVM2Instruction) ins;
|
||||
/*if (ains.definition instanceof DupIns) {
|
||||
do {
|
||||
AVM2Instruction insAfter = (AVM2Instruction) code.get(ip + 1);
|
||||
if (insAfter.definition instanceof ConvertBIns) { //SWF compiled with debug contain convert_b
|
||||
ip++;
|
||||
insAfter = (AVM2Instruction) code.get(ip + 1);
|
||||
}
|
||||
|
||||
if (insAfter.definition instanceof SetLocalTypeIns) {
|
||||
//chained assignments
|
||||
int reg = (((SetLocalTypeIns) insAfter.definition).getRegisterId(insAfter));
|
||||
for (int t = ip + 1; t < code.size(); t++) {
|
||||
if (((AVM2Instruction) code.get(t)).definition instanceof KillIns) {
|
||||
if (((AVM2Instruction) code.get(t)).operands[0] == reg) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (((AVM2Instruction) code.get(t)).definition instanceof GetLocalTypeIns) {
|
||||
if (((GetLocalTypeIns) ((AVM2Instruction) code.get(t)).definition).getRegisterId((AVM2Instruction) code.get(t)) == reg) {
|
||||
if (((AVM2Instruction) code.get(t + 1)).definition instanceof KillIns) {
|
||||
if (((AVM2Instruction) code.get(t + 1)).operands[0] == reg) {
|
||||
code.getCode().initToSource();
|
||||
ConvertOutput assignment = code.getCode().toSourceOutput(false, (Boolean) localData.get(0), (Integer) localData.get(13), (Integer) localData.get(1), (HashMap<Integer, GraphTargetItem>) localData.get(2), stack, (Stack<GraphTargetItem>) localData.get(3), (ABC) localData.get(7), (ConstantPool) localData.get(4), (MethodInfo[]) localData.get(5), (MethodBody) localData.get(6), ip + 2, t - 1, (HashMap<Integer, String>) localData.get(8), (List<String>) localData.get(9), null);
|
||||
stack.push(assignment.output.remove(assignment.output.size() - 1));
|
||||
ip = t + 2;
|
||||
continue iploop;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!code.getCode().isKilled(reg, 0, code.size() - 1)) {
|
||||
for (int i = ip; i >= 0; i--) {
|
||||
if (((AVM2Instruction) code.get(i)).definition instanceof DupIns) {
|
||||
GraphTargetItem v = stack.pop();
|
||||
stack.push(new LocalRegTreeItem((AVM2Instruction) ins, reg, v));
|
||||
stack.push(v);
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
ip++;
|
||||
continue iploop;
|
||||
//}
|
||||
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
} while (((AVM2Instruction) ins).definition instanceof DupIns);
|
||||
}*/
|
||||
if ((ins instanceof AVM2Instruction) && (((AVM2Instruction) ins).definition instanceof NewFunctionIns)) {
|
||||
stack.push(new BooleanTreeItem(null, true));
|
||||
} else {
|
||||
@@ -2303,7 +2068,6 @@ public class AVM2Code implements Serializable {
|
||||
}
|
||||
}
|
||||
ip = condition ? branches.get(0) : branches.get(1);
|
||||
lastIp = ip;
|
||||
continue;
|
||||
//ret += removeTraps(secondPass, useVisited, localData, stack, output, code, condition ? branches.get(0) : branches.get(1), ip, visited, visitedStates, decisions);
|
||||
} else {
|
||||
@@ -2323,7 +2087,7 @@ public class AVM2Code implements Serializable {
|
||||
for (int b : branches) {
|
||||
Stack<GraphTargetItem> brStack = (Stack<GraphTargetItem>) stack.clone();
|
||||
if (b >= 0) {
|
||||
ret += removeTraps(secondPass, useVisited || (!ins.isJump()), localData, brStack, output, code, b, ip, visited, visitedStates, decisions);
|
||||
ret += removeTraps(secondPass, useVisited || (!ins.isJump()), localData, brStack, output, code, b, visited, visitedStates, decisions);
|
||||
} else {
|
||||
if (debugMode) {
|
||||
System.out.println("Negative branch:" + b);
|
||||
@@ -2343,8 +2107,8 @@ public class AVM2Code implements Serializable {
|
||||
|
||||
public static int removeTraps(List<Object> localData, AVM2GraphSource code, int addr) {
|
||||
HashMap<GraphSourceItem, AVM2Code.Decision> decisions = new HashMap<>();
|
||||
removeTraps(false, false, localData, new Stack<GraphTargetItem>(), new ArrayList<GraphTargetItem>(), code, code.adr2pos(addr), 0, new HashMap<Integer, Integer>(), new HashMap<Integer, HashMap<Integer, GraphTargetItem>>(), decisions);
|
||||
removeTraps(false, false, localData, new Stack<GraphTargetItem>(), new ArrayList<GraphTargetItem>(), code, code.adr2pos(addr), new HashMap<Integer, Integer>(), new HashMap<Integer, HashMap<Integer, GraphTargetItem>>(), decisions);
|
||||
localData.set(2, new HashMap<Integer, GraphTargetItem>());
|
||||
return removeTraps(true, false, localData, new Stack<GraphTargetItem>(), new ArrayList<GraphTargetItem>(), code, code.adr2pos(addr), 0, new HashMap<Integer, Integer>(), new HashMap<Integer, HashMap<Integer, GraphTargetItem>>(), decisions);
|
||||
return removeTraps(true, false, localData, new Stack<GraphTargetItem>(), new ArrayList<GraphTargetItem>(), code, code.adr2pos(addr), new HashMap<Integer, Integer>(), new HashMap<Integer, HashMap<Integer, GraphTargetItem>>(), decisions);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,8 +22,11 @@ import com.jpexs.decompiler.flash.abc.types.Namespace;
|
||||
import com.jpexs.decompiler.flash.abc.types.NamespaceSet;
|
||||
import java.io.OutputStream;
|
||||
import java.io.PrintStream;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
public class ConstantPool {
|
||||
|
||||
@@ -81,7 +84,7 @@ public class ConstantPool {
|
||||
|
||||
public int getDoubleId(double value) {
|
||||
for (int i = 1; i < constant_double.length; i++) {
|
||||
if (constant_double[i] == value) {
|
||||
if (Double.compare(constant_double[i], value) == 0) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
@@ -130,7 +133,13 @@ public class ConstantPool {
|
||||
}
|
||||
|
||||
public void dump(OutputStream os) {
|
||||
PrintStream output = new PrintStream(os);
|
||||
PrintStream output;
|
||||
try {
|
||||
output = new PrintStream(os, false, "utf-8");
|
||||
} catch (UnsupportedEncodingException ex) {
|
||||
Logger.getLogger(ConstantPool.class.getName()).log(Level.SEVERE, null, ex);
|
||||
return;
|
||||
}
|
||||
String s = "";
|
||||
for (int i = 1; i < constant_int.length; i++) {
|
||||
output.println("INT[" + i + "]=" + constant_int[i]);
|
||||
|
||||
@@ -207,9 +207,9 @@ public class AVM2Graph extends Graph {
|
||||
}
|
||||
}
|
||||
if (catchedExceptions.size() > 0) {
|
||||
if (currentLoop != null) {
|
||||
//currentLoop.phase=0;
|
||||
}
|
||||
/*if (currentLoop != null) {
|
||||
//currentLoop.phase=0;
|
||||
}*/
|
||||
parsedExceptions.addAll(catchedExceptions);
|
||||
int endpos = code.adr2pos(code.fixAddrAfterDebugLine(catchedExceptions.get(0).end));
|
||||
int endposStartBlock = code.adr2pos(catchedExceptions.get(0).end);
|
||||
@@ -580,7 +580,7 @@ public class AVM2Graph extends Graph {
|
||||
|
||||
if ((!w.expression.isEmpty()) && (w.expression.get(w.expression.size() - 1) instanceof HasNextTreeItem)) {
|
||||
if (((HasNextTreeItem) w.expression.get(w.expression.size() - 1)).collection.getNotCoerced().getThroughRegister() instanceof FilteredCheckTreeItem) {
|
||||
GraphTargetItem gti = ((HasNextTreeItem) ((HasNextTreeItem) w.expression.get(w.expression.size() - 1))).collection.getNotCoerced().getThroughRegister();
|
||||
//GraphTargetItem gti = ((HasNextTreeItem) ((HasNextTreeItem) w.expression.get(w.expression.size() - 1))).collection.getNotCoerced().getThroughRegister();
|
||||
if (w.commands.size() >= 3) { //((w.commands.size() == 3) || (w.commands.size() == 4)) {
|
||||
int pos = 0;
|
||||
while (w.commands.get(pos) instanceof SetLocalTreeItem) {
|
||||
|
||||
@@ -41,6 +41,7 @@ import java.util.Stack;
|
||||
|
||||
public class AVM2Instruction implements Serializable, GraphSourceItem {
|
||||
|
||||
public static final long serialVersionUID = 1L;
|
||||
public InstructionDefinition definition;
|
||||
public int operands[];
|
||||
public long offset;
|
||||
@@ -95,11 +96,13 @@ public class AVM2Instruction implements Serializable, GraphSourceItem {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
String s = definition.instructionName;
|
||||
StringBuffer s = new StringBuffer();
|
||||
s.append(definition.instructionName);
|
||||
for (int i = 0; i < operands.length; i++) {
|
||||
s += " " + operands[i];
|
||||
s.append(" ");
|
||||
s.append(operands[i]);
|
||||
}
|
||||
return s;
|
||||
return s.toString();
|
||||
}
|
||||
|
||||
public List<Long> getOffsets() {
|
||||
@@ -135,13 +138,13 @@ public class AVM2Instruction implements Serializable, GraphSourceItem {
|
||||
s.add(constants.constant_string[operands[i]]);
|
||||
break;
|
||||
case AVM2Code.DAT_INT_INDEX:
|
||||
s.add(new Long(constants.constant_int[operands[i]]));
|
||||
s.add(Long.valueOf(constants.constant_int[operands[i]]));
|
||||
break;
|
||||
case AVM2Code.DAT_UINT_INDEX:
|
||||
s.add(new Long(constants.constant_uint[operands[i]]));
|
||||
break;
|
||||
case AVM2Code.DAT_DOUBLE_INDEX:
|
||||
s.add(new Double(constants.constant_double[operands[i]]));
|
||||
s.add(Double.valueOf(constants.constant_double[operands[i]]));
|
||||
break;
|
||||
case AVM2Code.DAT_OFFSET:
|
||||
s.add(new Long(offset + operands[i] + getBytes().length));
|
||||
@@ -164,54 +167,59 @@ public class AVM2Instruction implements Serializable, GraphSourceItem {
|
||||
}
|
||||
|
||||
public String getParams(ConstantPool constants, List<String> fullyQualifiedNames) {
|
||||
String s = "";
|
||||
StringBuilder s = new StringBuilder();
|
||||
for (int i = 0; i < definition.operands.length; i++) {
|
||||
switch (definition.operands[i]) {
|
||||
case AVM2Code.DAT_MULTINAME_INDEX:
|
||||
s += " m[" + operands[i] + "]\"" + Helper.escapeString(constants.constant_multiname[operands[i]].toString(constants, fullyQualifiedNames)) + "\"";
|
||||
s.append(" m[");
|
||||
s.append(operands[i]);
|
||||
s.append("]\"");
|
||||
s.append(Helper.escapeString(constants.constant_multiname[operands[i]].toString(constants, fullyQualifiedNames)));
|
||||
s.append("\"");
|
||||
break;
|
||||
case AVM2Code.DAT_STRING_INDEX:
|
||||
s += " \"" + Helper.escapeString(constants.constant_string[operands[i]]) + "\"";
|
||||
s.append(" \"");
|
||||
s.append(Helper.escapeString(constants.constant_string[operands[i]]));
|
||||
s.append("\"");
|
||||
break;
|
||||
case AVM2Code.DAT_INT_INDEX:
|
||||
s += " " + constants.constant_int[operands[i]] + "";
|
||||
s.append(" ");
|
||||
s.append(constants.constant_int[operands[i]]);
|
||||
break;
|
||||
case AVM2Code.DAT_UINT_INDEX:
|
||||
s += " " + constants.constant_uint[operands[i]] + "";
|
||||
s.append(" ");
|
||||
s.append(constants.constant_uint[operands[i]]);
|
||||
break;
|
||||
case AVM2Code.DAT_DOUBLE_INDEX:
|
||||
s += " " + constants.constant_double[operands[i]] + "";
|
||||
s.append(" ");
|
||||
s.append(constants.constant_double[operands[i]]);
|
||||
break;
|
||||
case AVM2Code.DAT_OFFSET:
|
||||
s += " ";
|
||||
if (operands[i] > 0) {
|
||||
//s += "+";
|
||||
}//operands[i]
|
||||
s += "ofs" + Helper.formatAddress(offset + operands[i] + getBytes().length) + "";
|
||||
s.append(" ");
|
||||
s.append("ofs");
|
||||
s.append(Helper.formatAddress(offset + operands[i] + getBytes().length));
|
||||
break;
|
||||
case AVM2Code.DAT_CASE_BASEOFFSET:
|
||||
s += " ";
|
||||
if (operands[i] > 0) {
|
||||
//s += "+";
|
||||
}//operands[i]
|
||||
s += "ofs" + Helper.formatAddress(offset + operands[i]) + "";
|
||||
s.append(" ");
|
||||
s.append("ofs");
|
||||
s.append(Helper.formatAddress(offset + operands[i]));
|
||||
break;
|
||||
case AVM2Code.OPT_CASE_OFFSETS:
|
||||
s += " " + operands[i];
|
||||
s.append(" ");
|
||||
s.append(operands[i]);
|
||||
for (int j = i + 1; j < operands.length; j++) {
|
||||
s += " ";
|
||||
if (operands[j] > 0) {
|
||||
//s += "+";
|
||||
}//operands[j]
|
||||
s += "ofs" + Helper.formatAddress(offset + operands[j]) + "";
|
||||
s.append(" ");
|
||||
s.append("ofs");
|
||||
s.append(Helper.formatAddress(offset + operands[j]));
|
||||
}
|
||||
break;
|
||||
default:
|
||||
s += " " + operands[i];
|
||||
s.append(" ");
|
||||
s.append(operands[i]);
|
||||
}
|
||||
|
||||
}
|
||||
return s;
|
||||
return s.toString();
|
||||
}
|
||||
|
||||
public String getComment() {
|
||||
|
||||
@@ -32,6 +32,8 @@ import java.util.Stack;
|
||||
|
||||
public class InstructionDefinition implements Serializable {
|
||||
|
||||
public static final long serialVersionUID = 1L;
|
||||
|
||||
protected String hilighOffset(String text, long offset) {
|
||||
return Highlighting.hilighOffset(text, offset);
|
||||
}
|
||||
@@ -47,25 +49,26 @@ public class InstructionDefinition implements Serializable {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
String s = instructionName;
|
||||
StringBuilder s = new StringBuilder();
|
||||
s.append(instructionName);
|
||||
for (int i = 0; i < operands.length; i++) {
|
||||
if ((operands[i] & 0xff00) == AVM2Code.OPT_U30) {
|
||||
s += " U30";
|
||||
s.append(" U30");
|
||||
}
|
||||
if ((operands[i] & 0xff00) == AVM2Code.OPT_U8) {
|
||||
s += " U8";
|
||||
s.append(" U8");
|
||||
}
|
||||
if ((operands[i] & 0xff00) == AVM2Code.OPT_BYTE) {
|
||||
s += " BYTE";
|
||||
s.append(" BYTE");
|
||||
}
|
||||
if ((operands[i] & 0xff00) == AVM2Code.OPT_S24) {
|
||||
s += " S24";
|
||||
s.append(" S24");
|
||||
}
|
||||
if ((operands[i] & 0xff00) == AVM2Code.OPT_CASE_OFFSETS) {
|
||||
s += " U30 S24,[S24]...";
|
||||
s.append(" U30 S24,[S24]...");
|
||||
}
|
||||
}
|
||||
return s;
|
||||
return s.toString();
|
||||
}
|
||||
|
||||
public void execute(LocalDataArea lda, ConstantPool constants, List<Object> arguments) {
|
||||
|
||||
@@ -22,6 +22,8 @@ package com.jpexs.decompiler.flash.abc.avm2.instructions;
|
||||
*/
|
||||
public class TagInstruction extends InstructionDefinition {
|
||||
|
||||
public static final long serialVersionUID = 1L;
|
||||
|
||||
public TagInstruction(String tagName) {
|
||||
super(-1, tagName, new int[0]);
|
||||
}
|
||||
|
||||
@@ -39,10 +39,10 @@ public class AddIns extends InstructionDefinition {
|
||||
Object o1 = lda.operandStack.pop();
|
||||
Object o2 = lda.operandStack.pop();
|
||||
if ((o1 instanceof Long) && ((o2 instanceof Long))) {
|
||||
Long ret = new Long(((Long) o1).longValue() + ((Long) o2).longValue());
|
||||
Long ret = Long.valueOf(((Long) o1).longValue() + ((Long) o2).longValue());
|
||||
lda.operandStack.push(ret);
|
||||
} else if ((o1 instanceof Double) && ((o2 instanceof Double))) {
|
||||
Double ret = new Double(((Double) o1).doubleValue() + ((Double) o2).doubleValue());
|
||||
Double ret = Double.valueOf(((Double) o1).doubleValue() + ((Double) o2).doubleValue());
|
||||
lda.operandStack.push(ret);
|
||||
} else if ((o1 instanceof Long) && ((o2 instanceof Double))) {
|
||||
Double ret = new Double(((Long) o1).longValue() + ((Double) o2).doubleValue());
|
||||
|
||||
@@ -39,10 +39,10 @@ public class DivideIns extends InstructionDefinition {
|
||||
Object o2 = lda.operandStack.pop();
|
||||
Object o1 = lda.operandStack.pop();
|
||||
if ((o1 instanceof Long) && ((o2 instanceof Long))) {
|
||||
Long ret = new Long(((Long) o1).longValue() / ((Long) o2).longValue());
|
||||
Long ret = Long.valueOf(((Long) o1).longValue() / ((Long) o2).longValue());
|
||||
lda.operandStack.push(ret);
|
||||
} else if ((o1 instanceof Double) && ((o2 instanceof Double))) {
|
||||
Double ret = new Double(((Double) o1).doubleValue() / ((Double) o2).doubleValue());
|
||||
Double ret = Double.valueOf(((Double) o1).doubleValue() / ((Double) o2).doubleValue());
|
||||
lda.operandStack.push(ret);
|
||||
} else if ((o1 instanceof Long) && ((o2 instanceof Double))) {
|
||||
Double ret = new Double(((Long) o1).longValue() / ((Double) o2).doubleValue());
|
||||
|
||||
@@ -40,7 +40,7 @@ public class ModuloIns extends InstructionDefinition {
|
||||
Object o2 = lda.operandStack.pop();
|
||||
|
||||
if ((o1 instanceof Long) && ((o2 instanceof Long))) {
|
||||
Long ret = new Long(((Long) o2).longValue() % ((Long) o1).longValue());
|
||||
Long ret = Long.valueOf(((Long) o2).longValue() % ((Long) o1).longValue());
|
||||
lda.operandStack.push(ret);
|
||||
} else {
|
||||
throw new RuntimeException("Cannot modulo");
|
||||
|
||||
@@ -39,10 +39,10 @@ public class MultiplyIns extends InstructionDefinition {
|
||||
Object o1 = lda.operandStack.pop();
|
||||
Object o2 = lda.operandStack.pop();
|
||||
if ((o1 instanceof Long) && ((o2 instanceof Long))) {
|
||||
Long ret = new Long(((Long) o1).longValue() * ((Long) o2).longValue());
|
||||
Long ret = Long.valueOf(((Long) o1).longValue() * ((Long) o2).longValue());
|
||||
lda.operandStack.push(ret);
|
||||
} else if ((o1 instanceof Double) && ((o2 instanceof Double))) {
|
||||
Double ret = new Double(((Double) o1).doubleValue() * ((Double) o2).doubleValue());
|
||||
Double ret = Double.valueOf(((Double) o1).doubleValue() * ((Double) o2).doubleValue());
|
||||
lda.operandStack.push(ret);
|
||||
} else if ((o1 instanceof Long) && ((o2 instanceof Double))) {
|
||||
Double ret = new Double(((Long) o1).longValue() * ((Double) o2).doubleValue());
|
||||
|
||||
@@ -37,7 +37,7 @@ public class BitNotIns extends InstructionDefinition {
|
||||
@Override
|
||||
public void execute(LocalDataArea lda, ConstantPool constants, List<Object> arguments) {
|
||||
Long value = (Long) lda.operandStack.pop();
|
||||
Long ret = new Long(-value.longValue());
|
||||
Long ret = Long.valueOf(-value.longValue());
|
||||
lda.operandStack.push(ret);
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.abc.avm2.instructions.comparsion;
|
||||
package com.jpexs.decompiler.flash.abc.avm2.instructions.comparison;
|
||||
|
||||
import com.jpexs.decompiler.flash.abc.ABC;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
|
||||
@@ -14,7 +14,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.abc.avm2.instructions.comparsion;
|
||||
package com.jpexs.decompiler.flash.abc.avm2.instructions.comparison;
|
||||
|
||||
import com.jpexs.decompiler.flash.abc.ABC;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
|
||||
@@ -14,7 +14,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.abc.avm2.instructions.comparsion;
|
||||
package com.jpexs.decompiler.flash.abc.avm2.instructions.comparison;
|
||||
|
||||
import com.jpexs.decompiler.flash.abc.ABC;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
|
||||
@@ -14,7 +14,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.abc.avm2.instructions.comparsion;
|
||||
package com.jpexs.decompiler.flash.abc.avm2.instructions.comparison;
|
||||
|
||||
import com.jpexs.decompiler.flash.abc.ABC;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
|
||||
@@ -14,7 +14,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.abc.avm2.instructions.comparsion;
|
||||
package com.jpexs.decompiler.flash.abc.avm2.instructions.comparison;
|
||||
|
||||
import com.jpexs.decompiler.flash.abc.ABC;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
|
||||
@@ -14,7 +14,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.abc.avm2.instructions.comparsion;
|
||||
package com.jpexs.decompiler.flash.abc.avm2.instructions.comparison;
|
||||
|
||||
import com.jpexs.decompiler.flash.abc.ABC;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
|
||||
@@ -35,8 +35,8 @@ public class LookupSwitchIns extends InstructionDefinition {
|
||||
|
||||
@Override
|
||||
public void translate(boolean isStatic, int scriptIndex, 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) {
|
||||
int defaultOffset = ins.operands[0];
|
||||
int caseCount = ins.operands[1];
|
||||
//int defaultOffset = ins.operands[0];
|
||||
//int caseCount = ins.operands[1];
|
||||
//stack.push("switch(...)");
|
||||
}
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ public class DecLocalIIns extends InstructionDefinition {
|
||||
int regIndex = ins.operands[0];
|
||||
output.add(new DecLocalTreeItem(ins, regIndex));
|
||||
if (localRegs.containsKey(regIndex)) {
|
||||
localRegs.put(regIndex, new NotCompileTimeTreeItem(ins, new SubtractTreeItem(ins, localRegs.get(regIndex), new IntegerValueTreeItem(ins, new Long(1)))));
|
||||
localRegs.put(regIndex, new NotCompileTimeTreeItem(ins, new SubtractTreeItem(ins, localRegs.get(regIndex), new IntegerValueTreeItem(ins, Long.valueOf(1)))));
|
||||
} else {
|
||||
//localRegs.put(regIndex, new SubtractTreeItem(ins, new IntegerValueTreeItem(ins, new Long(0)), new IntegerValueTreeItem(ins, new Long(1))));
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ public class DecLocalIns extends InstructionDefinition {
|
||||
int regIndex = ins.operands[0];
|
||||
output.add(new DecLocalTreeItem(ins, regIndex));
|
||||
if (localRegs.containsKey(regIndex)) {
|
||||
localRegs.put(regIndex, new NotCompileTimeTreeItem(ins, new SubtractTreeItem(ins, localRegs.get(regIndex), new IntegerValueTreeItem(ins, new Long(1)))));
|
||||
localRegs.put(regIndex, new NotCompileTimeTreeItem(ins, new SubtractTreeItem(ins, localRegs.get(regIndex), new IntegerValueTreeItem(ins, Long.valueOf(1)))));
|
||||
} else {
|
||||
//localRegs.put(regIndex, new SubtractTreeItem(ins, new IntegerValueTreeItem(ins, new Long(0)), new IntegerValueTreeItem(ins, new Long(1))));
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ public class IncLocalIIns extends InstructionDefinition {
|
||||
int regIndex = ins.operands[0];
|
||||
output.add(new IncLocalTreeItem(ins, regIndex));
|
||||
if (localRegs.containsKey(regIndex)) {
|
||||
localRegs.put(regIndex, new NotCompileTimeTreeItem(ins, new AddTreeItem(ins, localRegs.get(regIndex), new IntegerValueTreeItem(ins, new Long(1)))));
|
||||
localRegs.put(regIndex, new NotCompileTimeTreeItem(ins, new AddTreeItem(ins, localRegs.get(regIndex), new IntegerValueTreeItem(ins, Long.valueOf(1)))));
|
||||
} else {
|
||||
//localRegs.put(regIndex, new AddTreeItem(ins, null, new IntegerValueTreeItem(ins, new Long(1))));
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ public class IncLocalIns extends InstructionDefinition {
|
||||
int regIndex = ins.operands[0];
|
||||
output.add(new IncLocalTreeItem(ins, regIndex));
|
||||
if (localRegs.containsKey(regIndex)) {
|
||||
localRegs.put(regIndex, new NotCompileTimeTreeItem(ins, new AddTreeItem(ins, localRegs.get(regIndex), new IntegerValueTreeItem(ins, new Long(1)))));
|
||||
localRegs.put(regIndex, new NotCompileTimeTreeItem(ins, new AddTreeItem(ins, localRegs.get(regIndex), new IntegerValueTreeItem(ins, Long.valueOf(1)))));
|
||||
} else {
|
||||
//localRegs.put(regIndex, new AddTreeItem(ins, null, new IntegerValueTreeItem(ins, new Long(1))));
|
||||
}
|
||||
|
||||
@@ -39,11 +39,11 @@ public class DeletePropertyIns extends InstructionDefinition {
|
||||
|
||||
@Override
|
||||
public void execute(LocalDataArea lda, ConstantPool constants, List<Object> arguments) {
|
||||
int multiIndex = (int) ((Long) arguments.get(0)).longValue();
|
||||
//if multiname[multinameIndex] is runtime
|
||||
//pop(name) pop(ns)
|
||||
Object obj = lda.operandStack.pop();
|
||||
//push true if removed
|
||||
/*int multiIndex = (int) ((Long) arguments.get(0)).longValue();
|
||||
//if multiname[multinameIndex] is runtime
|
||||
//pop(name) pop(ns)
|
||||
Object obj = lda.operandStack.pop();
|
||||
//push true if removed*/
|
||||
throw new RuntimeException("Cannot remove property");
|
||||
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ public class FindPropertyIns extends InstructionDefinition {
|
||||
|
||||
@Override
|
||||
public void execute(LocalDataArea lda, ConstantPool constants, List<Object> arguments) {
|
||||
int multiIndex = (int) ((Long) arguments.get(0)).longValue();
|
||||
//int multiIndex = (int) ((Long) arguments.get(0)).longValue();
|
||||
//if is runtime
|
||||
//pop(name), pop(ns)
|
||||
throw new RuntimeException("Cannot find property");
|
||||
|
||||
@@ -38,7 +38,7 @@ public class FindPropertyStrictIns extends InstructionDefinition {
|
||||
|
||||
@Override
|
||||
public void execute(LocalDataArea lda, ConstantPool constants, List<Object> arguments) {
|
||||
int multiIndex = (int) ((Long) arguments.get(0)).longValue();
|
||||
//int multiIndex = (int) ((Long) arguments.get(0)).longValue();
|
||||
//if is runtime
|
||||
//pop(name), pop(ns)
|
||||
throw new RuntimeException("Cannot find property");
|
||||
|
||||
@@ -38,10 +38,10 @@ public class GetDescendantsIns extends InstructionDefinition {
|
||||
|
||||
@Override
|
||||
public void execute(LocalDataArea lda, ConstantPool constants, List<Object> arguments) {
|
||||
int multiIndex = (int) ((Long) arguments.get(0)).longValue();
|
||||
//if is runtime
|
||||
//pop(name), pop(ns)
|
||||
Object obj = lda.operandStack.pop();
|
||||
/*int multiIndex = (int) ((Long) arguments.get(0)).longValue();
|
||||
//if is runtime
|
||||
//pop(name), pop(ns)
|
||||
Object obj = lda.operandStack.pop();*/
|
||||
throw new RuntimeException("getdescentants not working");
|
||||
}
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ public class PushByteIns extends InstructionDefinition implements PushIntegerTyp
|
||||
|
||||
@Override
|
||||
public void translate(boolean isStatic, int scriptIndex, 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) {
|
||||
stack.push(new IntegerValueTreeItem(ins, new Long(ins.operands[0])));
|
||||
stack.push(new IntegerValueTreeItem(ins, Long.valueOf(ins.operands[0])));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -42,7 +42,7 @@ public class PushShortIns extends InstructionDefinition implements PushIntegerTy
|
||||
|
||||
@Override
|
||||
public void translate(boolean isStatic, int scriptIndex, 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) {
|
||||
stack.push(new IntegerValueTreeItem(ins, new Long(ins.operands[0])));
|
||||
stack.push(new IntegerValueTreeItem(ins, Long.valueOf(ins.operands[0])));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -38,7 +38,7 @@ public class AsTypeIns extends InstructionDefinition {
|
||||
|
||||
@Override
|
||||
public void execute(LocalDataArea lda, ConstantPool constants, List<Object> arguments) {
|
||||
Long typeIndex = (Long) arguments.get(0);
|
||||
//Long typeIndex = (Long) arguments.get(0);
|
||||
Object obj = lda.operandStack.pop();
|
||||
//if multiname[typeIndex]==obj
|
||||
lda.operandStack.push(obj);
|
||||
|
||||
@@ -36,7 +36,7 @@ public class AsTypeLateIns extends InstructionDefinition {
|
||||
|
||||
@Override
|
||||
public void execute(LocalDataArea lda, ConstantPool constants, List<Object> arguments) {
|
||||
Object objClass = lda.operandStack.pop();
|
||||
//Object objClass = lda.operandStack.pop();
|
||||
Object obj = lda.operandStack.pop();
|
||||
//if obj.class=objClass
|
||||
lda.operandStack.push(obj);
|
||||
|
||||
@@ -37,7 +37,7 @@ public class CoerceIns extends InstructionDefinition implements CoerceOrConvertT
|
||||
|
||||
@Override
|
||||
public void execute(LocalDataArea lda, ConstantPool constants, List<Object> arguments) {
|
||||
int multinameIndex = (int) ((Long) arguments.get(0)).longValue();
|
||||
//int multinameIndex = (int) ((Long) arguments.get(0)).longValue();
|
||||
//push and pop coerced value to specified type
|
||||
}
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ public class ConvertDIns extends InstructionDefinition implements CoerceOrConver
|
||||
} else {
|
||||
ret = 1; //must call toPrimitive
|
||||
}
|
||||
lda.operandStack.push(new Double(ret));
|
||||
lda.operandStack.push(Double.valueOf(ret));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -53,7 +53,7 @@ public class ConvertIIns extends InstructionDefinition implements CoerceOrConver
|
||||
} else {
|
||||
ret = 1; //must call toPrimitive
|
||||
}
|
||||
lda.operandStack.push(new Long(ret));
|
||||
lda.operandStack.push(Long.valueOf(ret));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -27,6 +27,7 @@ import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
public class ASM3Parser {
|
||||
|
||||
@@ -124,7 +125,7 @@ public class ASM3Parser {
|
||||
continue;
|
||||
}
|
||||
if (symb.type == ParsedSymbol.TYPE_INSTRUCTION_NAME) {
|
||||
if (((String) symb.value).toLowerCase().equals("exception")) {
|
||||
if (((String) symb.value).toLowerCase(Locale.ENGLISH).equals("exception")) {
|
||||
ParsedSymbol exIndex = lexer.yylex();
|
||||
if (exIndex.type != ParsedSymbol.TYPE_INTEGER) {
|
||||
throw new ParseException("Index expected", lexer.yyline());
|
||||
|
||||
@@ -36,22 +36,23 @@ public class ApplyTypeTreeItem extends TreeItem {
|
||||
|
||||
@Override
|
||||
public String toString(ConstantPool constants, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
|
||||
String ret = object.toString(Helper.toList(constants, localRegNames, fullyQualifiedNames));
|
||||
StringBuilder ret = new StringBuilder();
|
||||
ret.append(object.toString(Helper.toList(constants, localRegNames, fullyQualifiedNames)));
|
||||
if (!params.isEmpty()) {
|
||||
ret += hilight(".<");
|
||||
ret.append(hilight(".<"));
|
||||
for (int i = 0; i < params.size(); i++) {
|
||||
if (i > 0) {
|
||||
ret += hilight(",");
|
||||
ret.append(hilight(","));
|
||||
}
|
||||
GraphTargetItem p = params.get(i);
|
||||
if (p instanceof NullTreeItem) {
|
||||
ret += "*";
|
||||
ret.append("*");
|
||||
} else {
|
||||
ret += p.toString(Helper.toList(constants, localRegNames, fullyQualifiedNames));
|
||||
ret.append(p.toString(Helper.toList(constants, localRegNames, fullyQualifiedNames)));
|
||||
}
|
||||
}
|
||||
ret += hilight(">");
|
||||
ret.append(">");
|
||||
}
|
||||
return ret;
|
||||
return ret.toString();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.abc.types.traits;
|
||||
|
||||
import com.jpexs.decompiler.flash.Configuration;
|
||||
import com.jpexs.decompiler.flash.abc.ABC;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.abc.types.traits;
|
||||
|
||||
import com.jpexs.decompiler.flash.Configuration;
|
||||
import com.jpexs.decompiler.flash.abc.ABC;
|
||||
import com.jpexs.decompiler.flash.abc.types.MethodBody;
|
||||
import com.jpexs.decompiler.flash.graph.GraphTargetItem;
|
||||
|
||||
@@ -18,7 +18,6 @@ package com.jpexs.decompiler.flash.graph;
|
||||
|
||||
import com.jpexs.decompiler.flash.action.Action;
|
||||
import com.jpexs.decompiler.flash.helpers.Highlighting;
|
||||
import java.awt.GradientPaint;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
|
||||
@@ -20,7 +20,6 @@ import java.awt.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JDialog;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.SwingConstants;
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@ import java.awt.event.WindowAdapter;
|
||||
import java.awt.event.WindowEvent;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JDialog;
|
||||
import javax.swing.JLabel;
|
||||
|
||||
/**
|
||||
|
||||
@@ -19,17 +19,11 @@ package com.jpexs.decompiler.flash.gui;
|
||||
import com.jpexs.decompiler.flash.graph.Graph;
|
||||
import com.jpexs.decompiler.flash.graph.GraphPart;
|
||||
import java.awt.*;
|
||||
import java.awt.event.AdjustmentEvent;
|
||||
import java.awt.event.AdjustmentListener;
|
||||
import java.awt.event.ComponentAdapter;
|
||||
import java.awt.event.ComponentEvent;
|
||||
import java.awt.event.WindowAdapter;
|
||||
import java.awt.geom.AffineTransform;
|
||||
import java.awt.geom.Line2D;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
|
||||
|
||||
@@ -20,7 +20,6 @@ import com.jpexs.decompiler.flash.abc.avm2.graph.AVM2Graph;
|
||||
import com.jpexs.decompiler.flash.graph.GraphPart;
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Container;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JTree;
|
||||
import javax.swing.event.TreeModelListener;
|
||||
import javax.swing.tree.TreeModel;
|
||||
|
||||
@@ -22,6 +22,7 @@ import com.jpexs.decompiler.flash.PercentListener;
|
||||
import com.jpexs.decompiler.flash.SWF;
|
||||
import com.jpexs.decompiler.flash.Version;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
|
||||
import static com.jpexs.decompiler.flash.gui.AppStrings.translate;
|
||||
import com.jpexs.decompiler.flash.gui.jna.platform.win32.Advapi32Util;
|
||||
import com.jpexs.decompiler.flash.gui.jna.platform.win32.Kernel32;
|
||||
import com.jpexs.decompiler.flash.gui.jna.platform.win32.SHELLEXECUTEINFO;
|
||||
@@ -59,7 +60,6 @@ import javax.swing.JFrame;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.SwingWorker;
|
||||
import javax.swing.filechooser.FileFilter;
|
||||
import static com.jpexs.decompiler.flash.gui.AppStrings.translate;
|
||||
|
||||
/**
|
||||
* Main executable class
|
||||
@@ -984,7 +984,7 @@ public class Main {
|
||||
}
|
||||
|
||||
public static boolean isAssociated() {
|
||||
if(!Platform.isWindows()){
|
||||
if (!Platform.isWindows()) {
|
||||
return false;
|
||||
}
|
||||
if (!Advapi32Util.registryKeyExists(WinReg.HKEY_CLASSES_ROOT, ".swf")) {
|
||||
|
||||
@@ -25,15 +25,15 @@ import com.jpexs.decompiler.flash.TagNode;
|
||||
import com.jpexs.decompiler.flash.abc.ABC;
|
||||
import com.jpexs.decompiler.flash.abc.RenameType;
|
||||
import com.jpexs.decompiler.flash.abc.ScriptPack;
|
||||
import com.jpexs.decompiler.flash.abc.types.traits.Trait;
|
||||
import com.jpexs.decompiler.flash.abc.types.traits.TraitClass;
|
||||
import static com.jpexs.decompiler.flash.gui.Main.isAssociated;
|
||||
import com.jpexs.decompiler.flash.gui.abc.ABCPanel;
|
||||
import com.jpexs.decompiler.flash.gui.abc.ClassesListTreeModel;
|
||||
import com.jpexs.decompiler.flash.gui.abc.DeobfuscationDialog;
|
||||
import com.jpexs.decompiler.flash.gui.abc.LineMarkedEditorPane;
|
||||
import com.jpexs.decompiler.flash.gui.abc.TreeElement;
|
||||
import com.jpexs.decompiler.flash.abc.types.traits.Trait;
|
||||
import com.jpexs.decompiler.flash.abc.types.traits.TraitClass;
|
||||
import com.jpexs.decompiler.flash.gui.action.ActionPanel;
|
||||
import static com.jpexs.decompiler.flash.gui.Main.isAssociated;
|
||||
import com.jpexs.decompiler.flash.gui.player.FlashPlayerPanel;
|
||||
import com.jpexs.decompiler.flash.helpers.Helper;
|
||||
import com.jpexs.decompiler.flash.tags.ABCContainerTag;
|
||||
|
||||
@@ -23,7 +23,6 @@ import java.awt.event.ActionListener;
|
||||
import java.awt.event.WindowAdapter;
|
||||
import java.awt.event.WindowEvent;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JLabel;
|
||||
|
||||
/**
|
||||
|
||||
@@ -25,7 +25,6 @@ import java.awt.event.ActionListener;
|
||||
import java.util.List;
|
||||
import javax.swing.BoxLayout;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JDialog;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package com.jpexs.decompiler.flash.gui;
|
||||
|
||||
import com.jpexs.decompiler.flash.SWF;
|
||||
import static com.jpexs.decompiler.flash.gui.AppStrings.translate;
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.util.ArrayList;
|
||||
@@ -27,7 +28,6 @@ import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.SwingConstants;
|
||||
import javax.swing.border.BevelBorder;
|
||||
import static com.jpexs.decompiler.flash.gui.AppStrings.translate;
|
||||
|
||||
/**
|
||||
*
|
||||
|
||||
@@ -22,13 +22,10 @@ import java.awt.Container;
|
||||
import java.awt.FlowLayout;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.io.InputStream;
|
||||
import java.util.Locale;
|
||||
import java.util.Properties;
|
||||
import javax.swing.BoxLayout;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JDialog;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.border.EmptyBorder;
|
||||
|
||||
@@ -16,21 +16,22 @@
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.gui.abc;
|
||||
|
||||
import com.jpexs.decompiler.flash.gui.abc.tablemodels.UIntTableModel;
|
||||
import com.jpexs.decompiler.flash.gui.abc.tablemodels.DoubleTableModel;
|
||||
import com.jpexs.decompiler.flash.gui.abc.tablemodels.NamespaceTableModel;
|
||||
import com.jpexs.decompiler.flash.gui.abc.tablemodels.IntTableModel;
|
||||
import com.jpexs.decompiler.flash.gui.abc.tablemodels.NamespaceSetTableModel;
|
||||
import com.jpexs.decompiler.flash.gui.abc.tablemodels.MultinameTableModel;
|
||||
import com.jpexs.decompiler.flash.gui.abc.tablemodels.DecimalTableModel;
|
||||
import com.jpexs.decompiler.flash.gui.abc.tablemodels.StringTableModel;
|
||||
import com.jpexs.decompiler.flash.Configuration;
|
||||
import com.jpexs.decompiler.flash.abc.ABC;
|
||||
import com.jpexs.decompiler.flash.abc.ClassPath;
|
||||
import com.jpexs.decompiler.flash.abc.ScriptPack;
|
||||
import static com.jpexs.decompiler.flash.gui.AppStrings.translate;
|
||||
import com.jpexs.decompiler.flash.gui.Main;
|
||||
import com.jpexs.decompiler.flash.gui.TagTreeModel;
|
||||
import com.jpexs.decompiler.flash.gui.View;
|
||||
import com.jpexs.decompiler.flash.gui.abc.tablemodels.DecimalTableModel;
|
||||
import com.jpexs.decompiler.flash.gui.abc.tablemodels.DoubleTableModel;
|
||||
import com.jpexs.decompiler.flash.gui.abc.tablemodels.IntTableModel;
|
||||
import com.jpexs.decompiler.flash.gui.abc.tablemodels.MultinameTableModel;
|
||||
import com.jpexs.decompiler.flash.gui.abc.tablemodels.NamespaceSetTableModel;
|
||||
import com.jpexs.decompiler.flash.gui.abc.tablemodels.NamespaceTableModel;
|
||||
import com.jpexs.decompiler.flash.gui.abc.tablemodels.StringTableModel;
|
||||
import com.jpexs.decompiler.flash.gui.abc.tablemodels.UIntTableModel;
|
||||
import com.jpexs.decompiler.flash.tags.ABCContainerTag;
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Component;
|
||||
@@ -43,7 +44,6 @@ import java.beans.PropertyChangeListener;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.TimerTask;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import java.util.regex.Pattern;
|
||||
@@ -55,7 +55,6 @@ import javax.swing.table.*;
|
||||
import javax.swing.tree.TreePath;
|
||||
import jsyntaxpane.DefaultSyntaxKit;
|
||||
import jsyntaxpane.actions.DocumentSearchData;
|
||||
import static com.jpexs.decompiler.flash.gui.AppStrings.translate;
|
||||
|
||||
public class ABCPanel extends JPanel implements ItemListener, ActionListener {
|
||||
|
||||
|
||||
@@ -20,12 +20,11 @@ import com.jpexs.decompiler.flash.abc.ClassPath;
|
||||
import com.jpexs.decompiler.flash.abc.ScriptPack;
|
||||
import com.jpexs.decompiler.flash.abc.types.traits.Trait;
|
||||
import com.jpexs.decompiler.flash.abc.types.traits.TraitClass;
|
||||
import com.jpexs.decompiler.flash.gui.MainFrame;
|
||||
import static com.jpexs.decompiler.flash.gui.AppStrings.translate;
|
||||
import java.util.HashMap;
|
||||
import javax.swing.event.TreeModelListener;
|
||||
import javax.swing.tree.TreeModel;
|
||||
import javax.swing.tree.TreePath;
|
||||
import static com.jpexs.decompiler.flash.gui.AppStrings.translate;
|
||||
|
||||
class ClassIndexVisitor implements TreeVisitor {
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
|
||||
import com.jpexs.decompiler.flash.abc.types.ScriptInfo;
|
||||
import com.jpexs.decompiler.flash.abc.types.traits.Trait;
|
||||
import com.jpexs.decompiler.flash.abc.types.traits.TraitSlotConst;
|
||||
import static com.jpexs.decompiler.flash.gui.AppStrings.translate;
|
||||
import com.jpexs.decompiler.flash.helpers.Cache;
|
||||
import com.jpexs.decompiler.flash.helpers.Highlighting;
|
||||
import com.jpexs.decompiler.flash.tags.ABCContainerTag;
|
||||
@@ -33,7 +34,6 @@ import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
import javax.swing.event.CaretEvent;
|
||||
import javax.swing.event.CaretListener;
|
||||
import static com.jpexs.decompiler.flash.gui.AppStrings.translate;
|
||||
|
||||
public class DecompiledEditorPane extends LineMarkedEditorPane implements CaretListener {
|
||||
|
||||
|
||||
@@ -26,7 +26,6 @@ import java.awt.event.ActionListener;
|
||||
import java.util.Hashtable;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JCheckBox;
|
||||
import javax.swing.JDialog;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JSlider;
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package com.jpexs.decompiler.flash.gui.abc;
|
||||
|
||||
import com.jpexs.decompiler.flash.abc.types.traits.Trait;
|
||||
import static com.jpexs.decompiler.flash.gui.AppStrings.translate;
|
||||
import com.jpexs.decompiler.flash.gui.View;
|
||||
import com.jpexs.decompiler.flash.helpers.Helper;
|
||||
import java.awt.BorderLayout;
|
||||
@@ -29,7 +30,6 @@ import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import javax.swing.*;
|
||||
import javax.swing.border.BevelBorder;
|
||||
import static com.jpexs.decompiler.flash.gui.AppStrings.translate;
|
||||
|
||||
/**
|
||||
*
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
package com.jpexs.decompiler.flash.gui.abc;
|
||||
|
||||
import com.jpexs.decompiler.flash.abc.avm2.parser.MissingSymbolHandler;
|
||||
import javax.swing.JOptionPane;
|
||||
import static com.jpexs.decompiler.flash.gui.AppStrings.translate;
|
||||
import javax.swing.JOptionPane;
|
||||
|
||||
public class DialogMissingSymbolHandler implements MissingSymbolHandler {
|
||||
|
||||
|
||||
@@ -17,13 +17,13 @@
|
||||
package com.jpexs.decompiler.flash.gui.abc;
|
||||
|
||||
import com.jpexs.decompiler.flash.abc.types.MethodBody;
|
||||
import static com.jpexs.decompiler.flash.gui.AppStrings.translate;
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.text.NumberFormat;
|
||||
import javax.swing.*;
|
||||
import javax.swing.event.ChangeEvent;
|
||||
import javax.swing.event.ChangeListener;
|
||||
import static com.jpexs.decompiler.flash.gui.AppStrings.translate;
|
||||
|
||||
/**
|
||||
*
|
||||
|
||||
@@ -18,6 +18,7 @@ package com.jpexs.decompiler.flash.gui.abc;
|
||||
|
||||
import com.jpexs.decompiler.flash.abc.ABC;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
|
||||
import static com.jpexs.decompiler.flash.gui.AppStrings.translate;
|
||||
import com.jpexs.decompiler.flash.gui.Main;
|
||||
import com.jpexs.decompiler.flash.gui.View;
|
||||
import java.awt.BorderLayout;
|
||||
@@ -30,7 +31,6 @@ import javax.swing.JButton;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JToggleButton;
|
||||
import static com.jpexs.decompiler.flash.gui.AppStrings.translate;
|
||||
|
||||
/**
|
||||
*
|
||||
|
||||
@@ -21,13 +21,13 @@ import com.jpexs.decompiler.flash.abc.ABC;
|
||||
import com.jpexs.decompiler.flash.abc.methodinfo_parser.MethodInfoParser;
|
||||
import com.jpexs.decompiler.flash.abc.methodinfo_parser.ParseException;
|
||||
import com.jpexs.decompiler.flash.abc.types.MethodInfo;
|
||||
import static com.jpexs.decompiler.flash.gui.AppStrings.translate;
|
||||
import com.jpexs.decompiler.flash.helpers.Helper;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Font;
|
||||
import java.util.ArrayList;
|
||||
import javax.swing.*;
|
||||
import jsyntaxpane.syntaxkits.Flasm3MethodInfoSyntaxKit;
|
||||
import static com.jpexs.decompiler.flash.gui.AppStrings.translate;
|
||||
|
||||
/**
|
||||
*
|
||||
|
||||
@@ -16,9 +16,9 @@
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.gui.abc;
|
||||
|
||||
import static com.jpexs.decompiler.flash.gui.AppStrings.translate;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JTabbedPane;
|
||||
import static com.jpexs.decompiler.flash.gui.AppStrings.translate;
|
||||
|
||||
/**
|
||||
*
|
||||
|
||||
@@ -21,12 +21,12 @@ import com.jpexs.decompiler.flash.abc.methodinfo_parser.MethodInfoParser;
|
||||
import com.jpexs.decompiler.flash.abc.methodinfo_parser.ParseException;
|
||||
import com.jpexs.decompiler.flash.abc.types.ValueKind;
|
||||
import com.jpexs.decompiler.flash.abc.types.traits.TraitSlotConst;
|
||||
import static com.jpexs.decompiler.flash.gui.AppStrings.translate;
|
||||
import com.jpexs.decompiler.flash.helpers.Helper;
|
||||
import java.awt.BorderLayout;
|
||||
import java.util.ArrayList;
|
||||
import javax.swing.*;
|
||||
import jsyntaxpane.syntaxkits.Flasm3MethodInfoSyntaxKit;
|
||||
import static com.jpexs.decompiler.flash.gui.AppStrings.translate;
|
||||
|
||||
/**
|
||||
*
|
||||
|
||||
@@ -4,10 +4,10 @@ import com.jpexs.decompiler.flash.abc.ABC;
|
||||
import com.jpexs.decompiler.flash.abc.types.traits.Trait;
|
||||
import com.jpexs.decompiler.flash.abc.types.traits.TraitMethodGetterSetter;
|
||||
import com.jpexs.decompiler.flash.abc.types.traits.TraitSlotConst;
|
||||
import static com.jpexs.decompiler.flash.gui.AppStrings.translate;
|
||||
import com.jpexs.decompiler.flash.tags.ABCContainerTag;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import static com.jpexs.decompiler.flash.gui.AppStrings.translate;
|
||||
|
||||
/**
|
||||
*
|
||||
|
||||
@@ -20,7 +20,6 @@ import com.jpexs.decompiler.flash.Configuration;
|
||||
import com.jpexs.decompiler.flash.DisassemblyListener;
|
||||
import com.jpexs.decompiler.flash.SWF;
|
||||
import com.jpexs.decompiler.flash.TagNode;
|
||||
import com.jpexs.decompiler.flash.gui.abc.LineMarkedEditorPane;
|
||||
import com.jpexs.decompiler.flash.action.Action;
|
||||
import com.jpexs.decompiler.flash.action.ActionGraph;
|
||||
import com.jpexs.decompiler.flash.action.parser.ParseException;
|
||||
@@ -29,10 +28,12 @@ import com.jpexs.decompiler.flash.action.parser.script.ActionScriptParser;
|
||||
import com.jpexs.decompiler.flash.action.swf4.ActionPush;
|
||||
import com.jpexs.decompiler.flash.action.swf4.ConstantIndex;
|
||||
import com.jpexs.decompiler.flash.graph.GraphTargetItem;
|
||||
import static com.jpexs.decompiler.flash.gui.AppStrings.translate;
|
||||
import com.jpexs.decompiler.flash.gui.GraphFrame;
|
||||
import com.jpexs.decompiler.flash.gui.Main;
|
||||
import com.jpexs.decompiler.flash.gui.TagTreeModel;
|
||||
import com.jpexs.decompiler.flash.gui.View;
|
||||
import com.jpexs.decompiler.flash.gui.abc.LineMarkedEditorPane;
|
||||
import com.jpexs.decompiler.flash.helpers.Cache;
|
||||
import com.jpexs.decompiler.flash.helpers.Helper;
|
||||
import com.jpexs.decompiler.flash.helpers.Highlighting;
|
||||
@@ -51,9 +52,6 @@ import java.io.StringReader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.TimerTask;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import java.util.regex.Pattern;
|
||||
import javax.swing.BoxLayout;
|
||||
import javax.swing.JButton;
|
||||
@@ -71,7 +69,6 @@ import javax.swing.event.CaretListener;
|
||||
import javax.swing.tree.TreePath;
|
||||
import jsyntaxpane.DefaultSyntaxKit;
|
||||
import jsyntaxpane.actions.DocumentSearchData;
|
||||
import static com.jpexs.decompiler.flash.gui.AppStrings.translate;
|
||||
|
||||
public class ActionPanel extends JPanel implements ActionListener {
|
||||
|
||||
|
||||
@@ -21,7 +21,6 @@ import com.jpexs.decompiler.flash.SWF;
|
||||
import com.jpexs.decompiler.flash.SWFInputStream;
|
||||
import com.jpexs.decompiler.flash.SWFOutputStream;
|
||||
import com.jpexs.decompiler.flash.abc.CopyOutputStream;
|
||||
import com.jpexs.decompiler.flash.helpers.Helper;
|
||||
import com.jpexs.decompiler.flash.tags.base.BoundedTag;
|
||||
import com.jpexs.decompiler.flash.tags.base.CharacterTag;
|
||||
import com.jpexs.decompiler.flash.tags.base.Container;
|
||||
|
||||
@@ -23,5 +23,5 @@ package com.jpexs.decompiler.flash.types;
|
||||
*/
|
||||
public class ALPHABITMAPDATA {
|
||||
|
||||
public ARGB bitmapPixelData[];
|
||||
public ARGB bitmapPixelData[] = new ARGB[0];
|
||||
}
|
||||
|
||||
@@ -23,6 +23,6 @@ package com.jpexs.decompiler.flash.types;
|
||||
*/
|
||||
public class BITMAPDATA {
|
||||
|
||||
public PIX15 bitmapPixelDataPix15[];
|
||||
public PIX24 bitmapPixelDataPix24[];
|
||||
public PIX15 bitmapPixelDataPix15[] = new PIX15[0];
|
||||
public PIX24 bitmapPixelDataPix24[] = new PIX24[0];
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.types;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -32,5 +33,5 @@ public class CLIPACTIONS {
|
||||
/**
|
||||
* Individual event handlers
|
||||
*/
|
||||
public List<CLIPACTIONRECORD> clipActionRecords;
|
||||
public List<CLIPACTIONRECORD> clipActionRecords = new ArrayList<>();
|
||||
}
|
||||
|
||||
@@ -24,6 +24,6 @@ public class FOCALGRADIENT {
|
||||
|
||||
public int spreadMode;
|
||||
public int interPolationMode;
|
||||
public GRADRECORD gradientRecords[];
|
||||
public GRADRECORD gradientRecords[] = new GRADRECORD[0];
|
||||
public float focalPoint;
|
||||
}
|
||||
|
||||
@@ -22,6 +22,6 @@ package com.jpexs.decompiler.flash.types;
|
||||
*/
|
||||
public class LINESTYLEARRAY {
|
||||
|
||||
public LINESTYLE lineStyles[];
|
||||
public LINESTYLE2 lineStyles2[];
|
||||
public LINESTYLE lineStyles[] = new LINESTYLE[0];
|
||||
public LINESTYLE2 lineStyles2[] = new LINESTYLE2[0];
|
||||
}
|
||||
|
||||
@@ -31,5 +31,5 @@ public class SOUNDINFO {
|
||||
public long inPoint;
|
||||
public long outPoint;
|
||||
public int loopCount;
|
||||
public SOUNDENVELOPE envelopeRecords[];
|
||||
public SOUNDENVELOPE envelopeRecords[] = new SOUNDENVELOPE[0];
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ package com.jpexs.decompiler.flash.types;
|
||||
*/
|
||||
public class ZONERECORD {
|
||||
|
||||
public ZONEDATA zonedata[];
|
||||
public ZONEDATA zonedata[] = new ZONEDATA[0];
|
||||
public boolean zoneMaskX;
|
||||
public boolean zoneMaskY;
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ public class CONVOLUTIONFILTER extends FILTER {
|
||||
/**
|
||||
* Matrix values
|
||||
*/
|
||||
public float matrix[][];
|
||||
public float matrix[][] = new float[0][0];
|
||||
/**
|
||||
* Default color for pixels outside the image
|
||||
*/
|
||||
|
||||
@@ -32,11 +32,11 @@ public class GRADIENTBEVELFILTER extends FILTER {
|
||||
/**
|
||||
* Gradient colors
|
||||
*/
|
||||
public RGBA gradientColors[];
|
||||
public RGBA gradientColors[] = new RGBA[0];
|
||||
/**
|
||||
* Gradient ratios
|
||||
*/
|
||||
public int gradientRatio[];
|
||||
public int gradientRatio[] = new int[0];
|
||||
/**
|
||||
* Horizontal blur amount
|
||||
*/
|
||||
|
||||
@@ -32,7 +32,7 @@ public class GRADIENTGLOWFILTER extends FILTER {
|
||||
/**
|
||||
* Gradient colors
|
||||
*/
|
||||
public RGBA gradientColors[];
|
||||
public RGBA gradientColors[] = new RGBA[0];
|
||||
/**
|
||||
* Gradient ratios
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user