Fixed Classnames in PlaceObject

This commit is contained in:
Jindra Petřík
2022-12-10 16:06:19 +01:00
parent c828680c9e
commit 6a14c761ad
7 changed files with 93 additions and 40 deletions

View File

@@ -391,12 +391,14 @@ public final class SWF implements SWFContainerItem, Timelined, Openable {
@Internal
private Map<Integer, String> importedTagToExportNameMapping = new HashMap<>();
@Internal
private Map<String, Integer> classToCharacter = new HashMap<>();
private static final DecompilerPool decompilerPool = new DecompilerPool();
@Internal
private AbcIndexing abcIndex;
private static AbcIndexing playerGlobalAbcIndex;
private static AbcIndexing airGlobalAbcIndex;
@@ -738,6 +740,14 @@ public final class SWF implements SWFContainerItem, Timelined, Openable {
public CharacterTag getCharacter(int characterId) {
return getCharacters().get(characterId);
}
public CharacterTag getCharacterByClass(String className) {
if (!classToCharacter.containsKey(className)) {
return null;
}
int charId = classToCharacter.get(className);
return getCharacter(charId);
}
public String getExportName(int characterId) {
CharacterTag characterTag = getCharacters().get(characterId);
@@ -1867,6 +1877,11 @@ public final class SWF implements SWFContainerItem, Timelined, Openable {
}
}
}
classToCharacter.clear();
for (int ch:classes.keySet()) {
classToCharacter.put(classes.get(ch), ch);
}
}
/**