mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-05-25 11:56:29 +00:00
DottedChain namespace fix
This commit is contained in:
@@ -109,7 +109,7 @@ public class ABC {
|
||||
public ABCContainerTag parentTag;
|
||||
|
||||
/* Map from multiname index of namespace value to namespace name**/
|
||||
private Map<DottedChain, DottedChain> namespaceMap;
|
||||
private Map<String, DottedChain> namespaceMap;
|
||||
|
||||
public ABC(ABCContainerTag tag) {
|
||||
this.parentTag = tag;
|
||||
@@ -814,15 +814,15 @@ public class ABC {
|
||||
}
|
||||
}
|
||||
|
||||
private Map<DottedChain, DottedChain> getNamespaceMap() {
|
||||
private Map<String, DottedChain> getNamespaceMap() {
|
||||
if (namespaceMap == null) {
|
||||
Map<DottedChain, DottedChain> map = new HashMap<>();
|
||||
Map<String, DottedChain> map = new HashMap<>();
|
||||
for (ScriptInfo si : script_info) {
|
||||
for (Trait t : si.traits.traits) {
|
||||
if (t instanceof TraitSlotConst) {
|
||||
TraitSlotConst s = ((TraitSlotConst) t);
|
||||
if (s.isNamespace()) {
|
||||
DottedChain key = constants.getNamespace(s.value_index).getName(constants); // assume not null
|
||||
String key = constants.getNamespace(s.value_index).getName(constants).toRawString(); // assume not null
|
||||
DottedChain val = constants.getMultiname(s.name_index).getNameWithNamespace(constants);
|
||||
map.put(key, val);
|
||||
}
|
||||
@@ -858,10 +858,16 @@ public class ABC {
|
||||
}
|
||||
|
||||
public DottedChain nsValueToName(DottedChain value) {
|
||||
if (getNamespaceMap().containsKey(value)) {
|
||||
return getNamespaceMap().get(value);
|
||||
if (value == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
String valueStr = value.toRawString();
|
||||
|
||||
if (getNamespaceMap().containsKey(valueStr)) {
|
||||
return getNamespaceMap().get(valueStr);
|
||||
} else {
|
||||
DottedChain ns = getDeobfuscation().builtInNs(value);
|
||||
DottedChain ns = getDeobfuscation().builtInNs(valueStr);
|
||||
if (ns == null) {
|
||||
return DottedChain.EMPTY;
|
||||
} else {
|
||||
|
||||
@@ -96,13 +96,6 @@ public class AVM2Deobfuscation {
|
||||
return isValid;
|
||||
}
|
||||
|
||||
public DottedChain builtInNs(DottedChain ns) {
|
||||
if (ns == null || ns.size() != 1) {
|
||||
return null;
|
||||
}
|
||||
return builtInNs(ns.get(0));
|
||||
}
|
||||
|
||||
public DottedChain builtInNs(String ns) {
|
||||
if (ns == null) {
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user