mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-06-16 19:01:58 +00:00
Merge origin/master
This commit is contained in:
@@ -992,11 +992,13 @@ public class SWFInputStream implements AutoCloseable {
|
||||
return ret;
|
||||
}
|
||||
|
||||
private static void dumpTag(PrintStream out, int version, Tag tag, int level) {
|
||||
private static void dumpTag(PrintStream out, Tag tag, int index, int level) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(Helper.formatHex((int) tag.getPos(), 8));
|
||||
sb.append(": ");
|
||||
sb.append(Helper.indent(level, "", " "));
|
||||
sb.append(Helper.formatInt(index, 4));
|
||||
sb.append(". ");
|
||||
sb.append(Helper.format(tag.toString(), 25 - 2 * level));
|
||||
sb.append(" tagId=");
|
||||
sb.append(Helper.formatInt(tag.getId(), 3));
|
||||
@@ -1007,8 +1009,9 @@ public class SWFInputStream implements AutoCloseable {
|
||||
out.println(sb.toString());
|
||||
// out.println(Utils.formatHex((int)tag.getPos(), 8) + ": " + Utils.indent(level, "") + Utils.format(tag.toString(), 25 - 2*level) + " tagId="+tag.getId()+" len="+tag.getOrigDataLength()+": "+Utils.bytesToHexString(64, tag.getData(version), 0));
|
||||
if (tag instanceof DefineSpriteTag) {
|
||||
int i = 0;
|
||||
for (Tag subTag : ((DefineSpriteTag) tag).getSubTags()) {
|
||||
dumpTag(out, version, subTag, level + 1);
|
||||
dumpTag(out, subTag, i++, level + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1108,7 +1111,7 @@ public class SWFInputStream implements AutoCloseable {
|
||||
tags.add(tag);
|
||||
}
|
||||
if (Configuration.dumpTags.get() && level == 0) {
|
||||
dumpTag(System.out, swf.version, tag, level);
|
||||
dumpTag(System.out, tag, tags.size() - 1, level);
|
||||
}
|
||||
|
||||
boolean doParse;
|
||||
|
||||
@@ -299,7 +299,6 @@ import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.TreeMap;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
@@ -1469,7 +1468,7 @@ public class AVM2Code implements Cloneable {
|
||||
//if(true) return "";
|
||||
toSourceCount++;
|
||||
if (toSourceLimit > 0) {
|
||||
if (toSourceCount > toSourceLimit) {
|
||||
if (toSourceCount >= toSourceLimit) {
|
||||
throw new ConvertException("Limit of subs(" + toSourceLimit + ") was reached", start);
|
||||
}
|
||||
}
|
||||
@@ -2268,7 +2267,7 @@ public class AVM2Code implements Cloneable {
|
||||
new AVM2DeobfuscatorSimple().deobfuscate(path, classIndex, isStatic, scriptIndex, abc, constants, trait, info, body);
|
||||
new AVM2DeobfuscatorRegisters().deobfuscate(path, classIndex, isStatic, scriptIndex, abc, constants, trait, info, body);
|
||||
new AVM2DeobfuscatorJumps().deobfuscate(path, classIndex, isStatic, scriptIndex, abc, constants, trait, info, body);
|
||||
//body.getCode().checkValidOffsets(body); // todo: only for debugging. checkValidOffsets can be made private later
|
||||
//body.getCode().checkValidOffsets(body); // todo: only for debugging. checkValidOffsets can be made private later
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -2898,7 +2897,6 @@ public class AVM2Code implements Cloneable {
|
||||
for (int i = 0; i < code.size(); i++) {
|
||||
code.get(i).mappedOffset = ofs;
|
||||
ofs += code.get(i).getBytesLength();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3354,6 +3352,11 @@ public class AVM2Code implements Cloneable {
|
||||
}
|
||||
ret.code = codeCopy;
|
||||
}
|
||||
|
||||
cacheActual = false;
|
||||
ignoredIns = new ArrayList<>();
|
||||
killedRegs = new HashMap<>();
|
||||
unknownJumps = new ArrayList<>();
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -288,8 +288,9 @@ public final class MethodBody implements Cloneable {
|
||||
public Void call() throws InterruptedException {
|
||||
MethodBody converted = convertMethodBody(path, isStatic, scriptIndex, classIndex, abc, trait, constants, method_info, scopeStack, isStaticInitializer, fullyQualifiedNames, initTraits);
|
||||
HashMap<Integer, String> localRegNames = getLocalRegNames(abc);
|
||||
convertedItems = converted.getCode().toGraphTargetItems(path, isStatic, scriptIndex, classIndex, abc, constants, method_info, converted, localRegNames, scopeStack, isStaticInitializer, fullyQualifiedNames, initTraits, Graph.SOP_USE_STATIC, new HashMap<>(), converted.getCode().visitCode(converted));
|
||||
Graph.graphToString(convertedItems, writer, LocalData.create(constants, localRegNames, fullyQualifiedNames));
|
||||
List<GraphTargetItem> convertedItems1 = converted.getCode().toGraphTargetItems(path, isStatic, scriptIndex, classIndex, abc, constants, method_info, converted, localRegNames, scopeStack, isStaticInitializer, fullyQualifiedNames, initTraits, Graph.SOP_USE_STATIC, new HashMap<>(), converted.getCode().visitCode(converted));
|
||||
Graph.graphToString(convertedItems1, writer, LocalData.create(constants, localRegNames, fullyQualifiedNames));
|
||||
convertedItems = convertedItems1;
|
||||
return null;
|
||||
}
|
||||
};
|
||||
@@ -361,7 +362,11 @@ public final class MethodBody implements Cloneable {
|
||||
throw ex;
|
||||
} catch (Throwable ex) {
|
||||
//ignore
|
||||
return this;
|
||||
body = clone();
|
||||
code = body.getCode();
|
||||
code.markMappedOffsets();
|
||||
code.fixJumps(path, body);
|
||||
return body;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -383,7 +388,13 @@ public final class MethodBody implements Cloneable {
|
||||
}
|
||||
}
|
||||
|
||||
//maybe deep clone traits
|
||||
// maybe deep clone traits
|
||||
/*if (traits != null) {
|
||||
ret.traits = traits.clone();
|
||||
}*/
|
||||
convertedItems = null;
|
||||
convertException = null;
|
||||
|
||||
return ret;
|
||||
} catch (CloneNotSupportedException ex) {
|
||||
throw new RuntimeException();
|
||||
|
||||
@@ -29,7 +29,7 @@ import com.jpexs.helpers.Helper;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
public abstract class Trait implements Serializable {
|
||||
public abstract class Trait implements Cloneable, Serializable {
|
||||
|
||||
private static final int[] EMPTY_METADATA_ARRAY = new int[0];
|
||||
|
||||
@@ -193,4 +193,14 @@ public abstract class Trait implements Serializable {
|
||||
String objectName = name.getName(abc.constants, null, false);
|
||||
return new ClassPath(packageName, objectName); //assume not null name
|
||||
}
|
||||
|
||||
@Override
|
||||
public Trait clone() {
|
||||
try {
|
||||
Trait ret = (Trait) super.clone();
|
||||
return ret;
|
||||
} catch (CloneNotSupportedException ex) {
|
||||
throw new RuntimeException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -595,4 +595,10 @@ public class TraitClass extends Trait implements TraitWithSlot {
|
||||
ret += classInfo.static_traits.removeTraps(scriptIndex, class_info, true, abc, path);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TraitClass clone() {
|
||||
TraitClass ret = (TraitClass) super.clone();
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -109,4 +109,10 @@ public class TraitFunction extends Trait implements TraitWithSlot {
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TraitFunction clone() {
|
||||
TraitFunction ret = (TraitFunction) super.clone();
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -114,4 +114,10 @@ public class TraitMethodGetterSetter extends Trait {
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TraitMethodGetterSetter clone() {
|
||||
TraitMethodGetterSetter ret = (TraitMethodGetterSetter) super.clone();
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -181,4 +181,10 @@ public class TraitSlotConst extends Trait implements TraitWithSlot {
|
||||
//do nothing
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TraitSlotConst clone() {
|
||||
TraitSlotConst ret = (TraitSlotConst) super.clone();
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ import java.util.concurrent.Future;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
public class Traits implements Serializable {
|
||||
public class Traits implements Cloneable, Serializable {
|
||||
|
||||
public List<Trait> traits;
|
||||
|
||||
@@ -213,4 +213,22 @@ public class Traits implements Serializable {
|
||||
executor.shutdown();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Traits clone() {
|
||||
try {
|
||||
Traits ret = (Traits) super.clone();
|
||||
|
||||
if (traits != null) {
|
||||
ret.traits = new ArrayList<>(traits.size());
|
||||
for (int i = 0; i < traits.size(); i++) {
|
||||
ret.traits.add(traits.get(i).clone());
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
} catch (CloneNotSupportedException ex) {
|
||||
throw new RuntimeException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -161,6 +161,10 @@ public abstract class GraphTargetItem implements Serializable, Cloneable {
|
||||
}
|
||||
|
||||
public GraphTextWriter toStringSemicoloned(GraphTextWriter writer, LocalData localData) throws InterruptedException {
|
||||
if (Thread.currentThread().isInterrupted()) {
|
||||
throw new InterruptedException();
|
||||
}
|
||||
|
||||
writer.startOffset(src, getPos(), srcData);
|
||||
appendTo(writer, localData);
|
||||
if (needsSemicolon()) {
|
||||
|
||||
@@ -32,9 +32,9 @@ public class Loop implements Serializable {
|
||||
|
||||
public GraphPart loopPreContinue;
|
||||
|
||||
public List<GraphPart> breakCandidates = new ArrayList<>();
|
||||
public final List<GraphPart> breakCandidates = new ArrayList<>();
|
||||
|
||||
public List<Integer> breakCandidatesLevels = new ArrayList<>();
|
||||
public final List<Integer> breakCandidatesLevels = new ArrayList<>();
|
||||
|
||||
public long id;
|
||||
|
||||
|
||||
@@ -1,18 +1,19 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3.0 of the License, or (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* 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.graph.model;
|
||||
|
||||
import com.jpexs.decompiler.graph.GraphSourceItem;
|
||||
|
||||
Reference in New Issue
Block a user