mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-09-24 23:00:46 +00:00
dumpview: allow opening multiple swfs, context menu: expand all and close menu items
show abc and actionbytes in dump view, hexview style fixes better scroll to view mode in hex editor
This commit is contained in:
@@ -52,7 +52,7 @@ import com.jpexs.decompiler.flash.action.swf5.ActionNewObject;
|
||||
import com.jpexs.decompiler.flash.action.swf5.ActionSetMember;
|
||||
import com.jpexs.decompiler.flash.action.swf7.ActionDefineFunction2;
|
||||
import com.jpexs.decompiler.flash.configuration.Configuration;
|
||||
import com.jpexs.decompiler.flash.dumpview.DumpInfo;
|
||||
import com.jpexs.decompiler.flash.dumpview.DumpInfoSwfNode;
|
||||
import com.jpexs.decompiler.flash.ecma.Null;
|
||||
import com.jpexs.decompiler.flash.exporters.BinaryDataExporter;
|
||||
import com.jpexs.decompiler.flash.exporters.FontExporter;
|
||||
@@ -271,7 +271,7 @@ public final class SWF implements TreeItem, Timelined {
|
||||
|
||||
private Timeline timeline;
|
||||
|
||||
public DumpInfo dumpInfo;
|
||||
public DumpInfoSwfNode dumpInfo;
|
||||
|
||||
public void updateCharacters() {
|
||||
characters.clear();
|
||||
@@ -308,7 +308,7 @@ public final class SWF implements TreeItem, Timelined {
|
||||
Tag t = tags.get(i);
|
||||
if (t instanceof DefineSpriteTag) {
|
||||
if (!isSpriteValid((DefineSpriteTag) t, new ArrayList<Integer>())) {
|
||||
tags.set(i, new TagStub(this, t.getId(), "InvalidSprite", t.getPos(), t.getOriginalLength(), null));
|
||||
tags.set(i, new TagStub(this, t.getId(), "InvalidSprite", t.getOriginalRange(), null));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -385,9 +385,7 @@ public final class SWF implements TreeItem, Timelined {
|
||||
sos.writeUI8(frameRate);
|
||||
sos.writeUI16(frameCount);
|
||||
|
||||
Map<Tag, Long> tagPositions = new HashMap<>();
|
||||
Map<Tag, Integer> tagLengths = new HashMap<>();
|
||||
sos.writeTags(tags, tagPositions, tagLengths);
|
||||
sos.writeTags(tags);
|
||||
if (hasEndTag) {
|
||||
sos.writeUI16(0);
|
||||
}
|
||||
@@ -512,7 +510,7 @@ public final class SWF implements TreeItem, Timelined {
|
||||
uncompressedData = baos.toByteArray();
|
||||
|
||||
SWFInputStream sis = new SWFInputStream(this, uncompressedData);
|
||||
dumpInfo = new DumpInfo("rootswf", "", null, 0, 0);
|
||||
dumpInfo = new DumpInfoSwfNode(this, "rootswf", "", null, 0, 0);
|
||||
sis.dumpInfo = dumpInfo;
|
||||
sis.readBytesEx(3, "signature"); // skip siganture
|
||||
version = sis.readUI8("version");
|
||||
@@ -543,7 +541,7 @@ public final class SWF implements TreeItem, Timelined {
|
||||
} else {
|
||||
boolean hasNonUnknownTag = false;
|
||||
for (Tag tag : tags) {
|
||||
if (tag.getOriginalLength() > 2 && Tag.getRequiredTags().contains(tag.getId())) {
|
||||
if (tag.getOriginalDataLength() > 0 && Tag.getRequiredTags().contains(tag.getId())) {
|
||||
hasNonUnknownTag = true;
|
||||
}
|
||||
}
|
||||
@@ -2120,7 +2118,7 @@ public final class SWF implements TreeItem, Timelined {
|
||||
}
|
||||
}
|
||||
for (ASMSource src : actionsMap.keySet()) {
|
||||
actionsMap.put(src, Action.removeNops(0, actionsMap.get(src), version, 0, ""/*FIXME path*/));
|
||||
actionsMap.put(src, Action.removeNops(0, actionsMap.get(src), version, ""/*FIXME path*/));
|
||||
src.setActions(actionsMap.get(src));
|
||||
src.setModified();
|
||||
}
|
||||
|
||||
@@ -262,6 +262,7 @@ import com.jpexs.decompiler.flash.types.shaperecords.EndShapeRecord;
|
||||
import com.jpexs.decompiler.flash.types.shaperecords.SHAPERECORD;
|
||||
import com.jpexs.decompiler.flash.types.shaperecords.StraightEdgeRecord;
|
||||
import com.jpexs.decompiler.flash.types.shaperecords.StyleChangeRecord;
|
||||
import com.jpexs.helpers.ByteArrayRange;
|
||||
import com.jpexs.helpers.Helper;
|
||||
import com.jpexs.helpers.MemoryInputStream;
|
||||
import com.jpexs.helpers.ProgressListener;
|
||||
@@ -1100,8 +1101,7 @@ public class SWFInputStream implements AutoCloseable {
|
||||
return tag;
|
||||
}
|
||||
|
||||
long pos = tag.getPos();
|
||||
int length = tag.getOriginalLength();
|
||||
ByteArrayRange data = tag.getOriginalRange();
|
||||
SWF swf = tag.getSwf();
|
||||
TagStub tagStub = (TagStub) tag;
|
||||
SWFInputStream sis = tagStub.getDataStream();
|
||||
@@ -1109,127 +1109,127 @@ public class SWFInputStream implements AutoCloseable {
|
||||
try {
|
||||
switch (tag.getId()) {
|
||||
case 0:
|
||||
ret = new EndTag(swf, pos, length);
|
||||
ret = new EndTag(swf, data);
|
||||
break;
|
||||
case 1:
|
||||
ret = new ShowFrameTag(swf, pos, length);
|
||||
ret = new ShowFrameTag(swf, data);
|
||||
break;
|
||||
case 2:
|
||||
ret = new DefineShapeTag(sis, pos, length);
|
||||
ret = new DefineShapeTag(sis, data);
|
||||
break;
|
||||
//case 3: FreeCharacter
|
||||
case 4:
|
||||
ret = new PlaceObjectTag(sis, pos, length);
|
||||
ret = new PlaceObjectTag(sis, data);
|
||||
break;
|
||||
case 5:
|
||||
ret = new RemoveObjectTag(sis, pos, length);
|
||||
ret = new RemoveObjectTag(sis, data);
|
||||
break;
|
||||
case 6:
|
||||
ret = new DefineBitsTag(sis, pos, length);
|
||||
ret = new DefineBitsTag(sis, data);
|
||||
break;
|
||||
case 7:
|
||||
ret = new DefineButtonTag(sis, pos, length);
|
||||
ret = new DefineButtonTag(sis, data);
|
||||
break;
|
||||
case 8:
|
||||
ret = new JPEGTablesTag(sis, pos, length);
|
||||
ret = new JPEGTablesTag(sis, data);
|
||||
break;
|
||||
case 9:
|
||||
ret = new SetBackgroundColorTag(sis, pos, length);
|
||||
ret = new SetBackgroundColorTag(sis, data);
|
||||
break;
|
||||
case 10:
|
||||
ret = new DefineFontTag(sis, pos, length);
|
||||
ret = new DefineFontTag(sis, data);
|
||||
break;
|
||||
case 11:
|
||||
ret = new DefineTextTag(sis, pos, length);
|
||||
ret = new DefineTextTag(sis, data);
|
||||
break;
|
||||
case 12:
|
||||
ret = new DoActionTag(sis, pos, length);
|
||||
ret = new DoActionTag(sis, data);
|
||||
break;
|
||||
case 13:
|
||||
ret = new DefineFontInfoTag(sis, pos, length);
|
||||
ret = new DefineFontInfoTag(sis, data);
|
||||
break;
|
||||
case 14:
|
||||
ret = new DefineSoundTag(sis, pos, length);
|
||||
ret = new DefineSoundTag(sis, data);
|
||||
break;
|
||||
case 15:
|
||||
ret = new StartSoundTag(sis, pos, length);
|
||||
ret = new StartSoundTag(sis, data);
|
||||
break;
|
||||
//case 16:
|
||||
case 17:
|
||||
ret = new DefineButtonSoundTag(sis, pos, length);
|
||||
ret = new DefineButtonSoundTag(sis, data);
|
||||
break;
|
||||
case 18:
|
||||
ret = new SoundStreamHeadTag(sis, pos, length);
|
||||
ret = new SoundStreamHeadTag(sis, data);
|
||||
break;
|
||||
case 19:
|
||||
ret = new SoundStreamBlockTag(sis, pos, length);
|
||||
ret = new SoundStreamBlockTag(sis, data);
|
||||
break;
|
||||
case 21:
|
||||
ret = new DefineBitsJPEG2Tag(sis, pos, length);
|
||||
ret = new DefineBitsJPEG2Tag(sis, data);
|
||||
break;
|
||||
case 20:
|
||||
ret = new DefineBitsLosslessTag(sis, pos, length);
|
||||
ret = new DefineBitsLosslessTag(sis, data);
|
||||
break;
|
||||
case 22:
|
||||
ret = new DefineShape2Tag(sis, pos, length);
|
||||
ret = new DefineShape2Tag(sis, data);
|
||||
break;
|
||||
case 23:
|
||||
ret = new DefineButtonCxformTag(sis, pos, length);
|
||||
ret = new DefineButtonCxformTag(sis, data);
|
||||
break;
|
||||
case 24:
|
||||
ret = new ProtectTag(sis, pos, length);
|
||||
ret = new ProtectTag(sis, data);
|
||||
break;
|
||||
//case 25: PathsArePostscript
|
||||
case 26:
|
||||
ret = new PlaceObject2Tag(sis, pos, length);
|
||||
ret = new PlaceObject2Tag(sis, data);
|
||||
break;
|
||||
//case 27:
|
||||
case 28:
|
||||
ret = new RemoveObject2Tag(sis, pos, length);
|
||||
ret = new RemoveObject2Tag(sis, data);
|
||||
break;
|
||||
//case 29: SyncFrame
|
||||
//case 30:
|
||||
//case 31: FreeAll
|
||||
case 32:
|
||||
ret = new DefineShape3Tag(sis, pos, length);
|
||||
ret = new DefineShape3Tag(sis, data);
|
||||
break;
|
||||
case 33:
|
||||
ret = new DefineText2Tag(sis, pos, length);
|
||||
ret = new DefineText2Tag(sis, data);
|
||||
break;
|
||||
case 34:
|
||||
ret = new DefineButton2Tag(sis, pos, length);
|
||||
ret = new DefineButton2Tag(sis, data);
|
||||
break;
|
||||
case 35:
|
||||
ret = new DefineBitsJPEG3Tag(sis, pos, length);
|
||||
ret = new DefineBitsJPEG3Tag(sis, data);
|
||||
break;
|
||||
case 36:
|
||||
ret = new DefineBitsLossless2Tag(sis, pos, length);
|
||||
ret = new DefineBitsLossless2Tag(sis, data);
|
||||
break;
|
||||
case 37:
|
||||
ret = new DefineEditTextTag(sis, pos, length);
|
||||
ret = new DefineEditTextTag(sis, data);
|
||||
break;
|
||||
//case 38: DefineVideo
|
||||
case 39:
|
||||
ret = new DefineSpriteTag(sis, level, pos, length, parallel, skipUnusualTags);
|
||||
ret = new DefineSpriteTag(sis, level, data, parallel, skipUnusualTags);
|
||||
break;
|
||||
//case 40: NameCharacter
|
||||
case 41:
|
||||
ret = new ProductInfoTag(sis, pos, length);
|
||||
ret = new ProductInfoTag(sis, data);
|
||||
break;
|
||||
//case 42: DefineTextFormat
|
||||
case 43:
|
||||
ret = new FrameLabelTag(sis, pos, length);
|
||||
ret = new FrameLabelTag(sis, data);
|
||||
break;
|
||||
//case 44:
|
||||
case 45:
|
||||
ret = new SoundStreamHead2Tag(sis, pos, length);
|
||||
ret = new SoundStreamHead2Tag(sis, data);
|
||||
break;
|
||||
case 46:
|
||||
ret = new DefineMorphShapeTag(sis, pos, length);
|
||||
ret = new DefineMorphShapeTag(sis, data);
|
||||
break;
|
||||
//case 47: GenerateFrame
|
||||
case 48:
|
||||
ret = new DefineFont2Tag(sis, pos, length);
|
||||
ret = new DefineFont2Tag(sis, data);
|
||||
break;
|
||||
//case 49: GeneratorCommand
|
||||
//case 50: DefineCommandObject
|
||||
@@ -1237,148 +1237,148 @@ public class SWFInputStream implements AutoCloseable {
|
||||
//case 52: ExternalFont
|
||||
//case 53-55
|
||||
case 56:
|
||||
ret = new ExportAssetsTag(sis, pos, length);
|
||||
ret = new ExportAssetsTag(sis, data);
|
||||
break;
|
||||
case 57:
|
||||
ret = new ImportAssetsTag(sis, pos, length);
|
||||
ret = new ImportAssetsTag(sis, data);
|
||||
break;
|
||||
case 58:
|
||||
ret = new EnableDebuggerTag(sis, pos, length);
|
||||
ret = new EnableDebuggerTag(sis, data);
|
||||
break;
|
||||
case 59:
|
||||
ret = new DoInitActionTag(sis, pos, length);
|
||||
ret = new DoInitActionTag(sis, data);
|
||||
break;
|
||||
case 60:
|
||||
ret = new DefineVideoStreamTag(sis, pos, length);
|
||||
ret = new DefineVideoStreamTag(sis, data);
|
||||
break;
|
||||
case 61:
|
||||
ret = new VideoFrameTag(sis, pos, length);
|
||||
ret = new VideoFrameTag(sis, data);
|
||||
break;
|
||||
case 62:
|
||||
ret = new DefineFontInfo2Tag(sis, pos, length);
|
||||
ret = new DefineFontInfo2Tag(sis, data);
|
||||
break;
|
||||
case 63:
|
||||
ret = new DebugIDTag(sis, pos, length);
|
||||
ret = new DebugIDTag(sis, data);
|
||||
break;
|
||||
case 64:
|
||||
ret = new EnableDebugger2Tag(sis, pos, length);
|
||||
ret = new EnableDebugger2Tag(sis, data);
|
||||
break;
|
||||
case 65:
|
||||
ret = new ScriptLimitsTag(sis, pos, length);
|
||||
ret = new ScriptLimitsTag(sis, data);
|
||||
break;
|
||||
case 66:
|
||||
ret = new SetTabIndexTag(sis, pos, length);
|
||||
ret = new SetTabIndexTag(sis, data);
|
||||
break;
|
||||
//case 67-68:
|
||||
case 69:
|
||||
ret = new FileAttributesTag(sis, pos, length);
|
||||
ret = new FileAttributesTag(sis, data);
|
||||
break;
|
||||
case 70:
|
||||
ret = new PlaceObject3Tag(sis, pos, length);
|
||||
ret = new PlaceObject3Tag(sis, data);
|
||||
break;
|
||||
case 71:
|
||||
ret = new ImportAssets2Tag(sis, pos, length);
|
||||
ret = new ImportAssets2Tag(sis, data);
|
||||
break;
|
||||
case 72:
|
||||
ret = new DoABCTag(sis, pos, length);
|
||||
ret = new DoABCTag(sis, data);
|
||||
break;
|
||||
case 73:
|
||||
ret = new DefineFontAlignZonesTag(sis, pos, length);
|
||||
ret = new DefineFontAlignZonesTag(sis, data);
|
||||
break;
|
||||
case 74:
|
||||
ret = new CSMTextSettingsTag(sis, pos, length);
|
||||
ret = new CSMTextSettingsTag(sis, data);
|
||||
break;
|
||||
case 75:
|
||||
ret = new DefineFont3Tag(sis, pos, length);
|
||||
ret = new DefineFont3Tag(sis, data);
|
||||
break;
|
||||
case 76:
|
||||
ret = new SymbolClassTag(sis, pos, length);
|
||||
ret = new SymbolClassTag(sis, data);
|
||||
break;
|
||||
case 77:
|
||||
ret = new MetadataTag(sis, pos, length);
|
||||
ret = new MetadataTag(sis, data);
|
||||
break;
|
||||
case 78:
|
||||
ret = new DefineScalingGridTag(sis, pos, length);
|
||||
ret = new DefineScalingGridTag(sis, data);
|
||||
break;
|
||||
//case 79-81:
|
||||
case 82:
|
||||
ret = new DoABCDefineTag(sis, pos, length);
|
||||
ret = new DoABCDefineTag(sis, data);
|
||||
break;
|
||||
case 83:
|
||||
ret = new DefineShape4Tag(sis, pos, length);
|
||||
ret = new DefineShape4Tag(sis, data);
|
||||
break;
|
||||
case 84:
|
||||
ret = new DefineMorphShape2Tag(sis, pos, length);
|
||||
ret = new DefineMorphShape2Tag(sis, data);
|
||||
break;
|
||||
//case 85:
|
||||
case 86:
|
||||
ret = new DefineSceneAndFrameLabelDataTag(sis, pos, length);
|
||||
ret = new DefineSceneAndFrameLabelDataTag(sis, data);
|
||||
break;
|
||||
case 87:
|
||||
ret = new DefineBinaryDataTag(sis, pos, length);
|
||||
ret = new DefineBinaryDataTag(sis, data);
|
||||
break;
|
||||
case 88:
|
||||
ret = new DefineFontNameTag(sis, pos, length);
|
||||
ret = new DefineFontNameTag(sis, data);
|
||||
break;
|
||||
case 89:
|
||||
ret = new StartSound2Tag(sis, pos, length);
|
||||
ret = new StartSound2Tag(sis, data);
|
||||
break;
|
||||
case 90:
|
||||
ret = new DefineBitsJPEG4Tag(sis, pos, length);
|
||||
ret = new DefineBitsJPEG4Tag(sis, data);
|
||||
break;
|
||||
case 91:
|
||||
ret = new DefineFont4Tag(sis, pos, length);
|
||||
ret = new DefineFont4Tag(sis, data);
|
||||
break;
|
||||
//case 92: certificate
|
||||
case 93:
|
||||
ret = new EnableTelemetryTag(sis, pos, length);
|
||||
ret = new EnableTelemetryTag(sis, data);
|
||||
break;
|
||||
case 94:
|
||||
ret = new PlaceObject4Tag(sis, pos, length);
|
||||
ret = new PlaceObject4Tag(sis, data);
|
||||
break;
|
||||
default:
|
||||
if (gfx) { //GFX tags only in GFX files. There may be incorrect GFX tags in non GFX files
|
||||
switch (tag.getId()) {
|
||||
case 1000:
|
||||
ret = new ExporterInfoTag(sis, pos, length);
|
||||
ret = new ExporterInfoTag(sis, data);
|
||||
break;
|
||||
case 1001:
|
||||
ret = new DefineExternalImage(sis, pos, length);
|
||||
ret = new DefineExternalImage(sis, data);
|
||||
break;
|
||||
case 1002:
|
||||
ret = new FontTextureInfo(sis, pos, length);
|
||||
ret = new FontTextureInfo(sis, data);
|
||||
break;
|
||||
case 1003:
|
||||
ret = new DefineExternalGradient(sis, pos, length);
|
||||
ret = new DefineExternalGradient(sis, data);
|
||||
break;
|
||||
case 1004:
|
||||
ret = new DefineGradientMap(sis, pos, length);
|
||||
ret = new DefineGradientMap(sis, data);
|
||||
break;
|
||||
case 1005:
|
||||
ret = new DefineCompactedFont(sis, pos, length);
|
||||
ret = new DefineCompactedFont(sis, data);
|
||||
break;
|
||||
case 1006:
|
||||
ret = new DefineExternalSound(sis, pos, length);
|
||||
ret = new DefineExternalSound(sis, data);
|
||||
break;
|
||||
case 1007:
|
||||
ret = new DefineExternalStreamSound(sis, pos, length);
|
||||
ret = new DefineExternalStreamSound(sis, data);
|
||||
break;
|
||||
case 1008:
|
||||
ret = new DefineSubImage(sis, pos, length);
|
||||
ret = new DefineSubImage(sis, data);
|
||||
break;
|
||||
case 1009:
|
||||
ret = new DefineExternalImage2(sis, pos, length);
|
||||
ret = new DefineExternalImage2(sis, data);
|
||||
break;
|
||||
default:
|
||||
ret = new UnknownTag(swf, tag.getId(), pos, length);
|
||||
ret = new UnknownTag(swf, tag.getId(), data);
|
||||
}
|
||||
} else {
|
||||
ret = new UnknownTag(swf, tag.getId(), pos, length);
|
||||
ret = new UnknownTag(swf, tag.getId(), data);
|
||||
}
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
logger.log(Level.SEVERE, "Error during tag reading", ex);
|
||||
ret = new TagStub(swf, tag.getId(), "ErrorTag", pos, length, null);
|
||||
ret = new TagStub(swf, tag.getId(), "ErrorTag", data, null);
|
||||
}
|
||||
ret.forceWriteAsLong = tag.forceWriteAsLong;
|
||||
ret.setTimelined(tag.getTimelined());
|
||||
@@ -1413,7 +1413,8 @@ public class SWFInputStream implements AutoCloseable {
|
||||
}
|
||||
int headerLength = readLong ? 6 : 2;
|
||||
SWFInputStream tagDataStream = getLimitedStream((int) tagLength);
|
||||
TagStub tagStub = new TagStub(swf, tagID, "Unresolved", pos, (int) (tagLength + headerLength), tagDataStream);
|
||||
ByteArrayRange dataRange = new ByteArrayRange(swf.uncompressedData, (int) pos, (int) (tagLength + headerLength));
|
||||
TagStub tagStub = new TagStub(swf, tagID, "Unresolved", dataRange, tagDataStream);
|
||||
Tag ret = tagStub;
|
||||
ret.forceWriteAsLong = readLong;
|
||||
skipBytes((int) tagLength);
|
||||
|
||||
@@ -79,7 +79,6 @@ import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.zip.Deflater;
|
||||
import java.util.zip.DeflaterOutputStream;
|
||||
|
||||
@@ -415,20 +414,12 @@ public class SWFOutputStream extends OutputStream {
|
||||
* Writes list of Tag values to the stream
|
||||
*
|
||||
* @param tags List of tag values
|
||||
* @param tagPositions
|
||||
* @param tagLengths
|
||||
* @throws IOException
|
||||
*/
|
||||
public void writeTags(List<Tag> tags, Map<Tag, Long> tagPositions, Map<Tag, Integer> tagLengths) throws IOException {
|
||||
public void writeTags(List<Tag> tags) throws IOException {
|
||||
for (Tag tag : tags) {
|
||||
long pos = getPos();
|
||||
tag.writeTag(this);
|
||||
int length = (int) (getPos() - pos);
|
||||
tagPositions.put(tag, pos);
|
||||
tagLengths.put(tag, length);
|
||||
}
|
||||
|
||||
// todo: honfika: update tag position and lengths. Currently the 2nd save fails
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -107,7 +107,6 @@ public class Action implements GraphSourceItem {
|
||||
* Length of action data
|
||||
*/
|
||||
public int actionLength;
|
||||
public long containerSWFOffset;
|
||||
private long address;
|
||||
|
||||
public static final String[] reservedWords = {
|
||||
@@ -129,9 +128,7 @@ public class Action implements GraphSourceItem {
|
||||
return false;
|
||||
}
|
||||
|
||||
public long getFileAddress() {
|
||||
return containerSWFOffset + getAddress();
|
||||
}
|
||||
|
||||
/**
|
||||
* Names of ActionScript properties
|
||||
*/
|
||||
@@ -425,12 +422,11 @@ public class Action implements GraphSourceItem {
|
||||
* @param version SWF version
|
||||
* @param exportMode PCode or hex?
|
||||
* @param writer
|
||||
* @param swfPos
|
||||
* @param path
|
||||
* @return HilightedTextWriter
|
||||
*/
|
||||
public static GraphTextWriter actionsToString(List<DisassemblyListener> listeners, long address, List<Action> list, List<Long> importantOffsets, int version, ScriptExportMode exportMode, GraphTextWriter writer, long swfPos, String path) {
|
||||
return actionsToString(listeners, address, list, importantOffsets, new ArrayList<String>(), version, exportMode, writer, swfPos, path);
|
||||
public static GraphTextWriter actionsToString(List<DisassemblyListener> listeners, long address, List<Action> list, List<Long> importantOffsets, int version, ScriptExportMode exportMode, GraphTextWriter writer, String path) {
|
||||
return actionsToString(listeners, address, list, importantOffsets, new ArrayList<String>(), version, exportMode, writer, path);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -443,11 +439,10 @@ public class Action implements GraphSourceItem {
|
||||
* @param constantPool Constant pool
|
||||
* @param version SWF version
|
||||
* @param hex Add hexadecimal?
|
||||
* @param swfPos
|
||||
* @param path
|
||||
* @return HilightedTextWriter
|
||||
*/
|
||||
private static GraphTextWriter actionsToString(List<DisassemblyListener> listeners, long address, List<Action> list, List<Long> importantOffsets, List<String> constantPool, int version, ScriptExportMode exportMode, GraphTextWriter writer, long swfPos, String path) {
|
||||
private static GraphTextWriter actionsToString(List<DisassemblyListener> listeners, long address, List<Action> list, List<Long> importantOffsets, List<String> constantPool, int version, ScriptExportMode exportMode, GraphTextWriter writer, String path) {
|
||||
long offset;
|
||||
if (importantOffsets == null) {
|
||||
//setActionsAddresses(list, 0, version);
|
||||
@@ -1231,7 +1226,7 @@ public class Action implements GraphSourceItem {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static List<Action> removeNops(long address, List<Action> actions, int version, long swfPos, String path) {
|
||||
public static List<Action> removeNops(long address, List<Action> actions, int version, String path) {
|
||||
List<Action> ret = actions;
|
||||
if (true) {
|
||||
//return ret;
|
||||
@@ -1239,9 +1234,9 @@ public class Action implements GraphSourceItem {
|
||||
String s = null;
|
||||
try {
|
||||
HilightedTextWriter writer = new HilightedTextWriter(Configuration.getCodeFormatting(), false);
|
||||
Action.actionsToString(new ArrayList<DisassemblyListener>(), address, ret, null, version, ScriptExportMode.PCODE, writer, swfPos, path);
|
||||
Action.actionsToString(new ArrayList<DisassemblyListener>(), address, ret, null, version, ScriptExportMode.PCODE, writer, path);
|
||||
s = writer.toString();
|
||||
ret = ASMParser.parse(address, swfPos, true, s, SWF.DEFAULT_VERSION, false);
|
||||
ret = ASMParser.parse(address, true, s, SWF.DEFAULT_VERSION, false);
|
||||
} catch (IOException | ParseException ex) {
|
||||
Logger.getLogger(SWFInputStream.class.getName()).log(Level.SEVERE, "parsing error. path: " + path, ex);
|
||||
}
|
||||
|
||||
@@ -76,7 +76,6 @@ public class ActionListReader {
|
||||
* ActionEndFlag(=0) or end of the stream.
|
||||
*
|
||||
* @param listeners
|
||||
* @param containerSWFOffset
|
||||
* @param sis
|
||||
* @param version
|
||||
* @param ip
|
||||
@@ -87,13 +86,13 @@ public class ActionListReader {
|
||||
* @throws java.lang.InterruptedException
|
||||
* @throws java.util.concurrent.TimeoutException
|
||||
*/
|
||||
public static List<Action> readActionListTimeout(final List<DisassemblyListener> listeners, final long containerSWFOffset, final SWFInputStream sis, final int version, final int ip, final int endIp, final String path) throws IOException, InterruptedException, TimeoutException {
|
||||
public static List<Action> readActionListTimeout(final List<DisassemblyListener> listeners, final SWFInputStream sis, final int version, final int ip, final int endIp, final String path) throws IOException, InterruptedException, TimeoutException {
|
||||
try {
|
||||
return CancellableWorker.call(new Callable<List<Action>>() {
|
||||
|
||||
@Override
|
||||
public List<Action> call() throws IOException, InterruptedException {
|
||||
return readActionList(listeners, containerSWFOffset, sis, version, ip, endIp, path);
|
||||
return readActionList(listeners, sis, version, ip, endIp, path);
|
||||
}
|
||||
}, Configuration.decompilationTimeoutSingleMethod.get(), TimeUnit.SECONDS);
|
||||
} catch (ExecutionException ex) {
|
||||
@@ -114,7 +113,6 @@ public class ActionListReader {
|
||||
* ActionEndFlag(=0) or end of the stream.
|
||||
*
|
||||
* @param listeners
|
||||
* @param containerSWFOffset
|
||||
* @param sis
|
||||
* @param version
|
||||
* @param ip
|
||||
@@ -124,7 +122,7 @@ public class ActionListReader {
|
||||
* @throws IOException
|
||||
* @throws java.lang.InterruptedException
|
||||
*/
|
||||
public static List<Action> readActionList(List<DisassemblyListener> listeners, long containerSWFOffset, SWFInputStream sis, int version, int ip, int endIp, String path) throws IOException, InterruptedException {
|
||||
public static List<Action> readActionList(List<DisassemblyListener> listeners, SWFInputStream sis, int version, int ip, int endIp, String path) throws IOException, InterruptedException {
|
||||
boolean deobfuscate = Configuration.autoDeobfuscate.get();
|
||||
|
||||
ConstantPool cpool = new ConstantPool();
|
||||
@@ -132,7 +130,7 @@ public class ActionListReader {
|
||||
// List of the actions. N. item contains the action which starts in offset N.
|
||||
List<Action> actionMap = new ArrayList<>();
|
||||
List<Long> nextOffsets = new ArrayList<>();
|
||||
Action entryAction = readActionListAtPos(listeners, containerSWFOffset, cpool,
|
||||
Action entryAction = readActionListAtPos(listeners, cpool,
|
||||
sis, actionMap, nextOffsets,
|
||||
ip, ip, endIp, version, path, false, new ArrayList<Long>());
|
||||
|
||||
@@ -193,7 +191,7 @@ public class ActionListReader {
|
||||
|
||||
if (deobfuscate) {
|
||||
try {
|
||||
actions = deobfuscateActionList(listeners, containerSWFOffset, actions, version, ip, path);
|
||||
actions = deobfuscateActionList(listeners, actions, version, ip, path);
|
||||
updateActionLengths(actions, version);
|
||||
removeZeroJumps(actions, version);
|
||||
} catch (OutOfMemoryError | StackOverflowError | TranslateException ex) {
|
||||
@@ -210,7 +208,6 @@ public class ActionListReader {
|
||||
* ActionEndFlag(=0) or end of the stream.
|
||||
*
|
||||
* @param listeners
|
||||
* @param containerSWFOffset
|
||||
* @param actions
|
||||
* @param version
|
||||
* @param ip
|
||||
@@ -219,7 +216,7 @@ public class ActionListReader {
|
||||
* @throws IOException
|
||||
* @throws java.lang.InterruptedException
|
||||
*/
|
||||
public static List<Action> deobfuscateActionList(List<DisassemblyListener> listeners, long containerSWFOffset, List<Action> actions, int version, int ip, String path) throws IOException, InterruptedException {
|
||||
public static List<Action> deobfuscateActionList(List<DisassemblyListener> listeners, List<Action> actions, int version, int ip, String path) throws IOException, InterruptedException {
|
||||
if (actions.isEmpty()) {
|
||||
return actions;
|
||||
}
|
||||
@@ -260,7 +257,7 @@ public class ActionListReader {
|
||||
}
|
||||
}
|
||||
|
||||
deobfustaceActionListAtPosRecursive(listeners, new ArrayList<GraphTargetItem>(), new HashMap<Long, List<GraphSourceItemContainer>>(), containerSWFOffset, localData, stack, cpool, actionMap, ip, retdups, ip, endIp, path, new HashMap<Integer, Integer>(), false, new HashMap<Integer, HashMap<String, GraphTargetItem>>(), version, 0, maxRecursionLevel);
|
||||
deobfustaceActionListAtPosRecursive(listeners, new ArrayList<GraphTargetItem>(), new HashMap<Long, List<GraphSourceItemContainer>>(), localData, stack, cpool, actionMap, ip, retdups, ip, endIp, path, new HashMap<Integer, Integer>(), false, new HashMap<Integer, HashMap<String, GraphTargetItem>>(), version, 0, maxRecursionLevel);
|
||||
|
||||
if (!retdups.isEmpty()) {
|
||||
for (int i = 0; i < ip; i++) {
|
||||
@@ -286,7 +283,7 @@ public class ActionListReader {
|
||||
}
|
||||
}
|
||||
|
||||
ret = Action.removeNops(0, ret, version, 0, path);
|
||||
ret = Action.removeNops(0, ret, version, path);
|
||||
List<Action> reta = new ArrayList<>();
|
||||
for (Object o : ret) {
|
||||
if (o instanceof Action) {
|
||||
@@ -591,7 +588,7 @@ public class ActionListReader {
|
||||
return true;
|
||||
}
|
||||
|
||||
private static Action readActionListAtPos(List<DisassemblyListener> listeners, long containerSWFOffset, ConstantPool cpool,
|
||||
private static Action readActionListAtPos(List<DisassemblyListener> listeners, ConstantPool cpool,
|
||||
SWFInputStream sis, List<Action> actions, List<Long> nextOffsets,
|
||||
long ip, long startIp, long endIp, int version, String path, boolean indeterminate, List<Long> visitedContainers) throws IOException {
|
||||
|
||||
@@ -646,7 +643,6 @@ public class ActionListReader {
|
||||
listeners.get(i).progress(AppStrings.translate("disassemblingProgress.reading"), pos, length);
|
||||
}
|
||||
|
||||
a.containerSWFOffset = containerSWFOffset;
|
||||
a.setAddress(ip, version, false);
|
||||
|
||||
if (a instanceof ActionPush && cpool != null) {
|
||||
@@ -677,7 +673,7 @@ public class ActionListReader {
|
||||
if (size != 0) {
|
||||
long ip2 = ip + actionLengthWithHeader;
|
||||
//long endIp2 = ip + actionLengthWithHeader + size;
|
||||
readActionListAtPos(listeners, containerSWFOffset, cpool,
|
||||
readActionListAtPos(listeners, cpool,
|
||||
sis, actions, nextOffsets,
|
||||
ip2, startIp, endIp, version, newPath, indeterminate, visitedContainers);
|
||||
actionLengthWithHeader += size;
|
||||
@@ -706,7 +702,7 @@ public class ActionListReader {
|
||||
}
|
||||
}
|
||||
|
||||
private static void deobfustaceActionListAtPosRecursive(List<DisassemblyListener> listeners, List<GraphTargetItem> output, HashMap<Long, List<GraphSourceItemContainer>> containers, long containerSWFOffset, ActionLocalData localData, Stack<GraphTargetItem> stack, ConstantPool cpool, List<Action> actions, int ip, List<Action> ret, int startIp, int endip, String path, Map<Integer, Integer> visited, boolean indeterminate, Map<Integer, HashMap<String, GraphTargetItem>> decisionStates, int version, int recursionLevel, int maxRecursionLevel) throws IOException, InterruptedException {
|
||||
private static void deobfustaceActionListAtPosRecursive(List<DisassemblyListener> listeners, List<GraphTargetItem> output, HashMap<Long, List<GraphSourceItemContainer>> containers, ActionLocalData localData, Stack<GraphTargetItem> stack, ConstantPool cpool, List<Action> actions, int ip, List<Action> ret, int startIp, int endip, String path, Map<Integer, Integer> visited, boolean indeterminate, Map<Integer, HashMap<String, GraphTargetItem>> decisionStates, int version, int recursionLevel, int maxRecursionLevel) throws IOException, InterruptedException {
|
||||
boolean debugMode = false;
|
||||
boolean decideBranch = false;
|
||||
|
||||
@@ -879,7 +875,7 @@ public class ActionListReader {
|
||||
} else {
|
||||
localData2 = localData;
|
||||
}
|
||||
deobfustaceActionListAtPosRecursive(listeners, output2, containers, containerSWFOffset, localData2, new Stack<GraphTargetItem>(), cpool, actions, (int) endAddr, ret, startIp, (int) (endAddr + size), path + (cntName == null ? "" : "/" + cntName), visited, indeterminate, decisionStates, version, recursionLevel + 1, maxRecursionLevel);
|
||||
deobfustaceActionListAtPosRecursive(listeners, output2, containers, localData2, new Stack<GraphTargetItem>(), cpool, actions, (int) endAddr, ret, startIp, (int) (endAddr + size), path + (cntName == null ? "" : "/" + cntName), visited, indeterminate, decisionStates, version, recursionLevel + 1, maxRecursionLevel);
|
||||
output2s.add(output2);
|
||||
endAddr += size;
|
||||
}
|
||||
@@ -939,7 +935,7 @@ public class ActionListReader {
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
Stack<GraphTargetItem> substack = (Stack<GraphTargetItem>) stack.clone();
|
||||
deobfustaceActionListAtPosRecursive(listeners, output, containers, containerSWFOffset, prepareLocalBranch(localData), substack, cpool, actions, ip + actionLen + aif.getJumpOffset(), ret, startIp, endip, path, visited, indeterminate, decisionStates, version, recursionLevel + 1, maxRecursionLevel);
|
||||
deobfustaceActionListAtPosRecursive(listeners, output, containers, prepareLocalBranch(localData), substack, cpool, actions, ip + actionLen + aif.getJumpOffset(), ret, startIp, endip, path, visited, indeterminate, decisionStates, version, recursionLevel + 1, maxRecursionLevel);
|
||||
}
|
||||
|
||||
if (newip > -1) {
|
||||
|
||||
@@ -133,12 +133,11 @@ import java.util.logging.Logger;
|
||||
|
||||
public class ASMParser {
|
||||
|
||||
public static List<Action> parse(long containerSWFOffset, boolean ignoreNops, List<Label> labels, long address, FlasmLexer lexer, List<String> constantPool, int version) throws IOException, ParseException {
|
||||
public static List<Action> parse(boolean ignoreNops, List<Label> labels, long address, FlasmLexer lexer, List<String> constantPool, int version) throws IOException, ParseException {
|
||||
List<Action> list = new ArrayList<>();
|
||||
Stack<GraphSourceItemContainer> containers = new Stack<>();
|
||||
|
||||
ActionConstantPool cpool = new ActionConstantPool(constantPool);
|
||||
cpool.containerSWFOffset = containerSWFOffset;
|
||||
cpool.setAddress(address, version, false);
|
||||
address += cpool.getBytes(version).length;
|
||||
list.add(cpool);
|
||||
@@ -180,11 +179,9 @@ public class ASMParser {
|
||||
a = null;
|
||||
}
|
||||
if (a instanceof ActionNop) {
|
||||
a.containerSWFOffset = containerSWFOffset;
|
||||
a.setAddress(address, version, false);
|
||||
address += 1;
|
||||
} else if (a != null) {
|
||||
a.containerSWFOffset = containerSWFOffset;
|
||||
a.setAddress(address, version, false);
|
||||
address += a.getBytes(version).length;
|
||||
}
|
||||
@@ -446,7 +443,7 @@ public class ASMParser {
|
||||
}
|
||||
}
|
||||
|
||||
public static List<Action> parse(long address, long containerSWFOffset, boolean ignoreNops, String source, int version, boolean throwOnError) throws IOException, ParseException {
|
||||
public static List<Action> parse(long address, boolean ignoreNops, String source, int version, boolean throwOnError) throws IOException, ParseException {
|
||||
FlasmLexer lexer = new FlasmLexer(new StringReader(source));
|
||||
List<Action> list = parseAllActions(lexer, version);
|
||||
|
||||
@@ -459,7 +456,7 @@ public class ASMParser {
|
||||
|
||||
lexer = new FlasmLexer(new StringReader(source));
|
||||
List<Label> labels = new ArrayList<>();
|
||||
List<Action> ret = parse(containerSWFOffset, ignoreNops, labels, address, lexer, constantPool, version);
|
||||
List<Action> ret = parse(ignoreNops, labels, address, lexer, constantPool, version);
|
||||
List<Action> links = Action.getActionsAllIfsOrJumps(ret);
|
||||
//Action.setActionsAddresses(ret, address, version);
|
||||
for (Action link : links) {
|
||||
|
||||
@@ -42,7 +42,7 @@ public class DumpInfo {
|
||||
|
||||
public List<DumpInfo> childInfos = new ArrayList<>();
|
||||
|
||||
public DumpInfo(String name, String type, Object value, long startByte, int lengthBytes) {
|
||||
public DumpInfo(String name, String type, Object value, long startByte, long lengthBytes) {
|
||||
|
||||
this.name = name;
|
||||
this.type = type;
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2014 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.dumpview;
|
||||
|
||||
import com.jpexs.decompiler.flash.SWF;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class DumpInfoSwfNode extends DumpInfo {
|
||||
|
||||
private final SWF swf;
|
||||
|
||||
public DumpInfoSwfNode(SWF swf, String name, String type, Object value, long startByte, long lengthBytes) {
|
||||
super(name, type, value, startByte, lengthBytes);
|
||||
this.swf = swf;
|
||||
}
|
||||
|
||||
public SWF getSwf() {
|
||||
return swf;
|
||||
}
|
||||
|
||||
public static DumpInfoSwfNode getSwfNode(DumpInfo dumpInfo) {
|
||||
while (!(dumpInfo instanceof DumpInfoSwfNode)) {
|
||||
dumpInfo = dumpInfo.parent;
|
||||
}
|
||||
return (DumpInfoSwfNode) dumpInfo;
|
||||
}
|
||||
}
|
||||
@@ -27,7 +27,6 @@ import javax.swing.table.AbstractTableModel;
|
||||
import javax.swing.table.DefaultTableCellRenderer;
|
||||
import javax.swing.table.JTableHeader;
|
||||
import javax.swing.table.TableColumn;
|
||||
import javax.swing.table.TableColumnModel;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -41,6 +40,8 @@ public class HexView extends JTable {
|
||||
private byte[] data;
|
||||
private final String[] highlightColorsStr = new String[]{/*"EEEEEE", */"29AEC2", "9AC88C", "DF5F80", "EEA32E", "FFD200", "5E9B4C", "D3E976", "A3AEC2"};
|
||||
private final Color[] highlightColors;
|
||||
private Color bgColor = Color.decode("#F7F7F7");
|
||||
private Color bgColorAlternate = Color.decode("#EDEDED");
|
||||
|
||||
public class HighlightCellRenderer extends DefaultTableCellRenderer {
|
||||
|
||||
@@ -48,9 +49,9 @@ public class HexView extends JTable {
|
||||
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int col) {
|
||||
|
||||
JLabel l = (JLabel) super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, col);
|
||||
if (highlightStarts != null) {
|
||||
int idx = row * bytesInRow + ((col > bytesInRow) ? (col - bytesInRow - 1) : (col - 1));
|
||||
int level = -1;
|
||||
if (col > 0 && highlightStarts != null) {
|
||||
int idx = row * bytesInRow + ((col > bytesInRow) ? (col - bytesInRow - 1) : (col - 1));
|
||||
for (int i = 0; i < highlightStarts.length; i++) {
|
||||
if (highlightStarts[i] <= idx && highlightEnds[i] >= idx) {
|
||||
level++;
|
||||
@@ -58,12 +59,14 @@ public class HexView extends JTable {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (level > -1) {
|
||||
l.setBackground(highlightColors[level % highlightColors.length]);
|
||||
} else {
|
||||
l.setBackground(Color.white);
|
||||
}
|
||||
l.setBackground(row % 2 == 0 ? bgColor : bgColorAlternate);
|
||||
}
|
||||
|
||||
return l;
|
||||
}
|
||||
}
|
||||
@@ -131,17 +134,20 @@ public class HexView extends JTable {
|
||||
|
||||
setShowHorizontalLines(false);
|
||||
setShowVerticalLines(false);
|
||||
setRowSelectionAllowed(false);
|
||||
setColumnSelectionAllowed(false);
|
||||
|
||||
HighlightCellRenderer cellRenderer = new HighlightCellRenderer();
|
||||
TableColumnModel columnModel = getColumnModel();
|
||||
columnModel.getColumn(0).setMaxWidth(80);
|
||||
TableColumn column = columnModel.getColumn(0);
|
||||
column.setMaxWidth(80);
|
||||
//column.setCellRenderer(cellRenderer);
|
||||
for (int i = 0; i < bytesInRow; i++) {
|
||||
TableColumn column = columnModel.getColumn(i + 1);
|
||||
column = columnModel.getColumn(i + 1);
|
||||
column.setMaxWidth(25);
|
||||
column.setCellRenderer(cellRenderer);
|
||||
}
|
||||
for (int i = 0; i < bytesInRow; i++) {
|
||||
TableColumn column = columnModel.getColumn(i + bytesInRow + 1);
|
||||
column = columnModel.getColumn(i + bytesInRow + 1);
|
||||
column.setMaxWidth(10);
|
||||
column.setCellRenderer(cellRenderer);
|
||||
}
|
||||
@@ -163,24 +169,18 @@ public class HexView extends JTable {
|
||||
}
|
||||
|
||||
public void scrollToByte(long byteNum) {
|
||||
// HACK to scroll current selection to visible
|
||||
int row = (int) (byteNum / bytesInRow);
|
||||
|
||||
final int pageSize = (int) (getParent().getSize().getHeight() / getRowHeight());
|
||||
|
||||
int byteCount = data.length;
|
||||
int rowCount = byteCount / bytesInRow;
|
||||
if (byteCount % bytesInRow != 0) {
|
||||
rowCount++;
|
||||
}
|
||||
|
||||
int row2 = Math.min(row + pageSize - 2, rowCount - 1);
|
||||
getSelectionModel().setSelectionInterval(row2, row2);
|
||||
scrollRectToVisible(new Rectangle(getCellRect(row2, 0, true)));
|
||||
|
||||
//final int pageSize = (int) (getParent().getSize().getHeight() / getRowHeight());
|
||||
getSelectionModel().setSelectionInterval(row, row);
|
||||
scrollRectToVisible(new Rectangle(getCellRect(row, 0, true)));
|
||||
// END HACK
|
||||
}
|
||||
|
||||
public void scrollToByte(long[] byteNumStarts, long[] byteNumEnds) {
|
||||
for (int i = 0; i < byteNumStarts.length; i++) {
|
||||
scrollToByte(byteNumStarts[i]);
|
||||
scrollToByte(byteNumEnds[i]);
|
||||
scrollToByte(byteNumStarts[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -357,12 +357,14 @@ public class MainFrameClassicMenu implements MainFrameMenu, ActionListener {
|
||||
deobfuscationCommandButton.setEnabled(hasAbc);*/
|
||||
}
|
||||
|
||||
private void saveAs(SWF swf, SaveFileMode mode) {
|
||||
private boolean saveAs(SWF swf, SaveFileMode mode) {
|
||||
if (Main.saveFileDialog(swf, mode)) {
|
||||
swf.fileTitle = null;
|
||||
mainFrame.setTitle(ApplicationInfo.applicationVerName + (Configuration.displayFileName.get() ? " - " + swf.getFileTitle() : ""));
|
||||
saveCommandButton.setEnabled(mainFrame.panel.getCurrentSwf() != null);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -481,17 +483,19 @@ public class MainFrameClassicMenu implements MainFrameMenu, ActionListener {
|
||||
case ACTION_SAVE: {
|
||||
SWF swf = mainFrame.panel.getCurrentSwf();
|
||||
SWFNode snode = ((TagTreeModel) mainFrame.panel.tagTree.getModel()).getSwfNode(swf);
|
||||
boolean saved = false;
|
||||
if (snode.binaryData != null) {
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
try {
|
||||
swf.saveTo(baos);
|
||||
snode.binaryData.binaryData = baos.toByteArray();
|
||||
snode.binaryData.setModified(true);
|
||||
saved = true;
|
||||
} catch (IOException ex) {
|
||||
Logger.getLogger(MainFrameRibbonMenu.class.getName()).log(Level.SEVERE, "Cannot save SWF", ex);
|
||||
}
|
||||
} else if (swf.file == null) {
|
||||
saveAs(swf, SaveFileMode.SAVEAS);
|
||||
saved = saveAs(swf, SaveFileMode.SAVEAS);
|
||||
} else {
|
||||
try {
|
||||
Main.saveFile(swf, swf.file);
|
||||
@@ -500,14 +504,17 @@ public class MainFrameClassicMenu implements MainFrameMenu, ActionListener {
|
||||
View.showMessageDialog(null, translate("error.file.save"), translate("error"), JOptionPane.ERROR_MESSAGE);
|
||||
}
|
||||
}
|
||||
if (saved) {
|
||||
swf.clearModified();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ACTION_SAVE_AS: {
|
||||
SWF swf = mainFrame.panel.getCurrentSwf();
|
||||
saveAs(swf, SaveFileMode.SAVEAS);
|
||||
if (saveAs(swf, SaveFileMode.SAVEAS)) {
|
||||
swf.clearModified();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ACTION_SAVE_AS_EXE: {
|
||||
SWF swf = mainFrame.panel.getCurrentSwf();
|
||||
|
||||
@@ -538,12 +538,14 @@ public class MainFrameRibbonMenu implements MainFrameMenu, ActionListener {
|
||||
deobfuscationCommandButton.setEnabled(hasAbc);
|
||||
}
|
||||
|
||||
private void saveAs(SWF swf, SaveFileMode mode) {
|
||||
private boolean saveAs(SWF swf, SaveFileMode mode) {
|
||||
if (Main.saveFileDialog(swf, mode)) {
|
||||
swf.fileTitle = null;
|
||||
mainFrame.setTitle(ApplicationInfo.applicationVerName + (Configuration.displayFileName.get() ? " - " + swf.getFileTitle() : ""));
|
||||
saveCommandButton.setEnabled(mainFrame.panel.getCurrentSwf() != null);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -672,33 +674,39 @@ public class MainFrameRibbonMenu implements MainFrameMenu, ActionListener {
|
||||
case ACTION_SAVE: {
|
||||
SWF swf = mainFrame.panel.getCurrentSwf();
|
||||
SWFNode snode = ((TagTreeModel) mainFrame.panel.tagTree.getModel()).getSwfNode(swf);
|
||||
boolean saved = false;
|
||||
if (snode.binaryData != null) {
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
try {
|
||||
swf.saveTo(baos);
|
||||
snode.binaryData.binaryData = baos.toByteArray();
|
||||
snode.binaryData.setModified(true);
|
||||
saved = true;
|
||||
} catch (IOException ex) {
|
||||
Logger.getLogger(MainFrameRibbonMenu.class.getName()).log(Level.SEVERE, "Cannot save SWF", ex);
|
||||
}
|
||||
} else if (swf.file == null) {
|
||||
saveAs(swf, SaveFileMode.SAVEAS);
|
||||
saved = saveAs(swf, SaveFileMode.SAVEAS);
|
||||
} else {
|
||||
try {
|
||||
Main.saveFile(swf, swf.file);
|
||||
saved = true;
|
||||
} catch (IOException ex) {
|
||||
Logger.getLogger(MainFrameRibbonMenu.class.getName()).log(Level.SEVERE, null, ex);
|
||||
View.showMessageDialog(null, translate("error.file.save"), translate("error"), JOptionPane.ERROR_MESSAGE);
|
||||
}
|
||||
}
|
||||
if (saved) {
|
||||
swf.clearModified();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ACTION_SAVE_AS: {
|
||||
SWF swf = mainFrame.panel.getCurrentSwf();
|
||||
saveAs(swf, SaveFileMode.SAVEAS);
|
||||
if (saveAs(swf, SaveFileMode.SAVEAS)) {
|
||||
swf.clearModified();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ACTION_SAVE_AS_EXE: {
|
||||
SWF swf = mainFrame.panel.getCurrentSwf();
|
||||
|
||||
@@ -27,6 +27,7 @@ import com.jpexs.decompiler.flash.abc.types.traits.Trait;
|
||||
import com.jpexs.decompiler.flash.abc.types.traits.TraitClass;
|
||||
import com.jpexs.decompiler.flash.configuration.Configuration;
|
||||
import com.jpexs.decompiler.flash.dumpview.DumpInfo;
|
||||
import com.jpexs.decompiler.flash.dumpview.DumpInfoSwfNode;
|
||||
import com.jpexs.decompiler.flash.exporters.BinaryDataExporter;
|
||||
import com.jpexs.decompiler.flash.exporters.FontExporter;
|
||||
import com.jpexs.decompiler.flash.exporters.ImageExporter;
|
||||
@@ -59,6 +60,9 @@ import com.jpexs.decompiler.flash.gui.abc.ClassesListTreeModel;
|
||||
import com.jpexs.decompiler.flash.gui.abc.DeobfuscationDialog;
|
||||
import com.jpexs.decompiler.flash.gui.abc.treenodes.TreeElement;
|
||||
import com.jpexs.decompiler.flash.gui.action.ActionPanel;
|
||||
import com.jpexs.decompiler.flash.gui.dumpview.DumpTree;
|
||||
import com.jpexs.decompiler.flash.gui.dumpview.DumpTreeModel;
|
||||
import com.jpexs.decompiler.flash.gui.dumpview.DumpViewPanel;
|
||||
import com.jpexs.decompiler.flash.gui.player.FlashPlayerPanel;
|
||||
import com.jpexs.decompiler.flash.gui.timeline.TimelineFrame;
|
||||
import com.jpexs.decompiler.flash.gui.treenodes.SWFBundleNode;
|
||||
@@ -96,7 +100,6 @@ import com.jpexs.decompiler.flash.tags.Tag;
|
||||
import com.jpexs.decompiler.flash.tags.base.ASMSource;
|
||||
import com.jpexs.decompiler.flash.tags.base.BoundedTag;
|
||||
import com.jpexs.decompiler.flash.tags.base.ButtonTag;
|
||||
import com.jpexs.decompiler.flash.tags.base.CharacterIdTag;
|
||||
import com.jpexs.decompiler.flash.tags.base.CharacterTag;
|
||||
import com.jpexs.decompiler.flash.tags.base.Container;
|
||||
import com.jpexs.decompiler.flash.tags.base.ContainerItem;
|
||||
@@ -182,17 +185,13 @@ import javax.swing.JColorChooser;
|
||||
import javax.swing.JFileChooser;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JMenu;
|
||||
import javax.swing.JMenuItem;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JPopupMenu;
|
||||
import javax.swing.JProgressBar;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JSplitPane;
|
||||
import javax.swing.JTabbedPane;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.JTree;
|
||||
import javax.swing.SwingConstants;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.UIManager;
|
||||
@@ -204,7 +203,6 @@ import javax.swing.filechooser.FileFilter;
|
||||
import javax.swing.plaf.basic.BasicTreeUI;
|
||||
import javax.swing.tree.TreeModel;
|
||||
import javax.swing.tree.TreePath;
|
||||
import javax.swing.tree.TreeSelectionModel;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -247,6 +245,7 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec
|
||||
private final PreviewPanel previewPanel;
|
||||
private DumpViewPanel dumpViewPanel;
|
||||
private final JPanel treePanel;
|
||||
private TreePanelMode treePanelMode;
|
||||
private AbortRetryIgnoreHandler errorHandler = new GuiAbortRetryIgnoreHandler();
|
||||
private CancellableWorker setSourceWorker;
|
||||
public TreeNode oldNode;
|
||||
@@ -255,12 +254,6 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec
|
||||
|
||||
public static final String ACTION_SELECT_BKCOLOR = "SELECTCOLOR";
|
||||
public static final String ACTION_REPLACE = "REPLACE";
|
||||
private static final String ACTION_RAW_EDIT = "RAWEDIT";
|
||||
private static final String ACTION_JUMP_TO_CHARACTER = "JUMPTOCHARACTER";
|
||||
private static final String ACTION_REMOVE_ITEM = "REMOVEITEM";
|
||||
private static final String ACTION_REMOVE_ITEM_WITH_DEPENDENCIES = "REMOVEITEMWITHDEPENDENCIES";
|
||||
private static final String ACTION_CLOSE_SWF = "CLOSESWF";
|
||||
private static final String ACTION_EXPAND_RECURSIVE = "EXPANDRECURSIVE";
|
||||
|
||||
// play morph shape in 2 second(s)
|
||||
public static final int MORPH_SHAPE_ANIMATION_LENGTH = 2;
|
||||
@@ -311,146 +304,6 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec
|
||||
statusPanel.setWorkStatus(s, worker);
|
||||
}
|
||||
|
||||
private void createContextMenu() {
|
||||
final JPopupMenu contextPopupMenu = new JPopupMenu();
|
||||
|
||||
final JMenuItem expandRecursiveMenuItem = new JMenuItem(translate("contextmenu.expandAll"));
|
||||
expandRecursiveMenuItem.addActionListener(this);
|
||||
expandRecursiveMenuItem.setActionCommand(ACTION_EXPAND_RECURSIVE);
|
||||
contextPopupMenu.add(expandRecursiveMenuItem);
|
||||
|
||||
final JMenuItem removeMenuItem = new JMenuItem(translate("contextmenu.remove"));
|
||||
removeMenuItem.addActionListener(this);
|
||||
removeMenuItem.setActionCommand(ACTION_REMOVE_ITEM);
|
||||
contextPopupMenu.add(removeMenuItem);
|
||||
|
||||
final JMenuItem removeWithDependenciesMenuItem = new JMenuItem(translate("contextmenu.removeWithDependencies"));
|
||||
removeWithDependenciesMenuItem.addActionListener(this);
|
||||
removeWithDependenciesMenuItem.setActionCommand(ACTION_REMOVE_ITEM_WITH_DEPENDENCIES);
|
||||
contextPopupMenu.add(removeWithDependenciesMenuItem);
|
||||
|
||||
final JMenuItem exportSelectionMenuItem = new JMenuItem(translate("menu.file.export.selection"));
|
||||
exportSelectionMenuItem.setActionCommand(MainFrameRibbonMenu.ACTION_EXPORT_SEL);
|
||||
exportSelectionMenuItem.addActionListener(this);
|
||||
contextPopupMenu.add(exportSelectionMenuItem);
|
||||
|
||||
final JMenuItem replaceSelectionMenuItem = new JMenuItem(translate("button.replace"));
|
||||
replaceSelectionMenuItem.setActionCommand(ACTION_REPLACE);
|
||||
replaceSelectionMenuItem.addActionListener(this);
|
||||
contextPopupMenu.add(replaceSelectionMenuItem);
|
||||
|
||||
final JMenuItem rawEditMenuItem = new JMenuItem(translate("contextmenu.rawEdit"));
|
||||
rawEditMenuItem.setActionCommand(ACTION_RAW_EDIT);
|
||||
rawEditMenuItem.addActionListener(this);
|
||||
rawEditMenuItem.setVisible(false);
|
||||
contextPopupMenu.add(rawEditMenuItem);
|
||||
|
||||
final JMenuItem jumpToCharacterMenuItem = new JMenuItem(translate("contextmenu.jumpToCharacter"));
|
||||
jumpToCharacterMenuItem.setActionCommand(ACTION_JUMP_TO_CHARACTER);
|
||||
jumpToCharacterMenuItem.addActionListener(this);
|
||||
jumpToCharacterMenuItem.setVisible(false);
|
||||
contextPopupMenu.add(jumpToCharacterMenuItem);
|
||||
|
||||
final JMenuItem closeSelectionMenuItem = new JMenuItem(translate("contextmenu.closeSwf"));
|
||||
closeSelectionMenuItem.setActionCommand(ACTION_CLOSE_SWF);
|
||||
closeSelectionMenuItem.addActionListener(this);
|
||||
contextPopupMenu.add(closeSelectionMenuItem);
|
||||
|
||||
final JMenu moveTagMenu = new JMenu(translate("contextmenu.moveTag"));
|
||||
contextPopupMenu.add(moveTagMenu);
|
||||
|
||||
tagTree.addMouseListener(new MouseAdapter() {
|
||||
@Override
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
if (SwingUtilities.isRightMouseButton(e)) {
|
||||
|
||||
int row = tagTree.getClosestRowForLocation(e.getX(), e.getY());
|
||||
int[] selectionRows = tagTree.getSelectionRows();
|
||||
if (!Helper.contains(selectionRows, row)) {
|
||||
tagTree.setSelectionRow(row);
|
||||
}
|
||||
|
||||
TreePath[] paths = tagTree.getSelectionPaths();
|
||||
if (paths == null || paths.length == 0) {
|
||||
return;
|
||||
}
|
||||
boolean allSelectedIsTagOrFrame = true;
|
||||
for (TreePath treePath : paths) {
|
||||
TreeNode treeNode = (TreeNode) treePath.getLastPathComponent();
|
||||
|
||||
TreeItem tag = treeNode.getItem();
|
||||
if (!(tag instanceof Tag) && !(tag instanceof FrameNodeItem)) {
|
||||
allSelectedIsTagOrFrame = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
replaceSelectionMenuItem.setVisible(false);
|
||||
closeSelectionMenuItem.setVisible(false);
|
||||
moveTagMenu.setVisible(false);
|
||||
expandRecursiveMenuItem.setVisible(false);
|
||||
|
||||
if (paths.length == 1) {
|
||||
TreeNode treeNode = (TreeNode) paths[0].getLastPathComponent();
|
||||
|
||||
TreeItem item = ((TreeNode) treeNode).getItem();
|
||||
|
||||
if (item instanceof ImageTag && ((ImageTag) item).importSupported()) {
|
||||
replaceSelectionMenuItem.setVisible(true);
|
||||
}
|
||||
|
||||
if (item instanceof DefineBinaryDataTag) {
|
||||
replaceSelectionMenuItem.setVisible(true);
|
||||
}
|
||||
|
||||
if (item instanceof DefineSoundTag) {
|
||||
replaceSelectionMenuItem.setVisible(true);
|
||||
}
|
||||
|
||||
if (treeNode instanceof SWFNode) {
|
||||
closeSelectionMenuItem.setVisible(true);
|
||||
}
|
||||
|
||||
if (item instanceof Tag && swfs.size() > 1) {
|
||||
final Tag tag = (Tag) item;
|
||||
moveTagMenu.removeAll();
|
||||
for (SWFList targetSwfList : swfs) {
|
||||
for (final SWF targetSwf : targetSwfList) {
|
||||
if (targetSwf != tag.getSwf()) {
|
||||
JMenuItem swfItem = new JMenuItem(targetSwf.getShortFileName());
|
||||
swfItem.addActionListener(new ActionListener() {
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent ae) {
|
||||
tag.getSwf().tags.remove(tag);
|
||||
tag.setSwf(targetSwf);
|
||||
targetSwf.tags.add(tag);
|
||||
refreshTree();
|
||||
}
|
||||
});
|
||||
moveTagMenu.add(swfItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
moveTagMenu.setVisible(true);
|
||||
}
|
||||
|
||||
TreeModel model = tagTree.getModel();
|
||||
expandRecursiveMenuItem.setVisible(model.getChildCount(treeNode) > 0);
|
||||
|
||||
jumpToCharacterMenuItem.setVisible(item instanceof CharacterIdTag && !(item instanceof CharacterTag));
|
||||
|
||||
rawEditMenuItem.setVisible(item instanceof Tag);
|
||||
}
|
||||
|
||||
removeMenuItem.setVisible(allSelectedIsTagOrFrame);
|
||||
exportSelectionMenuItem.setEnabled(hasExportableNodes());
|
||||
contextPopupMenu.show(e.getComponent(), e.getX(), e.getY());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private JPanel createWelcomePanel() {
|
||||
JPanel welcomePanel = new JPanel();
|
||||
welcomePanel.setLayout(new BoxLayout(welcomePanel, BoxLayout.Y_AXIS));
|
||||
@@ -530,7 +383,7 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec
|
||||
cl2.show(detailPanel, DETAILCARDEMPTYPANEL);
|
||||
|
||||
UIManager.getDefaults().put("TreeUI", BasicTreeUI.class.getName());
|
||||
tagTree = new TagTree((TagTreeModel) null);
|
||||
tagTree = new TagTree((TagTreeModel) null, this);
|
||||
tagTree.addTreeSelectionListener(this);
|
||||
|
||||
DragSource dragSource = DragSource.getDefaultDragSource();
|
||||
@@ -612,10 +465,11 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec
|
||||
}
|
||||
});
|
||||
|
||||
createContextMenu();
|
||||
tagTree.createContextMenu(swfs);
|
||||
|
||||
dumpTree = new DumpTree((DumpTreeModel) null);
|
||||
dumpTree = new DumpTree((DumpTreeModel) null, this);
|
||||
dumpTree.addTreeSelectionListener(this);
|
||||
dumpTree.createContextMenu();
|
||||
|
||||
statusPanel = new MainFrameStatusPanel(this);
|
||||
add(statusPanel, BorderLayout.SOUTH);
|
||||
@@ -1034,19 +888,6 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec
|
||||
}
|
||||
}
|
||||
|
||||
public List<TagNode> getSelectedNodes() {
|
||||
List<TagNode> ret = new ArrayList<>();
|
||||
TreePath[] tps = tagTree.getSelectionPaths();
|
||||
if (tps == null) {
|
||||
return ret;
|
||||
}
|
||||
for (TreePath tp : tps) {
|
||||
TagNode te = (TagNode) tp.getLastPathComponent();
|
||||
ret.add(te);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
public void renameIdentifier(SWF swf, String identifier) throws InterruptedException {
|
||||
String oldName = identifier;
|
||||
String newName = View.showInputDialog(translate("rename.enternew"), oldName);
|
||||
@@ -1094,48 +935,6 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec
|
||||
}
|
||||
}
|
||||
|
||||
public List<TreeNode> getSelected(JTree tree) {
|
||||
TreeSelectionModel tsm = tree.getSelectionModel();
|
||||
TreePath[] tps = tsm.getSelectionPaths();
|
||||
List<TreeNode> ret = new ArrayList<>();
|
||||
if (tps == null) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
for (TreePath tp : tps) {
|
||||
TreeNode treeNode = (TreeNode) tp.getLastPathComponent();
|
||||
ret.add(treeNode);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
public List<TreeNode> getAllSubs(JTree tree, TreeNode o) {
|
||||
TagTreeModel tm = (TagTreeModel) tree.getModel();
|
||||
List<TreeNode> ret = new ArrayList<>();
|
||||
for (int i = 0; i < tm.getChildCount(o); i++) {
|
||||
TreeNode c = tm.getChild(o, i);
|
||||
ret.add(c);
|
||||
ret.addAll(getAllSubs(tree, c));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
public List<TreeNode> getAllSelected(TagTree tree) {
|
||||
TreeSelectionModel tsm = tree.getSelectionModel();
|
||||
TreePath[] tps = tsm.getSelectionPaths();
|
||||
List<TreeNode> ret = new ArrayList<>();
|
||||
if (tps == null) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
for (TreePath tp : tps) {
|
||||
TreeNode treeNode = (TreeNode) tp.getLastPathComponent();
|
||||
ret.add(treeNode);
|
||||
ret.addAll(getAllSubs(tree, treeNode));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
public List<TreeNode> getASTreeNodes(TagTree tree) {
|
||||
List<TreeNode> result = new ArrayList<>();
|
||||
TagTreeModel tm = (TagTreeModel) tree.getModel();
|
||||
@@ -1165,68 +964,10 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec
|
||||
}
|
||||
private SearchDialog searchDialog;
|
||||
|
||||
public boolean hasExportableNodes() {
|
||||
return !getSelection(getCurrentSwf()).isEmpty();
|
||||
}
|
||||
|
||||
private List<Object> getSelection(SWF swf) {
|
||||
List<Object> ret = new ArrayList<>();
|
||||
List<TreeNode> sel = getAllSelected(tagTree);
|
||||
for (TreeNode d : sel) {
|
||||
if (d.getItem().getSwf() != swf) {
|
||||
continue;
|
||||
}
|
||||
if (d instanceof ContainerNode) {
|
||||
ContainerNode n = (ContainerNode) d;
|
||||
TreeNodeType nodeType = TagTree.getTreeNodeType(n.getItem());
|
||||
if (nodeType == TreeNodeType.IMAGE) {
|
||||
ret.add((Tag) n.getItem());
|
||||
}
|
||||
if (nodeType == TreeNodeType.SHAPE) {
|
||||
ret.add((Tag) n.getItem());
|
||||
}
|
||||
if (nodeType == TreeNodeType.MORPH_SHAPE) {
|
||||
ret.add((Tag) n.getItem());
|
||||
}
|
||||
if (nodeType == TreeNodeType.AS) {
|
||||
ret.add(n);
|
||||
}
|
||||
if (nodeType == TreeNodeType.MOVIE) {
|
||||
ret.add((Tag) n.getItem());
|
||||
}
|
||||
if (nodeType == TreeNodeType.SOUND) {
|
||||
ret.add((Tag) n.getItem());
|
||||
}
|
||||
if (nodeType == TreeNodeType.BINARY_DATA) {
|
||||
ret.add((Tag) n.getItem());
|
||||
}
|
||||
if (nodeType == TreeNodeType.TEXT) {
|
||||
ret.add((Tag) n.getItem());
|
||||
}
|
||||
if (nodeType == TreeNodeType.FONT) {
|
||||
ret.add((Tag) n.getItem());
|
||||
}
|
||||
}
|
||||
if (d instanceof FrameNode) {
|
||||
FrameNode fn = (FrameNode) d;
|
||||
if (!fn.scriptsNode) {
|
||||
ret.add(d.getItem());
|
||||
}
|
||||
}
|
||||
if (d instanceof TreeElement) {
|
||||
if (((TreeElement) d).isLeaf()) {
|
||||
TreeElement treeElement = (TreeElement) d;
|
||||
ret.add((ScriptPack) treeElement.getItem());
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
public List<File> exportSelection(AbortRetryIgnoreHandler handler, String selFile, ExportDialog export) throws IOException {
|
||||
|
||||
List<File> ret = new ArrayList<>();
|
||||
List<TreeNode> sel = getAllSelected(tagTree);
|
||||
List<TreeNode> sel = tagTree.getAllSelected(tagTree);
|
||||
|
||||
for (SWFList swfList : swfs) {
|
||||
for (SWF swf : swfList) {
|
||||
@@ -1371,6 +1112,7 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec
|
||||
return null;
|
||||
}
|
||||
|
||||
if (treePanelMode == TreePanelMode.TAG_TREE) {
|
||||
TreeNode treeNode = (TreeNode) tagTree.getLastSelectedPathComponent();
|
||||
if (treeNode == null) {
|
||||
return swfs.get(0).get(0);
|
||||
@@ -1381,6 +1123,13 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec
|
||||
}
|
||||
|
||||
return treeNode.getItem().getSwf();
|
||||
} else if (treePanelMode == TreePanelMode.DUMP_TREE) {
|
||||
DumpInfo dumpInfo = (DumpInfo) dumpTree.getLastSelectedPathComponent();
|
||||
|
||||
return DumpInfoSwfNode.getSwfNode(dumpInfo).getSwf();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private void clearCache() {
|
||||
@@ -1849,7 +1598,7 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec
|
||||
public void export(final boolean onlySel) {
|
||||
|
||||
final SWF swf = getCurrentSwf();
|
||||
List<Object> sel = getSelection(swf);
|
||||
List<Object> sel = tagTree.getSelection(swf);
|
||||
if (!onlySel) {
|
||||
sel = null;
|
||||
} else {
|
||||
@@ -2085,6 +1834,7 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec
|
||||
showCard(CARDEMPTYPANEL);
|
||||
TreeItem treeItem = tagTree.getCurrentTreeItem();
|
||||
View.refreshTree(tagTree, new TagTreeModel(mainFrame, swfs));
|
||||
View.refreshTree(dumpTree, new DumpTreeModel(swfs));
|
||||
if (treeItem != null) {
|
||||
setTreeItem(treeItem);
|
||||
}
|
||||
@@ -2238,7 +1988,7 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec
|
||||
try {
|
||||
SWF swf = it.getSwf();
|
||||
if (it instanceof DefineBitsTag) {
|
||||
DefineBitsJPEG2Tag jpeg2Tag = new DefineBitsJPEG2Tag(swf, it.getPos(), it.getOriginalLength(), it.getCharacterId(), data);
|
||||
DefineBitsJPEG2Tag jpeg2Tag = new DefineBitsJPEG2Tag(swf, it.getOriginalRange(), it.getCharacterId(), data);
|
||||
jpeg2Tag.setModified(true);
|
||||
swf.tags.set(swf.tags.indexOf(it), jpeg2Tag);
|
||||
swf.updateCharacters();
|
||||
@@ -2274,74 +2024,6 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ACTION_RAW_EDIT: {
|
||||
TreeItem item = tagTree.getCurrentTreeItem();
|
||||
if (item == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
showCard(CARDPREVIEWPANEL);
|
||||
previewPanel.showGenericTagPanel((Tag) item);
|
||||
}
|
||||
break;
|
||||
case ACTION_JUMP_TO_CHARACTER: {
|
||||
TreeItem item = tagTree.getCurrentTreeItem();
|
||||
if (item == null || !(item instanceof CharacterIdTag)) {
|
||||
return;
|
||||
}
|
||||
|
||||
CharacterIdTag characterIdTag = (CharacterIdTag) item;
|
||||
setTreeItem(item.getSwf().characters.get(characterIdTag.getCharacterId()));
|
||||
}
|
||||
break;
|
||||
case ACTION_EXPAND_RECURSIVE: {
|
||||
TreePath path = tagTree.getSelectionPath();
|
||||
if (path == null) {
|
||||
return;
|
||||
}
|
||||
View.expandTreeNodesRecursive(tagTree, path, true);
|
||||
}
|
||||
break;
|
||||
case ACTION_REMOVE_ITEM:
|
||||
case ACTION_REMOVE_ITEM_WITH_DEPENDENCIES:
|
||||
List<TreeNode> sel = getSelected(tagTree);
|
||||
|
||||
List<Tag> tagsToRemove = new ArrayList<>();
|
||||
for (TreeNode o : sel) {
|
||||
TreeItem tag = o.getItem();
|
||||
if (tag instanceof Tag) {
|
||||
tagsToRemove.add((Tag) tag);
|
||||
} else if (tag instanceof FrameNodeItem) {
|
||||
FrameNodeItem frameNode = (FrameNodeItem) tag;
|
||||
Frame frame = frameNode.getParent().getTimeline().frames.get(frameNode.getFrame() - 1);
|
||||
if (frame.showFrameTag != null) {
|
||||
tagsToRemove.add(frame.showFrameTag);
|
||||
} else {
|
||||
// this should be the last frame, so remove the inner tags
|
||||
tagsToRemove.addAll(frame.innerTags);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
boolean removeDependencies = e.getActionCommand().equals(ACTION_REMOVE_ITEM_WITH_DEPENDENCIES);
|
||||
if (tagsToRemove.size() == 1) {
|
||||
Tag tag = tagsToRemove.get(0);
|
||||
if (View.showConfirmDialog(this, translate("message.confirm.remove").replace("%item%", tag.toString()), translate("message.confirm"), JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE) == JOptionPane.YES_OPTION) {
|
||||
tag.getSwf().removeTag(tag, removeDependencies);
|
||||
refreshTree();
|
||||
}
|
||||
} else if (tagsToRemove.size() > 1) {
|
||||
if (View.showConfirmDialog(this, translate("message.confirm.removemultiple").replace("%count%", Integer.toString(tagsToRemove.size())), translate("message.confirm"), JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE) == JOptionPane.YES_OPTION) {
|
||||
for (Tag tag : tagsToRemove) {
|
||||
tag.getSwf().removeTag(tag, removeDependencies);
|
||||
}
|
||||
refreshTree();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ACTION_CLOSE_SWF: {
|
||||
Main.closeFile(getCurrentSwfList());
|
||||
}
|
||||
}
|
||||
if (Main.isWorking()) {
|
||||
return;
|
||||
@@ -2382,8 +2064,8 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec
|
||||
private void dumpTreeValueChanged(TreeSelectionEvent e) {
|
||||
DumpInfo dumpInfo = (DumpInfo) e.getPath().getLastPathComponent();
|
||||
|
||||
// todo honfika: support multiple swf
|
||||
dumpViewPanel.setData(swfs.get(0).swfs.get(0).uncompressedData, dumpInfo);
|
||||
|
||||
dumpViewPanel.setData(DumpInfoSwfNode.getSwfNode(dumpInfo).getSwf().uncompressedData, dumpInfo);
|
||||
dumpViewPanel.revalidate();
|
||||
showCard(CARDDUMPVIEW);
|
||||
}
|
||||
@@ -2438,8 +2120,10 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec
|
||||
treePanel.removeAll();
|
||||
if (show) {
|
||||
treePanel.add(new JScrollPane(dumpTree), BorderLayout.CENTER);
|
||||
treePanelMode = TreePanelMode.DUMP_TREE;
|
||||
} else {
|
||||
treePanel.add(new JScrollPane(tagTree), BorderLayout.CENTER);
|
||||
treePanelMode = TreePanelMode.TAG_TREE;
|
||||
}
|
||||
treePanel.revalidate();
|
||||
}
|
||||
@@ -2619,13 +2303,18 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec
|
||||
previewPanel.setParametersPanelVisible(false);
|
||||
}
|
||||
} else if (tagObj instanceof Tag) {
|
||||
showCard(CARDPREVIEWPANEL);
|
||||
previewPanel.showGenericTagPanel((Tag) tagObj);
|
||||
showGenericTag((Tag) tagObj);
|
||||
} else {
|
||||
showCard(CARDEMPTYPANEL);
|
||||
}
|
||||
}
|
||||
|
||||
public void showGenericTag(Tag tag) {
|
||||
|
||||
showCard(CARDPREVIEWPANEL);
|
||||
previewPanel.showGenericTagPanel(tag);
|
||||
}
|
||||
|
||||
private void showFontTag(FontTag ft) {
|
||||
|
||||
previewPanel.showFontPanel(ft);
|
||||
|
||||
@@ -683,8 +683,8 @@ public class PreviewPanel extends JSplitPane implements ActionListener {
|
||||
List<Action> actions;
|
||||
DoActionTag doa;
|
||||
|
||||
doa = new DoActionTag(swf, 0, 0);
|
||||
actions = ASMParser.parse(0, 0, false,
|
||||
doa = new DoActionTag(swf, null);
|
||||
actions = ASMParser.parse(0, false,
|
||||
"ConstantPool \"_root\" \"my_sound\" \"Sound\" \"my_define_sound\" \"attachSound\"\n"
|
||||
+ "Push \"_root\"\n"
|
||||
+ "GetVariable\n"
|
||||
@@ -703,7 +703,7 @@ public class PreviewPanel extends JSplitPane implements ActionListener {
|
||||
doa.writeTag(sos2);
|
||||
new ShowFrameTag(swf).writeTag(sos2);
|
||||
|
||||
actions = ASMParser.parse(0, 0, false,
|
||||
actions = ASMParser.parse(0, false,
|
||||
"ConstantPool \"_root\" \"my_sound\" \"Sound\" \"my_define_sound\" \"attachSound\" \"start\"\n"
|
||||
+ "StopSounds\n"
|
||||
+ "Push \"_root\"\n"
|
||||
@@ -730,7 +730,7 @@ public class PreviewPanel extends JSplitPane implements ActionListener {
|
||||
doa.writeTag(sos2);
|
||||
new ShowFrameTag(swf).writeTag(sos2);
|
||||
|
||||
actions = ASMParser.parse(0, 0, false,
|
||||
actions = ASMParser.parse(0, false,
|
||||
"ConstantPool \"_root\" \"my_sound\" \"Sound\" \"my_define_sound\" \"attachSound\" \"onSoundComplete\" \"start\" \"execParam\"\n"
|
||||
+ "StopSounds\n"
|
||||
+ "Push \"_root\"\n"
|
||||
@@ -774,7 +774,7 @@ public class PreviewPanel extends JSplitPane implements ActionListener {
|
||||
doa.writeTag(sos2);
|
||||
new ShowFrameTag(swf).writeTag(sos2);
|
||||
|
||||
actions = ASMParser.parse(0, 0, false,
|
||||
actions = ASMParser.parse(0, false,
|
||||
"StopSounds\n"
|
||||
+ "Stop", swf.version, false);
|
||||
doa.setActions(actions);
|
||||
|
||||
@@ -18,6 +18,8 @@ package com.jpexs.decompiler.flash.gui;
|
||||
|
||||
import com.jpexs.decompiler.flash.SWF;
|
||||
import com.jpexs.decompiler.flash.abc.ScriptPack;
|
||||
import com.jpexs.decompiler.flash.gui.abc.treenodes.TreeElement;
|
||||
import com.jpexs.decompiler.flash.gui.treenodes.SWFNode;
|
||||
import com.jpexs.decompiler.flash.gui.treenodes.TagTreeRoot;
|
||||
import com.jpexs.decompiler.flash.tags.DefineBinaryDataTag;
|
||||
import com.jpexs.decompiler.flash.tags.DefineBitsJPEG2Tag;
|
||||
@@ -49,7 +51,11 @@ import com.jpexs.decompiler.flash.tags.SoundStreamHead2Tag;
|
||||
import com.jpexs.decompiler.flash.tags.SoundStreamHeadTag;
|
||||
import com.jpexs.decompiler.flash.tags.Tag;
|
||||
import com.jpexs.decompiler.flash.tags.base.ASMSource;
|
||||
import com.jpexs.decompiler.flash.tags.base.CharacterIdTag;
|
||||
import com.jpexs.decompiler.flash.tags.base.CharacterTag;
|
||||
import com.jpexs.decompiler.flash.tags.base.ImageTag;
|
||||
import com.jpexs.decompiler.flash.tags.gfx.DefineCompactedFont;
|
||||
import com.jpexs.decompiler.flash.timeline.Frame;
|
||||
import com.jpexs.decompiler.flash.treeitems.AS2PackageNodeItem;
|
||||
import com.jpexs.decompiler.flash.treeitems.AS3PackageNodeItem;
|
||||
import com.jpexs.decompiler.flash.treeitems.FrameNodeItem;
|
||||
@@ -57,24 +63,48 @@ import com.jpexs.decompiler.flash.treeitems.SWFList;
|
||||
import com.jpexs.decompiler.flash.treeitems.StringItem;
|
||||
import com.jpexs.decompiler.flash.treeitems.TreeElementItem;
|
||||
import com.jpexs.decompiler.flash.treeitems.TreeItem;
|
||||
import com.jpexs.decompiler.flash.treenodes.ContainerNode;
|
||||
import com.jpexs.decompiler.flash.treenodes.FrameNode;
|
||||
import com.jpexs.decompiler.flash.treenodes.TreeNode;
|
||||
import com.jpexs.helpers.Helper;
|
||||
import java.awt.Color;
|
||||
import java.awt.Component;
|
||||
import java.awt.Font;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JMenu;
|
||||
import javax.swing.JMenuItem;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPopupMenu;
|
||||
import javax.swing.JTree;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.plaf.basic.BasicLabelUI;
|
||||
import javax.swing.plaf.basic.BasicTreeUI;
|
||||
import javax.swing.tree.DefaultTreeCellRenderer;
|
||||
import javax.swing.tree.TreeModel;
|
||||
import javax.swing.tree.TreePath;
|
||||
import javax.swing.tree.TreeSelectionModel;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class TagTree extends JTree {
|
||||
public class TagTree extends JTree implements ActionListener {
|
||||
|
||||
private static final String ACTION_RAW_EDIT = "RAWEDIT";
|
||||
private static final String ACTION_JUMP_TO_CHARACTER = "JUMPTOCHARACTER";
|
||||
private static final String ACTION_REMOVE_ITEM = "REMOVEITEM";
|
||||
private static final String ACTION_REMOVE_ITEM_WITH_DEPENDENCIES = "REMOVEITEMWITHDEPENDENCIES";
|
||||
private static final String ACTION_CLOSE_SWF = "CLOSESWF";
|
||||
private static final String ACTION_EXPAND_RECURSIVE = "EXPANDRECURSIVE";
|
||||
|
||||
private final MainPanel mainPanel;
|
||||
|
||||
public class TagTreeCellRenderer extends DefaultTreeCellRenderer {
|
||||
|
||||
@@ -140,8 +170,9 @@ public class TagTree extends JTree {
|
||||
}
|
||||
}
|
||||
|
||||
TagTree(TagTreeModel treeModel) {
|
||||
TagTree(TagTreeModel treeModel, MainPanel mainPanel) {
|
||||
super(treeModel);
|
||||
this.mainPanel = mainPanel;
|
||||
setCellRenderer(new TagTreeCellRenderer());
|
||||
setRootVisible(false);
|
||||
setBackground(Color.white);
|
||||
@@ -246,43 +277,322 @@ public class TagTree extends JTree {
|
||||
return TreeNodeType.OTHER_TAG;
|
||||
}
|
||||
|
||||
/*if(t instanceof StringNode){
|
||||
StringNode sn=(StringNode)t;
|
||||
String name = sn.getItem().getName();
|
||||
if(name!=null){
|
||||
switch(name){
|
||||
case TagTreeModel.FOLDER_BINARY_DATA:
|
||||
break;
|
||||
case TagTreeModel.FOLDER_BUTTONS:
|
||||
break;
|
||||
case TagTreeModel.FOLDER_FONTS:
|
||||
break;
|
||||
case TagTreeModel.FOLDER_FRAMES:
|
||||
break;
|
||||
case TagTreeModel.FOLDER_IMAGES:
|
||||
break;
|
||||
case TagTreeModel.FOLDER_MORPHSHAPES:
|
||||
break;
|
||||
case TagTreeModel.FOLDER_MOVIES:
|
||||
break;
|
||||
case TagTreeModel.FOLDER_OTHERS:
|
||||
break;
|
||||
case TagTreeModel.FOLDER_SCRIPTS:
|
||||
break;
|
||||
case TagTreeModel.FOLDER_SHAPES:
|
||||
break;
|
||||
case TagTreeModel.FOLDER_SOUNDS:
|
||||
break;
|
||||
case TagTreeModel.FOLDER_SPRITES:
|
||||
break;
|
||||
case TagTreeModel.FOLDER_TEXTS:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
return TreeNodeType.FOLDER;
|
||||
}
|
||||
|
||||
public void createContextMenu(final List<SWFList> swfs) {
|
||||
final JPopupMenu contextPopupMenu = new JPopupMenu();
|
||||
|
||||
final JMenuItem expandRecursiveMenuItem = new JMenuItem(mainPanel.translate("contextmenu.expandAll"));
|
||||
expandRecursiveMenuItem.addActionListener(this);
|
||||
expandRecursiveMenuItem.setActionCommand(ACTION_EXPAND_RECURSIVE);
|
||||
contextPopupMenu.add(expandRecursiveMenuItem);
|
||||
|
||||
final JMenuItem removeMenuItem = new JMenuItem(mainPanel.translate("contextmenu.remove"));
|
||||
removeMenuItem.addActionListener(this);
|
||||
removeMenuItem.setActionCommand(ACTION_REMOVE_ITEM);
|
||||
contextPopupMenu.add(removeMenuItem);
|
||||
|
||||
final JMenuItem removeWithDependenciesMenuItem = new JMenuItem(mainPanel.translate("contextmenu.removeWithDependencies"));
|
||||
removeWithDependenciesMenuItem.addActionListener(this);
|
||||
removeWithDependenciesMenuItem.setActionCommand(ACTION_REMOVE_ITEM_WITH_DEPENDENCIES);
|
||||
contextPopupMenu.add(removeWithDependenciesMenuItem);
|
||||
|
||||
final JMenuItem exportSelectionMenuItem = new JMenuItem(mainPanel.translate("menu.file.export.selection"));
|
||||
exportSelectionMenuItem.setActionCommand(MainFrameRibbonMenu.ACTION_EXPORT_SEL);
|
||||
exportSelectionMenuItem.addActionListener(this);
|
||||
contextPopupMenu.add(exportSelectionMenuItem);
|
||||
|
||||
final JMenuItem replaceSelectionMenuItem = new JMenuItem(mainPanel.translate("button.replace"));
|
||||
replaceSelectionMenuItem.setActionCommand(MainPanel.ACTION_REPLACE);
|
||||
replaceSelectionMenuItem.addActionListener(mainPanel);
|
||||
contextPopupMenu.add(replaceSelectionMenuItem);
|
||||
|
||||
final JMenuItem rawEditMenuItem = new JMenuItem(mainPanel.translate("contextmenu.rawEdit"));
|
||||
rawEditMenuItem.setActionCommand(ACTION_RAW_EDIT);
|
||||
rawEditMenuItem.addActionListener(this);
|
||||
rawEditMenuItem.setVisible(false);
|
||||
contextPopupMenu.add(rawEditMenuItem);
|
||||
|
||||
final JMenuItem jumpToCharacterMenuItem = new JMenuItem(mainPanel.translate("contextmenu.jumpToCharacter"));
|
||||
jumpToCharacterMenuItem.setActionCommand(ACTION_JUMP_TO_CHARACTER);
|
||||
jumpToCharacterMenuItem.addActionListener(this);
|
||||
jumpToCharacterMenuItem.setVisible(false);
|
||||
contextPopupMenu.add(jumpToCharacterMenuItem);
|
||||
|
||||
final JMenuItem closeSelectionMenuItem = new JMenuItem(mainPanel.translate("contextmenu.closeSwf"));
|
||||
closeSelectionMenuItem.setActionCommand(ACTION_CLOSE_SWF);
|
||||
closeSelectionMenuItem.addActionListener(this);
|
||||
contextPopupMenu.add(closeSelectionMenuItem);
|
||||
|
||||
final JMenu moveTagMenu = new JMenu(mainPanel.translate("contextmenu.moveTag"));
|
||||
contextPopupMenu.add(moveTagMenu);
|
||||
|
||||
addMouseListener(new MouseAdapter() {
|
||||
@Override
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
if (SwingUtilities.isRightMouseButton(e)) {
|
||||
|
||||
int row = getClosestRowForLocation(e.getX(), e.getY());
|
||||
int[] selectionRows = getSelectionRows();
|
||||
if (!Helper.contains(selectionRows, row)) {
|
||||
setSelectionRow(row);
|
||||
}
|
||||
|
||||
TreePath[] paths = getSelectionPaths();
|
||||
if (paths == null || paths.length == 0) {
|
||||
return;
|
||||
}
|
||||
boolean allSelectedIsTagOrFrame = true;
|
||||
for (TreePath treePath : paths) {
|
||||
TreeNode treeNode = (TreeNode) treePath.getLastPathComponent();
|
||||
|
||||
TreeItem tag = treeNode.getItem();
|
||||
if (!(tag instanceof Tag) && !(tag instanceof FrameNodeItem)) {
|
||||
allSelectedIsTagOrFrame = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
replaceSelectionMenuItem.setVisible(false);
|
||||
closeSelectionMenuItem.setVisible(false);
|
||||
moveTagMenu.setVisible(false);
|
||||
expandRecursiveMenuItem.setVisible(false);
|
||||
|
||||
if (paths.length == 1) {
|
||||
TreeNode treeNode = (TreeNode) paths[0].getLastPathComponent();
|
||||
|
||||
TreeItem item = ((TreeNode) treeNode).getItem();
|
||||
|
||||
if (item instanceof ImageTag && ((ImageTag) item).importSupported()) {
|
||||
replaceSelectionMenuItem.setVisible(true);
|
||||
}
|
||||
|
||||
if (item instanceof DefineBinaryDataTag) {
|
||||
replaceSelectionMenuItem.setVisible(true);
|
||||
}
|
||||
|
||||
if (item instanceof DefineSoundTag) {
|
||||
replaceSelectionMenuItem.setVisible(true);
|
||||
}
|
||||
|
||||
if (treeNode instanceof SWFNode) {
|
||||
closeSelectionMenuItem.setVisible(true);
|
||||
}
|
||||
|
||||
if (item instanceof Tag && swfs.size() > 1) {
|
||||
final Tag tag = (Tag) item;
|
||||
moveTagMenu.removeAll();
|
||||
for (SWFList targetSwfList : swfs) {
|
||||
for (final SWF targetSwf : targetSwfList) {
|
||||
if (targetSwf != tag.getSwf()) {
|
||||
JMenuItem swfItem = new JMenuItem(targetSwf.getShortFileName());
|
||||
swfItem.addActionListener(new ActionListener() {
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent ae) {
|
||||
tag.getSwf().tags.remove(tag);
|
||||
tag.setSwf(targetSwf);
|
||||
targetSwf.tags.add(tag);
|
||||
mainPanel.refreshTree();
|
||||
}
|
||||
});
|
||||
moveTagMenu.add(swfItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
moveTagMenu.setVisible(true);
|
||||
}
|
||||
|
||||
TreeModel model = getModel();
|
||||
expandRecursiveMenuItem.setVisible(model.getChildCount(treeNode) > 0);
|
||||
|
||||
jumpToCharacterMenuItem.setVisible(item instanceof CharacterIdTag && !(item instanceof CharacterTag));
|
||||
|
||||
rawEditMenuItem.setVisible(item instanceof Tag);
|
||||
}
|
||||
|
||||
removeMenuItem.setVisible(allSelectedIsTagOrFrame);
|
||||
exportSelectionMenuItem.setEnabled(hasExportableNodes());
|
||||
contextPopupMenu.show(e.getComponent(), e.getX(), e.getY());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
switch (e.getActionCommand()) {
|
||||
case ACTION_RAW_EDIT: {
|
||||
TreeItem item = getCurrentTreeItem();
|
||||
if (item == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
mainPanel.showGenericTag((Tag) item);
|
||||
}
|
||||
break;
|
||||
case ACTION_JUMP_TO_CHARACTER: {
|
||||
TreeItem item = getCurrentTreeItem();
|
||||
if (item == null || !(item instanceof CharacterIdTag)) {
|
||||
return;
|
||||
}
|
||||
|
||||
CharacterIdTag characterIdTag = (CharacterIdTag) item;
|
||||
mainPanel.setTreeItem(item.getSwf().characters.get(characterIdTag.getCharacterId()));
|
||||
}
|
||||
break;
|
||||
case ACTION_EXPAND_RECURSIVE: {
|
||||
TreePath path = getSelectionPath();
|
||||
if (path == null) {
|
||||
return;
|
||||
}
|
||||
View.expandTreeNodesRecursive(this, path, true);
|
||||
}
|
||||
break;
|
||||
case ACTION_REMOVE_ITEM:
|
||||
case ACTION_REMOVE_ITEM_WITH_DEPENDENCIES:
|
||||
List<TreeNode> sel = getSelected(this);
|
||||
|
||||
List<Tag> tagsToRemove = new ArrayList<>();
|
||||
for (TreeNode o : sel) {
|
||||
TreeItem tag = o.getItem();
|
||||
if (tag instanceof Tag) {
|
||||
tagsToRemove.add((Tag) tag);
|
||||
} else if (tag instanceof FrameNodeItem) {
|
||||
FrameNodeItem frameNode = (FrameNodeItem) tag;
|
||||
Frame frame = frameNode.getParent().getTimeline().frames.get(frameNode.getFrame() - 1);
|
||||
if (frame.showFrameTag != null) {
|
||||
tagsToRemove.add(frame.showFrameTag);
|
||||
} else {
|
||||
// this should be the last frame, so remove the inner tags
|
||||
tagsToRemove.addAll(frame.innerTags);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
boolean removeDependencies = e.getActionCommand().equals(ACTION_REMOVE_ITEM_WITH_DEPENDENCIES);
|
||||
if (tagsToRemove.size() == 1) {
|
||||
Tag tag = tagsToRemove.get(0);
|
||||
if (View.showConfirmDialog(this, mainPanel.translate("message.confirm.remove").replace("%item%", tag.toString()), mainPanel.translate("message.confirm"), JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE) == JOptionPane.YES_OPTION) {
|
||||
tag.getSwf().removeTag(tag, removeDependencies);
|
||||
mainPanel.refreshTree();
|
||||
}
|
||||
} else if (tagsToRemove.size() > 1) {
|
||||
if (View.showConfirmDialog(this, mainPanel.translate("message.confirm.removemultiple").replace("%count%", Integer.toString(tagsToRemove.size())), mainPanel.translate("message.confirm"), JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE) == JOptionPane.YES_OPTION) {
|
||||
for (Tag tag : tagsToRemove) {
|
||||
tag.getSwf().removeTag(tag, removeDependencies);
|
||||
}
|
||||
mainPanel.refreshTree();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ACTION_CLOSE_SWF: {
|
||||
Main.closeFile(mainPanel.getCurrentSwfList());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean hasExportableNodes() {
|
||||
return !getSelection(mainPanel.getCurrentSwf()).isEmpty();
|
||||
}
|
||||
|
||||
public List<TreeNode> getAllSubs(JTree tree, TreeNode o) {
|
||||
TagTreeModel tm = (TagTreeModel) tree.getModel();
|
||||
List<TreeNode> ret = new ArrayList<>();
|
||||
for (int i = 0; i < tm.getChildCount(o); i++) {
|
||||
TreeNode c = tm.getChild(o, i);
|
||||
ret.add(c);
|
||||
ret.addAll(getAllSubs(tree, c));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
public List<TreeNode> getAllSelected(TagTree tree) {
|
||||
TreeSelectionModel tsm = tree.getSelectionModel();
|
||||
TreePath[] tps = tsm.getSelectionPaths();
|
||||
List<TreeNode> ret = new ArrayList<>();
|
||||
if (tps == null) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
for (TreePath tp : tps) {
|
||||
TreeNode treeNode = (TreeNode) tp.getLastPathComponent();
|
||||
ret.add(treeNode);
|
||||
ret.addAll(getAllSubs(tree, treeNode));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
public List<TreeNode> getSelected(JTree tree) {
|
||||
TreeSelectionModel tsm = tree.getSelectionModel();
|
||||
TreePath[] tps = tsm.getSelectionPaths();
|
||||
List<TreeNode> ret = new ArrayList<>();
|
||||
if (tps == null) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
for (TreePath tp : tps) {
|
||||
TreeNode treeNode = (TreeNode) tp.getLastPathComponent();
|
||||
ret.add(treeNode);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
public List<Object> getSelection(SWF swf) {
|
||||
List<Object> ret = new ArrayList<>();
|
||||
List<TreeNode> sel = getAllSelected(this);
|
||||
for (TreeNode d : sel) {
|
||||
if (d.getItem().getSwf() != swf) {
|
||||
continue;
|
||||
}
|
||||
if (d instanceof ContainerNode) {
|
||||
ContainerNode n = (ContainerNode) d;
|
||||
TreeNodeType nodeType = TagTree.getTreeNodeType(n.getItem());
|
||||
if (nodeType == TreeNodeType.IMAGE) {
|
||||
ret.add((Tag) n.getItem());
|
||||
}
|
||||
if (nodeType == TreeNodeType.SHAPE) {
|
||||
ret.add((Tag) n.getItem());
|
||||
}
|
||||
if (nodeType == TreeNodeType.MORPH_SHAPE) {
|
||||
ret.add((Tag) n.getItem());
|
||||
}
|
||||
if (nodeType == TreeNodeType.AS) {
|
||||
ret.add(n);
|
||||
}
|
||||
if (nodeType == TreeNodeType.MOVIE) {
|
||||
ret.add((Tag) n.getItem());
|
||||
}
|
||||
if (nodeType == TreeNodeType.SOUND) {
|
||||
ret.add((Tag) n.getItem());
|
||||
}
|
||||
if (nodeType == TreeNodeType.BINARY_DATA) {
|
||||
ret.add((Tag) n.getItem());
|
||||
}
|
||||
if (nodeType == TreeNodeType.TEXT) {
|
||||
ret.add((Tag) n.getItem());
|
||||
}
|
||||
if (nodeType == TreeNodeType.FONT) {
|
||||
ret.add((Tag) n.getItem());
|
||||
}
|
||||
}
|
||||
if (d instanceof FrameNode) {
|
||||
FrameNode fn = (FrameNode) d;
|
||||
if (!fn.scriptsNode) {
|
||||
ret.add(d.getItem());
|
||||
}
|
||||
}
|
||||
if (d instanceof TreeElement) {
|
||||
if (((TreeElement) d).isLeaf()) {
|
||||
TreeElement treeElement = (TreeElement) d;
|
||||
ret.add((ScriptPack) treeElement.getItem());
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
public List<TreeElementItem> getTagsWithType(List<TreeElementItem> list, TreeNodeType type) {
|
||||
List<TreeElementItem> ret = new ArrayList<>();
|
||||
for (TreeElementItem item : list) {
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2014 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.gui;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public enum TreePanelMode {
|
||||
|
||||
TAG_TREE, DUMP_TREE
|
||||
}
|
||||
@@ -733,7 +733,7 @@ public class ActionPanel extends JPanel implements ActionListener, SearchListene
|
||||
if (text.trim().startsWith("#hexdata")) {
|
||||
src.setActionBytes(Helper.getBytesFromHexaText(text));
|
||||
} else {
|
||||
src.setActions(ASMParser.parse(0, src.getPos(), true, text, src.getSwf().version, false));
|
||||
src.setActions(ASMParser.parse(0, true, text, src.getSwf().version, false));
|
||||
}
|
||||
src.setModified();
|
||||
setSource(this.src, false);
|
||||
|
||||
@@ -0,0 +1,171 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2014 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.gui.dumpview;
|
||||
|
||||
import com.jpexs.decompiler.flash.dumpview.DumpInfo;
|
||||
import com.jpexs.decompiler.flash.dumpview.DumpInfoSwfNode;
|
||||
import com.jpexs.decompiler.flash.gui.Main;
|
||||
import com.jpexs.decompiler.flash.gui.MainPanel;
|
||||
import com.jpexs.decompiler.flash.gui.View;
|
||||
import com.jpexs.helpers.Helper;
|
||||
import java.awt.Color;
|
||||
import java.awt.Component;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JMenuItem;
|
||||
import javax.swing.JPopupMenu;
|
||||
import javax.swing.JTree;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.plaf.basic.BasicLabelUI;
|
||||
import javax.swing.plaf.basic.BasicTreeUI;
|
||||
import javax.swing.tree.DefaultTreeCellRenderer;
|
||||
import javax.swing.tree.TreeModel;
|
||||
import javax.swing.tree.TreePath;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class DumpTree extends JTree implements ActionListener {
|
||||
|
||||
private static final String ACTION_CLOSE_SWF = "CLOSESWF";
|
||||
private static final String ACTION_EXPAND_RECURSIVE = "EXPANDRECURSIVE";
|
||||
|
||||
private final MainPanel mainPanel;
|
||||
|
||||
public class DumpTreeCellRenderer extends DefaultTreeCellRenderer {
|
||||
|
||||
@Override
|
||||
public Component getTreeCellRendererComponent(
|
||||
JTree tree,
|
||||
Object value,
|
||||
boolean sel,
|
||||
boolean expanded,
|
||||
boolean leaf,
|
||||
int row,
|
||||
boolean hasFocus) {
|
||||
|
||||
super.getTreeCellRendererComponent(
|
||||
tree, value, sel,
|
||||
expanded, leaf, row,
|
||||
hasFocus);
|
||||
|
||||
//DumpInfo dumpInfo = (DumpInfo) value;
|
||||
setUI(new BasicLabelUI());
|
||||
setOpaque(false);
|
||||
setBackgroundNonSelectionColor(Color.white);
|
||||
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
public DumpTree(DumpTreeModel treeModel, MainPanel mainPanel) {
|
||||
super(treeModel);
|
||||
this.mainPanel = mainPanel;
|
||||
setCellRenderer(new DumpTreeCellRenderer());
|
||||
setRootVisible(false);
|
||||
setBackground(Color.white);
|
||||
setUI(new BasicTreeUI() {
|
||||
@Override
|
||||
public void paint(Graphics g, JComponent c) {
|
||||
setHashColor(Color.gray);
|
||||
super.paint(g, c);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void createContextMenu() {
|
||||
final JPopupMenu contextPopupMenu = new JPopupMenu();
|
||||
|
||||
final JMenuItem expandRecursiveMenuItem = new JMenuItem(mainPanel.translate("contextmenu.expandAll"));
|
||||
expandRecursiveMenuItem.addActionListener(this);
|
||||
expandRecursiveMenuItem.setActionCommand(ACTION_EXPAND_RECURSIVE);
|
||||
contextPopupMenu.add(expandRecursiveMenuItem);
|
||||
|
||||
final JMenuItem closeSelectionMenuItem = new JMenuItem(mainPanel.translate("contextmenu.closeSwf"));
|
||||
closeSelectionMenuItem.setActionCommand(ACTION_CLOSE_SWF);
|
||||
closeSelectionMenuItem.addActionListener(this);
|
||||
contextPopupMenu.add(closeSelectionMenuItem);
|
||||
|
||||
addMouseListener(new MouseAdapter() {
|
||||
@Override
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
if (SwingUtilities.isRightMouseButton(e)) {
|
||||
|
||||
int row = getClosestRowForLocation(e.getX(), e.getY());
|
||||
int[] selectionRows = getSelectionRows();
|
||||
if (!Helper.contains(selectionRows, row)) {
|
||||
setSelectionRow(row);
|
||||
}
|
||||
|
||||
TreePath[] paths = getSelectionPaths();
|
||||
if (paths == null || paths.length == 0) {
|
||||
return;
|
||||
}
|
||||
closeSelectionMenuItem.setVisible(false);
|
||||
expandRecursiveMenuItem.setVisible(false);
|
||||
|
||||
if (paths.length == 1) {
|
||||
DumpInfo treeNode = (DumpInfo) paths[0].getLastPathComponent();
|
||||
|
||||
if (treeNode instanceof DumpInfoSwfNode) {
|
||||
closeSelectionMenuItem.setVisible(true);
|
||||
}
|
||||
|
||||
TreeModel model = getModel();
|
||||
expandRecursiveMenuItem.setVisible(model.getChildCount(treeNode) > 0);
|
||||
}
|
||||
|
||||
contextPopupMenu.show(e.getComponent(), e.getX(), e.getY());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
switch (e.getActionCommand()) {
|
||||
case ACTION_EXPAND_RECURSIVE: {
|
||||
TreePath path = getSelectionPath();
|
||||
if (path == null) {
|
||||
return;
|
||||
}
|
||||
View.expandTreeNodesRecursive(this, path, true);
|
||||
}
|
||||
break;
|
||||
case ACTION_CLOSE_SWF: {
|
||||
Main.closeFile(mainPanel.getCurrentSwfList());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setModel(TreeModel tm) {
|
||||
super.setModel(tm);
|
||||
if (tm != null) {
|
||||
int rowCount = tm.getChildCount(tm.getRoot());
|
||||
for (int i = rowCount - 1; i >= 0; i--) {
|
||||
expandRow(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2014 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.gui.dumpview;
|
||||
|
||||
import com.jpexs.decompiler.flash.SWF;
|
||||
import com.jpexs.decompiler.flash.dumpview.DumpInfo;
|
||||
import com.jpexs.decompiler.flash.treeitems.SWFList;
|
||||
import java.util.List;
|
||||
import javax.swing.event.TreeModelListener;
|
||||
import javax.swing.tree.TreeModel;
|
||||
import javax.swing.tree.TreePath;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class DumpTreeModel implements TreeModel {
|
||||
|
||||
private final DumpInfo root;
|
||||
|
||||
public DumpTreeModel(List<SWFList> swfs) {
|
||||
DumpInfo root = new DumpInfo("root", "", null, 0, 0);
|
||||
for (SWFList swfList : swfs) {
|
||||
for (SWF swf : swfList) {
|
||||
swf.dumpInfo.name = swf.getFileTitle();
|
||||
root.childInfos.add(swf.dumpInfo);
|
||||
}
|
||||
}
|
||||
this.root = root;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getRoot() {
|
||||
return root;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getChild(Object o, int i) {
|
||||
return ((DumpInfo) o).childInfos.get(i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getChildCount(Object o) {
|
||||
return ((DumpInfo) o).childInfos.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLeaf(Object o) {
|
||||
return ((DumpInfo) o).childInfos.isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void valueForPathChanged(TreePath tp, Object o) {
|
||||
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getIndexOfChild(Object o, Object o1) {
|
||||
return ((DumpInfo) o).childInfos.indexOf(o1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addTreeModelListener(TreeModelListener tl) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeTreeModelListener(TreeModelListener tl) {
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2014 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.gui.dumpview;
|
||||
|
||||
import com.jpexs.decompiler.flash.dumpview.DumpInfo;
|
||||
import com.jpexs.decompiler.flash.gui.HexView;
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Dimension;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class DumpViewPanel extends JPanel {
|
||||
|
||||
private final JLabel dumpViewLabel;
|
||||
private final HexView dumpViewHexTable;
|
||||
|
||||
public DumpViewPanel() {
|
||||
super(new BorderLayout());
|
||||
|
||||
dumpViewLabel = new JLabel();
|
||||
dumpViewLabel.setMinimumSize(new Dimension(100, 20));
|
||||
add(dumpViewLabel, BorderLayout.SOUTH);
|
||||
|
||||
dumpViewHexTable = new HexView();
|
||||
add(new JScrollPane(dumpViewHexTable), BorderLayout.CENTER);
|
||||
}
|
||||
|
||||
private int getEndIndex(DumpInfo dumpInfo) {
|
||||
int end = (int) dumpInfo.startByte;
|
||||
if (dumpInfo.lengthBytes != 0) {
|
||||
end += dumpInfo.lengthBytes;
|
||||
} else {
|
||||
int bits = dumpInfo.startBit + dumpInfo.lengthBits;
|
||||
end += bits / 8;
|
||||
if (bits % 8 != 0) {
|
||||
end++;
|
||||
}
|
||||
}
|
||||
return end - 1;
|
||||
}
|
||||
|
||||
public void setData(byte[] data, DumpInfo dumpInfo) {
|
||||
List<DumpInfo> dumpInfos = new ArrayList<>();
|
||||
DumpInfo di = dumpInfo;
|
||||
while (di.parent != null) {
|
||||
dumpInfos.add(di);
|
||||
di = di.parent;
|
||||
}
|
||||
long[] highlightStarts = new long[dumpInfos.size()];
|
||||
long[] highlightEnds = new long[dumpInfos.size()];
|
||||
for (int i = 0; i < dumpInfos.size(); i++) {
|
||||
DumpInfo di2 = dumpInfos.get(highlightStarts.length - i - 1);
|
||||
highlightStarts[i] = di2.startByte;
|
||||
highlightEnds[i] = getEndIndex(di2);
|
||||
}
|
||||
dumpViewHexTable.setData(data, highlightStarts, highlightEnds);
|
||||
|
||||
if (dumpInfo.lengthBytes != 0 || dumpInfo.lengthBits != 0) {
|
||||
int selectionStart = (int) dumpInfo.startByte;
|
||||
int selectionEnd = getEndIndex(dumpInfo);
|
||||
|
||||
dumpViewHexTable.scrollToByte(highlightStarts, highlightEnds);
|
||||
|
||||
setLabelText("startByte: " + dumpInfo.startByte
|
||||
+ " startBit: " + dumpInfo.startBit
|
||||
+ " lengthBytes: " + dumpInfo.lengthBytes
|
||||
+ " lengthBits: " + dumpInfo.lengthBits
|
||||
+ " selectionStart: " + selectionStart
|
||||
+ " selectionEnd: " + selectionEnd);
|
||||
}
|
||||
|
||||
repaint();
|
||||
}
|
||||
|
||||
public void setLabelText(String text) {
|
||||
dumpViewLabel.setText(text);
|
||||
}
|
||||
}
|
||||
@@ -21,6 +21,7 @@ import com.jpexs.decompiler.flash.SWFOutputStream;
|
||||
import com.jpexs.decompiler.flash.types.BasicType;
|
||||
import com.jpexs.decompiler.flash.types.annotations.Reserved;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFType;
|
||||
import com.jpexs.helpers.ByteArrayRange;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
@@ -84,12 +85,11 @@ public class CSMTextSettingsTag extends Tag {
|
||||
* Constructor
|
||||
*
|
||||
* @param sis
|
||||
* @param length
|
||||
* @param pos
|
||||
* @param data
|
||||
* @throws IOException
|
||||
*/
|
||||
public CSMTextSettingsTag(SWFInputStream sis, long pos, int length) throws IOException {
|
||||
super(sis.getSwf(), ID, "CSMTextSettings", pos, length);
|
||||
public CSMTextSettingsTag(SWFInputStream sis, ByteArrayRange data) throws IOException {
|
||||
super(sis.getSwf(), ID, "CSMTextSettings", data);
|
||||
textID = sis.readUI16("textID");
|
||||
useFlashType = (int) sis.readUB(2, "useFlashType");
|
||||
gridFit = (int) sis.readUB(3, "gridFit");
|
||||
|
||||
@@ -20,6 +20,7 @@ import com.jpexs.decompiler.flash.SWFInputStream;
|
||||
import com.jpexs.decompiler.flash.SWFOutputStream;
|
||||
import com.jpexs.decompiler.flash.types.BasicType;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFType;
|
||||
import com.jpexs.helpers.ByteArrayRange;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
@@ -57,12 +58,11 @@ public class DebugIDTag extends Tag {
|
||||
* Constructor
|
||||
*
|
||||
* @param sis
|
||||
* @param length
|
||||
* @param pos
|
||||
* @param data
|
||||
* @throws IOException
|
||||
*/
|
||||
public DebugIDTag(SWFInputStream sis, long pos, int length) throws IOException {
|
||||
super(sis.getSwf(), ID, "DebugID", pos, length);
|
||||
public DebugIDTag(SWFInputStream sis, ByteArrayRange data) throws IOException {
|
||||
super(sis.getSwf(), ID, "DebugID", data);
|
||||
debugId = sis.readBytesEx(16, "debugId");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ import com.jpexs.decompiler.flash.tags.base.CharacterTag;
|
||||
import com.jpexs.decompiler.flash.types.BasicType;
|
||||
import com.jpexs.decompiler.flash.types.annotations.Reserved;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFType;
|
||||
import com.jpexs.helpers.ByteArrayRange;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
@@ -58,8 +59,8 @@ public class DefineBinaryDataTag extends CharacterTag {
|
||||
return baos.toByteArray();
|
||||
}
|
||||
|
||||
public DefineBinaryDataTag(SWFInputStream sis, long pos, int length) throws IOException {
|
||||
super(sis.getSwf(), ID, "DefineBinaryData", pos, length);
|
||||
public DefineBinaryDataTag(SWFInputStream sis, ByteArrayRange data) throws IOException {
|
||||
super(sis.getSwf(), ID, "DefineBinaryData", data);
|
||||
tag = sis.readUI16("tag");
|
||||
reserved = sis.readUI32("reserved");
|
||||
binaryData = sis.readBytesEx(sis.available(), "binaryData");
|
||||
|
||||
@@ -23,6 +23,7 @@ import com.jpexs.decompiler.flash.tags.base.AloneTag;
|
||||
import com.jpexs.decompiler.flash.tags.base.ImageTag;
|
||||
import com.jpexs.decompiler.flash.types.BasicType;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFType;
|
||||
import com.jpexs.helpers.ByteArrayRange;
|
||||
import com.jpexs.helpers.SerializableImage;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
@@ -68,14 +69,14 @@ public class DefineBitsJPEG2Tag extends ImageTag implements AloneTag {
|
||||
return null;
|
||||
}
|
||||
|
||||
public DefineBitsJPEG2Tag(SWFInputStream sis, long pos, int length) throws IOException {
|
||||
super(sis.getSwf(), ID, "DefineBitsJPEG2", pos, length);
|
||||
public DefineBitsJPEG2Tag(SWFInputStream sis, ByteArrayRange data) throws IOException {
|
||||
super(sis.getSwf(), ID, "DefineBitsJPEG2", data);
|
||||
characterID = sis.readUI16("characterID");
|
||||
imageData = sis.readBytesEx(sis.available(), "imageData");
|
||||
}
|
||||
|
||||
public DefineBitsJPEG2Tag(SWF swf, long pos, int length, int characterID, byte[] imageData) throws IOException {
|
||||
super(swf, ID, "DefineBitsJPEG2", pos, length);
|
||||
public DefineBitsJPEG2Tag(SWF swf, ByteArrayRange data, int characterID, byte[] imageData) throws IOException {
|
||||
super(swf, ID, "DefineBitsJPEG2", data);
|
||||
this.characterID = characterID;
|
||||
this.imageData = imageData;
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ import com.jpexs.decompiler.flash.tags.base.AloneTag;
|
||||
import com.jpexs.decompiler.flash.tags.base.ImageTag;
|
||||
import com.jpexs.decompiler.flash.types.BasicType;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFType;
|
||||
import com.jpexs.helpers.ByteArrayRange;
|
||||
import com.jpexs.helpers.SerializableImage;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
@@ -107,8 +108,8 @@ public class DefineBitsJPEG3Tag extends ImageTag implements AloneTag {
|
||||
return null;
|
||||
}
|
||||
|
||||
public DefineBitsJPEG3Tag(SWFInputStream sis, long pos, int length) throws IOException {
|
||||
super(sis.getSwf(), ID, "DefineBitsJPEG3", pos, length);
|
||||
public DefineBitsJPEG3Tag(SWFInputStream sis, ByteArrayRange data) throws IOException {
|
||||
super(sis.getSwf(), ID, "DefineBitsJPEG3", data);
|
||||
characterID = sis.readUI16("characterID");
|
||||
long alphaDataOffset = sis.readUI32("alphaDataOffset");
|
||||
imageData = sis.readBytesEx(alphaDataOffset, "imageData");
|
||||
|
||||
@@ -22,6 +22,7 @@ import com.jpexs.decompiler.flash.tags.base.AloneTag;
|
||||
import com.jpexs.decompiler.flash.tags.base.ImageTag;
|
||||
import com.jpexs.decompiler.flash.types.BasicType;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFType;
|
||||
import com.jpexs.helpers.ByteArrayRange;
|
||||
import com.jpexs.helpers.SerializableImage;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
@@ -133,12 +134,11 @@ public class DefineBitsJPEG4Tag extends ImageTag implements AloneTag {
|
||||
* Constructor
|
||||
*
|
||||
* @param sis
|
||||
* @param length
|
||||
* @param pos
|
||||
* @param data
|
||||
* @throws IOException
|
||||
*/
|
||||
public DefineBitsJPEG4Tag(SWFInputStream sis, long pos, int length) throws IOException {
|
||||
super(sis.getSwf(), ID, "DefineBitsJPEG4", pos, length);
|
||||
public DefineBitsJPEG4Tag(SWFInputStream sis, ByteArrayRange data) throws IOException {
|
||||
super(sis.getSwf(), ID, "DefineBitsJPEG4", data);
|
||||
characterID = sis.readUI16("characterID");
|
||||
long alphaDataOffset = sis.readUI32("alphaDataOffset");
|
||||
deblockParam = sis.readUI16("deblockParam");
|
||||
|
||||
@@ -26,6 +26,7 @@ import com.jpexs.decompiler.flash.types.ARGB;
|
||||
import com.jpexs.decompiler.flash.types.BasicType;
|
||||
import com.jpexs.decompiler.flash.types.annotations.Conditional;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFType;
|
||||
import com.jpexs.helpers.ByteArrayRange;
|
||||
import com.jpexs.helpers.Helper;
|
||||
import com.jpexs.helpers.SerializableImage;
|
||||
import java.awt.Color;
|
||||
@@ -107,8 +108,8 @@ public class DefineBitsLossless2Tag extends ImageTag implements AloneTag {
|
||||
setModified(true);
|
||||
}
|
||||
|
||||
public DefineBitsLossless2Tag(SWFInputStream sis, long pos, int length) throws IOException {
|
||||
super(sis.getSwf(), ID, "DefineBitsLossless2", pos, length);
|
||||
public DefineBitsLossless2Tag(SWFInputStream sis, ByteArrayRange data) throws IOException {
|
||||
super(sis.getSwf(), ID, "DefineBitsLossless2", data);
|
||||
characterID = sis.readUI16("characterID");
|
||||
bitmapFormat = sis.readUI8("bitmapFormat");
|
||||
bitmapWidth = sis.readUI16("bitmapWidth");
|
||||
|
||||
@@ -28,6 +28,7 @@ import com.jpexs.decompiler.flash.types.RGB;
|
||||
import com.jpexs.decompiler.flash.types.annotations.Conditional;
|
||||
import com.jpexs.decompiler.flash.types.annotations.Internal;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFType;
|
||||
import com.jpexs.helpers.ByteArrayRange;
|
||||
import com.jpexs.helpers.Helper;
|
||||
import com.jpexs.helpers.SerializableImage;
|
||||
import java.awt.Color;
|
||||
@@ -181,8 +182,8 @@ public class DefineBitsLosslessTag extends ImageTag implements AloneTag {
|
||||
decompressed = true;
|
||||
}
|
||||
|
||||
public DefineBitsLosslessTag(SWFInputStream sis, long pos, int length) throws IOException {
|
||||
super(sis.getSwf(), ID, "DefineBitsLossless", pos, length);
|
||||
public DefineBitsLosslessTag(SWFInputStream sis, ByteArrayRange data) throws IOException {
|
||||
super(sis.getSwf(), ID, "DefineBitsLossless", data);
|
||||
characterID = sis.readUI16("characterID");
|
||||
bitmapFormat = sis.readUI8("bitmapFormat");
|
||||
bitmapWidth = sis.readUI16("bitmapWidth");
|
||||
|
||||
@@ -23,6 +23,7 @@ import com.jpexs.decompiler.flash.tags.base.ImageTag;
|
||||
import com.jpexs.decompiler.flash.types.BasicType;
|
||||
import com.jpexs.decompiler.flash.types.annotations.Internal;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFType;
|
||||
import com.jpexs.helpers.ByteArrayRange;
|
||||
import com.jpexs.helpers.SerializableImage;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
@@ -54,8 +55,8 @@ public class DefineBitsTag extends ImageTag {
|
||||
return true;
|
||||
}
|
||||
|
||||
public DefineBitsTag(SWFInputStream sis, long pos, int length) throws IOException {
|
||||
super(sis.getSwf(), ID, "DefineBits", pos, length);
|
||||
public DefineBitsTag(SWFInputStream sis, ByteArrayRange data) throws IOException {
|
||||
super(sis.getSwf(), ID, "DefineBits", data);
|
||||
characterID = sis.readUI16("characterID");
|
||||
jpegData = sis.readBytesEx(sis.available(), "jpegData");
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@ import com.jpexs.decompiler.flash.types.MATRIX;
|
||||
import com.jpexs.decompiler.flash.types.RECT;
|
||||
import com.jpexs.decompiler.flash.types.annotations.Reserved;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFType;
|
||||
import com.jpexs.helpers.ByteArrayRange;
|
||||
import com.jpexs.helpers.Cache;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
@@ -97,12 +98,11 @@ public class DefineButton2Tag extends ButtonTag implements Container {
|
||||
* Constructor
|
||||
*
|
||||
* @param sis
|
||||
* @param length
|
||||
* @param pos
|
||||
* @param data
|
||||
* @throws IOException
|
||||
*/
|
||||
public DefineButton2Tag(SWFInputStream sis, long pos, int length) throws IOException {
|
||||
super(sis.getSwf(), ID, "DefineButton2", pos, length);
|
||||
public DefineButton2Tag(SWFInputStream sis, ByteArrayRange data) throws IOException {
|
||||
super(sis.getSwf(), ID, "DefineButton2", data);
|
||||
buttonId = sis.readUI16("buttonId");
|
||||
reserved = (int) sis.readUB(7, "reserved");
|
||||
trackAsMenu = sis.readUB(1, "trackAsMenu") == 1;
|
||||
|
||||
@@ -21,6 +21,7 @@ import com.jpexs.decompiler.flash.SWFOutputStream;
|
||||
import com.jpexs.decompiler.flash.types.BasicType;
|
||||
import com.jpexs.decompiler.flash.types.CXFORM;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFType;
|
||||
import com.jpexs.helpers.ByteArrayRange;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
@@ -59,12 +60,11 @@ public class DefineButtonCxformTag extends Tag {
|
||||
* Constructor
|
||||
*
|
||||
* @param sis
|
||||
* @param length
|
||||
* @param pos
|
||||
* @param data
|
||||
* @throws IOException
|
||||
*/
|
||||
public DefineButtonCxformTag(SWFInputStream sis, long pos, int length) throws IOException {
|
||||
super(sis.getSwf(), ID, "DefineButtonCxform", pos, length);
|
||||
public DefineButtonCxformTag(SWFInputStream sis, ByteArrayRange data) throws IOException {
|
||||
super(sis.getSwf(), ID, "DefineButtonCxform", data);
|
||||
buttonId = sis.readUI16("buttonId");
|
||||
buttonColorTransform = sis.readCXFORM("buttonColorTransform");
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ import com.jpexs.decompiler.flash.tags.base.CharacterIdTag;
|
||||
import com.jpexs.decompiler.flash.types.BasicType;
|
||||
import com.jpexs.decompiler.flash.types.SOUNDINFO;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFType;
|
||||
import com.jpexs.helpers.ByteArrayRange;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
@@ -99,12 +100,11 @@ public class DefineButtonSoundTag extends CharacterIdTag {
|
||||
* Constructor
|
||||
*
|
||||
* @param sis
|
||||
* @param length
|
||||
* @param pos
|
||||
* @param data
|
||||
* @throws IOException
|
||||
*/
|
||||
public DefineButtonSoundTag(SWFInputStream sis, long pos, int length) throws IOException {
|
||||
super(sis.getSwf(), ID, "DefineButtonSound", pos, length);
|
||||
public DefineButtonSoundTag(SWFInputStream sis, ByteArrayRange data) throws IOException {
|
||||
super(sis.getSwf(), ID, "DefineButtonSound", data);
|
||||
buttonId = sis.readUI16("buttonId");
|
||||
buttonSoundChar0 = sis.readUI16("buttonSoundChar0");
|
||||
if (buttonSoundChar0 != 0) {
|
||||
|
||||
@@ -39,6 +39,7 @@ import com.jpexs.decompiler.flash.types.MATRIX;
|
||||
import com.jpexs.decompiler.flash.types.RECT;
|
||||
import com.jpexs.decompiler.flash.types.annotations.Internal;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFType;
|
||||
import com.jpexs.helpers.ByteArrayRange;
|
||||
import com.jpexs.helpers.Cache;
|
||||
import com.jpexs.helpers.Helper;
|
||||
import java.io.ByteArrayInputStream;
|
||||
@@ -95,12 +96,11 @@ public class DefineButtonTag extends ButtonTag implements ASMSource {
|
||||
* Constructor
|
||||
*
|
||||
* @param sis
|
||||
* @param length
|
||||
* @param pos
|
||||
* @param data
|
||||
* @throws IOException
|
||||
*/
|
||||
public DefineButtonTag(SWFInputStream sis, long pos, int length) throws IOException {
|
||||
super(sis.getSwf(), ID, "DefineButton", pos, length);
|
||||
public DefineButtonTag(SWFInputStream sis, ByteArrayRange data) throws IOException {
|
||||
super(sis.getSwf(), ID, "DefineButton", data);
|
||||
buttonId = sis.readUI16("buttonId");
|
||||
characters = sis.readBUTTONRECORDList(false, "characters");
|
||||
hdrSize = sis.getPos();
|
||||
@@ -144,7 +144,7 @@ public class DefineButtonTag extends ButtonTag implements ASMSource {
|
||||
if (actions == null) {
|
||||
actions = getActions();
|
||||
}
|
||||
return Action.actionsToString(listeners, 0, actions, null, swf.version, exportMode, writer, getDataPos() + hdrSize, toString()/*FIXME?*/);
|
||||
return Action.actionsToString(listeners, 0, actions, null, swf.version, exportMode, writer, toString()/*FIXME?*/);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -170,13 +170,13 @@ public class DefineButtonTag extends ButtonTag implements ASMSource {
|
||||
SWFInputStream rri;
|
||||
if (actionBytes == null) {
|
||||
prevLength = (int) (getDataPos() + hdrSize);
|
||||
rri = new SWFInputStream(swf, swf.uncompressedData);
|
||||
rri = new SWFInputStream(swf, getOriginalRange().array);
|
||||
rri.seek(prevLength);
|
||||
} else {
|
||||
prevLength = 0;
|
||||
rri = new SWFInputStream(swf, actionBytes);
|
||||
}
|
||||
List<Action> list = ActionListReader.readActionListTimeout(listeners, getDataPos() + hdrSize - prevLength, rri, getVersion(), prevLength, -1, toString()/*FIXME?*/);
|
||||
List<Action> list = ActionListReader.readActionListTimeout(listeners, rri, getVersion(), prevLength, -1, toString()/*FIXME?*/);
|
||||
return list;
|
||||
} catch (InterruptedException ex) {
|
||||
throw ex;
|
||||
|
||||
@@ -44,6 +44,7 @@ import com.jpexs.decompiler.flash.types.RGBA;
|
||||
import com.jpexs.decompiler.flash.types.TEXTRECORD;
|
||||
import com.jpexs.decompiler.flash.types.annotations.Conditional;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFType;
|
||||
import com.jpexs.helpers.ByteArrayRange;
|
||||
import com.jpexs.helpers.SerializableImage;
|
||||
import com.jpexs.helpers.utf8.Utf8Helper;
|
||||
import java.awt.Color;
|
||||
@@ -695,12 +696,11 @@ public class DefineEditTextTag extends TextTag {
|
||||
* Constructor
|
||||
*
|
||||
* @param sis
|
||||
* @param length
|
||||
* @param pos
|
||||
* @param data
|
||||
* @throws IOException
|
||||
*/
|
||||
public DefineEditTextTag(SWFInputStream sis, long pos, int length) throws IOException {
|
||||
super(sis.getSwf(), ID, "DefineEditText", pos, length);
|
||||
public DefineEditTextTag(SWFInputStream sis, ByteArrayRange data) throws IOException {
|
||||
super(sis.getSwf(), ID, "DefineEditText", data);
|
||||
characterID = sis.readUI16("characterID");
|
||||
bounds = sis.readRECT("bounds");
|
||||
hasText = sis.readUB(1, "hasText") == 1;
|
||||
|
||||
@@ -29,6 +29,7 @@ import com.jpexs.decompiler.flash.types.annotations.Conditional;
|
||||
import com.jpexs.decompiler.flash.types.annotations.Internal;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFType;
|
||||
import com.jpexs.decompiler.flash.types.shaperecords.SHAPERECORD;
|
||||
import com.jpexs.helpers.ByteArrayRange;
|
||||
import com.jpexs.helpers.utf8.Utf8Helper;
|
||||
import java.awt.Font;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
@@ -185,19 +186,18 @@ public class DefineFont2Tag extends FontTag {
|
||||
}
|
||||
|
||||
public DefineFont2Tag(SWF swf) throws IOException {
|
||||
super(swf, ID, "DefineFont2", 0, 0);
|
||||
super(swf, ID, "DefineFont2", null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param sis
|
||||
* @param length
|
||||
* @param pos
|
||||
* @param data
|
||||
* @throws IOException
|
||||
*/
|
||||
public DefineFont2Tag(SWFInputStream sis, long pos, int length) throws IOException {
|
||||
super(sis.getSwf(), ID, "DefineFont2", pos, length);
|
||||
public DefineFont2Tag(SWFInputStream sis, ByteArrayRange data) throws IOException {
|
||||
super(sis.getSwf(), ID, "DefineFont2", data);
|
||||
fontId = sis.readUI16("fontId");
|
||||
fontFlagsHasLayout = sis.readUB(1, "fontFlagsHasLayout") == 1;
|
||||
fontFlagsShiftJIS = sis.readUB(1, "fontFlagsShiftJIS") == 1;
|
||||
|
||||
@@ -31,6 +31,7 @@ import com.jpexs.decompiler.flash.types.annotations.Conditional;
|
||||
import com.jpexs.decompiler.flash.types.annotations.Internal;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFType;
|
||||
import com.jpexs.decompiler.flash.types.shaperecords.SHAPERECORD;
|
||||
import com.jpexs.helpers.ByteArrayRange;
|
||||
import com.jpexs.helpers.utf8.Utf8Helper;
|
||||
import java.awt.Font;
|
||||
import java.io.ByteArrayInputStream;
|
||||
@@ -110,8 +111,8 @@ public class DefineFont3Tag extends FontTag {
|
||||
return codeTable.indexOf((int) c);
|
||||
}
|
||||
|
||||
public DefineFont3Tag(SWFInputStream sis, long pos, int length) throws IOException {
|
||||
super(sis.getSwf(), ID, "DefineFont3", pos, length);
|
||||
public DefineFont3Tag(SWFInputStream sis, ByteArrayRange data) throws IOException {
|
||||
super(sis.getSwf(), ID, "DefineFont3", data);
|
||||
fontId = sis.readUI16("fontId");
|
||||
fontFlagsHasLayout = sis.readUB(1, "fontFlagsHasLayout") == 1;
|
||||
fontFlagsShiftJIS = sis.readUB(1, "fontFlagsShiftJIS") == 1;
|
||||
|
||||
@@ -22,6 +22,7 @@ import com.jpexs.decompiler.flash.tags.base.CharacterTag;
|
||||
import com.jpexs.decompiler.flash.types.BasicType;
|
||||
import com.jpexs.decompiler.flash.types.annotations.Reserved;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFType;
|
||||
import com.jpexs.helpers.ByteArrayRange;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
@@ -46,8 +47,8 @@ public class DefineFont4Tag extends CharacterTag {
|
||||
return fontID;
|
||||
}
|
||||
|
||||
public DefineFont4Tag(SWFInputStream sis, long pos, int length) throws IOException {
|
||||
super(sis.getSwf(), ID, "DefineFont4", pos, length);
|
||||
public DefineFont4Tag(SWFInputStream sis, ByteArrayRange data) throws IOException {
|
||||
super(sis.getSwf(), ID, "DefineFont4", data);
|
||||
fontID = sis.readUI16("fontID");
|
||||
reserved = (int) sis.readUB(5, "reserved");
|
||||
fontFlagsHasFontData = sis.readUB(1, "fontFlagsHasFontData") == 1;
|
||||
|
||||
@@ -23,6 +23,7 @@ import com.jpexs.decompiler.flash.types.ZONERECORD;
|
||||
import com.jpexs.decompiler.flash.types.annotations.Reserved;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFArray;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFType;
|
||||
import com.jpexs.helpers.ByteArrayRange;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
@@ -42,8 +43,8 @@ public class DefineFontAlignZonesTag extends Tag {
|
||||
public List<ZONERECORD> zoneTable;
|
||||
public static final int ID = 73;
|
||||
|
||||
public DefineFontAlignZonesTag(SWFInputStream sis, long pos, int length) throws IOException {
|
||||
super(sis.getSwf(), ID, "DefineFontAlignZones", pos, length);
|
||||
public DefineFontAlignZonesTag(SWFInputStream sis, ByteArrayRange data) throws IOException {
|
||||
super(sis.getSwf(), ID, "DefineFontAlignZones", data);
|
||||
fontID = sis.readUI16("fontID");
|
||||
CSMTableHint = (int) sis.readUB(2, "CSMTableHint");
|
||||
reserved = (int) sis.readUB(6, "reserved");
|
||||
|
||||
@@ -22,6 +22,7 @@ import com.jpexs.decompiler.flash.types.BasicType;
|
||||
import com.jpexs.decompiler.flash.types.LANGCODE;
|
||||
import com.jpexs.decompiler.flash.types.annotations.Reserved;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFType;
|
||||
import com.jpexs.helpers.ByteArrayRange;
|
||||
import com.jpexs.helpers.utf8.Utf8Helper;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
@@ -88,12 +89,11 @@ public class DefineFontInfo2Tag extends Tag {
|
||||
* Constructor
|
||||
*
|
||||
* @param sis
|
||||
* @param length
|
||||
* @param pos
|
||||
* @param data
|
||||
* @throws IOException
|
||||
*/
|
||||
public DefineFontInfo2Tag(SWFInputStream sis, long pos, int length) throws IOException {
|
||||
super(sis.getSwf(), ID, "DefineFontInfo2", pos, length);
|
||||
public DefineFontInfo2Tag(SWFInputStream sis, ByteArrayRange data) throws IOException {
|
||||
super(sis.getSwf(), ID, "DefineFontInfo2", data);
|
||||
fontID = sis.readUI16("fontID");
|
||||
int fontNameLen = sis.readUI8("fontNameLen");
|
||||
if (swf.version >= 6) {
|
||||
|
||||
@@ -21,6 +21,7 @@ import com.jpexs.decompiler.flash.SWFOutputStream;
|
||||
import com.jpexs.decompiler.flash.types.BasicType;
|
||||
import com.jpexs.decompiler.flash.types.annotations.Reserved;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFType;
|
||||
import com.jpexs.helpers.ByteArrayRange;
|
||||
import com.jpexs.helpers.utf8.Utf8Helper;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
@@ -89,12 +90,11 @@ public class DefineFontInfoTag extends Tag {
|
||||
* Constructor
|
||||
*
|
||||
* @param sis
|
||||
* @param length
|
||||
* @param pos
|
||||
* @param data
|
||||
* @throws IOException
|
||||
*/
|
||||
public DefineFontInfoTag(SWFInputStream sis, long pos, int length) throws IOException {
|
||||
super(sis.getSwf(), ID, "DefineFontInfo", pos, length);
|
||||
public DefineFontInfoTag(SWFInputStream sis, ByteArrayRange data) throws IOException {
|
||||
super(sis.getSwf(), ID, "DefineFontInfo", data);
|
||||
fontId = sis.readUI16("fontId");
|
||||
int fontNameLen = sis.readUI8("fontNameLen");
|
||||
if (swf.version >= 6) {
|
||||
|
||||
@@ -19,6 +19,7 @@ package com.jpexs.decompiler.flash.tags;
|
||||
import com.jpexs.decompiler.flash.SWFInputStream;
|
||||
import com.jpexs.decompiler.flash.types.BasicType;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFType;
|
||||
import com.jpexs.helpers.ByteArrayRange;
|
||||
import java.io.IOException;
|
||||
|
||||
public class DefineFontNameTag extends Tag {
|
||||
@@ -29,8 +30,8 @@ public class DefineFontNameTag extends Tag {
|
||||
public String fontCopyright;
|
||||
public static final int ID = 88;
|
||||
|
||||
public DefineFontNameTag(SWFInputStream sis, long pos, int length) throws IOException {
|
||||
super(sis.getSwf(), ID, "DefineFontName", pos, length);
|
||||
public DefineFontNameTag(SWFInputStream sis, ByteArrayRange data) throws IOException {
|
||||
super(sis.getSwf(), ID, "DefineFontName", data);
|
||||
fontId = sis.readUI16("fontId");
|
||||
fontName = sis.readString("fontName");
|
||||
fontCopyright = sis.readString("fontCopyright");
|
||||
|
||||
@@ -24,6 +24,7 @@ import com.jpexs.decompiler.flash.types.SHAPE;
|
||||
import com.jpexs.decompiler.flash.types.annotations.Internal;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFType;
|
||||
import com.jpexs.decompiler.flash.types.shaperecords.SHAPERECORD;
|
||||
import com.jpexs.helpers.ByteArrayRange;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
@@ -136,12 +137,11 @@ public class DefineFontTag extends FontTag {
|
||||
* Constructor
|
||||
*
|
||||
* @param sis
|
||||
* @param length
|
||||
* @param pos
|
||||
* @param data
|
||||
* @throws IOException
|
||||
*/
|
||||
public DefineFontTag(SWFInputStream sis, long pos, int length) throws IOException {
|
||||
super(sis.getSwf(), ID, "DefineFont", pos, length);
|
||||
public DefineFontTag(SWFInputStream sis, ByteArrayRange data) throws IOException {
|
||||
super(sis.getSwf(), ID, "DefineFont", data);
|
||||
fontId = sis.readUI16("fontId");
|
||||
int firstOffset = sis.readUI16("firstOffset");
|
||||
int nGlyphs = firstOffset / 2;
|
||||
|
||||
@@ -43,6 +43,7 @@ import com.jpexs.decompiler.flash.types.shaperecords.EndShapeRecord;
|
||||
import com.jpexs.decompiler.flash.types.shaperecords.SHAPERECORD;
|
||||
import com.jpexs.decompiler.flash.types.shaperecords.StraightEdgeRecord;
|
||||
import com.jpexs.decompiler.flash.types.shaperecords.StyleChangeRecord;
|
||||
import com.jpexs.helpers.ByteArrayRange;
|
||||
import com.jpexs.helpers.SerializableImage;
|
||||
import java.awt.Shape;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
@@ -148,12 +149,11 @@ public class DefineMorphShape2Tag extends CharacterTag implements MorphShapeTag
|
||||
* Constructor
|
||||
*
|
||||
* @param sis
|
||||
* @param length
|
||||
* @param pos
|
||||
* @param data
|
||||
* @throws IOException
|
||||
*/
|
||||
public DefineMorphShape2Tag(SWFInputStream sis, long pos, int length) throws IOException {
|
||||
super(sis.getSwf(), ID, "DefineMorphShape2", pos, length);
|
||||
public DefineMorphShape2Tag(SWFInputStream sis, ByteArrayRange data) throws IOException {
|
||||
super(sis.getSwf(), ID, "DefineMorphShape2", data);
|
||||
characterId = sis.readUI16("characterId");
|
||||
startBounds = sis.readRECT("startBounds");
|
||||
endBounds = sis.readRECT("endBounds");
|
||||
|
||||
@@ -42,6 +42,7 @@ import com.jpexs.decompiler.flash.types.shaperecords.EndShapeRecord;
|
||||
import com.jpexs.decompiler.flash.types.shaperecords.SHAPERECORD;
|
||||
import com.jpexs.decompiler.flash.types.shaperecords.StraightEdgeRecord;
|
||||
import com.jpexs.decompiler.flash.types.shaperecords.StyleChangeRecord;
|
||||
import com.jpexs.helpers.ByteArrayRange;
|
||||
import com.jpexs.helpers.SerializableImage;
|
||||
import java.awt.Shape;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
@@ -126,12 +127,11 @@ public class DefineMorphShapeTag extends CharacterTag implements MorphShapeTag {
|
||||
* Constructor
|
||||
*
|
||||
* @param sis
|
||||
* @param length
|
||||
* @param pos
|
||||
* @param data
|
||||
* @throws IOException
|
||||
*/
|
||||
public DefineMorphShapeTag(SWFInputStream sis, long pos, int length) throws IOException {
|
||||
super(sis.getSwf(), ID, "DefineMorphShape", pos, length);
|
||||
public DefineMorphShapeTag(SWFInputStream sis, ByteArrayRange data) throws IOException {
|
||||
super(sis.getSwf(), ID, "DefineMorphShape", data);
|
||||
characterId = sis.readUI16("characterId");
|
||||
startBounds = sis.readRECT("startBounds");
|
||||
endBounds = sis.readRECT("endBounds");
|
||||
|
||||
@@ -21,6 +21,7 @@ import com.jpexs.decompiler.flash.SWFOutputStream;
|
||||
import com.jpexs.decompiler.flash.types.BasicType;
|
||||
import com.jpexs.decompiler.flash.types.RECT;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFType;
|
||||
import com.jpexs.helpers.ByteArrayRange;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
@@ -35,8 +36,8 @@ public class DefineScalingGridTag extends Tag {
|
||||
public RECT splitter;
|
||||
public static final int ID = 78;
|
||||
|
||||
public DefineScalingGridTag(SWFInputStream sis, long pos, int length) throws IOException {
|
||||
super(sis.getSwf(), ID, "DefineScalingGrid", pos, length);
|
||||
public DefineScalingGridTag(SWFInputStream sis, ByteArrayRange data) throws IOException {
|
||||
super(sis.getSwf(), ID, "DefineScalingGrid", data);
|
||||
characterId = sis.readUI16("characterId");
|
||||
splitter = sis.readRECT("splitter");
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ import com.jpexs.decompiler.flash.SWFOutputStream;
|
||||
import com.jpexs.decompiler.flash.types.BasicType;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFArray;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFType;
|
||||
import com.jpexs.helpers.ByteArrayRange;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
@@ -78,12 +79,11 @@ public class DefineSceneAndFrameLabelDataTag extends Tag {
|
||||
* Constructor
|
||||
*
|
||||
* @param sis
|
||||
* @param length
|
||||
* @param pos
|
||||
* @param data
|
||||
* @throws IOException
|
||||
*/
|
||||
public DefineSceneAndFrameLabelDataTag(SWFInputStream sis, long pos, int length) throws IOException {
|
||||
super(sis.getSwf(), ID, "DefineSceneAndFrameLabelData", pos, length);
|
||||
public DefineSceneAndFrameLabelDataTag(SWFInputStream sis, ByteArrayRange data) throws IOException {
|
||||
super(sis.getSwf(), ID, "DefineSceneAndFrameLabelData", data);
|
||||
int sceneCount = (int) sis.readEncodedU32("sceneCount");
|
||||
sceneOffsets = new long[sceneCount];
|
||||
sceneNames = new String[sceneCount];
|
||||
|
||||
@@ -22,6 +22,7 @@ import com.jpexs.decompiler.flash.types.BasicType;
|
||||
import com.jpexs.decompiler.flash.types.RECT;
|
||||
import com.jpexs.decompiler.flash.types.SHAPEWITHSTYLE;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFType;
|
||||
import com.jpexs.helpers.ByteArrayRange;
|
||||
import java.io.IOException;
|
||||
import java.util.Set;
|
||||
|
||||
@@ -67,8 +68,8 @@ public class DefineShape2Tag extends ShapeTag {
|
||||
return shapeBounds;
|
||||
}
|
||||
|
||||
public DefineShape2Tag(SWFInputStream sis, long pos, int length) throws IOException {
|
||||
super(sis.getSwf(), ID, "DefineShape2", pos, length);
|
||||
public DefineShape2Tag(SWFInputStream sis, ByteArrayRange data) throws IOException {
|
||||
super(sis.getSwf(), ID, "DefineShape2", data);
|
||||
shapeId = sis.readUI16("shapeId");
|
||||
shapeBounds = sis.readRECT("shapeBounds");
|
||||
shapes = sis.readSHAPEWITHSTYLE(2, false, "shapes");
|
||||
|
||||
@@ -22,6 +22,7 @@ import com.jpexs.decompiler.flash.types.BasicType;
|
||||
import com.jpexs.decompiler.flash.types.RECT;
|
||||
import com.jpexs.decompiler.flash.types.SHAPEWITHSTYLE;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFType;
|
||||
import com.jpexs.helpers.ByteArrayRange;
|
||||
import java.io.IOException;
|
||||
import java.util.Set;
|
||||
|
||||
@@ -67,8 +68,8 @@ public class DefineShape3Tag extends ShapeTag {
|
||||
return shapeId;
|
||||
}
|
||||
|
||||
public DefineShape3Tag(SWFInputStream sis, long pos, int length) throws IOException {
|
||||
super(sis.getSwf(), ID, "DefineShape3", pos, length);
|
||||
public DefineShape3Tag(SWFInputStream sis, ByteArrayRange data) throws IOException {
|
||||
super(sis.getSwf(), ID, "DefineShape3", data);
|
||||
shapeId = sis.readUI16("shapeId");
|
||||
shapeBounds = sis.readRECT("shapeBounds");
|
||||
shapes = sis.readSHAPEWITHSTYLE(3, false, "shapes");
|
||||
|
||||
@@ -23,6 +23,7 @@ import com.jpexs.decompiler.flash.types.RECT;
|
||||
import com.jpexs.decompiler.flash.types.SHAPEWITHSTYLE;
|
||||
import com.jpexs.decompiler.flash.types.annotations.Reserved;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFType;
|
||||
import com.jpexs.helpers.ByteArrayRange;
|
||||
import java.io.IOException;
|
||||
import java.util.Set;
|
||||
|
||||
@@ -75,8 +76,8 @@ public class DefineShape4Tag extends ShapeTag {
|
||||
return shapeBounds;
|
||||
}
|
||||
|
||||
public DefineShape4Tag(SWFInputStream sis, long pos, int length) throws IOException {
|
||||
super(sis.getSwf(), ID, "DefineShape4", pos, length);
|
||||
public DefineShape4Tag(SWFInputStream sis, ByteArrayRange data) throws IOException {
|
||||
super(sis.getSwf(), ID, "DefineShape4", data);
|
||||
shapeId = sis.readUI16("shapeId");
|
||||
shapeBounds = sis.readRECT("shapeBounds");
|
||||
edgeBounds = sis.readRECT("edgeBounds");
|
||||
|
||||
@@ -23,6 +23,7 @@ import com.jpexs.decompiler.flash.types.BasicType;
|
||||
import com.jpexs.decompiler.flash.types.RECT;
|
||||
import com.jpexs.decompiler.flash.types.SHAPEWITHSTYLE;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFType;
|
||||
import com.jpexs.helpers.ByteArrayRange;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.Set;
|
||||
@@ -64,8 +65,8 @@ public class DefineShapeTag extends ShapeTag {
|
||||
return shapeBounds;
|
||||
}
|
||||
|
||||
public DefineShapeTag(SWFInputStream sis, long pos, int length) throws IOException {
|
||||
super(sis.getSwf(), ID, "DefineShape", pos, length);
|
||||
public DefineShapeTag(SWFInputStream sis, ByteArrayRange data) throws IOException {
|
||||
super(sis.getSwf(), ID, "DefineShape", data);
|
||||
shapeId = sis.readUI16("shapeId");
|
||||
shapeBounds = sis.readRECT("shapeBounds");
|
||||
shapes = sis.readSHAPEWITHSTYLE(1, false, "shapes");
|
||||
|
||||
@@ -26,6 +26,7 @@ import com.jpexs.decompiler.flash.types.annotations.SWFType;
|
||||
import com.jpexs.decompiler.flash.types.sound.MP3FRAME;
|
||||
import com.jpexs.decompiler.flash.types.sound.MP3SOUNDDATA;
|
||||
import com.jpexs.decompiler.flash.types.sound.SoundFormat;
|
||||
import com.jpexs.helpers.ByteArrayRange;
|
||||
import com.jpexs.helpers.Helper;
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
@@ -96,12 +97,11 @@ public class DefineSoundTag extends CharacterTag implements SoundTag {
|
||||
* Constructor
|
||||
*
|
||||
* @param sis
|
||||
* @param length
|
||||
* @param pos
|
||||
* @param data
|
||||
* @throws IOException
|
||||
*/
|
||||
public DefineSoundTag(SWFInputStream sis, long pos, int length) throws IOException {
|
||||
super(sis.getSwf(), ID, "DefineSound", pos, length);
|
||||
public DefineSoundTag(SWFInputStream sis, ByteArrayRange data) throws IOException {
|
||||
super(sis.getSwf(), ID, "DefineSound", data);
|
||||
soundId = sis.readUI16("soundId");
|
||||
soundFormat = (int) sis.readUB(4, "soundFormat");
|
||||
soundRate = (int) sis.readUB(2, "soundRate");
|
||||
|
||||
@@ -38,6 +38,7 @@ import com.jpexs.decompiler.flash.types.ColorTransform;
|
||||
import com.jpexs.decompiler.flash.types.MATRIX;
|
||||
import com.jpexs.decompiler.flash.types.RECT;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFType;
|
||||
import com.jpexs.helpers.ByteArrayRange;
|
||||
import com.jpexs.helpers.Cache;
|
||||
import com.jpexs.helpers.SerializableImage;
|
||||
import java.awt.Shape;
|
||||
@@ -50,7 +51,6 @@ import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
@@ -193,16 +193,15 @@ public class DefineSpriteTag extends CharacterTag implements Container, Drawable
|
||||
* Constructor
|
||||
*
|
||||
* @param sis
|
||||
* @param length
|
||||
* @param data
|
||||
* @param level
|
||||
* @param pos
|
||||
* @param parallel
|
||||
* @param skipUnusualTags
|
||||
* @throws IOException
|
||||
* @throws java.lang.InterruptedException
|
||||
*/
|
||||
public DefineSpriteTag(SWFInputStream sis, int level, long pos, int length, boolean parallel, boolean skipUnusualTags) throws IOException, InterruptedException {
|
||||
super(sis.getSwf(), ID, "DefineSprite", pos, length);
|
||||
public DefineSpriteTag(SWFInputStream sis, int level, ByteArrayRange data, boolean parallel, boolean skipUnusualTags) throws IOException, InterruptedException {
|
||||
super(sis.getSwf(), ID, "DefineSprite", data);
|
||||
spriteId = sis.readUI16("spriteId");
|
||||
frameCount = sis.readUI16("frameCount");
|
||||
List<Tag> subTags = sis.readTagList(this, level + 1, parallel, skipUnusualTags, true, swf.gfx);
|
||||
@@ -230,9 +229,7 @@ public class DefineSpriteTag extends CharacterTag implements Container, Drawable
|
||||
try {
|
||||
sos.writeUI16(spriteId);
|
||||
sos.writeUI16(frameCount);
|
||||
Map<Tag, Long> tagPositions = new HashMap<>();
|
||||
Map<Tag, Integer> tagLengths = new HashMap<>();
|
||||
sos.writeTags(subTags, tagPositions, tagLengths);
|
||||
sos.writeTags(subTags);
|
||||
if (hasEndTag) {
|
||||
sos.writeUI16(0);
|
||||
}
|
||||
|
||||
@@ -36,6 +36,7 @@ import com.jpexs.decompiler.flash.types.RECT;
|
||||
import com.jpexs.decompiler.flash.types.RGBA;
|
||||
import com.jpexs.decompiler.flash.types.TEXTRECORD;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFType;
|
||||
import com.jpexs.helpers.ByteArrayRange;
|
||||
import com.jpexs.helpers.Helper;
|
||||
import com.jpexs.helpers.SerializableImage;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
@@ -460,12 +461,11 @@ public class DefineText2Tag extends TextTag {
|
||||
* Constructor
|
||||
*
|
||||
* @param sis
|
||||
* @param length
|
||||
* @param pos
|
||||
* @param data
|
||||
* @throws IOException
|
||||
*/
|
||||
public DefineText2Tag(SWFInputStream sis, long pos, int length) throws IOException {
|
||||
super(sis.getSwf(), ID, "DefineText2", pos, length);
|
||||
public DefineText2Tag(SWFInputStream sis, ByteArrayRange data) throws IOException {
|
||||
super(sis.getSwf(), ID, "DefineText2", data);
|
||||
characterID = sis.readUI16("characterID");
|
||||
textBounds = sis.readRECT("textBounds");
|
||||
textMatrix = sis.readMatrix("textMatrix");
|
||||
|
||||
@@ -37,6 +37,7 @@ import com.jpexs.decompiler.flash.types.RECT;
|
||||
import com.jpexs.decompiler.flash.types.RGB;
|
||||
import com.jpexs.decompiler.flash.types.TEXTRECORD;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFType;
|
||||
import com.jpexs.helpers.ByteArrayRange;
|
||||
import com.jpexs.helpers.Helper;
|
||||
import com.jpexs.helpers.SerializableImage;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
@@ -425,7 +426,7 @@ public class DefineTextTag extends TextTag {
|
||||
}
|
||||
|
||||
public DefineTextTag(SWF swf, int characterID, RECT textBounds, MATRIX textMatrix, List<TEXTRECORD> textRecords) {
|
||||
super(swf, ID, "DefineText", 0, 0);
|
||||
super(swf, ID, "DefineText", null);
|
||||
this.characterID = characterID;
|
||||
this.textBounds = textBounds;
|
||||
this.textMatrix = textMatrix;
|
||||
@@ -471,12 +472,11 @@ public class DefineTextTag extends TextTag {
|
||||
* Constructor
|
||||
*
|
||||
* @param sis
|
||||
* @param length
|
||||
* @param pos
|
||||
* @param data
|
||||
* @throws IOException
|
||||
*/
|
||||
public DefineTextTag(SWFInputStream sis, long pos, int length) throws IOException {
|
||||
super(sis.getSwf(), ID, "DefineText", pos, length);
|
||||
public DefineTextTag(SWFInputStream sis, ByteArrayRange data) throws IOException {
|
||||
super(sis.getSwf(), ID, "DefineText", data);
|
||||
characterID = sis.readUI16("characterID");
|
||||
textBounds = sis.readRECT("textBounds");
|
||||
textMatrix = sis.readMatrix("textMatrix");
|
||||
|
||||
@@ -25,6 +25,7 @@ import com.jpexs.decompiler.flash.types.BasicType;
|
||||
import com.jpexs.decompiler.flash.types.RECT;
|
||||
import com.jpexs.decompiler.flash.types.annotations.Reserved;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFType;
|
||||
import com.jpexs.helpers.ByteArrayRange;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
@@ -99,12 +100,11 @@ public class DefineVideoStreamTag extends CharacterTag implements BoundedTag {
|
||||
* Constructor
|
||||
*
|
||||
* @param sis
|
||||
* @param length
|
||||
* @param pos
|
||||
* @param data
|
||||
* @throws IOException
|
||||
*/
|
||||
public DefineVideoStreamTag(SWFInputStream sis, long pos, int length) throws IOException {
|
||||
super(sis.getSwf(), ID, "DefineVideoStream", pos, length);
|
||||
public DefineVideoStreamTag(SWFInputStream sis, ByteArrayRange data) throws IOException {
|
||||
super(sis.getSwf(), ID, "DefineVideoStream", data);
|
||||
characterID = sis.readUI16("characterID");
|
||||
numFrames = sis.readUI16("numFrames");
|
||||
width = sis.readUI16("width");
|
||||
|
||||
@@ -24,6 +24,7 @@ import com.jpexs.decompiler.flash.configuration.Configuration;
|
||||
import com.jpexs.decompiler.flash.types.BasicType;
|
||||
import com.jpexs.decompiler.flash.types.annotations.Internal;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFType;
|
||||
import com.jpexs.helpers.ByteArrayRange;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
@@ -66,12 +67,11 @@ public class DoABCDefineTag extends Tag implements ABCContainerTag {
|
||||
* Constructor
|
||||
*
|
||||
* @param sis
|
||||
* @param length
|
||||
* @param pos
|
||||
* @param data
|
||||
* @throws IOException
|
||||
*/
|
||||
public DoABCDefineTag(SWFInputStream sis, long pos, int length) throws IOException {
|
||||
super(sis.getSwf(), ID, "DoABCDefine", pos, length);
|
||||
public DoABCDefineTag(SWFInputStream sis, ByteArrayRange data) throws IOException {
|
||||
super(sis.getSwf(), ID, "DoABCDefine", data);
|
||||
flags = sis.readUI32("flags");
|
||||
name = sis.readString("name");
|
||||
abc = new ABC(sis, swf, this);
|
||||
|
||||
@@ -22,6 +22,7 @@ import com.jpexs.decompiler.flash.abc.ABC;
|
||||
import com.jpexs.decompiler.flash.abc.CopyOutputStream;
|
||||
import com.jpexs.decompiler.flash.configuration.Configuration;
|
||||
import com.jpexs.decompiler.flash.types.annotations.Internal;
|
||||
import com.jpexs.helpers.ByteArrayRange;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
@@ -53,12 +54,11 @@ public class DoABCTag extends Tag implements ABCContainerTag {
|
||||
* Constructor
|
||||
*
|
||||
* @param sis
|
||||
* @param length
|
||||
* @param pos
|
||||
* @param data
|
||||
* @throws IOException
|
||||
*/
|
||||
public DoABCTag(SWFInputStream sis, long pos, int length) throws IOException {
|
||||
super(sis.getSwf(), ID, "DoABC", pos, length);
|
||||
public DoABCTag(SWFInputStream sis, ByteArrayRange data) throws IOException {
|
||||
super(sis.getSwf(), ID, "DoABC", data);
|
||||
abc = new ABC(sis, swf, this);
|
||||
}
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@ import com.jpexs.decompiler.flash.exporters.modes.ScriptExportMode;
|
||||
import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
|
||||
import com.jpexs.decompiler.flash.tags.base.ASMSource;
|
||||
import com.jpexs.decompiler.flash.types.annotations.Internal;
|
||||
import com.jpexs.helpers.ByteArrayRange;
|
||||
import com.jpexs.helpers.Helper;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
@@ -50,25 +51,23 @@ public class DoActionTag extends Tag implements ASMSource {
|
||||
* Constructor
|
||||
*
|
||||
* @param sis
|
||||
* @param length
|
||||
* @param pos
|
||||
* @param data
|
||||
* @throws java.io.IOException
|
||||
*/
|
||||
public DoActionTag(SWFInputStream sis, long pos, int length) throws IOException {
|
||||
super(sis.getSwf(), ID, "DoAction", pos, length);
|
||||
//do not load actionBytes. Disassebler will use the original SWF stream in this case
|
||||
//actionBytes = sis.readBytesEx(sis.available());
|
||||
public DoActionTag(SWFInputStream sis, ByteArrayRange data) throws IOException {
|
||||
super(sis.getSwf(), ID, "DoAction", data);
|
||||
//do not store actionBytes. Disassebler will use the original SWF stream in this case
|
||||
sis.readBytesEx(sis.available(), "actionBytes");
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param swf
|
||||
* @param length
|
||||
* @param pos
|
||||
* @param data
|
||||
*/
|
||||
public DoActionTag(SWF swf, long pos, int length) {
|
||||
super(swf, ID, "DoAction", pos, length);
|
||||
public DoActionTag(SWF swf, ByteArrayRange data) {
|
||||
super(swf, ID, "DoAction", data);
|
||||
actionBytes = new byte[0];
|
||||
}
|
||||
|
||||
@@ -95,7 +94,7 @@ public class DoActionTag extends Tag implements ASMSource {
|
||||
if (actions == null) {
|
||||
actions = getActions();
|
||||
}
|
||||
return Action.actionsToString(listeners, 0, actions, null, swf.version, exportMode, writer, getDataPos(), toString()/*FIXME?*/);
|
||||
return Action.actionsToString(listeners, 0, actions, null, swf.version, exportMode, writer, toString()/*FIXME?*/);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -125,13 +124,13 @@ public class DoActionTag extends Tag implements ASMSource {
|
||||
SWFInputStream rri;
|
||||
if (actionBytes == null) {
|
||||
prevLength = (int) getDataPos();
|
||||
rri = new SWFInputStream(swf, swf.uncompressedData);
|
||||
rri = new SWFInputStream(swf, getOriginalRange().array);
|
||||
rri.seek(prevLength);
|
||||
} else {
|
||||
prevLength = 0;
|
||||
rri = new SWFInputStream(swf, actionBytes);
|
||||
}
|
||||
List<Action> list = ActionListReader.readActionListTimeout(listeners, getDataPos() - prevLength, rri, getVersion(), prevLength, -1, toString()/*FIXME?*/);
|
||||
List<Action> list = ActionListReader.readActionListTimeout(listeners, rri, getVersion(), prevLength, -1, toString()/*FIXME?*/);
|
||||
return list;
|
||||
} catch (InterruptedException ex) {
|
||||
throw ex;
|
||||
|
||||
@@ -28,6 +28,7 @@ import com.jpexs.decompiler.flash.tags.base.CharacterIdTag;
|
||||
import com.jpexs.decompiler.flash.types.BasicType;
|
||||
import com.jpexs.decompiler.flash.types.annotations.Internal;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFType;
|
||||
import com.jpexs.helpers.ByteArrayRange;
|
||||
import com.jpexs.helpers.Helper;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
@@ -55,15 +56,14 @@ public class DoInitActionTag extends CharacterIdTag implements ASMSource {
|
||||
* Constructor
|
||||
*
|
||||
* @param sis
|
||||
* @param length
|
||||
* @param pos
|
||||
* @param data
|
||||
* @throws IOException
|
||||
*/
|
||||
public DoInitActionTag(SWFInputStream sis, long pos, int length) throws IOException {
|
||||
super(sis.getSwf(), ID, "DoInitAction", pos, length);
|
||||
public DoInitActionTag(SWFInputStream sis, ByteArrayRange data) throws IOException {
|
||||
super(sis.getSwf(), ID, "DoInitAction", data);
|
||||
spriteId = sis.readUI16("spriteId");
|
||||
//actions = sis.readActionList();
|
||||
actionBytes = sis.readBytesEx(sis.available(), "actionBytes");
|
||||
//do not store actionBytes. Disassebler will use the original SWF stream in this case
|
||||
sis.readBytesEx(sis.available(), "actionBytes");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -108,7 +108,7 @@ public class DoInitActionTag extends CharacterIdTag implements ASMSource {
|
||||
if (actions == null) {
|
||||
actions = getActions();
|
||||
}
|
||||
return Action.actionsToString(listeners, 0, actions, null, swf.version, exportMode, writer, getDataPos() + 2, toString()/*FIXME?*/);
|
||||
return Action.actionsToString(listeners, 0, actions, null, swf.version, exportMode, writer, toString()/*FIXME?*/);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -118,13 +118,13 @@ public class DoInitActionTag extends CharacterIdTag implements ASMSource {
|
||||
SWFInputStream rri;
|
||||
if (actionBytes == null) {
|
||||
prevLength = (int) (getDataPos() + 2);
|
||||
rri = new SWFInputStream(swf, swf.uncompressedData);
|
||||
rri = new SWFInputStream(swf, getOriginalRange().array);
|
||||
rri.seek(prevLength);
|
||||
} else {
|
||||
prevLength = 0;
|
||||
rri = new SWFInputStream(swf, actionBytes);
|
||||
}
|
||||
List<Action> list = ActionListReader.readActionListTimeout(listeners, getDataPos() + 2 - prevLength, rri, getVersion(), prevLength, -1, toString()/*FIXME?*/);
|
||||
List<Action> list = ActionListReader.readActionListTimeout(listeners, rri, getVersion(), prevLength, -1, toString()/*FIXME?*/);
|
||||
return list;
|
||||
} catch (InterruptedException ex) {
|
||||
throw ex;
|
||||
|
||||
@@ -21,6 +21,7 @@ import com.jpexs.decompiler.flash.SWFOutputStream;
|
||||
import com.jpexs.decompiler.flash.types.BasicType;
|
||||
import com.jpexs.decompiler.flash.types.annotations.Reserved;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFType;
|
||||
import com.jpexs.helpers.ByteArrayRange;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
@@ -64,12 +65,11 @@ public class EnableDebugger2Tag extends Tag {
|
||||
* Constructor
|
||||
*
|
||||
* @param sis
|
||||
* @param length
|
||||
* @param pos
|
||||
* @param data
|
||||
* @throws IOException
|
||||
*/
|
||||
public EnableDebugger2Tag(SWFInputStream sis, long pos, int length) throws IOException {
|
||||
super(sis.getSwf(), ID, "EnableDebugger2", pos, length);
|
||||
public EnableDebugger2Tag(SWFInputStream sis, ByteArrayRange data) throws IOException {
|
||||
super(sis.getSwf(), ID, "EnableDebugger2", data);
|
||||
reserved = sis.readUI16("reserved");
|
||||
passwordHash = sis.readString("passwordHash");
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ package com.jpexs.decompiler.flash.tags;
|
||||
|
||||
import com.jpexs.decompiler.flash.SWFInputStream;
|
||||
import com.jpexs.decompiler.flash.SWFOutputStream;
|
||||
import com.jpexs.helpers.ByteArrayRange;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
@@ -58,12 +59,11 @@ public class EnableDebuggerTag extends Tag {
|
||||
* Constructor
|
||||
*
|
||||
* @param sis
|
||||
* @param length
|
||||
* @param pos
|
||||
* @param data
|
||||
* @throws IOException
|
||||
*/
|
||||
public EnableDebuggerTag(SWFInputStream sis, long pos, int length) throws IOException {
|
||||
super(sis.getSwf(), ID, "EnableDebugger", pos, length);
|
||||
public EnableDebuggerTag(SWFInputStream sis, ByteArrayRange data) throws IOException {
|
||||
super(sis.getSwf(), ID, "EnableDebugger", data);
|
||||
passwordHash = sis.readString("passwordHash");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ import com.jpexs.decompiler.flash.types.BasicType;
|
||||
import com.jpexs.decompiler.flash.types.annotations.Optional;
|
||||
import com.jpexs.decompiler.flash.types.annotations.Reserved;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFType;
|
||||
import com.jpexs.helpers.ByteArrayRange;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
@@ -67,12 +68,11 @@ public class EnableTelemetryTag extends Tag {
|
||||
* Constructor
|
||||
*
|
||||
* @param sis
|
||||
* @param length
|
||||
* @param pos
|
||||
* @param data
|
||||
* @throws IOException
|
||||
*/
|
||||
public EnableTelemetryTag(SWFInputStream sis, long pos, int length) throws IOException {
|
||||
super(sis.getSwf(), ID, "", pos, length);
|
||||
public EnableTelemetryTag(SWFInputStream sis, ByteArrayRange data) throws IOException {
|
||||
super(sis.getSwf(), ID, "", data);
|
||||
reserved = (int) sis.readUB(16, "reserved");
|
||||
if (sis.available() > 0) {
|
||||
passwordHash = sis.readBytesEx(32, "passwordHash");
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package com.jpexs.decompiler.flash.tags;
|
||||
|
||||
import com.jpexs.decompiler.flash.SWF;
|
||||
import com.jpexs.helpers.ByteArrayRange;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
@@ -41,16 +42,15 @@ public class EndTag extends Tag {
|
||||
* Constructor
|
||||
*
|
||||
* @param swf
|
||||
* @param length
|
||||
* @param pos
|
||||
* @param data
|
||||
* @throws IOException
|
||||
*/
|
||||
public EndTag(SWF swf, long pos, int length) throws IOException {
|
||||
super(swf, ID, "End", pos, length);
|
||||
public EndTag(SWF swf, ByteArrayRange data) throws IOException {
|
||||
super(swf, ID, "End", data);
|
||||
|
||||
}
|
||||
|
||||
public EndTag(SWF swf) {
|
||||
super(swf, ID, "End", 0, 0);
|
||||
super(swf, ID, "End", null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ import com.jpexs.decompiler.flash.SWFOutputStream;
|
||||
import com.jpexs.decompiler.flash.types.BasicType;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFArray;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFType;
|
||||
import com.jpexs.helpers.ByteArrayRange;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
@@ -47,7 +48,7 @@ public class ExportAssetsTag extends Tag {
|
||||
public static final int ID = 56;
|
||||
|
||||
public ExportAssetsTag(SWF swf) {
|
||||
super(swf, ID, "ExportAssets", 0, 0);
|
||||
super(swf, ID, "ExportAssets", null);
|
||||
tags = new ArrayList<>();
|
||||
names = new ArrayList<>();
|
||||
}
|
||||
@@ -56,12 +57,11 @@ public class ExportAssetsTag extends Tag {
|
||||
* Constructor
|
||||
*
|
||||
* @param sis
|
||||
* @param length
|
||||
* @param pos
|
||||
* @param data
|
||||
* @throws IOException
|
||||
*/
|
||||
public ExportAssetsTag(SWFInputStream sis, long pos, int length) throws IOException {
|
||||
super(sis.getSwf(), ID, "ExportAssets", pos, length);
|
||||
public ExportAssetsTag(SWFInputStream sis, ByteArrayRange data) throws IOException {
|
||||
super(sis.getSwf(), ID, "ExportAssets", data);
|
||||
int count = sis.readUI16("count");
|
||||
tags = new ArrayList<>();
|
||||
names = new ArrayList<>();
|
||||
|
||||
@@ -22,6 +22,7 @@ import com.jpexs.decompiler.flash.SWFOutputStream;
|
||||
import com.jpexs.decompiler.flash.types.BasicType;
|
||||
import com.jpexs.decompiler.flash.types.annotations.Reserved;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFType;
|
||||
import com.jpexs.helpers.ByteArrayRange;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
@@ -45,11 +46,11 @@ public class FileAttributesTag extends Tag {
|
||||
public static final int ID = 69;
|
||||
|
||||
public FileAttributesTag(SWF swf) {
|
||||
super(swf, ID, "FileAttributes", 0, 0);
|
||||
super(swf, ID, "FileAttributes", null);
|
||||
}
|
||||
|
||||
public FileAttributesTag(SWFInputStream sis, long pos, int length) throws IOException {
|
||||
super(sis.getSwf(), ID, "FileAttributes", pos, length);
|
||||
public FileAttributesTag(SWFInputStream sis, ByteArrayRange data) throws IOException {
|
||||
super(sis.getSwf(), ID, "FileAttributes", data);
|
||||
reserved1 = sis.readUB(1, "reserved1") == 1; // reserved
|
||||
// UB[1] == 0 (reserved)
|
||||
useDirectBlit = sis.readUB(1, "useDirectBlit") != 0;
|
||||
|
||||
@@ -18,6 +18,7 @@ package com.jpexs.decompiler.flash.tags;
|
||||
|
||||
import com.jpexs.decompiler.flash.SWFInputStream;
|
||||
import com.jpexs.decompiler.flash.SWFOutputStream;
|
||||
import com.jpexs.helpers.ByteArrayRange;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
@@ -36,8 +37,8 @@ public class FrameLabelTag extends Tag {
|
||||
return namedAnchor;
|
||||
}
|
||||
|
||||
public FrameLabelTag(SWFInputStream sis, long pos, int length) throws IOException {
|
||||
super(sis.getSwf(), ID, "FrameLabel", pos, length);
|
||||
public FrameLabelTag(SWFInputStream sis, ByteArrayRange data) throws IOException {
|
||||
super(sis.getSwf(), ID, "FrameLabel", data);
|
||||
name = sis.readString("name");
|
||||
if (sis.available() > 0) {
|
||||
if (sis.readUI8("namedAnchor") == 1) {
|
||||
|
||||
@@ -23,6 +23,7 @@ import com.jpexs.decompiler.flash.types.BasicType;
|
||||
import com.jpexs.decompiler.flash.types.annotations.Reserved;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFArray;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFType;
|
||||
import com.jpexs.helpers.ByteArrayRange;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
@@ -59,12 +60,11 @@ public class ImportAssets2Tag extends Tag implements ImportTag {
|
||||
* Constructor
|
||||
*
|
||||
* @param sis
|
||||
* @param length
|
||||
* @param pos
|
||||
* @param data
|
||||
* @throws IOException
|
||||
*/
|
||||
public ImportAssets2Tag(SWFInputStream sis, long pos, int length) throws IOException {
|
||||
super(sis.getSwf(), ID, "ImportAssets2", pos, length);
|
||||
public ImportAssets2Tag(SWFInputStream sis, ByteArrayRange data) throws IOException {
|
||||
super(sis.getSwf(), ID, "ImportAssets2", data);
|
||||
tags = new ArrayList<>();
|
||||
names = new ArrayList<>();
|
||||
url = sis.readString("url");
|
||||
|
||||
@@ -22,6 +22,7 @@ import com.jpexs.decompiler.flash.tags.base.ImportTag;
|
||||
import com.jpexs.decompiler.flash.types.BasicType;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFArray;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFType;
|
||||
import com.jpexs.helpers.ByteArrayRange;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
@@ -52,12 +53,11 @@ public class ImportAssetsTag extends Tag implements ImportTag {
|
||||
* Constructor
|
||||
*
|
||||
* @param sis
|
||||
* @param length
|
||||
* @param pos
|
||||
* @param data
|
||||
* @throws IOException
|
||||
*/
|
||||
public ImportAssetsTag(SWFInputStream sis, long pos, int length) throws IOException {
|
||||
super(sis.getSwf(), ID, "ImportAssets", pos, length);
|
||||
public ImportAssetsTag(SWFInputStream sis, ByteArrayRange data) throws IOException {
|
||||
super(sis.getSwf(), ID, "ImportAssets", data);
|
||||
tags = new ArrayList<>();
|
||||
names = new ArrayList<>();
|
||||
url = sis.readString("url");
|
||||
|
||||
@@ -18,6 +18,7 @@ package com.jpexs.decompiler.flash.tags;
|
||||
|
||||
import com.jpexs.decompiler.flash.SWFInputStream;
|
||||
import com.jpexs.decompiler.flash.types.annotations.Internal;
|
||||
import com.jpexs.helpers.ByteArrayRange;
|
||||
import java.io.IOException;
|
||||
|
||||
public class JPEGTablesTag extends Tag {
|
||||
@@ -26,8 +27,8 @@ public class JPEGTablesTag extends Tag {
|
||||
@Internal
|
||||
public byte[] jpegData;
|
||||
|
||||
public JPEGTablesTag(SWFInputStream sis, long pos, int length) throws IOException {
|
||||
super(sis.getSwf(), ID, "JPEGTables", pos, length);
|
||||
public JPEGTablesTag(SWFInputStream sis, ByteArrayRange data) throws IOException {
|
||||
super(sis.getSwf(), ID, "JPEGTables", data);
|
||||
jpegData = sis.readBytesEx(sis.available(), "jpegData");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ package com.jpexs.decompiler.flash.tags;
|
||||
import com.jpexs.decompiler.flash.SWFInputStream;
|
||||
import com.jpexs.decompiler.flash.SWFOutputStream;
|
||||
import com.jpexs.decompiler.flash.types.annotations.Multiline;
|
||||
import com.jpexs.helpers.ByteArrayRange;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
@@ -29,8 +30,8 @@ public class MetadataTag extends Tag {
|
||||
public String xmlMetadata;
|
||||
public static final int ID = 77;
|
||||
|
||||
public MetadataTag(SWFInputStream sis, long pos, int length) {
|
||||
super(sis.getSwf(), ID, "Metadata", pos, length);
|
||||
public MetadataTag(SWFInputStream sis, ByteArrayRange data) {
|
||||
super(sis.getSwf(), ID, "Metadata", data);
|
||||
try {
|
||||
xmlMetadata = sis.readString("xmlMetadata");
|
||||
} catch (IOException ex) {
|
||||
|
||||
@@ -35,6 +35,7 @@ import com.jpexs.decompiler.flash.types.annotations.Conditional;
|
||||
import com.jpexs.decompiler.flash.types.annotations.Internal;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFType;
|
||||
import com.jpexs.decompiler.flash.types.filters.FILTER;
|
||||
import com.jpexs.helpers.ByteArrayRange;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
@@ -191,7 +192,7 @@ public class PlaceObject2Tag extends CharacterIdTag implements Container, PlaceO
|
||||
}
|
||||
|
||||
public PlaceObject2Tag(SWF swf, boolean placeFlagHasClipActions, boolean placeFlagHasClipDepth, boolean placeFlagHasName, boolean placeFlagHasRatio, boolean placeFlagHasColorTransform, boolean placeFlagHasMatrix, boolean placeFlagHasCharacter, boolean placeFlagMove, int depth, int characterId, MATRIX matrix, CXFORMWITHALPHA colorTransform, int ratio, String name, int clipDepth, CLIPACTIONS clipActions) {
|
||||
super(swf, ID, "PlaceObject2", 0, 0);
|
||||
super(swf, ID, "PlaceObject2", null);
|
||||
this.placeFlagHasClipActions = placeFlagHasClipActions;
|
||||
this.placeFlagHasClipDepth = placeFlagHasClipDepth;
|
||||
this.placeFlagHasName = placeFlagHasName;
|
||||
@@ -214,12 +215,11 @@ public class PlaceObject2Tag extends CharacterIdTag implements Container, PlaceO
|
||||
* Constructor
|
||||
*
|
||||
* @param sis
|
||||
* @param length
|
||||
* @param pos
|
||||
* @param data
|
||||
* @throws IOException
|
||||
*/
|
||||
public PlaceObject2Tag(SWFInputStream sis, long pos, int length) throws IOException {
|
||||
super(sis.getSwf(), ID, "PlaceObject2", pos, length);
|
||||
public PlaceObject2Tag(SWFInputStream sis, ByteArrayRange data) throws IOException {
|
||||
super(sis.getSwf(), ID, "PlaceObject2", data);
|
||||
placeFlagHasClipActions = sis.readUB(1, "placeFlagHasClipActions") == 1;
|
||||
placeFlagHasClipDepth = sis.readUB(1, "placeFlagHasClipDepth") == 1;
|
||||
placeFlagHasName = sis.readUB(1, "placeFlagHasName") == 1;
|
||||
|
||||
@@ -36,6 +36,7 @@ import com.jpexs.decompiler.flash.types.annotations.Internal;
|
||||
import com.jpexs.decompiler.flash.types.annotations.Reserved;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFType;
|
||||
import com.jpexs.decompiler.flash.types.filters.FILTER;
|
||||
import com.jpexs.helpers.ByteArrayRange;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
@@ -298,12 +299,11 @@ public class PlaceObject3Tag extends CharacterIdTag implements Container, PlaceO
|
||||
* Constructor
|
||||
*
|
||||
* @param sis
|
||||
* @param length
|
||||
* @param pos
|
||||
* @param data
|
||||
* @throws IOException
|
||||
*/
|
||||
public PlaceObject3Tag(SWFInputStream sis, long pos, int length) throws IOException {
|
||||
super(sis.getSwf(), ID, "PlaceObject3", pos, length);
|
||||
public PlaceObject3Tag(SWFInputStream sis, ByteArrayRange data) throws IOException {
|
||||
super(sis.getSwf(), ID, "PlaceObject3", data);
|
||||
placeFlagHasClipActions = sis.readUB(1, "placeFlagHasClipActions") == 1;
|
||||
placeFlagHasClipDepth = sis.readUB(1, "placeFlagHasClipDepth") == 1;
|
||||
placeFlagHasName = sis.readUB(1, "placeFlagHasName") == 1;
|
||||
|
||||
@@ -36,6 +36,7 @@ import com.jpexs.decompiler.flash.types.annotations.Internal;
|
||||
import com.jpexs.decompiler.flash.types.annotations.Reserved;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFType;
|
||||
import com.jpexs.decompiler.flash.types.filters.FILTER;
|
||||
import com.jpexs.helpers.ByteArrayRange;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
@@ -299,12 +300,11 @@ public class PlaceObject4Tag extends CharacterIdTag implements Container, PlaceO
|
||||
* Constructor
|
||||
*
|
||||
* @param sis
|
||||
* @param length
|
||||
* @param pos
|
||||
* @param data
|
||||
* @throws IOException
|
||||
*/
|
||||
public PlaceObject4Tag(SWFInputStream sis, long pos, int length) throws IOException {
|
||||
super(sis.getSwf(), ID, "PlaceObject4", pos, length);
|
||||
public PlaceObject4Tag(SWFInputStream sis, ByteArrayRange data) throws IOException {
|
||||
super(sis.getSwf(), ID, "PlaceObject4", data);
|
||||
placeFlagHasClipActions = sis.readUB(1, "placeFlagHasClipActions") == 1;
|
||||
placeFlagHasClipDepth = sis.readUB(1, "placeFlagHasClipDepth") == 1;
|
||||
placeFlagHasName = sis.readUB(1, "placeFlagHasName") == 1;
|
||||
|
||||
@@ -30,6 +30,7 @@ import com.jpexs.decompiler.flash.types.RGBA;
|
||||
import com.jpexs.decompiler.flash.types.annotations.Optional;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFType;
|
||||
import com.jpexs.decompiler.flash.types.filters.FILTER;
|
||||
import com.jpexs.helpers.ByteArrayRange;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
@@ -100,12 +101,11 @@ public class PlaceObjectTag extends CharacterIdTag implements PlaceObjectTypeTag
|
||||
* Constructor
|
||||
*
|
||||
* @param sis
|
||||
* @param length
|
||||
* @param pos
|
||||
* @param data
|
||||
* @throws IOException
|
||||
*/
|
||||
public PlaceObjectTag(SWFInputStream sis, long pos, int length) throws IOException {
|
||||
super(sis.getSwf(), ID, "PlaceObject", pos, length);
|
||||
public PlaceObjectTag(SWFInputStream sis, ByteArrayRange data) throws IOException {
|
||||
super(sis.getSwf(), ID, "PlaceObject", data);
|
||||
characterId = sis.readUI16("characterId");
|
||||
depth = sis.readUI16("depth");
|
||||
matrix = sis.readMatrix("matrix");
|
||||
@@ -115,7 +115,7 @@ public class PlaceObjectTag extends CharacterIdTag implements PlaceObjectTypeTag
|
||||
}
|
||||
|
||||
public PlaceObjectTag(SWF swf, int characterId, int depth, MATRIX matrix, CXFORM colorTransform) {
|
||||
super(swf, ID, "PlaceObject", 0, 0);
|
||||
super(swf, ID, "PlaceObject", null);
|
||||
this.characterId = characterId;
|
||||
this.depth = depth;
|
||||
this.matrix = matrix;
|
||||
|
||||
@@ -20,6 +20,7 @@ import com.jpexs.decompiler.flash.SWFInputStream;
|
||||
import com.jpexs.decompiler.flash.SWFOutputStream;
|
||||
import com.jpexs.decompiler.flash.types.BasicType;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFType;
|
||||
import com.jpexs.helpers.ByteArrayRange;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
@@ -44,8 +45,8 @@ public class ProductInfoTag extends Tag {
|
||||
public long compilationDateHigh;
|
||||
public static final int ID = 41;
|
||||
|
||||
public ProductInfoTag(SWFInputStream sis, long pos, int length) throws IOException {
|
||||
super(sis.getSwf(), ID, "ProductInfo", pos, length);
|
||||
public ProductInfoTag(SWFInputStream sis, ByteArrayRange data) throws IOException {
|
||||
super(sis.getSwf(), ID, "ProductInfo", data);
|
||||
/*
|
||||
* 0: Unknown
|
||||
* 1: Macromedia Flex for J2EE
|
||||
|
||||
@@ -18,6 +18,7 @@ package com.jpexs.decompiler.flash.tags;
|
||||
|
||||
import com.jpexs.decompiler.flash.SWFInputStream;
|
||||
import com.jpexs.decompiler.flash.SWFOutputStream;
|
||||
import com.jpexs.helpers.ByteArrayRange;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
@@ -58,12 +59,11 @@ public class ProtectTag extends Tag {
|
||||
* Constructor
|
||||
*
|
||||
* @param sis
|
||||
* @param length
|
||||
* @param pos
|
||||
* @param data
|
||||
* @throws IOException
|
||||
*/
|
||||
public ProtectTag(SWFInputStream sis, long pos, int length) throws IOException {
|
||||
super(sis.getSwf(), ID, "Protect", pos, length);
|
||||
public ProtectTag(SWFInputStream sis, ByteArrayRange data) throws IOException {
|
||||
super(sis.getSwf(), ID, "Protect", data);
|
||||
if (sis.available() > 0) {
|
||||
passwordHash = sis.readString("passwordHash");
|
||||
} else {
|
||||
|
||||
@@ -20,6 +20,7 @@ import com.jpexs.decompiler.flash.SWFInputStream;
|
||||
import com.jpexs.decompiler.flash.tags.base.RemoveTag;
|
||||
import com.jpexs.decompiler.flash.types.BasicType;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFType;
|
||||
import com.jpexs.helpers.ByteArrayRange;
|
||||
import java.io.IOException;
|
||||
|
||||
public class RemoveObject2Tag extends Tag implements RemoveTag {
|
||||
@@ -28,8 +29,8 @@ public class RemoveObject2Tag extends Tag implements RemoveTag {
|
||||
public int depth;
|
||||
public static final int ID = 28;
|
||||
|
||||
public RemoveObject2Tag(SWFInputStream sis, long pos, int length) throws IOException {
|
||||
super(sis.getSwf(), ID, "RemoveObject2", pos, length);
|
||||
public RemoveObject2Tag(SWFInputStream sis, ByteArrayRange data) throws IOException {
|
||||
super(sis.getSwf(), ID, "RemoveObject2", data);
|
||||
depth = sis.readUI16("depth");
|
||||
}
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ import com.jpexs.decompiler.flash.tags.base.CharacterIdTag;
|
||||
import com.jpexs.decompiler.flash.tags.base.RemoveTag;
|
||||
import com.jpexs.decompiler.flash.types.BasicType;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFType;
|
||||
import com.jpexs.helpers.ByteArrayRange;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
@@ -67,12 +68,11 @@ public class RemoveObjectTag extends CharacterIdTag implements RemoveTag {
|
||||
* Constructor
|
||||
*
|
||||
* @param sis
|
||||
* @param length
|
||||
* @param pos
|
||||
* @param data
|
||||
* @throws IOException
|
||||
*/
|
||||
public RemoveObjectTag(SWFInputStream sis, long pos, int length) throws IOException {
|
||||
super(sis.getSwf(), ID, "RemoveObject", pos, length);
|
||||
public RemoveObjectTag(SWFInputStream sis, ByteArrayRange data) throws IOException {
|
||||
super(sis.getSwf(), ID, "RemoveObject", data);
|
||||
characterId = sis.readUI16("characterId");
|
||||
depth = sis.readUI16("depth");
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ import com.jpexs.decompiler.flash.SWFInputStream;
|
||||
import com.jpexs.decompiler.flash.SWFOutputStream;
|
||||
import com.jpexs.decompiler.flash.types.BasicType;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFType;
|
||||
import com.jpexs.helpers.ByteArrayRange;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
@@ -34,8 +35,8 @@ public class ScriptLimitsTag extends Tag {
|
||||
|
||||
public static final int ID = 65;
|
||||
|
||||
public ScriptLimitsTag(SWFInputStream sis, long pos, int length) throws IOException {
|
||||
super(sis.getSwf(), ID, "ScriptLimits", pos, length);
|
||||
public ScriptLimitsTag(SWFInputStream sis, ByteArrayRange data) throws IOException {
|
||||
super(sis.getSwf(), ID, "ScriptLimits", data);
|
||||
maxRecursionDepth = sis.readUI16("maxRecursionDepth");
|
||||
scriptTimeoutSeconds = sis.readUI16("scriptTimeoutSeconds");
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ import com.jpexs.decompiler.flash.SWF;
|
||||
import com.jpexs.decompiler.flash.SWFInputStream;
|
||||
import com.jpexs.decompiler.flash.SWFOutputStream;
|
||||
import com.jpexs.decompiler.flash.types.RGB;
|
||||
import com.jpexs.helpers.ByteArrayRange;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
@@ -28,13 +29,13 @@ public class SetBackgroundColorTag extends Tag {
|
||||
public RGB backgroundColor;
|
||||
public static final int ID = 9;
|
||||
|
||||
public SetBackgroundColorTag(SWFInputStream sis, long pos, int length) throws IOException {
|
||||
super(sis.getSwf(), ID, "SetBackgroundColor", pos, length);
|
||||
public SetBackgroundColorTag(SWFInputStream sis, ByteArrayRange data) throws IOException {
|
||||
super(sis.getSwf(), ID, "SetBackgroundColor", data);
|
||||
backgroundColor = sis.readRGB("backgroundColor");
|
||||
}
|
||||
|
||||
public SetBackgroundColorTag(SWF swf, RGB backgroundColor) {
|
||||
super(swf, ID, "SetBackgroundColor", 0, 0);
|
||||
super(swf, ID, "SetBackgroundColor", null);
|
||||
this.backgroundColor = backgroundColor;
|
||||
}
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ import com.jpexs.decompiler.flash.SWFInputStream;
|
||||
import com.jpexs.decompiler.flash.SWFOutputStream;
|
||||
import com.jpexs.decompiler.flash.types.BasicType;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFType;
|
||||
import com.jpexs.helpers.ByteArrayRange;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
@@ -65,12 +66,11 @@ public class SetTabIndexTag extends Tag {
|
||||
* Constructor
|
||||
*
|
||||
* @param sis
|
||||
* @param length
|
||||
* @param pos
|
||||
* @param data
|
||||
* @throws IOException
|
||||
*/
|
||||
public SetTabIndexTag(SWFInputStream sis, long pos, int length) throws IOException {
|
||||
super(sis.getSwf(), ID, "SetTabIndex", pos, length);
|
||||
public SetTabIndexTag(SWFInputStream sis, ByteArrayRange data) throws IOException {
|
||||
super(sis.getSwf(), ID, "SetTabIndex", data);
|
||||
depth = sis.readUI16("depth");
|
||||
tabIndex = sis.readUI16("tabIndex");
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package com.jpexs.decompiler.flash.tags;
|
||||
|
||||
import com.jpexs.decompiler.flash.SWF;
|
||||
import com.jpexs.helpers.ByteArrayRange;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -51,15 +52,14 @@ public class ShowFrameTag extends Tag {
|
||||
* Constructor
|
||||
*
|
||||
* @param swf
|
||||
* @param length
|
||||
* @param pos
|
||||
* @param data
|
||||
*/
|
||||
public ShowFrameTag(SWF swf, long pos, int length) {
|
||||
super(swf, ID, "ShowFrame", pos, length);
|
||||
public ShowFrameTag(SWF swf, ByteArrayRange data) {
|
||||
super(swf, ID, "ShowFrame", data);
|
||||
}
|
||||
|
||||
public ShowFrameTag(SWF swf) {
|
||||
super(swf, ID, "ShowFrame", 0, 0);
|
||||
super(swf, ID, "ShowFrame", null);
|
||||
}
|
||||
|
||||
public static boolean isNestedTagType(int tagTypeId) {
|
||||
|
||||
@@ -18,6 +18,7 @@ package com.jpexs.decompiler.flash.tags;
|
||||
|
||||
import com.jpexs.decompiler.flash.SWFInputStream;
|
||||
import com.jpexs.decompiler.flash.types.annotations.Internal;
|
||||
import com.jpexs.helpers.ByteArrayRange;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
@@ -36,12 +37,11 @@ public class SoundStreamBlockTag extends Tag {
|
||||
* Constructor
|
||||
*
|
||||
* @param sis
|
||||
* @param length
|
||||
* @param pos
|
||||
* @param data
|
||||
* @throws IOException
|
||||
*/
|
||||
public SoundStreamBlockTag(SWFInputStream sis, long pos, int length) throws IOException {
|
||||
super(sis.getSwf(), ID, "SoundStreamBlock", pos, length);
|
||||
public SoundStreamBlockTag(SWFInputStream sis, ByteArrayRange data) throws IOException {
|
||||
super(sis.getSwf(), ID, "SoundStreamBlock", data);
|
||||
//all data is streamSoundData
|
||||
streamSoundData = sis.readBytesEx(sis.available(), "streamSoundData");
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ import com.jpexs.decompiler.flash.types.annotations.Internal;
|
||||
import com.jpexs.decompiler.flash.types.annotations.Reserved;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFType;
|
||||
import com.jpexs.decompiler.flash.types.sound.SoundFormat;
|
||||
import com.jpexs.helpers.ByteArrayRange;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
@@ -137,12 +138,11 @@ public class SoundStreamHead2Tag extends CharacterIdTag implements SoundStreamHe
|
||||
* Constructor
|
||||
*
|
||||
* @param sis
|
||||
* @param length
|
||||
* @param pos
|
||||
* @param data
|
||||
* @throws IOException
|
||||
*/
|
||||
public SoundStreamHead2Tag(SWFInputStream sis, long pos, int length) throws IOException {
|
||||
super(sis.getSwf(), ID, "SoundStreamHead2", pos, length);
|
||||
public SoundStreamHead2Tag(SWFInputStream sis, ByteArrayRange data) throws IOException {
|
||||
super(sis.getSwf(), ID, "SoundStreamHead2", data);
|
||||
reserved = (int) sis.readUB(4, "reserved");
|
||||
playBackSoundRate = (int) sis.readUB(2, "playBackSoundRate");
|
||||
playBackSoundSize = sis.readUB(1, "playBackSoundSize") == 1;
|
||||
|
||||
@@ -28,6 +28,7 @@ import com.jpexs.decompiler.flash.types.annotations.Internal;
|
||||
import com.jpexs.decompiler.flash.types.annotations.Reserved;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFType;
|
||||
import com.jpexs.decompiler.flash.types.sound.SoundFormat;
|
||||
import com.jpexs.helpers.ByteArrayRange;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
@@ -130,12 +131,11 @@ public class SoundStreamHeadTag extends CharacterIdTag implements SoundStreamHea
|
||||
* Constructor
|
||||
*
|
||||
* @param sis
|
||||
* @param length
|
||||
* @param pos
|
||||
* @param data
|
||||
* @throws IOException
|
||||
*/
|
||||
public SoundStreamHeadTag(SWFInputStream sis, long pos, int length) throws IOException {
|
||||
super(sis.getSwf(), ID, "SoundStreamHead", pos, length);
|
||||
public SoundStreamHeadTag(SWFInputStream sis, ByteArrayRange data) throws IOException {
|
||||
super(sis.getSwf(), ID, "SoundStreamHead", data);
|
||||
reserved = (int) sis.readUB(4, "reserved");
|
||||
playBackSoundRate = (int) sis.readUB(2, "playBackSoundRate");
|
||||
playBackSoundSize = sis.readUB(1, "playBackSoundSize") == 1;
|
||||
|
||||
@@ -19,6 +19,7 @@ package com.jpexs.decompiler.flash.tags;
|
||||
import com.jpexs.decompiler.flash.SWFInputStream;
|
||||
import com.jpexs.decompiler.flash.SWFOutputStream;
|
||||
import com.jpexs.decompiler.flash.types.SOUNDINFO;
|
||||
import com.jpexs.helpers.ByteArrayRange;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
@@ -55,12 +56,11 @@ public class StartSound2Tag extends Tag {
|
||||
* Constructor
|
||||
*
|
||||
* @param sis
|
||||
* @param length
|
||||
* @param pos
|
||||
* @param data
|
||||
* @throws IOException
|
||||
*/
|
||||
public StartSound2Tag(SWFInputStream sis, long pos, int length) throws IOException {
|
||||
super(sis.getSwf(), ID, "StartSound2", pos, length);
|
||||
public StartSound2Tag(SWFInputStream sis, ByteArrayRange data) throws IOException {
|
||||
super(sis.getSwf(), ID, "StartSound2", data);
|
||||
soundClassName = sis.readString("soundClassName");
|
||||
soundInfo = sis.readSOUNDINFO("soundInfo");
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ import com.jpexs.decompiler.flash.SWFOutputStream;
|
||||
import com.jpexs.decompiler.flash.types.BasicType;
|
||||
import com.jpexs.decompiler.flash.types.SOUNDINFO;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFType;
|
||||
import com.jpexs.helpers.ByteArrayRange;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
@@ -59,12 +60,11 @@ public class StartSoundTag extends Tag {
|
||||
* Constructor
|
||||
*
|
||||
* @param sis
|
||||
* @param length
|
||||
* @param pos
|
||||
* @param data
|
||||
* @throws IOException
|
||||
*/
|
||||
public StartSoundTag(SWFInputStream sis, long pos, int length) throws IOException {
|
||||
super(sis.getSwf(), ID, "StartSound", pos, length);
|
||||
public StartSoundTag(SWFInputStream sis, ByteArrayRange data) throws IOException {
|
||||
super(sis.getSwf(), ID, "StartSound", data);
|
||||
soundId = sis.readUI16("soundId");
|
||||
soundInfo = sis.readSOUNDINFO("soundInfo");
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ import com.jpexs.decompiler.flash.SWFOutputStream;
|
||||
import com.jpexs.decompiler.flash.types.BasicType;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFArray;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFType;
|
||||
import com.jpexs.helpers.ByteArrayRange;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
@@ -34,8 +35,8 @@ public class SymbolClassTag extends Tag {
|
||||
public String[] names;
|
||||
public static final int ID = 76;
|
||||
|
||||
public SymbolClassTag(SWFInputStream sis, long pos, int length) throws IOException {
|
||||
super(sis.getSwf(), ID, "SymbolClass", pos, length);
|
||||
public SymbolClassTag(SWFInputStream sis, ByteArrayRange data) throws IOException {
|
||||
super(sis.getSwf(), ID, "SymbolClass", data);
|
||||
int numSymbols = sis.readUI16("numSymbols");
|
||||
tags = new int[numSymbols];
|
||||
names = new String[numSymbols];
|
||||
|
||||
@@ -33,6 +33,7 @@ import com.jpexs.decompiler.flash.tags.gfx.ExporterInfoTag;
|
||||
import com.jpexs.decompiler.flash.tags.gfx.FontTextureInfo;
|
||||
import com.jpexs.decompiler.flash.timeline.Timelined;
|
||||
import com.jpexs.decompiler.flash.types.annotations.Internal;
|
||||
import com.jpexs.helpers.ByteArrayRange;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
@@ -56,16 +57,6 @@ public abstract class Tag implements NeedsCharacters, Exportable, ContainerItem,
|
||||
*/
|
||||
@Internal
|
||||
public boolean forceWriteAsLong = false;
|
||||
/**
|
||||
* Original position in the SWF file
|
||||
*/
|
||||
@Internal
|
||||
private final long pos;
|
||||
/**
|
||||
* Original tag length
|
||||
*/
|
||||
@Internal
|
||||
private final int length;
|
||||
protected String tagName;
|
||||
@Internal
|
||||
protected transient SWF swf;
|
||||
@@ -73,6 +64,11 @@ public abstract class Tag implements NeedsCharacters, Exportable, ContainerItem,
|
||||
protected transient Timelined timelined;
|
||||
@Internal
|
||||
private boolean modified;
|
||||
/**
|
||||
* Original tag data
|
||||
*/
|
||||
@Internal
|
||||
private final ByteArrayRange originalData;
|
||||
|
||||
public String getTagName() {
|
||||
return tagName;
|
||||
@@ -119,19 +115,17 @@ public abstract class Tag implements NeedsCharacters, Exportable, ContainerItem,
|
||||
* @param swf The SWF
|
||||
* @param id Tag type identifier
|
||||
* @param name Tag name
|
||||
* @param pos Original position in the SWF file
|
||||
* @param length Original tag length
|
||||
* @param data Original tag data
|
||||
*/
|
||||
public Tag(SWF swf, int id, String name, long pos, int length) {
|
||||
public Tag(SWF swf, int id, String name, ByteArrayRange data) {
|
||||
this.id = id;
|
||||
this.tagName = name;
|
||||
this.pos = pos;
|
||||
this.length = length;
|
||||
this.originalData = data;
|
||||
this.swf = swf;
|
||||
if (swf == null) {
|
||||
throw new Error("swf parameter cannot be null.");
|
||||
}
|
||||
if (pos == 0) { // it is tag build by constructor
|
||||
if (data == null) { // it is tag build by constructor
|
||||
modified = true;
|
||||
}
|
||||
}
|
||||
@@ -336,7 +330,7 @@ public abstract class Tag implements NeedsCharacters, Exportable, ContainerItem,
|
||||
sos.write(newHeaderData);
|
||||
sos.write(newData);
|
||||
} else {
|
||||
sos.write(swf.uncompressedData, (int) pos, length);
|
||||
sos.write(originalData.array, originalData.pos, originalData.length);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -359,24 +353,24 @@ public abstract class Tag implements NeedsCharacters, Exportable, ContainerItem,
|
||||
return getOriginalData();
|
||||
}
|
||||
|
||||
public final int getOriginalLength() {
|
||||
return length;
|
||||
public final ByteArrayRange getOriginalRange() {
|
||||
return originalData;
|
||||
}
|
||||
|
||||
public final byte[] getOriginalData() {
|
||||
// todo honfika: do not copy data
|
||||
int dataLength = getOriginalDataLength();
|
||||
byte[] data = new byte[dataLength];
|
||||
System.arraycopy(swf.uncompressedData, (int) (pos + length - dataLength), data, 0, dataLength);
|
||||
System.arraycopy(originalData.array, (int) (originalData.pos + originalData.length - dataLength), data, 0, dataLength);
|
||||
return data;
|
||||
}
|
||||
|
||||
public final int getOriginalDataLength() {
|
||||
return length - (isLongOriginal() ? 6 : 2);
|
||||
return originalData.length - (isLongOriginal() ? 6 : 2);
|
||||
}
|
||||
|
||||
public final boolean isLongOriginal() {
|
||||
int shortLength = swf.uncompressedData[(int) pos] & 0x003F;
|
||||
private final boolean isLongOriginal() {
|
||||
int shortLength = originalData.array[(int) originalData.pos] & 0x003F;
|
||||
return shortLength == 0x3f;
|
||||
}
|
||||
|
||||
@@ -389,11 +383,11 @@ public abstract class Tag implements NeedsCharacters, Exportable, ContainerItem,
|
||||
}
|
||||
|
||||
public long getPos() {
|
||||
return pos;
|
||||
return originalData.pos;
|
||||
}
|
||||
|
||||
public long getDataPos() {
|
||||
return pos + (isLongOriginal() ? 6 : 2);
|
||||
return originalData.pos + (isLongOriginal() ? 6 : 2);
|
||||
}
|
||||
|
||||
public void setModified(boolean value) {
|
||||
|
||||
@@ -18,6 +18,7 @@ package com.jpexs.decompiler.flash.tags;
|
||||
|
||||
import com.jpexs.decompiler.flash.SWF;
|
||||
import com.jpexs.decompiler.flash.SWFInputStream;
|
||||
import com.jpexs.helpers.ByteArrayRange;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -33,13 +34,12 @@ public class TagStub extends Tag {
|
||||
*
|
||||
* @param swf
|
||||
* @param id
|
||||
* @param length
|
||||
* @param data
|
||||
* @param name
|
||||
* @param pos
|
||||
* @param sis
|
||||
*/
|
||||
public TagStub(SWF swf, int id, String name, long pos, int length, SWFInputStream sis) {
|
||||
super(swf, id, name, pos, length);
|
||||
public TagStub(SWF swf, int id, String name, ByteArrayRange data, SWFInputStream sis) {
|
||||
super(swf, id, name, data);
|
||||
dataStream = sis;
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package com.jpexs.decompiler.flash.tags;
|
||||
|
||||
import com.jpexs.decompiler.flash.SWF;
|
||||
import com.jpexs.helpers.ByteArrayRange;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -24,8 +25,8 @@ import com.jpexs.decompiler.flash.SWF;
|
||||
*/
|
||||
public class UnknownTag extends Tag {
|
||||
|
||||
public UnknownTag(SWF swf, int id, long pos, int length) {
|
||||
super(swf, id, "Unknown", pos, length);
|
||||
public UnknownTag(SWF swf, int id, ByteArrayRange data) {
|
||||
super(swf, id, "Unknown", data);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -20,6 +20,7 @@ import com.jpexs.decompiler.flash.SWFInputStream;
|
||||
import com.jpexs.decompiler.flash.SWFOutputStream;
|
||||
import com.jpexs.decompiler.flash.types.BasicType;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFType;
|
||||
import com.jpexs.helpers.ByteArrayRange;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
@@ -61,12 +62,11 @@ public class VideoFrameTag extends Tag {
|
||||
* Constructor
|
||||
*
|
||||
* @param sis
|
||||
* @param length
|
||||
* @param pos
|
||||
* @param data
|
||||
* @throws IOException
|
||||
*/
|
||||
public VideoFrameTag(SWFInputStream sis, long pos, int length) throws IOException {
|
||||
super(sis.getSwf(), ID, "VideoFrame", pos, length);
|
||||
public VideoFrameTag(SWFInputStream sis, ByteArrayRange data) throws IOException {
|
||||
super(sis.getSwf(), ID, "VideoFrame", data);
|
||||
streamID = sis.readUI16("streamID");
|
||||
frameNum = sis.readUI16("frameNum");
|
||||
videoData = sis.readBytesEx(sis.available(), "videoData"); //TODO: Parse video packets
|
||||
|
||||
@@ -72,8 +72,6 @@ public interface ASMSource extends TreeItem {
|
||||
|
||||
public GraphTextWriter getActionBytesAsHex(GraphTextWriter writer);
|
||||
|
||||
public long getPos();
|
||||
|
||||
public void addDisassemblyListener(DisassemblyListener listener);
|
||||
|
||||
public void removeDisassemblyListener(DisassemblyListener listener);
|
||||
|
||||
@@ -25,6 +25,7 @@ import com.jpexs.decompiler.flash.timeline.DepthState;
|
||||
import com.jpexs.decompiler.flash.timeline.Timelined;
|
||||
import com.jpexs.decompiler.flash.types.BUTTONRECORD;
|
||||
import com.jpexs.decompiler.flash.types.ColorTransform;
|
||||
import com.jpexs.helpers.ByteArrayRange;
|
||||
import com.jpexs.helpers.SerializableImage;
|
||||
import java.awt.Shape;
|
||||
import java.io.IOException;
|
||||
@@ -42,8 +43,8 @@ public abstract class ButtonTag extends CharacterTag implements DrawableTag, Tim
|
||||
public static int FRAME_DOWN = 2;
|
||||
public static int FRAME_HITTEST = 3;
|
||||
|
||||
public ButtonTag(SWF swf, int id, String name, long pos, int length) {
|
||||
super(swf, id, name, pos, length);
|
||||
public ButtonTag(SWF swf, int id, String name, ByteArrayRange data) {
|
||||
super(swf, id, name, data);
|
||||
}
|
||||
|
||||
public abstract List<BUTTONRECORD> getRecords();
|
||||
|
||||
@@ -20,6 +20,7 @@ import com.jpexs.decompiler.flash.SWF;
|
||||
import com.jpexs.decompiler.flash.tags.ExportAssetsTag;
|
||||
import com.jpexs.decompiler.flash.tags.Tag;
|
||||
import com.jpexs.decompiler.flash.types.annotations.Internal;
|
||||
import com.jpexs.helpers.ByteArrayRange;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -29,8 +30,8 @@ import java.util.List;
|
||||
*/
|
||||
public abstract class CharacterIdTag extends Tag {
|
||||
|
||||
public CharacterIdTag(SWF swf, int id, String name, long pos, int length) {
|
||||
super(swf, id, name, pos, length);
|
||||
public CharacterIdTag(SWF swf, int id, String name, ByteArrayRange data) {
|
||||
super(swf, id, name, data);
|
||||
}
|
||||
|
||||
public abstract int getCharacterId();
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package com.jpexs.decompiler.flash.tags.base;
|
||||
|
||||
import com.jpexs.decompiler.flash.SWF;
|
||||
import com.jpexs.helpers.ByteArrayRange;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -24,7 +25,7 @@ import com.jpexs.decompiler.flash.SWF;
|
||||
*/
|
||||
public abstract class CharacterTag extends CharacterIdTag {
|
||||
|
||||
public CharacterTag(SWF swf, int id, String name, long pos, int length) {
|
||||
super(swf, id, name, pos, length);
|
||||
public CharacterTag(SWF swf, int id, String name, ByteArrayRange data) {
|
||||
super(swf, id, name, data);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,6 +33,7 @@ import com.jpexs.decompiler.flash.types.RECT;
|
||||
import com.jpexs.decompiler.flash.types.SHAPE;
|
||||
import com.jpexs.decompiler.flash.types.TEXTRECORD;
|
||||
import com.jpexs.decompiler.flash.types.shaperecords.SHAPERECORD;
|
||||
import com.jpexs.helpers.ByteArrayRange;
|
||||
import com.jpexs.helpers.SerializableImage;
|
||||
import java.awt.Color;
|
||||
import java.awt.Font;
|
||||
@@ -55,8 +56,8 @@ public abstract class FontTag extends CharacterTag implements AloneTag, Drawable
|
||||
|
||||
protected final int previewSize = 500;
|
||||
|
||||
public FontTag(SWF swf, int id, String name, long pos, int length) {
|
||||
super(swf, id, name, pos, length);
|
||||
public FontTag(SWF swf, int id, String name, ByteArrayRange data) {
|
||||
super(swf, id, name, data);
|
||||
}
|
||||
|
||||
public abstract int getFontId();
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package com.jpexs.decompiler.flash.tags.base;
|
||||
|
||||
import com.jpexs.decompiler.flash.SWF;
|
||||
import com.jpexs.helpers.ByteArrayRange;
|
||||
import com.jpexs.helpers.SerializableImage;
|
||||
import java.awt.Color;
|
||||
import java.io.IOException;
|
||||
@@ -28,8 +29,8 @@ import java.io.InputStream;
|
||||
*/
|
||||
public abstract class ImageTag extends CharacterTag {
|
||||
|
||||
public ImageTag(SWF swf, int id, String name, long pos, int length) {
|
||||
super(swf, id, name, pos, length);
|
||||
public ImageTag(SWF swf, int id, String name, ByteArrayRange data) {
|
||||
super(swf, id, name, data);
|
||||
}
|
||||
|
||||
public abstract InputStream getImageData();
|
||||
|
||||
@@ -25,6 +25,7 @@ import com.jpexs.decompiler.flash.exporters.shape.SVGShapeExporter;
|
||||
import com.jpexs.decompiler.flash.timeline.DepthState;
|
||||
import com.jpexs.decompiler.flash.types.ColorTransform;
|
||||
import com.jpexs.decompiler.flash.types.SHAPEWITHSTYLE;
|
||||
import com.jpexs.helpers.ByteArrayRange;
|
||||
import com.jpexs.helpers.SerializableImage;
|
||||
import java.awt.Shape;
|
||||
import java.io.IOException;
|
||||
@@ -36,8 +37,8 @@ import java.util.Set;
|
||||
*/
|
||||
public abstract class ShapeTag extends CharacterTag implements BoundedTag, DrawableTag {
|
||||
|
||||
public ShapeTag(SWF swf, int id, String name, long pos, int length) {
|
||||
super(swf, id, name, pos, length);
|
||||
public ShapeTag(SWF swf, int id, String name, ByteArrayRange data) {
|
||||
super(swf, id, name, data);
|
||||
}
|
||||
|
||||
public abstract SHAPEWITHSTYLE getShapes();
|
||||
|
||||
@@ -44,6 +44,7 @@ import com.jpexs.decompiler.flash.types.shaperecords.EndShapeRecord;
|
||||
import com.jpexs.decompiler.flash.types.shaperecords.SHAPERECORD;
|
||||
import com.jpexs.decompiler.flash.types.shaperecords.StraightEdgeRecord;
|
||||
import com.jpexs.decompiler.flash.types.shaperecords.StyleChangeRecord;
|
||||
import com.jpexs.helpers.ByteArrayRange;
|
||||
import com.jpexs.helpers.Helper;
|
||||
import com.jpexs.helpers.SerializableImage;
|
||||
import java.awt.Color;
|
||||
@@ -67,8 +68,8 @@ import org.w3c.dom.Element;
|
||||
*/
|
||||
public abstract class TextTag extends CharacterTag implements BoundedTag, DrawableTag {
|
||||
|
||||
public TextTag(SWF swf, int id, String name, long pos, int length) {
|
||||
super(swf, id, name, pos, length);
|
||||
public TextTag(SWF swf, int id, String name, ByteArrayRange data) {
|
||||
super(swf, id, name, data);
|
||||
}
|
||||
|
||||
public abstract MATRIX getTextMatrix();
|
||||
|
||||
@@ -37,6 +37,7 @@ import com.jpexs.decompiler.flash.types.shaperecords.CurvedEdgeRecord;
|
||||
import com.jpexs.decompiler.flash.types.shaperecords.SHAPERECORD;
|
||||
import com.jpexs.decompiler.flash.types.shaperecords.StraightEdgeRecord;
|
||||
import com.jpexs.decompiler.flash.types.shaperecords.StyleChangeRecord;
|
||||
import com.jpexs.helpers.ByteArrayRange;
|
||||
import com.jpexs.helpers.Helper;
|
||||
import java.awt.Font;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
@@ -84,12 +85,11 @@ public final class DefineCompactedFont extends FontTag implements DrawableTag {
|
||||
* Constructor
|
||||
*
|
||||
* @param sis
|
||||
* @param length
|
||||
* @param pos
|
||||
* @param data
|
||||
* @throws IOException
|
||||
*/
|
||||
public DefineCompactedFont(SWFInputStream sis, long pos, int length) throws IOException {
|
||||
super(sis.getSwf(), ID, "DefineCompactedFont", pos, length);
|
||||
public DefineCompactedFont(SWFInputStream sis, ByteArrayRange data) throws IOException {
|
||||
super(sis.getSwf(), ID, "DefineCompactedFont", data);
|
||||
|
||||
fontId = sis.readUI16("fontId");
|
||||
fonts = new ArrayList<>();
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user