mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-06-01 19:04:38 +00:00
Fixed
- Recalculating dependencies in the loop (now only on change) - Dependencies handling
This commit is contained in:
@@ -26,6 +26,7 @@ import com.jpexs.decompiler.flash.types.annotations.SWFType;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFVersion;
|
||||
import com.jpexs.helpers.ByteArrayRange;
|
||||
import java.io.IOException;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -124,4 +125,9 @@ public class CSMTextSettingsTag extends Tag implements CharacterIdTag {
|
||||
public String toString() {
|
||||
return super.toString() + " (" + textID + ")";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getNeededCharacters(Set<Integer> needed) {
|
||||
needed.add(textID);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ import com.jpexs.decompiler.flash.types.annotations.SWFType;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFVersion;
|
||||
import com.jpexs.helpers.ByteArrayRange;
|
||||
import java.io.IOException;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -97,4 +98,9 @@ public class DefineButtonCxformTag extends Tag implements CharacterIdTag {
|
||||
public String toString() {
|
||||
return super.toString() + " (" + buttonId + ")";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getNeededCharacters(Set<Integer> needed) {
|
||||
needed.add(buttonId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -155,6 +155,7 @@ public class DefineButtonSoundTag extends Tag implements CharacterIdTag {
|
||||
if (buttonSoundChar3 != 0) {
|
||||
needed.add(buttonSoundChar3);
|
||||
}
|
||||
needed.add(buttonId);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -31,6 +31,7 @@ import com.jpexs.helpers.ByteArrayRange;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -116,4 +117,9 @@ public class DefineFontAlignZonesTag extends Tag implements CharacterIdTag {
|
||||
public String toString() {
|
||||
return super.toString() + " (" + fontID + ")";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getNeededCharacters(Set<Integer> needed) {
|
||||
needed.add(fontID);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ import com.jpexs.helpers.utf8.Utf8Helper;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -189,4 +190,9 @@ public class DefineFontInfo2Tag extends FontInfoTag {
|
||||
public boolean isShiftJIS() {
|
||||
return fontFlagsShiftJIS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getNeededCharacters(Set<Integer> needed) {
|
||||
needed.add(fontID);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ import com.jpexs.helpers.utf8.Utf8Helper;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -191,4 +192,9 @@ public class DefineFontInfoTag extends FontInfoTag {
|
||||
public boolean isAnsi() {
|
||||
return fontFlagsANSI;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getNeededCharacters(Set<Integer> needed) {
|
||||
needed.add(fontID);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ import com.jpexs.decompiler.flash.types.annotations.SWFType;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFVersion;
|
||||
import com.jpexs.helpers.ByteArrayRange;
|
||||
import java.io.IOException;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -94,4 +95,9 @@ public class DefineFontNameTag extends Tag implements CharacterIdTag {
|
||||
public String toString() {
|
||||
return super.toString() + " (" + fontId + ")";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getNeededCharacters(Set<Integer> needed) {
|
||||
needed.add(fontId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,6 +37,7 @@ import java.awt.geom.AffineTransform;
|
||||
import java.awt.geom.GeneralPath;
|
||||
import java.awt.geom.PathIterator;
|
||||
import java.io.IOException;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -214,5 +215,10 @@ public class DefineScalingGridTag extends Tag implements CharacterIdTag {
|
||||
public String toString() {
|
||||
return super.toString() + " (" + characterId + ")";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getNeededCharacters(Set<Integer> needed) {
|
||||
needed.add(characterId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -456,10 +456,12 @@ public class DefineSpriteTag extends DrawableTag implements Timelined {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<Integer> getMissingNeededCharacters() {
|
||||
public Set<Integer> getMissingNeededCharacters(Set<Integer> needed) {
|
||||
Set<Integer> ret = new LinkedHashSet<>();
|
||||
for (Tag tag : getTags()) {
|
||||
Set<Integer> sub = tag.getMissingNeededCharacters();
|
||||
Set<Integer> subNeeded = new HashSet<>();
|
||||
tag.getNeededCharactersDeep(subNeeded);
|
||||
Set<Integer> sub = tag.getMissingNeededCharacters(subNeeded);
|
||||
ret.addAll(sub);
|
||||
}
|
||||
return ret;
|
||||
|
||||
@@ -38,6 +38,7 @@ import com.jpexs.helpers.Helper;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -264,4 +265,9 @@ public class DoInitActionTag extends Tag implements CharacterIdTag, ASMSource {
|
||||
public Tag getTag() {
|
||||
return null; //?
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getNeededCharacters(Set<Integer> needed) {
|
||||
needed.add(spriteId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ import com.jpexs.decompiler.flash.types.annotations.SWFType;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFVersion;
|
||||
import com.jpexs.helpers.ByteArrayRange;
|
||||
import java.io.IOException;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -82,4 +83,9 @@ public class FreeCharacterTag extends Tag implements CharacterIdTag {
|
||||
public void setCharacterId(int characterId) {
|
||||
this.characterId = characterId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getNeededCharacters(Set<Integer> needed) {
|
||||
needed.add(characterId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ import com.jpexs.decompiler.flash.types.annotations.SWFType;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFVersion;
|
||||
import com.jpexs.helpers.ByteArrayRange;
|
||||
import java.io.IOException;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -91,4 +92,9 @@ public class NameCharacterTag extends Tag implements CharacterIdTag {
|
||||
public void setCharacterId(int characterId) {
|
||||
this.characterId = characterId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getNeededCharacters(Set<Integer> needed) {
|
||||
needed.add(characterId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ import com.jpexs.decompiler.flash.types.annotations.SWFType;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFVersion;
|
||||
import com.jpexs.helpers.ByteArrayRange;
|
||||
import java.io.IOException;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Removes the specified character
|
||||
@@ -105,4 +106,9 @@ public class RemoveObjectTag extends RemoveTag implements CharacterIdTag {
|
||||
public void setCharacterId(int characterId) {
|
||||
this.characterId = characterId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getNeededCharacters(Set<Integer> needed) {
|
||||
needed.add(characterId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@ import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -263,4 +264,6 @@ public class SoundStreamHead2Tag extends Tag implements SoundStreamHeadTypeTag {
|
||||
public String toString() {
|
||||
return getName() + (virtualCharacterId > 0 ? " (" + virtualCharacterId + ")" : "");
|
||||
}
|
||||
|
||||
//getNeededCharacters intentionally not defined
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@ import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -273,4 +274,13 @@ public class SoundStreamHeadTag extends Tag implements SoundStreamHeadTypeTag {
|
||||
public String toString() {
|
||||
return getName() + (virtualCharacterId > 0 ? " (" + virtualCharacterId + ")" : "");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getNeededCharacters(Set<Integer> needed) {
|
||||
if (virtualCharacterId > 0) {
|
||||
needed.add(virtualCharacterId);
|
||||
}
|
||||
}
|
||||
|
||||
//getNeededCharacters intentionally not defined
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ import com.jpexs.decompiler.flash.SWF;
|
||||
import com.jpexs.decompiler.flash.SWFInputStream;
|
||||
import com.jpexs.decompiler.flash.SWFOutputStream;
|
||||
import com.jpexs.decompiler.flash.abc.CopyOutputStream;
|
||||
import com.jpexs.decompiler.flash.amf.amf3.ListSet;
|
||||
import com.jpexs.decompiler.flash.configuration.Configuration;
|
||||
import com.jpexs.decompiler.flash.tags.base.BoundedTag;
|
||||
import com.jpexs.decompiler.flash.tags.base.CharacterIdTag;
|
||||
@@ -599,15 +600,14 @@ public abstract class Tag implements NeedsCharacters, Exportable, Serializable {
|
||||
public void getNeededCharacters(Set<Integer> needed) {
|
||||
}
|
||||
|
||||
public Set<Integer> getMissingNeededCharacters() {
|
||||
Set<Integer> needed = new LinkedHashSet<>();
|
||||
getNeededCharacters(needed);
|
||||
if (needed.isEmpty()) {
|
||||
return needed;
|
||||
public Set<Integer> getMissingNeededCharacters(Set<Integer> needed) {
|
||||
Set<Integer> needed2 = new ListSet<>(needed);
|
||||
if (needed2.isEmpty()) {
|
||||
return new LinkedHashSet<>();
|
||||
}
|
||||
Timelined tim = getTimelined();
|
||||
if (tim == null) {
|
||||
return needed;
|
||||
return needed2;
|
||||
}
|
||||
ReadOnlyTagList tags = tim.getTags();
|
||||
for (int i = tags.indexOf(this) - 1; i >= -1; i--) {
|
||||
@@ -624,13 +624,13 @@ public abstract class Tag implements NeedsCharacters, Exportable, Serializable {
|
||||
}
|
||||
if (tags.get(i) instanceof CharacterTag) {
|
||||
int charId = ((CharacterTag) tags.get(i)).getCharacterId();
|
||||
needed.remove(charId);
|
||||
if (needed.isEmpty()) {
|
||||
return needed;
|
||||
needed2.remove(charId);
|
||||
if (needed2.isEmpty()) {
|
||||
return needed2;
|
||||
}
|
||||
}
|
||||
}
|
||||
return needed;
|
||||
return needed2;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -725,7 +725,7 @@ public abstract class Tag implements NeedsCharacters, Exportable, Serializable {
|
||||
bounds.getHeight() / SWF.unitDivisor));
|
||||
}
|
||||
|
||||
Set<Integer> needed = new LinkedHashSet<>();
|
||||
/*Set<Integer> needed = new LinkedHashSet<>();
|
||||
getNeededCharactersDeep(needed);
|
||||
|
||||
if (needed.size() > 0) {
|
||||
@@ -745,7 +745,7 @@ public abstract class Tag implements NeedsCharacters, Exportable, Serializable {
|
||||
if(dependent2 != null && dependent2.size() > 0) {
|
||||
tagInfo.addInfo("general", "dependentFrames", Helper.joinStrings(dependent2, ", "));
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
public String getCharset() {
|
||||
|
||||
@@ -25,6 +25,7 @@ import com.jpexs.decompiler.flash.types.annotations.SWFType;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFVersion;
|
||||
import com.jpexs.helpers.ByteArrayRange;
|
||||
import java.io.IOException;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -96,4 +97,9 @@ public class VideoFrameTag extends Tag implements CharacterIdTag {
|
||||
public void setCharacterId(int characterId) {
|
||||
this.streamID = characterId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getNeededCharacters(Set<Integer> needed) {
|
||||
needed.add(streamID);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,11 +70,6 @@ public abstract class ButtonTag extends DrawableTag implements Timelined {
|
||||
for (BUTTONRECORD r : getRecords()) {
|
||||
needed.add(r.characterId);
|
||||
}
|
||||
|
||||
DefineButtonSoundTag sounds = getSounds();
|
||||
if (sounds != null) {
|
||||
sounds.getNeededCharacters(needed);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user