mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-09-27 01:50:50 +00:00
Added #2124 Copy tags to other SWFs and replace same classes / export names
This commit is contained in:
@@ -413,6 +413,9 @@ public final class SWF implements SWFContainerItem, Timelined, Openable {
|
||||
|
||||
private static final DecompilerPool decompilerPool = new DecompilerPool();
|
||||
|
||||
@Internal
|
||||
private Map<String, Integer> exportNameToCharacter = new HashMap<>();
|
||||
|
||||
@Internal
|
||||
private AbcIndexing abcIndex;
|
||||
|
||||
@@ -822,6 +825,14 @@ public final class SWF implements SWFContainerItem, Timelined, Openable {
|
||||
int charId = classToCharacter.get(className);
|
||||
return getCharacter(charId);
|
||||
}
|
||||
|
||||
public CharacterTag getCharacterByExportName(String exportName) {
|
||||
if (!exportNameToCharacter.containsKey(exportName)) {
|
||||
return null;
|
||||
}
|
||||
int charId = exportNameToCharacter.get(exportName);
|
||||
return getCharacter(charId);
|
||||
}
|
||||
|
||||
public String getExportName(int characterId) {
|
||||
CharacterTag characterTag = getCharacters().get(characterId);
|
||||
@@ -1821,6 +1832,7 @@ public final class SWF implements SWFContainerItem, Timelined, Openable {
|
||||
}
|
||||
|
||||
public void assignExportNamesToSymbols() {
|
||||
exportNameToCharacter.clear();
|
||||
HashMap<Integer, String> exportNames = new HashMap<>(importedTagToExportNameMapping);
|
||||
for (Tag t : getTags()) {
|
||||
if (t instanceof ExportAssetsTag) {
|
||||
@@ -1830,6 +1842,7 @@ public final class SWF implements SWFContainerItem, Timelined, Openable {
|
||||
String name = eat.names.get(i);
|
||||
if ((!exportNames.containsKey(tagId)) && (!exportNames.containsValue(name))) {
|
||||
exportNames.put(tagId, name);
|
||||
exportNameToCharacter.put(name, tagId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -377,8 +377,11 @@ public class DefineSpriteTag extends DrawableTag implements Timelined {
|
||||
@Override
|
||||
public void getNeededCharacters(Set<Integer> needed, SWF swf) {
|
||||
for (Tag t : getTags()) {
|
||||
if ((t instanceof CharacterIdTag) && !(t instanceof SoundStreamHeadTypeTag) && !(t instanceof DefineExternalStreamSound)) {
|
||||
needed.add(((CharacterIdTag) t).getCharacterId());
|
||||
if (t instanceof PlaceObjectTypeTag) {
|
||||
int chId = ((PlaceObjectTypeTag) t).getCharacterId();
|
||||
if (chId != -1) {
|
||||
needed.add(chId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user