#749 Internal viewer Sprite fill color is wrong sometimes: fixed

This commit is contained in:
honfika@gmail.com
2014-12-14 15:30:59 +01:00
parent caaee42318
commit 60f170dcda
32 changed files with 225 additions and 192 deletions

View File

@@ -60,7 +60,7 @@ public class ApplicationInfo {
version = version + " nightly build " + version_build;
}
} catch (IOException | NullPointerException | NumberFormatException ex) {
//ignore
// ignore
version = "unknown";
}

View File

@@ -48,27 +48,27 @@ public class IdentifiersDeobfuscation {
public static final String FOO_CHARACTERS = "bcdfghjklmnpqrstvwz";
public static final String FOO_JOIN_CHARACTERS = "aeiouy";
//http://help.adobe.com/en_US/AS2LCR/Flash_10.0/help.html?content=00000477.html
// http://help.adobe.com/en_US/AS2LCR/Flash_10.0/help.html?content=00000477.html
public static final String[] reservedWordsAS2 = {
//is "add" really a keyword? documentation says yes, but I can create "add" variable in CS6...
//"add",
// is "add" really a keyword? documentation says yes, but I can create "add" variable in CS6...
// "add",
"and", "break", "case", "catch", "class", "continue", "default", "delete", "do", "dynamic", "else",
"eq", "extends", "false", "finally", "for", "function", "ge", "get", "gt", "if", "ifFrameLoaded", "implements",
"import", "in", "instanceof", "interface", "intrinsic", "le",
//is "it" really a keyword? documentation says yes, but I can create "it" variable in CS6...
//"it",
// is "it" really a keyword? documentation says yes, but I can create "it" variable in CS6...
// "it",
"ne", "new", "not", "null", "on", "onClipEvent",
"or", "private", "public", "return", "set", "static", "super", "switch", "tellTarget", "this", "throw", "try",
"typeof", "undefined", "var", "void", "while", "with"
};
//http://www.adobe.com/devnet/actionscript/learning/as3-fundamentals/syntax.html
// http://www.adobe.com/devnet/actionscript/learning/as3-fundamentals/syntax.html
public static final String[] reservedWordsAS3 = {
"as", "break", "case", "catch", "class", "const", "continue", "default", "delete", "do", "else",
"extends", "false", "finally", "for", "function", "if", "implements", "import", "in", "instanceof",
"interface", "internal", "is", "new", "null", "package", "private", "protected", "public",
"return", "super", "switch", "this", "throw",
//is "to" really a keyword? documentation says yes, but I can create "to" variable...
// is "to" really a keyword? documentation says yes, but I can create "to" variable...
// "to",
"true", "try", "typeof", "use", "var",
"void", "while", "with"
@@ -232,11 +232,11 @@ public class IdentifiersDeobfuscation {
return false;
}
//simple fast test
// simple fast test
if (s.matches("^[a-zA-Z_\\$][a-zA-Z0-9_\\$]*$")) {
return true;
}
//unicode test
// unicode test
if (IDENTIFIER_PATTERN.matcher(s).matches()) {
return true;
}
@@ -303,7 +303,7 @@ public class IdentifiersDeobfuscation {
* @return
*/
public static String printIdentifier(boolean as3, String s, String... validExceptions) {
if (s.startsWith("\u00A7") && s.endsWith("\u00A7")) { //Assuming already printed - TODO:detect better
if (s.startsWith("\u00A7") && s.endsWith("\u00A7")) { // Assuming already printed - TODO:detect better
return s;
}

View File

@@ -624,7 +624,7 @@ public final class SWF implements SWFContainerItem, Timelined {
sis.setPercentMax(fileSize);
displayRect = sis.readRECT("displayRect");
// FIXED8 (16 bit fixed point) frameRate
sis.readUI8("tmpFirstByetOfFrameRate"); //tmpFirstByetOfFrameRate
sis.readUI8("tmpFirstByetOfFrameRate"); // tmpFirstByetOfFrameRate
frameRate = sis.readUI8("frameRate");
frameCount = sis.readUI16("frameCount");
List<Tag> tags = sis.readTagList(this, 0, parallelRead, true, !checkOnly);
@@ -812,11 +812,11 @@ public final class SWF implements SWFContainerItem, Timelined {
String signature = new String(hdr, 0, 3, Utf8Helper.charset);
if (!Arrays.asList(
"FWS", //Uncompressed Flash
"CWS", //ZLib compressed Flash
"ZWS", //LZMA compressed Flash
"GFX", //Uncompressed ScaleForm GFx
"CFX" //Compressed ScaleForm GFx
"FWS", // Uncompressed Flash
"CWS", // ZLib compressed Flash
"ZWS", // LZMA compressed Flash
"GFX", // Uncompressed ScaleForm GFx
"CFX" // Compressed ScaleForm GFx
).contains(signature)) {
throw new IOException("Invalid SWF file");
}
@@ -1185,12 +1185,12 @@ public final class SWF implements SWFContainerItem, Timelined {
public static void createWavFromPcmData(OutputStream fos, int soundRateHz, boolean soundSize, boolean soundType, byte[] data) throws IOException {
ByteArrayOutputStream subChunk1Data = new ByteArrayOutputStream();
int audioFormat = 1; //PCM
int audioFormat = 1; // PCM
writeLE(subChunk1Data, audioFormat, 2);
int numChannels = soundType ? 2 : 1;
writeLE(subChunk1Data, numChannels, 2);
int[] rateMap = {5512, 11025, 22050, 44100};
int sampleRate = soundRateHz;//rateMap[soundRate];
int sampleRate = soundRateHz; // rateMap[soundRate];
writeLE(subChunk1Data, sampleRate, 4);
int bitsPerSample = soundSize ? 16 : 8;
int byteRate = sampleRate * numChannels * bitsPerSample / 8;
@@ -1457,7 +1457,7 @@ public final class SWF implements SWFContainerItem, Timelined {
JPacker.main(new String[]{"-q", "-b", "62", "-o", fmin.getAbsolutePath(), f.getAbsolutePath()});
f.delete();
packed = true;
} catch (Exception | Error e) { //Something wrong in the packer
} catch (Exception | Error e) { // Something wrong in the packer
logger.log(Level.WARNING, "JPacker: Cannot minimize script");
f.renameTo(fmin);
}
@@ -1655,7 +1655,7 @@ public final class SWF implements SWFContainerItem, Timelined {
usageType = "class";
}
if (ins instanceof ActionCallMethod) {
usageType = "function"; //can there be method?
usageType = "function"; // can there be method?
}
if (ins instanceof ActionCallFunction) {
usageType = "function";
@@ -1689,7 +1689,7 @@ public final class SWF implements SWFContainerItem, Timelined {
((GraphSourceItemContainer) ins).translateContainer(r, stack, output, new HashMap<Integer, String>(), new HashMap<String, GraphTargetItem>(), new HashMap<String, GraphTargetItem>());
} catch (EmptyStackException ex) {
}
//ip++;
continue;
}
@@ -1713,7 +1713,7 @@ public final class SWF implements SWFContainerItem, Timelined {
usageTypes.put((DirectValueActionItem) name, usageType);
}
//for..in return
// for..in return
if (((ins instanceof ActionEquals) || (ins instanceof ActionEquals2)) && (stack.size() == 1) && (stack.peek() instanceof DirectValueActionItem)) {
stack.push(new DirectValueActionItem(null, 0, new Null(), new ArrayList<String>()));
}
@@ -2029,7 +2029,7 @@ public final class SWF implements SWFContainerItem, Timelined {
informListeners("rename", "function " + fc + "/" + allFunctions.size());
if (fun instanceof ActionDefineFunction) {
ActionDefineFunction f = (ActionDefineFunction) fun;
if (f.functionName.isEmpty()) { //anonymous function, leave as is
if (f.functionName.isEmpty()) { // anonymous function, leave as is
continue;
}
String changed = deobfuscation.deobfuscateName(false, f.functionName, false, "function", deobfuscated, renameType, selected);
@@ -2040,7 +2040,7 @@ public final class SWF implements SWFContainerItem, Timelined {
}
if (fun instanceof ActionDefineFunction2) {
ActionDefineFunction2 f = (ActionDefineFunction2) fun;
if (f.functionName.isEmpty()) { //anonymous function, leave as is
if (f.functionName.isEmpty()) { // anonymous function, leave as is
continue;
}
String changed = deobfuscation.deobfuscateName(false, f.functionName, false, "function", deobfuscated, renameType, selected);
@@ -2517,7 +2517,7 @@ public final class SWF implements SWFContainerItem, Timelined {
}
ColorTransform clrTrans = colorTransform.clone();
if (layer.colorTransForm != null && layer.blendMode <= 1) { //Normal blend mode
if (layer.colorTransForm != null && layer.blendMode <= 1) { // Normal blend mode
clrTrans = colorTransform.merge(layer.colorTransForm);
}
@@ -2664,7 +2664,7 @@ public final class SWF implements SWFContainerItem, Timelined {
}
ColorTransform clrTrans = colorTransform.clone();
if (layer.colorTransForm != null && layer.blendMode <= 1) { //Normal blend mode
if (layer.colorTransForm != null && layer.blendMode <= 1) { // Normal blend mode
clrTrans = colorTransform.merge(layer.colorTransForm);
}
@@ -2762,7 +2762,7 @@ public final class SWF implements SWFContainerItem, Timelined {
case 1:
g.setComposite(AlphaComposite.SrcOver);
break;
case 2://Layer
case 2: // Layer
g.setComposite(AlphaComposite.SrcOver);
break;
case 3:
@@ -2801,7 +2801,7 @@ public final class SWF implements SWFContainerItem, Timelined {
case 14:
g.setComposite(BlendComposite.HardLight);
break;
default: //Not implemented
default: // Not implemented
g.setComposite(AlphaComposite.SrcOver);
break;
}
@@ -2817,7 +2817,7 @@ public final class SWF implements SWFContainerItem, Timelined {
gm.fillRect(0, 0, image.getWidth(), image.getHeight());
gm.setTransform(trans);
gm.drawImage(img.getBufferedImage(), 0, 0, null);
Clip clip = new Clip(Helper.imageToShape(mask), layer.clipDepth); //Maybe we can get current outline instead converting from image (?)
Clip clip = new Clip(Helper.imageToShape(mask), layer.clipDepth); // Maybe we can get current outline instead converting from image (?)
clips.add(clip);
prevClips.add(g.getClip());
g.setTransform(AffineTransform.getTranslateInstance(0, 0));

View File

@@ -1083,7 +1083,7 @@ public class SWFInputStream implements AutoCloseable {
doParse = true;
} else {
switch (tag.getId()) {
case FileAttributesTag.ID: //FileAttributes
case FileAttributesTag.ID: // FileAttributes
if (tag instanceof TagStub) {
tag = resolveTag((TagStub) tag, level, parallel, skipUnusualTags, true);
}
@@ -1106,7 +1106,7 @@ public class SWFInputStream implements AutoCloseable {
case PlaceObject2Tag.ID:
case RemoveObjectTag.ID:
case RemoveObject2Tag.ID:
case PlaceObject3Tag.ID: //?
case PlaceObject3Tag.ID: // ?
case StartSoundTag.ID:
case FrameLabelTag.ID:
case SoundStreamHeadTag.ID:
@@ -1401,7 +1401,7 @@ public class SWFInputStream implements AutoCloseable {
ret = new PlaceObject4Tag(sis, data);
break;
default:
if (swf.gfx) { //GFX tags only in GFX files. There may be incorrect GFX tags in non GFX files
if (swf.gfx) { // GFX tags only in GFX files. There may be incorrect GFX tags in non GFX files
switch (tag.getId()) {
case 1000:
ret = new ExporterInfo(sis, data);
@@ -1563,7 +1563,7 @@ public class SWFInputStream implements AutoCloseable {
actionLength = readUI16("actionLength");
}
switch (actionCode) {
//SWF3 Actions
// SWF3 Actions
case 0x81:
return new ActionGotoFrame(actionLength, this);
case 0x83:
@@ -1586,7 +1586,7 @@ public class SWFInputStream implements AutoCloseable {
return new ActionSetTarget(actionLength, this, swf.version);
case 0x8C:
return new ActionGoToLabel(actionLength, this, swf.version);
//SWF4 Actions
// SWF4 Actions
case 0x96:
return new ActionPush(actionLength, this, swf.version);
case 0x17:
@@ -1669,7 +1669,7 @@ public class SWFInputStream implements AutoCloseable {
return new ActionGetTime();
case 0x30:
return new ActionRandomNumber();
//SWF5 Actions
// SWF5 Actions
case 0x3D:
return new ActionCallFunction();
case 0x52:
@@ -1742,7 +1742,7 @@ public class SWFInputStream implements AutoCloseable {
return new ActionStackSwap();
case 0x87:
return new ActionStoreRegister(actionLength, this);
//SWF6 Actions
// SWF6 Actions
case 0x54:
return new ActionInstanceOf();
case 0x55:
@@ -1753,7 +1753,7 @@ public class SWFInputStream implements AutoCloseable {
return new ActionGreater();
case 0x68:
return new ActionStringGreater();
//SWF7 Actions
// SWF7 Actions
case 0x8E:
return new ActionDefineFunction2(actionLength, this, swf.version);
case 0x69:
@@ -1774,8 +1774,8 @@ public class SWFInputStream implements AutoCloseable {
Action r = new ActionNop();
r.actionCode = actionCode;
r.actionLength = actionLength;
logger.log(Level.SEVERE, "Unknown action code: {0}", actionCode);
return r;
//return new Action(actionCode, actionLength);
}
} catch (EndOfStreamException | ArrayIndexOutOfBoundsException eos) {
return null;
@@ -2127,7 +2127,7 @@ public class SWFInputStream implements AutoCloseable {
public BEVELFILTER readBEVELFILTER(String name) throws IOException {
BEVELFILTER ret = new BEVELFILTER();
newDumpLevel(name, "BEVELFILTER");
ret.highlightColor = readRGBA("highlightColor"); //Highlight color first. It it opposite of the documentation
ret.highlightColor = readRGBA("highlightColor"); // Highlight color first. It it opposite of the documentation
ret.shadowColor = readRGBA("shadowColor");
ret.blurX = readFIXED("blurX");
ret.blurY = readFIXED("blurY");
@@ -2642,7 +2642,7 @@ public class SWFInputStream implements AutoCloseable {
}
ret = scr;
}
} else {//typeFlag==1
} else { // typeFlag==1
int straightFlag = (int) readUB(1, "straightFlag");
if (straightFlag == 1) {
StraightEdgeRecord ser = new StraightEdgeRecord();
@@ -2826,13 +2826,13 @@ public class SWFInputStream implements AutoCloseable {
public TEXTRECORD readTEXTRECORD(boolean inDefineText2, int glyphBits, int advanceBits, String name) throws IOException {
TEXTRECORD ret = new TEXTRECORD();
newDumpLevel(name, "TEXTRECORD");
int first = (int) readUB(1, "first"); //always 1
readUB(3, "styleFlagsHasReserved"); //always 0
int first = (int) readUB(1, "first"); // always 1
readUB(3, "styleFlagsHasReserved"); // always 0
ret.styleFlagsHasFont = readUB(1, "styleFlagsHasFont") == 1;
ret.styleFlagsHasColor = readUB(1, "styleFlagsHasColor") == 1;
ret.styleFlagsHasYOffset = readUB(1, "styleFlagsHasYOffset") == 1;
ret.styleFlagsHasXOffset = readUB(1, "styleFlagsHasXOffset") == 1;
if ((!ret.styleFlagsHasFont) && (!ret.styleFlagsHasColor) && (!ret.styleFlagsHasYOffset) && (!ret.styleFlagsHasXOffset) && (first == 0)) { //final text record
if ((!ret.styleFlagsHasFont) && (!ret.styleFlagsHasColor) && (!ret.styleFlagsHasYOffset) && (!ret.styleFlagsHasXOffset) && (first == 0)) { // final text record
endDumpLevel();
return null;
}
@@ -2893,7 +2893,7 @@ public class SWFInputStream implements AutoCloseable {
public MORPHGRADIENT readMORPHGRADIENT(String name) throws IOException {
MORPHGRADIENT ret = new MORPHGRADIENT();
newDumpLevel(name, "MORPHGRADIENT");
//Despite of documentation (UI8 1-8), there are two fields
// Despite of documentation (UI8 1-8), there are two fields
// spreadMode and interPolationMode which are same as in GRADIENT
ret.spreadMode = (int) readUB(2, "spreadMode");
ret.interPolationMode = (int) readUB(2, "interPolationMode");

View File

@@ -531,9 +531,9 @@ public class SWFOutputStream extends OutputStream {
* @return Number of bits
*/
public static int getNeededBitsF(float value) {
//0.26213074 16bits
//0.5 17bits
//1.3476715 18bits
// 0.26213074 16bits
// 0.5 17bits
// 1.3476715 18bits
int k = (int) value;
return getNeededBitsS(k) + 16;
}
@@ -741,7 +741,7 @@ public class SWFOutputStream extends OutputStream {
sos.write(value.actionBytes);
}
byte[] data = baos.toByteArray();
writeUI32(data.length); //actionRecordSize
writeUI32(data.length); // actionRecordSize
write(data);
}
@@ -1323,8 +1323,8 @@ public class SWFOutputStream extends OutputStream {
for (SHAPERECORD sh : value) {
if (sh instanceof CurvedEdgeRecord) {
CurvedEdgeRecord cer = (CurvedEdgeRecord) sh;
writeUB(1, 1); //typeFlag
writeUB(1, 0);//curvedEdge
writeUB(1, 1); // typeFlag
writeUB(1, 0); // curvedEdge
cer.numBits = Math.max(getNeededBitsS(cer.controlDeltaX, cer.controlDeltaY, cer.anchorDeltaX, cer.anchorDeltaY) - 2, 0);
writeUB(4, cer.numBits);
writeSB(cer.numBits + 2, cer.controlDeltaX);
@@ -1333,8 +1333,8 @@ public class SWFOutputStream extends OutputStream {
writeSB(cer.numBits + 2, cer.anchorDeltaY);
} else if (sh instanceof StraightEdgeRecord) {
StraightEdgeRecord ser = (StraightEdgeRecord) sh;
writeUB(1, 1); //typeFlag
writeUB(1, 1);//straightEdge
writeUB(1, 1); // typeFlag
writeUB(1, 1); // straightEdge
ser.numBits = Math.max(getNeededBitsS(ser.deltaX, ser.deltaY) - 2, 0);
writeUB(4, ser.numBits);
writeUB(1, ser.generalLineFlag ? 1 : 0);
@@ -1349,7 +1349,7 @@ public class SWFOutputStream extends OutputStream {
}
} else if (sh instanceof StyleChangeRecord) {
StyleChangeRecord scr = (StyleChangeRecord) sh;
writeUB(1, 0); //typeFlag
writeUB(1, 0); // typeFlag
writeUB(1, scr.stateNewStyles ? 1 : 0);
writeUB(1, scr.stateLineStyle ? 1 : 0);
writeUB(1, scr.stateFillStyle1 ? 1 : 0);
@@ -1382,8 +1382,8 @@ public class SWFOutputStream extends OutputStream {
}
} else if (sh instanceof EndShapeRecord) {
writeUB(1, 0); //typeFlag
writeUB(5, 0); //end of shape flag
writeUB(1, 0); // typeFlag
writeUB(5, 0); // end of shape flag
}
}
alignByte();
@@ -1548,7 +1548,7 @@ public class SWFOutputStream extends OutputStream {
* @throws IOException
*/
public void writeMORPHGRADIENT(MORPHGRADIENT value, int shapeNum) throws IOException {
//Despite of documentation (UI8 1-8), there are two fields
// Despite of documentation (UI8 1-8), there are two fields
// spreadMode and interPolationMode which are same as in GRADIENT
writeUB(2, value.spreadMode);
writeUB(2, value.interPolationMode);

View File

@@ -69,11 +69,11 @@ public class SWFSearch {
setProgress(p);
}
},
"FWS".getBytes(), //Uncompressed Flash
"CWS".getBytes(), //ZLib compressed Flash
"ZWS".getBytes(), //LZMA compressed Flash
"GFX".getBytes(), //Uncompressed ScaleForm GFx
"CFX".getBytes()); //Compressed ScaleForm GFx
"FWS".getBytes(), // Uncompressed Flash
"CWS".getBytes(), // ZLib compressed Flash
"ZWS".getBytes(), // LZMA compressed Flash
"GFX".getBytes(), // Uncompressed ScaleForm GFx
"CFX".getBytes()); // Compressed ScaleForm GFx
int pos = 0;
long biggestSize = 0;
long smallestSize = Long.MAX_VALUE;

View File

@@ -37,7 +37,7 @@ public class SourceGeneratorLocalData implements Serializable {
public Boolean inMethod;
public Integer forInLevel;
//TODO: handle AVM2 separately
// TODO: handle AVM2 separately
public List<ABCException> exceptions = new ArrayList<>();
public List<Integer> finallyCatches = new ArrayList<>();
public Map<Integer, Integer> finallyCounter = new HashMap<>();

View File

@@ -96,7 +96,7 @@ public class ZippedSWFBundle implements SWFBundle {
@Override
public Map<String, SeekableInputStream> getAll() throws IOException {
for (String key : getKeys()) { //cache everything first
for (String key : getKeys()) { // cache everything first
getSWF(key);
}
return cachedSWFs;

View File

@@ -254,7 +254,7 @@ public class ABC {
Set<Integer> stringUsages = getStringUsages();
Set<Integer> namespaceUsages = getNsStringUsages();
int strIndex = constants.getMultiname(multinameIndex).name_index;
if (stringUsages.contains(strIndex) || namespaceUsages.contains(strIndex)) { //name is used elsewhere as string literal
if (stringUsages.contains(strIndex) || namespaceUsages.contains(strIndex)) { // name is used elsewhere as string literal
strIndex = constants.getStringId(newname, true);
constants.getMultiname(multinameIndex).name_index = strIndex;
} else {
@@ -291,13 +291,13 @@ public class ABC {
}
for (int i = 1; i < constants.getNamespaceCount(); i++) {
informListeners("deobfuscate", "namespace " + i + "/" + constants.getNamespaceCount());
if (constants.getNamespace(i).kind != Namespace.KIND_PACKAGE) { //only packages
if (constants.getNamespace(i).kind != Namespace.KIND_PACKAGE) { // only packages
continue;
}
constants.getNamespace(i).name_index = deobfuscation.deobfuscatePackageName(stringUsageTypes, stringUsages, namesMap, constants.getNamespace(i).name_index, renameType);
}
//process reflection using getDefinitionByName too
// process reflection using getDefinitionByName too
for (MethodBody body : bodies) {
for (int ip = 0; ip < body.getCode().code.size(); ip++) {
if (body.getCode().code.get(ip).definition instanceof CallPropertyIns) {
@@ -350,7 +350,7 @@ public class ABC {
deobfuscation = new AVM2Deobfuscation(constants);
ais.newDumpLevel("constant_pool", "cpool_info");
//constant integers
// constant integers
int constant_int_pool_count = ais.readU30("int_count");
constants.constant_int = new ArrayList<>(constant_int_pool_count);
if (constant_int_pool_count > 0) {
@@ -358,13 +358,13 @@ public class ABC {
}
if (constant_int_pool_count > 1) {
ais.newDumpLevel("integers", "integer[]");
for (int i = 1; i < constant_int_pool_count; i++) { //index 0 not used. Values 1..n-1
for (int i = 1; i < constant_int_pool_count; i++) { // index 0 not used. Values 1..n-1
constants.addInt(ais.readS32("int"));
}
ais.endDumpLevel();
}
//constant unsigned integers
// constant unsigned integers
int constant_uint_pool_count = ais.readU30("uint_count");
constants.constant_uint = new ArrayList<>(constant_uint_pool_count);
if (constant_uint_pool_count > 0) {
@@ -372,13 +372,13 @@ public class ABC {
}
if (constant_uint_pool_count > 1) {
ais.newDumpLevel("uintegers", "uinteger[]");
for (int i = 1; i < constant_uint_pool_count; i++) { //index 0 not used. Values 1..n-1
for (int i = 1; i < constant_uint_pool_count; i++) { // index 0 not used. Values 1..n-1
constants.addUInt(ais.readU32("uint"));
}
ais.endDumpLevel();
}
//constant double
// constant double
int constant_double_pool_count = ais.readU30("double_count");
constants.constant_double = new ArrayList<>(constant_double_pool_count);
if (constant_double_pool_count > 0) {
@@ -386,13 +386,13 @@ public class ABC {
}
if (constant_double_pool_count > 1) {
ais.newDumpLevel("doubles", "double[]");
for (int i = 1; i < constant_double_pool_count; i++) { //index 0 not used. Values 1..n-1
for (int i = 1; i < constant_double_pool_count; i++) { // index 0 not used. Values 1..n-1
constants.addDouble(ais.readDouble("double"));
}
ais.endDumpLevel();
}
//constant decimal
// constant decimal
if (minor_version >= MINORwithDECIMAL) {
int constant_decimal_pool_count = ais.readU30("decimal_count");
constants.constant_decimal = new ArrayList<>(constant_decimal_pool_count);
@@ -401,7 +401,7 @@ public class ABC {
}
if (constant_decimal_pool_count > 1) {
ais.newDumpLevel("decimals", "decimal[]");
for (int i = 1; i < constant_decimal_pool_count; i++) { //index 0 not used. Values 1..n-1
for (int i = 1; i < constant_decimal_pool_count; i++) { // index 0 not used. Values 1..n-1
constants.addDecimal(ais.readDecimal("decimal"));
}
ais.endDumpLevel();
@@ -410,7 +410,7 @@ public class ABC {
constants.constant_decimal = new ArrayList<>(0);
}
//constant string
// constant string
int constant_string_pool_count = ais.readU30("string_count");
constants.constant_string = new ArrayList<>(constant_string_pool_count);
stringOffsets = new long[constant_string_pool_count];
@@ -419,7 +419,7 @@ public class ABC {
}
if (constant_string_pool_count > 1) {
ais.newDumpLevel("strings", "string[]");
for (int i = 1; i < constant_string_pool_count; i++) { //index 0 not used. Values 1..n-1
for (int i = 1; i < constant_string_pool_count; i++) { // index 0 not used. Values 1..n-1
long pos = ais.getPosition();
constants.addString(ais.readString("string"));
stringOffsets[i] = pos;
@@ -427,7 +427,7 @@ public class ABC {
ais.endDumpLevel();
}
//constant namespace
// constant namespace
int constant_namespace_pool_count = ais.readU30("namespace_count");
constants.constant_namespace = new ArrayList<>(constant_namespace_pool_count);
if (constant_namespace_pool_count > 0) {
@@ -435,13 +435,13 @@ public class ABC {
}
if (constant_namespace_pool_count > 1) {
ais.newDumpLevel("namespaces", "namespace[]");
for (int i = 1; i < constant_namespace_pool_count; i++) { //index 0 not used. Values 1..n-1
for (int i = 1; i < constant_namespace_pool_count; i++) { // index 0 not used. Values 1..n-1
constants.addNamespace(ais.readNamespace("namespace"));
}
ais.endDumpLevel();
}
//constant namespace set
// constant namespace set
int constant_namespace_set_pool_count = ais.readU30("ns_set_count");
constants.constant_namespace_set = new ArrayList<>(constant_namespace_set_pool_count);
if (constant_namespace_set_pool_count > 0) {
@@ -449,7 +449,7 @@ public class ABC {
}
if (constant_namespace_set_pool_count > 1) {
ais.newDumpLevel("ns_sets", "ns_set[]");
for (int i = 1; i < constant_namespace_set_pool_count; i++) { //index 0 not used. Values 1..n-1
for (int i = 1; i < constant_namespace_set_pool_count; i++) { // index 0 not used. Values 1..n-1
ais.newDumpLevel("ns_set_infos", "ns_set_info[]");
constants.addNamespaceSet(new NamespaceSet());
int namespace_count = ais.readU30("count");
@@ -462,7 +462,7 @@ public class ABC {
ais.endDumpLevel();
}
//constant multiname
// constant multiname
int constant_multiname_pool_count = ais.readU30("multiname_count");
constants.constant_multiname = new ArrayList<>(constant_multiname_pool_count);
if (constant_multiname_pool_count > 0) {
@@ -470,24 +470,24 @@ public class ABC {
}
if (constant_multiname_pool_count > 1) {
ais.newDumpLevel("multiname", "multinames[]");
for (int i = 1; i < constant_multiname_pool_count; i++) { //index 0 not used. Values 1..n-1
for (int i = 1; i < constant_multiname_pool_count; i++) { // index 0 not used. Values 1..n-1
constants.addMultiname(ais.readMultiname("multiname"));
}
ais.endDumpLevel();
}
ais.endDumpLevel(); //cpool_info
ais.endDumpLevel(); // cpool_info
//method info
// method info
int methods_count = ais.readU30("methods_count");
method_info = new ArrayList<>(methods_count); //MethodInfo[methods_count];
bodyIdxFromMethodIdx = new ArrayList<>(methods_count); //[methods_count];
method_info = new ArrayList<>(methods_count); // MethodInfo[methods_count];
bodyIdxFromMethodIdx = new ArrayList<>(methods_count);
for (int i = 0; i < methods_count; i++) {
method_info.add(ais.readMethodInfo("method"));
bodyIdxFromMethodIdx.add(-1);
}
//metadata info
// metadata info
int metadata_count = ais.readU30("metadata_count");
metadata_info = new ArrayList<>(metadata_count);
for (int i = 0; i < metadata_count; i++) {
@@ -505,11 +505,11 @@ public class ABC {
}
int class_count = ais.readU30("class_count");
instance_info = new ArrayList<>(class_count); //InstanceInfo[class_count];
instance_info = new ArrayList<>(class_count);
for (int i = 0; i < class_count; i++) {
instance_info.add(ais.readInstanceInfo("instance"));
}
class_info = new ArrayList<>(class_count); //ClassInfo[class_count];
class_info = new ArrayList<>(class_count);
for (int i = 0; i < class_count; i++) {
ais.newDumpLevel("class", "class_info");
ClassInfo ci = new ClassInfo();
@@ -519,7 +519,7 @@ public class ABC {
ais.endDumpLevel();
}
int script_count = ais.readU30("script_count");
script_info = new ArrayList<>(script_count); //ScriptInfo[script_count];
script_info = new ArrayList<>(script_count);
for (int i = 0; i < script_count; i++) {
ais.newDumpLevel("script", "script_info");
ScriptInfo si = new ScriptInfo();
@@ -530,7 +530,7 @@ public class ABC {
}
int bodies_count = ais.readU30("bodies_count");
bodies = new ArrayList<>(bodies_count); //MethodBody[bodies_count];
bodies = new ArrayList<>(bodies_count);
for (int i = 0; i < bodies_count; i++) {
ais.newDumpLevel("method_body", "method_body_info");
MethodBody mb = new MethodBody();
@@ -737,7 +737,7 @@ public class ABC {
} else if (traitId < class_info.get(classIndex).static_traits.traits.size() + instance_info.get(classIndex).instance_traits.traits.size()) {
return false;
} else {
return true; //Can be class or instance initializer
return true; // Can be class or instance initializer
}
}
@@ -754,7 +754,7 @@ public class ABC {
traitId -= staticTraits.size();
return instanceTraits.get(traitId);
} else {
return null; //Can be class or instance initializer
return null; // Can be class or instance initializer
}
}
}
@@ -801,7 +801,7 @@ public class ABC {
if (t instanceof TraitSlotConst) {
TraitSlotConst s = ((TraitSlotConst) t);
if (s.isNamespace()) {
String key = constants.getNamespace(s.value_index).getName(constants, true); //assume not null
String key = constants.getNamespace(s.value_index).getName(constants, true); // assume not null
String val = constants.getMultiname(s.name_index).getNameWithNamespace(constants, true);
namespaceMap.put(key, val);
}
@@ -1219,10 +1219,10 @@ public class ABC {
}
}
ActionScriptParser.compile(as, this, new ArrayList<ABC>(), isDocumentClass, scriptName, newClassIndex);
//Move newly added script to its position
// Move newly added script to its position
script_info.set(oldIndex, script_info.get(newIndex));
script_info.remove(newIndex);
pack(); //removes old classes/methods
pack(); // removes old classes/methods
((Tag) parentTag).setModified(true);
}

View File

@@ -309,10 +309,10 @@ public class ABCInputStream implements AutoCloseable {
} else if ((kind == Multiname.MULTINAMEL) || (kind == Multiname.MULTINAMELA)) {
namespace_set_index = readU30("namespace_set_index");
} else if (kind == Multiname.TYPENAME) {
qname_index = readU30("qname_index"); //Multiname index!!!
qname_index = readU30("qname_index"); // Multiname index!!!
int paramsLength = readU30("paramsLength");
for (int i = 0; i < paramsLength; i++) {
params.add(readU30("param")); //multiname indices!
params.add(readU30("param")); // multiname indices!
}
} else {
throw new IOException("Unknown kind of Multiname:0x" + Integer.toHexString(kind));
@@ -333,9 +333,9 @@ public class ABCInputStream implements AutoCloseable {
int name_index = readU30("name_index");
int flags = read("flags");
//// 1=need_arguments, 2=need_activation, 4=need_rest 8=has_optional (16=ignore_rest, 32=explicit,) 64=setsdxns, 128=has_paramnames
// 1=need_arguments, 2=need_activation, 4=need_rest 8=has_optional (16=ignore_rest, 32=explicit,) 64=setsdxns, 128=has_paramnames
ValueKind[] optional = new ValueKind[0];
if ((flags & 8) == 8) { //if has_optional
if ((flags & 8) == 8) { // if has_optional
int optional_count = readU30("optional_count");
optional = new ValueKind[optional_count];
for (int i = 0; i < optional_count; i++) {
@@ -344,7 +344,7 @@ public class ABCInputStream implements AutoCloseable {
}
int[] param_names = new int[param_count];
if ((flags & 128) == 128) { //if has_paramnames
if ((flags & 128) == 128) { // if has_paramnames
for (int i = 0; i < param_count; i++) {
param_names[i] = readU30("param_name");
}
@@ -365,8 +365,8 @@ public class ABCInputStream implements AutoCloseable {
Trait trait;
switch (kindType) {
case 0: //slot
case 6: //const
case 0: // slot
case 6: // const
TraitSlotConst t1 = new TraitSlotConst();
t1.slot_id = readU30("slot_id");
t1.type_index = readU30("type_index");
@@ -376,21 +376,21 @@ public class ABCInputStream implements AutoCloseable {
}
trait = t1;
break;
case 1: //method
case 2: //getter
case 3: //setter
case 1: // method
case 2: // getter
case 3: // setter
TraitMethodGetterSetter t2 = new TraitMethodGetterSetter();
t2.disp_id = readU30("disp_id");
t2.method_info = readU30("method_info");
trait = t2;
break;
case 4: //class
case 4: // class
TraitClass t3 = new TraitClass();
t3.slot_id = readU30("slot_id");
t3.class_info = readU30("class_info");
trait = t3;
break;
case 5: //function
case 5: // function
TraitFunction t4 = new TraitFunction();
t4.slot_id = readU30("slot_id");
t4.method_info = readU30("method_info");

View File

@@ -12,7 +12,8 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc;
import com.jpexs.decompiler.flash.abc.types.Decimal;
@@ -183,10 +184,10 @@ public class ABCOutputStream extends OutputStream {
writeU30(m.name_index);
writeU30(m.namespace_set_index);
}
}
if ((m.kind == 0xf) || (m.kind == 0x10)) { // CONSTANT_RTQName and CONSTANT_RTQNameA
writeU30(m.name_index);
}
}
if ((m.kind == 0x1B) || (m.kind == 0x1C)) { // CONSTANT_MultinameL and CONSTANT_MultinameLA
writeU30(m.namespace_set_index);
}
if (m.kind == 0x1D) {
@@ -196,7 +197,7 @@ public class ABCOutputStream extends OutputStream {
writeU30(m.params.get(i));
}
}
}
// kind==0x11,0x12 nothing CONSTANT_RTQNameL and CONSTANT_RTQNameLA.
}
public void writeMethodInfo(MethodInfo mi) throws IOException {
@@ -215,7 +216,7 @@ public class ABCOutputStream extends OutputStream {
}
}
if ((mi.flags & 128) == 128) { // if has_paramnames
for (int i = 0; i < mi.paramNames.length; i++) {
writeU30(mi.paramNames[i]);
}

View File

@@ -76,7 +76,7 @@ public class ScriptPack extends AS3ClassTreeItem {
Multiname name = abc.script_info.get(scriptIndex).traits.traits.get(t).getName(abc);
Namespace ns = name.getNamespace(abc.constants);
if ((ns.kind == Namespace.KIND_PACKAGE) || (ns.kind == Namespace.KIND_PACKAGE_INTERNAL)) {
packageName = ns.getName(abc.constants, false); //assume not null
packageName = ns.getName(abc.constants, false); // assume not null
}
}
return packageName;

View File

@@ -287,7 +287,7 @@ public class AVM2Code implements Cloneable {
new InstructionDefinition(0x9b, "add_d", new int[]{}) {
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2 + 1; //?
return -2 + 1; // ?
}
},
new AddIIns(),
@@ -314,16 +314,16 @@ public class AVM2Code implements Cloneable {
new CheckFilterIns(),
new CoerceIns(),
new CoerceAIns(),
new InstructionDefinition(0x81, "coerce_b", new int[]{}), //stack:-1+1
new InstructionDefinition(0x84, "coerce_d", new int[]{}), //stack:-1+1
new InstructionDefinition(0x83, "coerce_i", new int[]{}), //stack:-1+1
new InstructionDefinition(0x89, "coerce_o", new int[]{}), //stack:-1+1
new InstructionDefinition(0x81, "coerce_b", new int[]{}), // stack:-1+1
new InstructionDefinition(0x84, "coerce_d", new int[]{}), // stack:-1+1
new InstructionDefinition(0x83, "coerce_i", new int[]{}), // stack:-1+1
new InstructionDefinition(0x89, "coerce_o", new int[]{}), // stack:-1+1
new CoerceSIns(),
new InstructionDefinition(0x88, "coerce_u", new int[]{}), //stack:-1+1
new InstructionDefinition(0x88, "coerce_u", new int[]{}), // stack:-1+1
new InstructionDefinition(0x9a, "concat", new int[]{}) {
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2 + 1; //?
return -2 + 1; // ?
}
},
new ConstructIns(),
@@ -335,7 +335,7 @@ public class AVM2Code implements Cloneable {
new ConvertOIns(),
new ConvertUIns(),
new ConvertSIns(),
new InstructionDefinition(0x79, "convert_m", new int[]{}), //-1 +1
new InstructionDefinition(0x79, "convert_m", new int[]{}), // -1 +1
new InstructionDefinition(0x7a, "convert_m_p", new int[]{AVM2Code.DAT_DECIMAL_PARAMS}) {
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
@@ -366,7 +366,7 @@ public class AVM2Code implements Cloneable {
new InstructionDefinition(0xb8, "divide_p", new int[]{AVM2Code.DAT_DECIMAL_PARAMS}) {
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2 + 1; //?
return -2 + 1; // ?
}
},
new DupIns(),
@@ -376,7 +376,7 @@ public class AVM2Code implements Cloneable {
new EscXAttrIns(),
new EscXElemIns(),
new FindDefIns(),
/* //Duplicate OPCODE with deldescendants. Prefering deldescendants (found in FLEX compiler)
/* // Duplicate OPCODE with deldescendants. Prefering deldescendants (found in FLEX compiler)
new InstructionDefinition(0x5b,"findpropglobalstrict",new int[]{AVM2Code.DAT_MULTINAME_INDEX}){
@Override
@@ -469,7 +469,7 @@ public class AVM2Code implements Cloneable {
new InstructionDefinition(0xb9, "modulo_p", new int[]{AVM2Code.DAT_DECIMAL_PARAMS}) {
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2 + 1; //?
return -2 + 1; // ?
}
},
new MultiplyIns(),
@@ -477,7 +477,7 @@ public class AVM2Code implements Cloneable {
new InstructionDefinition(0xb7, "multiply_p", new int[]{AVM2Code.DAT_DECIMAL_PARAMS}) {
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return -2 + 1; //?
return -2 + 1; // ?
}
},
new NegateIns(),
@@ -509,19 +509,19 @@ public class AVM2Code implements Cloneable {
new InstructionDefinition(0x22, "pushconstant", new int[]{AVM2Code.DAT_STRING_INDEX}) {
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return 1; //?
return 1; // ?
}
},
new InstructionDefinition(0x33, "pushdecimal", new int[]{AVM2Code.DAT_DECIMAL_INDEX}) {
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return 1; //?
return 1; // ?
}
},
new InstructionDefinition(0x34, "pushdnan", new int[]{}) {
@Override
public int getStackDelta(AVM2Instruction ins, ABC abc) {
return 1; //?
return 1; // ?
}
},
new PushDoubleIns(),
@@ -725,7 +725,8 @@ public class AVM2Code implements Cloneable {
}
}
};
//endoflist
// endoflist
public static InstructionDefinition[] instructionSetByCode = buildInstructionSetByCode();
public boolean hideTemporaryRegisters = true;
@@ -800,7 +801,7 @@ public class AVM2Code implements Cloneable {
if (codeMap.containsKey(address)) {
continue;
}
if (address < startPos) //no jump outside block
if (address < startPos) // no jump outside block
{
continue;
}
@@ -816,7 +817,7 @@ public class AVM2Code implements Cloneable {
}
if (instr != null) {
int[] actualOperands = null;
if (instructionCode == 0x1b) { //switch
if (instructionCode == 0x1b) { // switch
int firstOperand = ais.readS24("default_offset");
int case_count = ais.readU30("case_count");
actualOperands = new int[case_count + 3];
@@ -1155,13 +1156,13 @@ public class AVM2Code implements Cloneable {
for (int i = 0; i < -ins.definition.getStackDelta(ins, null/*IfTypeIns do not require ABCs*/); i++) {
writer.appendNoHilight(new DeobfuscatePopIns().instructionName).newLine();
}
if (fixBranch == 0) { //jump
if (fixBranch == 0) { // jump
writer.appendNoHilight(new JumpIns().instructionName + " ofs" + Helper.formatAddress(ofs + ins.getBytes().length + ins.operands[0]));
} else {
//nojump, ignore
// nojump, ignore
}
}
//TODO: lookupswitch ?
// TODO: lookupswitch ?
} else {
if (ins.changeJumpTo > -1) {
writer.appendNoHilight(ins.definition.instructionName + " ofs" + Helper.formatAddress(pos2adr(ins.changeJumpTo)));
@@ -1245,7 +1246,7 @@ public class AVM2Code implements Cloneable {
if (ins.definition instanceof DebugIns) {
if (ins.operands[0] == 1) {
String v = abc.constants.getString(ins.operands[1]);
//Same name already exists, it may be wrong names inserted by obfuscator
// Same name already exists, it may be wrong names inserted by obfuscator
if (localRegNames.values().contains(v)) {
return new HashMap<>();
}
@@ -1254,7 +1255,7 @@ public class AVM2Code implements Cloneable {
}
}
//TODO: Make this immune to using existing multinames (?)
// TODO: Make this immune to using existing multinames (?)
return localRegNames;
}
@@ -1278,7 +1279,7 @@ public class AVM2Code implements Cloneable {
}
} catch (InterruptedException ex) {
//ignored
// ignored
}
}
@@ -1415,7 +1416,7 @@ public class AVM2Code implements Cloneable {
}
}//*/
/*if ((ip + 2 < code.size()) && (ins.definition instanceof NewCatchIns)) { //Filling local register in catch clause
/*if ((ip + 2 < code.size()) && (ins.definition instanceof NewCatchIns)) { // Filling local register in catch clause
if (code.get(ip + 1).definition instanceof DupIns) {
if (code.get(ip + 2).definition instanceof SetLocalTypeIns) {
ins.definition.translate(isStatic, classIndex, localRegs, stack, scopeStack, constants, ins, method_info, output, body, abc, localRegNames, fullyQualifiedNames);
@@ -1428,7 +1429,7 @@ public class AVM2Code implements Cloneable {
SetLocalAVM2Item slt = (SetLocalAVM2Item) output.remove(output.size() - 1);
stack.push(slt.getValue());
ip++;
} else if ((ins.definition instanceof SetLocalTypeIns) && (ip + 1 <= end) && (isKilled(((SetLocalTypeIns) ins.definition).getRegisterId(ins), ip, end))) { //set_local_x,get_local_x..kill x
} else if ((ins.definition instanceof SetLocalTypeIns) && (ip + 1 <= end) && (isKilled(((SetLocalTypeIns) ins.definition).getRegisterId(ins), ip, end))) { // set_local_x,get_local_x..kill x
AVM2Instruction insAfter = code.get(ip + 1);
if ((insAfter.definition instanceof GetLocalTypeIns) && (((GetLocalTypeIns) insAfter.definition).getRegisterId(insAfter) == ((SetLocalTypeIns) ins.definition).getRegisterId(ins))) {
GraphTargetItem before = stack.peek();
@@ -1449,7 +1450,7 @@ public class AVM2Code implements Cloneable {
if (ip - 1 >= start) {
insBefore = code.get(ip - 1);
}
if (insAfter.definition instanceof ConvertBIns) { //SWF compiled with debug contain convert_b
if (insAfter.definition instanceof ConvertBIns) { // SWF compiled with debug contain convert_b
ip++;
//addr = pos2adr(ip);
insAfter = code.get(ip + 1);
@@ -1463,7 +1464,7 @@ public class AVM2Code implements Cloneable {
//stack.add("(" + stack.pop() + ")||");
isAnd = false;
} else if (insAfter.definition instanceof SetLocalTypeIns) {
//chained assignments
// chained assignments
int reg = (((SetLocalTypeIns) insAfter.definition).getRegisterId(insAfter));
for (int t = ip + 1; t <= end - 1; t++) {
if (code.get(t).definition instanceof KillIns) {
@@ -1490,7 +1491,7 @@ public class AVM2Code implements Cloneable {
for (int i = ip; i >= start; i--) {
if (code.get(i).definition instanceof DupIns) {
if (stack.isEmpty()) {
break;//FIXME?o
break; // FIXME?o
}
GraphTargetItem v = stack.pop();
stack.push(new LocalRegAVM2Item(ins, reg, v));
@@ -1537,9 +1538,9 @@ public class AVM2Code implements Cloneable {
if (code.get(ip + plus + 4).definition instanceof PopScopeIns) {
if (code.get(ip + plus + 3).definition instanceof SetPropertyIns) {
functionName = abc.constants.getMultiname(code.get(ip + plus + 3).operands[0]).getName(constants, fullyQualifiedNames, true);
scopeStack.pop();//with
output.remove(output.size() - 1); //with
ip = ip + plus + 4; //+1 below
scopeStack.pop();// with
output.remove(output.size() - 1); // with
ip = ip + plus + 4; // +1 below
}
}
}
@@ -1549,7 +1550,7 @@ public class AVM2Code implements Cloneable {
}
}
}
//What to do when hasDup is false?
// What to do when hasDup is false?
ins.definition.translate(isStatic, scriptIndex, classIndex, localRegs, stack, scopeStack, constants, ins, method_info, output, body, abc, localRegNames, fullyQualifiedNames, path, localRegAssigmentIps, ip, refs, this);
NewFunctionAVM2Item nft = (NewFunctionAVM2Item) stack.peek();
nft.functionName = functionName;
@@ -1763,7 +1764,7 @@ public class AVM2Code implements Cloneable {
}
}
} else {
//In obfuscated code, SetLocal instructions comes first
// In obfuscated code, SetLocal instructions comes first
//break;
}
}
@@ -1784,7 +1785,7 @@ public class AVM2Code implements Cloneable {
return list;
}
}
//Declarations
// Declarations
injectDeclarations(list, new boolean[regCount], new ArrayList<Slot>(), abc, body);
int lastPos = list.size() - 1;
@@ -1982,7 +1983,7 @@ public class AVM2Code implements Cloneable {
while (pos < code.size()) {
AVM2Instruction ins = code.get(pos);
if (stats.instructionStats[pos].seen) {
//check stack mismatch here
// check stack mismatch here
return true;
}
@@ -2032,11 +2033,11 @@ public class AVM2Code implements Cloneable {
}
}
if (ins.definition instanceof ReturnValueIns) {
//check stack=1
// check stack=1
return true;
}
if (ins.definition instanceof ReturnVoidIns) {
//check stack=0
// check stack=0
return true;
}
if (ins.definition instanceof JumpIns) {
@@ -2098,7 +2099,7 @@ public class AVM2Code implements Cloneable {
return null;
}
int maxIp = 0;
//searching for visited instruction in second run which has maximum position
// searching for visited instruction in second run which has maximum position
for (int i = 0; i < stats.instructionStats.length; i++) {
if (stats.instructionStats[i].seen && !visited.contains(i)) {
maxIp = i;
@@ -2118,7 +2119,7 @@ public class AVM2Code implements Cloneable {
for (int i = 0; i < stats.instructionStats.length; i++) {
stats.instructionStats[i].seen = false;
}
//Rerun rest with new scopePos, stackPos
// Rerun rest with new scopePos, stackPos
if (!walkCode(stats, nextIp, origStackPos + 1/*magic!*/, scopePos - 1 /*magic!*/, abc)) {
return null;
}
@@ -2127,7 +2128,7 @@ public class AVM2Code implements Cloneable {
}
prevStart = ex.start;
} catch (ConvertException ex1) {
//ignore
// ignore
}
}
//stats.maxscope+=initScope;
@@ -2753,7 +2754,7 @@ public class AVM2Code implements Cloneable {
}*/
AVM2Instruction ins = code.get(ip);
//Errorneous code inserted by some obfuscators
// Errorneous code inserted by some obfuscators
if (ins.definition instanceof NewObjectIns) {
if (ins.operands[0] > stack.size()) {
ins.setIgnored(true, 0);

View File

@@ -231,8 +231,8 @@ public class AVM2Deobfuscation {
} else {
newname = fooString(namesMap, constants.getString(strIndex), firstUppercase, DEFAULT_FOO_SIZE, stringUsageTypes.get(strIndex), renameType);
}
if (stringUsages.contains(strIndex) || namespaceUsages.contains(strIndex)) { //this name is already referenced as String
strIndex = constants.addString(s); //add new index
if (stringUsages.contains(strIndex) || namespaceUsages.contains(strIndex)) { // this name is already referenced as String
strIndex = constants.addString(s); // add new index
}
constants.setString(strIndex, newname);
if (!namesMap.containsKey(s)) {

View File

@@ -86,7 +86,7 @@ public class AVM2Instruction implements Cloneable, GraphSourceItem {
}
}
} catch (IOException ex) {
//ignored
// ignored
}
return bos.toByteArray();
}

View File

@@ -1560,7 +1560,7 @@ public class ActionScriptParser {
try {
ui.resolve(null, new ArrayList<GraphTargetItem>(), new ArrayList<String>(), abc, otherABCs, new ArrayList<MethodBody>(), variables);
} catch (CompilationException ex) {
//ignore
// ignore
}
ui.setSlotNumber(e.getSlotNumber());
ui.setSlotScope(e.getSlotScope());
@@ -1583,7 +1583,7 @@ public class ActionScriptParser {
try {
ui.resolve(null, new ArrayList<GraphTargetItem>(), new ArrayList<String>(), abc, otherABCs, new ArrayList<MethodBody>(), variables);
} catch (CompilationException ex) {
//ignore
// ignore
}
ui.setSlotNumber(e.getSlotNumber());
ui.setSlotScope(e.getSlotScope());

View File

@@ -12,7 +12,8 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.usages;
import com.jpexs.decompiler.flash.abc.ABC;
@@ -50,7 +51,7 @@ public abstract class ConstVarMultinameUsage extends TraitMultinameUsage {
try {
((TraitSlotConst) traits.traits.get(traitIndex)).convertHeader(null, "", abcTags, abc, isStatic, ScriptExportMode.AS, -1/*FIXME*/, classIndex, nulWriter, new ArrayList<String>(), false);
} catch (InterruptedException ex) {
} catch (InterruptedException ex) {
// ignore
}
HighlightedTextWriter writer = new HighlightedTextWriter(Configuration.getCodeFormatting(), false);
@@ -65,7 +66,7 @@ public abstract class ConstVarMultinameUsage extends TraitMultinameUsage {
try {
((TraitSlotConst) traits.traits.get(traitIndex)).toStringHeader(null, "", abcTags, abc, isStatic, ScriptExportMode.AS, -1/*FIXME*/, classIndex, writer, new ArrayList<String>(), false);
} catch (InterruptedException ex) {
} catch (InterruptedException ex) {
// ignore
}
return writer.toString();
}

View File

@@ -94,7 +94,7 @@ import java.util.logging.Logger;
/**
* Represents one ACTIONRECORD, also has some static method to work with Actions
*/
public class Action implements GraphSourceItem {
public abstract class Action implements GraphSourceItem {
private static final int INFORM_LISTENER_RESOLUTION = 100;
@@ -946,7 +946,7 @@ public class Action implements GraphSourceItem {
try {
action.translate(localData, stack, output);
} catch (Exception ex) {
//ignore
// ignore
}
}
} */ /*else if (action instanceof ActionStrictEquals) {
@@ -1065,7 +1065,7 @@ public class Action implements GraphSourceItem {
if ((nti.value instanceof GetMemberActionItem) || (nti.value instanceof GetVariableActionItem)) {
if (true) { //it.onFalse.isEmpty()){ //||(it.onFalse.get(0) instanceof UnsupportedActionItem)) {
if ((it.onTrue.size() == 1) && (it.onTrue.get(0) instanceof SetMemberActionItem) && (((SetMemberActionItem) it.onTrue.get(0)).value instanceof NewObjectActionItem)) {
//ignore
// ignore
} else {
List<GraphTargetItem> parts = it.onTrue;
className = getWithoutGlobal(nti.value);

View File

@@ -516,7 +516,7 @@ public class Configuration {
HashMap<String, Object> cfg = (HashMap<String, Object>) ois.readObject();
config = cfg;
} catch (ClassNotFoundException | IOException ex) {
//ignore
// ignore
}
return config;
}
@@ -548,7 +548,7 @@ public class Configuration {
try {
saveToFile(getConfigFile());
} catch (IOException ex) {
//ignore
// ignore
}
}

View File

@@ -383,11 +383,12 @@ public class BitmapExporter extends ShapeExporterBase {
} else {
lineStroke = new BasicStroke((float) thickness, capStyle, joinStyle);
}
//Do not scale strokes automatically:
// Do not scale strokes automatically:
try {
lineStroke = new TransformedStroke(lineStroke, graphics.getTransform());
} catch (NoninvertibleTransformException net) {
//ignore
// ignore
}
}
@@ -424,8 +425,21 @@ public class BitmapExporter extends ShapeExporterBase {
graphics.setClip(path);
Matrix inverse = null;
try {
double scx = fillTransform.getScaleX();
double scy = fillTransform.getScaleY();
double shx = fillTransform.getShearX();
double shy = fillTransform.getShearY();
double det = scx * scy - shx * shy;
if (Math.abs(det) <= Double.MIN_VALUE) {
// use only the translate values
// todo: make it better
fillTransform.setToTranslation(fillTransform.getTranslateX(), fillTransform.getTranslateY());
}
inverse = new Matrix(new AffineTransform(fillTransform).createInverse());
} catch (NoninvertibleTransformException ex) {
// it should never happen as we already checked the determinant of the matrix
}
fillTransform.preConcatenate(oldAf);
@@ -446,8 +460,20 @@ public class BitmapExporter extends ShapeExporterBase {
graphics.setClip(path);
Matrix inverse = null;
try {
double scx = fillTransform.getScaleX();
double scy = fillTransform.getScaleY();
double shx = fillTransform.getShearX();
double shy = fillTransform.getShearY();
double det = scx * scy - shx * shy;
if (Math.abs(det) <= Double.MIN_VALUE) {
// use only the translate values
// todo: make it better
fillTransform.setToTranslation(fillTransform.getTranslateX(), fillTransform.getTranslateY());
}
inverse = new Matrix(new AffineTransform(fillTransform).createInverse());
} catch (NoninvertibleTransformException ex) {
// it should never happen as we already checked the determinant of the matrix
}
fillTransform.preConcatenate(oldAf);

View File

@@ -12,7 +12,8 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
* License along with this library.
*/
package com.jpexs.decompiler.flash.flv;
import java.io.ByteArrayOutputStream;
@@ -65,7 +66,7 @@ public class AUDIODATA extends DATA {
flv.writeUB(1, soundType ? 1 : 0);
flv.write(soundData);
} catch (IOException ex) {
} catch (IOException ex) {
// ignore
}
return baos.toByteArray();
}

View File

@@ -12,7 +12,8 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
* License along with this library.
*/
package com.jpexs.decompiler.flash.flv;
import java.io.ByteArrayOutputStream;
@@ -43,7 +44,7 @@ public class VIDEODATA extends DATA {
flv.writeUB(4, codecId);
flv.write(videoData);
} catch (IOException ex) {
} catch (IOException ex) {
// ignore
}
return baos.toByteArray();
}

View File

@@ -71,7 +71,7 @@ public class BMPFile extends Component {
try {
b.fo.close();
} catch (Exception ex) {
//ignore
// ignore
}
}
}

View File

@@ -83,7 +83,7 @@ public class FontHelper {
fonts = (Font[]) clFm.getDeclaredMethod("getAllInstalledFonts").invoke(fm);
} catch (Throwable ex) {
//ignore
// ignore
}
if (fonts == null) {
@@ -148,7 +148,7 @@ public class FontHelper {
try {
return k.loadFromTTF(fontFile, size);
} catch (IOException | FontFormatException ex) {
//ignore
// ignore
}
}
List<KerningPair> ret = new ArrayList<>();

View File

@@ -93,7 +93,7 @@ public class DefineBinaryDataTag extends CharacterTag {
innerSwf = bswf;
bswf.binaryData = this;
} catch (IOException | InterruptedException ex) {
//ignore
// ignore
}
}
}

View File

@@ -158,7 +158,7 @@ public class DefineMorphShapeTag extends CharacterTag implements MorphShapeTag {
characterId = sis.readUI16("characterId");
startBounds = sis.readRECT("startBounds");
endBounds = sis.readRECT("endBounds");
long offset = sis.readUI32("offset"); //ignore
long offset = sis.readUI32("offset"); // ignore
morphFillStyles = sis.readMORPHFILLSTYLEARRAY("morphFillStyles");
morphLineStyles = sis.readMORPHLINESTYLEARRAY(1, "morphLineStyles");
startEdges = sis.readSHAPE(1, true, "startEdges");

View File

@@ -12,7 +12,8 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
* License along with this library.
*/
package com.jpexs.decompiler.flash.types.shaperecords;
import com.jpexs.decompiler.flash.SWFOutputStream;
@@ -38,8 +39,8 @@ public class StraightEdgeRecord extends SHAPERECORD {
ser.deltaY = (int) readSB(ser.numBits + 2);
}
*/
*/
public int typeFlag = 1;
public boolean typeFlag = true;
public boolean straightFlag = true;
@Calculated
@SWFType(value = BasicType.UB, count = 4)

View File

@@ -2141,7 +2141,7 @@ public class XFLConverter {
DefineSoundTag s = (DefineSoundTag) ta;
if (s.soundId == startSound.soundId) {
if (!files.containsKey("sound" + s.soundId + "." + s.getExportFormat())) { //Sound was not exported
startSound = null; //ignore
startSound = null; // ignore
}
break;
}
@@ -2152,7 +2152,7 @@ public class XFLConverter {
if (t instanceof SoundStreamHeadTypeTag) {
soundStreamHead = (SoundStreamHeadTypeTag) t;
if (!files.containsKey("sound" + soundStreamHead.getCharacterId() + "." + soundStreamHead.getExportFormat())) { //Sound was not exported
soundStreamHead = null; //ignore
soundStreamHead = null; // ignore
}
}
if (t instanceof ShowFrameTag) {

View File

@@ -213,7 +213,7 @@ public class FileHashMap<K, V> extends AbstractMap<K, V> implements Freed {
try {
oos.close();
} catch (IOException ex) {
//ignore
// ignore
}
}
return value;

View File

@@ -476,7 +476,7 @@ public class Helper {
}
}
} catch (IOException ex) {
//ignore
// ignore
}
}
@@ -486,7 +486,7 @@ public class Helper {
fos.write(d);
}
} catch (IOException ex) {
//ignore
// ignore
}
}

View File

@@ -133,7 +133,7 @@ public class SerializableImage implements Serializable {
try {
ImageHelper.write(image, "png", out);
} catch (Exception ex) {
//ignore
// ignore
}
}

View File

@@ -12,7 +12,8 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
* License along with this library.
*/
package com.jpexs.helpers;
import java.io.BufferedInputStream;
@@ -65,7 +66,7 @@ public class SoundPlayer {
wait();
}
} catch (InterruptedException ex) {
} catch (InterruptedException ex) {
// Ignore
}
}