mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-06-05 15:55:10 +00:00
Added Show button records in the tree, preview them
This commit is contained in:
@@ -202,6 +202,7 @@ import com.jpexs.decompiler.flash.tags.Tag;
|
||||
import com.jpexs.decompiler.flash.tags.TagStub;
|
||||
import com.jpexs.decompiler.flash.tags.UnknownTag;
|
||||
import com.jpexs.decompiler.flash.tags.VideoFrameTag;
|
||||
import com.jpexs.decompiler.flash.tags.base.ButtonTag;
|
||||
import com.jpexs.decompiler.flash.tags.gfx.DefineCompactedFont;
|
||||
import com.jpexs.decompiler.flash.tags.gfx.DefineExternalGradient;
|
||||
import com.jpexs.decompiler.flash.tags.gfx.DefineExternalImage;
|
||||
@@ -2457,17 +2458,17 @@ public class SWFInputStream implements AutoCloseable {
|
||||
/**
|
||||
* Reads list of BUTTONRECORD values from the stream
|
||||
*
|
||||
* @param inDefineButton2 Whether read from inside of DefineButton2Tag or
|
||||
* not
|
||||
* @param swf
|
||||
* @param buttonTag
|
||||
* @param name
|
||||
* @return List of BUTTONRECORD values
|
||||
* @throws IOException
|
||||
*/
|
||||
public List<BUTTONRECORD> readBUTTONRECORDList(boolean inDefineButton2, String name) throws IOException {
|
||||
public List<BUTTONRECORD> readBUTTONRECORDList(SWF swf, ButtonTag buttonTag, String name) throws IOException {
|
||||
List<BUTTONRECORD> ret = new ArrayList<>();
|
||||
newDumpLevel(name, "BUTTONRECORDList");
|
||||
BUTTONRECORD br;
|
||||
while ((br = readBUTTONRECORD(inDefineButton2, "record")) != null) {
|
||||
while ((br = readBUTTONRECORD(swf, buttonTag, "record")) != null) {
|
||||
ret.add(br);
|
||||
}
|
||||
endDumpLevel();
|
||||
@@ -2477,13 +2478,14 @@ public class SWFInputStream implements AutoCloseable {
|
||||
/**
|
||||
* Reads one BUTTONRECORD value from the stream
|
||||
*
|
||||
* @param inDefineButton2 True when in DefineButton2
|
||||
* @param swf
|
||||
* @param tag
|
||||
* @param name
|
||||
* @return BUTTONRECORD value
|
||||
* @throws IOException
|
||||
*/
|
||||
public BUTTONRECORD readBUTTONRECORD(boolean inDefineButton2, String name) throws IOException {
|
||||
BUTTONRECORD ret = new BUTTONRECORD();
|
||||
public BUTTONRECORD readBUTTONRECORD(SWF swf, ButtonTag tag, String name) throws IOException {
|
||||
BUTTONRECORD ret = new BUTTONRECORD(swf, tag);
|
||||
newDumpLevel(name, "BUTTONRECORD");
|
||||
ret.reserved = (int) readUB(2, "reserved");
|
||||
ret.buttonHasBlendMode = readUB(1, "buttonHasBlendMode") == 1;
|
||||
@@ -2503,7 +2505,7 @@ public class SWFInputStream implements AutoCloseable {
|
||||
ret.characterId = readUI16("characterId");
|
||||
ret.placeDepth = readUI16("placeDepth");
|
||||
ret.placeMatrix = readMatrix("placeMatrix");
|
||||
if (inDefineButton2) {
|
||||
if (tag instanceof DefineButton2Tag) {
|
||||
ret.colorTransform = readCXFORMWITHALPHA("colorTransform");
|
||||
if (ret.buttonHasFilterList) {
|
||||
ret.filterList = readFILTERLIST("filterList");
|
||||
|
||||
@@ -109,7 +109,7 @@ public class DefineButton2Tag extends ButtonTag implements ASMSourceContainer {
|
||||
reserved = (int) sis.readUB(7, "reserved");
|
||||
trackAsMenu = sis.readUB(1, "trackAsMenu") == 1;
|
||||
int actionOffset = sis.readUI16("actionOffset");
|
||||
characters = sis.readBUTTONRECORDList(true, "characters");
|
||||
characters = sis.readBUTTONRECORDList(swf, this, "characters");
|
||||
if (actionOffset > 0) {
|
||||
actions = sis.readBUTTONCONDACTIONList(swf, this, "actions");
|
||||
}
|
||||
|
||||
@@ -101,7 +101,7 @@ public class DefineButtonTag extends ButtonTag implements ASMSourceContainer {
|
||||
@Override
|
||||
public final void readData(SWFInputStream sis, ByteArrayRange data, int level, boolean parallel, boolean skipUnusualTags, boolean lazy) throws IOException {
|
||||
buttonId = sis.readUI16("buttonId");
|
||||
characters = sis.readBUTTONRECORDList(false, "characters");
|
||||
characters = sis.readBUTTONRECORDList(swf, this, "characters");
|
||||
actionBytes = sis.readByteRangeEx(sis.available(), "actionBytes", DumpInfoSpecialType.ACTION_BYTES, sis.getPos());
|
||||
}
|
||||
|
||||
|
||||
@@ -16,8 +16,13 @@
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.types;
|
||||
|
||||
import com.jpexs.decompiler.flash.SWF;
|
||||
import com.jpexs.decompiler.flash.tags.DefineButton2Tag;
|
||||
import com.jpexs.decompiler.flash.tags.Tag;
|
||||
import com.jpexs.decompiler.flash.tags.base.ButtonTag;
|
||||
import com.jpexs.decompiler.flash.treeitems.TreeItem;
|
||||
import com.jpexs.decompiler.flash.types.annotations.Conditional;
|
||||
import com.jpexs.decompiler.flash.types.annotations.Internal;
|
||||
import com.jpexs.decompiler.flash.types.annotations.Reserved;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFArray;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFType;
|
||||
@@ -30,7 +35,7 @@ import java.util.List;
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class BUTTONRECORD implements Serializable {
|
||||
public class BUTTONRECORD implements Serializable, TreeItem {
|
||||
|
||||
@Reserved
|
||||
@SWFType(value = BasicType.UB, count = 2)
|
||||
@@ -104,8 +109,47 @@ public class BUTTONRECORD implements Serializable {
|
||||
@Conditional(value = {"buttonHasBlendMode"}, tags = {DefineButton2Tag.ID})
|
||||
public int blendMode;
|
||||
|
||||
@Internal
|
||||
private SWF swf;
|
||||
|
||||
@Internal
|
||||
private ButtonTag tag;
|
||||
|
||||
public BUTTONRECORD(SWF swf, ButtonTag tag) {
|
||||
this.swf = swf;
|
||||
this.tag = tag;
|
||||
}
|
||||
|
||||
public BUTTONRECORD() {
|
||||
swf = null;
|
||||
tag = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "[BUTTONRECORD character:" + characterId + ", depth:" + placeDepth + ", state:" + ((buttonStateDown ? "down " : "") + (buttonStateHitTest ? "hit " : "") + (buttonStateOver ? "over " : "") + (buttonStateUp ? "up " : "")) + "]";
|
||||
return "BUTTONRECORD (" + characterId + ") Depth:" + placeDepth + " State:" + ((buttonStateDown ? "down " : "") + (buttonStateHitTest ? "hit " : "") + (buttonStateOver ? "over " : "") + (buttonStateUp ? "up " : ""));
|
||||
}
|
||||
|
||||
@Override
|
||||
public SWF getSwf() {
|
||||
return swf;
|
||||
}
|
||||
|
||||
public void setModified() {
|
||||
if (tag != null) {
|
||||
tag.setModified(true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isModified() {
|
||||
if (tag != null) {
|
||||
return tag.isModified();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public ButtonTag getTag() {
|
||||
return tag;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user