mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-07-17 18:38:12 +00:00
#989 Rename invalid idetifiers -Type - classes get lost if name exists: check existing constants in all abc tags
This commit is contained in:
@@ -1829,6 +1829,19 @@ public final class SWF implements SWFContainerItem, Timelined {
|
||||
getVariables(variables, actionsMap, functions, strings, usageTypes, asm, path);
|
||||
}
|
||||
|
||||
public boolean as3StringConstantExists(String str) {
|
||||
for (ABCContainerTag abcTag : getAbcList()) {
|
||||
ABC abc = abcTag.getABC();
|
||||
for (int i = 1; i < abc.constants.getStringCount(); i++) {
|
||||
if (abc.constants.getString(i).equals(str)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void fixAS3Code() {
|
||||
for (ABCContainerTag abcTag : getAbcList()) {
|
||||
ABC abc = abcTag.getABC();
|
||||
|
||||
@@ -837,7 +837,7 @@ public class ABC {
|
||||
|
||||
private AVM2Deobfuscation getDeobfuscation() {
|
||||
if (deobfuscation == null) {
|
||||
deobfuscation = new AVM2Deobfuscation(constants);
|
||||
deobfuscation = new AVM2Deobfuscation(getSwf(), constants);
|
||||
}
|
||||
|
||||
return deobfuscation;
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.abc.avm2;
|
||||
|
||||
import com.jpexs.decompiler.flash.SWF;
|
||||
import com.jpexs.decompiler.flash.abc.RenameType;
|
||||
import com.jpexs.decompiler.graph.DottedChain;
|
||||
import java.util.ArrayList;
|
||||
@@ -53,6 +54,8 @@ public class AVM2Deobfuscation {
|
||||
|
||||
public static final String FOO_JOIN_CHARACTERS = "aeiouy";
|
||||
|
||||
private final SWF swf;
|
||||
|
||||
private final AVM2ConstantPool constants;
|
||||
|
||||
private final Map<String, Integer> usageTypesCount = new HashMap<>();
|
||||
@@ -61,7 +64,8 @@ public class AVM2Deobfuscation {
|
||||
|
||||
public static final DottedChain BUILTIN = new DottedChain("-");
|
||||
|
||||
public AVM2Deobfuscation(AVM2ConstantPool constants) {
|
||||
public AVM2Deobfuscation(SWF swf, AVM2ConstantPool constants) {
|
||||
this.swf = swf;
|
||||
this.constants = constants;
|
||||
}
|
||||
|
||||
@@ -148,12 +152,11 @@ public class AVM2Deobfuscation {
|
||||
|
||||
ret = sb.toString();
|
||||
}
|
||||
for (int i = 1; i < constants.getStringCount(); i++) {
|
||||
if (constants.getString(i).equals(ret)) {
|
||||
exists = true;
|
||||
rndSize += 1;
|
||||
continue loopfoo;
|
||||
}
|
||||
if (swf.as3StringConstantExists(ret)) {
|
||||
exists = true;
|
||||
rndSize += 1;
|
||||
continue loopfoo;
|
||||
|
||||
}
|
||||
if (isReserved(ret)) {
|
||||
exists = true;
|
||||
|
||||
Reference in New Issue
Block a user