mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-09-25 07:20:46 +00:00
button and clip actions fixed
This commit is contained in:
@@ -2264,6 +2264,7 @@ public class SWFInputStream implements AutoCloseable {
|
||||
if (!ret.buttonHasBlendMode && !ret.buttonHasFilterList
|
||||
&& !ret.buttonStateHitTest && !ret.buttonStateDown
|
||||
&& !ret.buttonStateOver && !ret.buttonStateUp && ret.reserved == 0) {
|
||||
endDumpLevel();
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -695,7 +695,7 @@ public class SWFOutputStream extends OutputStream {
|
||||
if (value.eventFlags.clipEventKeyPress) {
|
||||
sos.writeUI8(value.keyCode);
|
||||
}
|
||||
sos.write(value.actionBytes);
|
||||
sos.write(value.actionBytes.getRangeData());
|
||||
}
|
||||
byte[] data = baos.toByteArray();
|
||||
writeUI32(data.length); //actionRecordSize
|
||||
@@ -1037,7 +1037,7 @@ public class SWFOutputStream extends OutputStream {
|
||||
sos.writeUB(1, value.condIdleToOverUp ? 1 : 0);
|
||||
sos.writeUB(7, value.condKeyPress);
|
||||
sos.writeUB(1, value.condOverDownToIdle ? 1 : 0);
|
||||
sos.write(value.actionBytes);
|
||||
sos.write(value.actionBytes.getRangeData());
|
||||
}
|
||||
byte[] data = baos.toByteArray();
|
||||
if (isLast) {
|
||||
|
||||
@@ -31,6 +31,7 @@ import com.jpexs.decompiler.flash.tags.base.Exportable;
|
||||
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 java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
@@ -71,11 +72,14 @@ public class BUTTONCONDACTION implements ASMSource, Exportable, ContainerItem, S
|
||||
condIdleToOverUp = sis.readUB(1, "condIdleToOverUp") == 1;
|
||||
condKeyPress = (int) sis.readUB(7, "condKeyPress");
|
||||
condOverDownToIdle = sis.readUB(1, "condOverDownToIdle") == 1;
|
||||
int actionBytesPos = (int) sis.getPos();
|
||||
byte[] bytes;
|
||||
if (condActionSize <= 0) {
|
||||
actionBytes = sis.readBytesEx(sis.available(), "actionBytes");
|
||||
bytes = sis.readBytesEx(sis.available(), "actionBytes");
|
||||
} else {
|
||||
actionBytes = sis.readBytesEx(condActionSize - 4, "actionBytes");
|
||||
bytes = sis.readBytesEx(condActionSize - 4, "actionBytes");
|
||||
}
|
||||
actionBytes = new ByteArrayRange(swf.uncompressedData, actionBytesPos, bytes.length);
|
||||
}
|
||||
/**
|
||||
* Is this BUTTONCONDACTION last in the list?
|
||||
@@ -132,7 +136,7 @@ public class BUTTONCONDACTION implements ASMSource, Exportable, ContainerItem, S
|
||||
* Actions to perform in byte array
|
||||
*/
|
||||
@Internal
|
||||
public byte[] actionBytes;
|
||||
public ByteArrayRange actionBytes;
|
||||
|
||||
/**
|
||||
* Sets actions associated with this object
|
||||
@@ -188,7 +192,12 @@ public class BUTTONCONDACTION implements ASMSource, Exportable, ContainerItem, S
|
||||
@Override
|
||||
public ActionList getActions() throws InterruptedException {
|
||||
try {
|
||||
ActionList list = ActionListReader.readActionListTimeout(listeners, new SWFInputStream(swf, actionBytes), swf.version, 0, -1, toString()/*FIXME?*/);
|
||||
int prevLength = actionBytes.pos;
|
||||
SWFInputStream rri = new SWFInputStream(swf, actionBytes.array);
|
||||
if (prevLength != 0) {
|
||||
rri.seek(prevLength);
|
||||
}
|
||||
ActionList list = ActionListReader.readActionListTimeout(listeners, rri, swf.version, prevLength, prevLength + actionBytes.length, toString()/*FIXME?*/);
|
||||
return list;
|
||||
|
||||
} catch (InterruptedException ex) {
|
||||
@@ -201,17 +210,18 @@ public class BUTTONCONDACTION implements ASMSource, Exportable, ContainerItem, S
|
||||
|
||||
@Override
|
||||
public void setActions(List<Action> actions) {
|
||||
actionBytes = Action.actionsToBytes(actions, true, swf.version);
|
||||
byte[] bytes = Action.actionsToBytes(actions, true, swf.version);
|
||||
actionBytes = new ByteArrayRange(bytes, 0, bytes.length);
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] getActionBytes() {
|
||||
return actionBytes;
|
||||
return actionBytes.getRangeData();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setActionBytes(byte[] actionBytes) {
|
||||
this.actionBytes = actionBytes;
|
||||
this.actionBytes = new ByteArrayRange(actionBytes);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -223,7 +233,7 @@ public class BUTTONCONDACTION implements ASMSource, Exportable, ContainerItem, S
|
||||
|
||||
@Override
|
||||
public GraphTextWriter getActionBytesAsHex(GraphTextWriter writer) {
|
||||
return Helper.byteArrayToHexWithHeader(writer, actionBytes);
|
||||
return Helper.byteArrayToHexWithHeader(writer, actionBytes.getRangeData());
|
||||
}
|
||||
|
||||
List<DisassemblyListener> listeners = new ArrayList<>();
|
||||
|
||||
@@ -30,6 +30,7 @@ import com.jpexs.decompiler.flash.tags.base.ContainerItem;
|
||||
import com.jpexs.decompiler.flash.tags.base.Exportable;
|
||||
import com.jpexs.decompiler.flash.types.annotations.Conditional;
|
||||
import com.jpexs.decompiler.flash.types.annotations.Internal;
|
||||
import com.jpexs.helpers.ByteArrayRange;
|
||||
import com.jpexs.helpers.Helper;
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
@@ -94,16 +95,13 @@ public class CLIPACTIONRECORD implements ASMSource, Exportable, ContainerItem, S
|
||||
private final Tag tag;
|
||||
@Internal
|
||||
private long pos;
|
||||
@Internal
|
||||
private long hdrPos;
|
||||
|
||||
//Constructor for Generic tag editor. TODO:Handle this somehow better
|
||||
public CLIPACTIONRECORD() {
|
||||
swf = null;
|
||||
tag = null;
|
||||
eventFlags = new CLIPEVENTFLAGS();
|
||||
actionBytes = new byte[0];
|
||||
hdrPos = 0;
|
||||
actionBytes = new ByteArrayRange(new byte[0]);
|
||||
}
|
||||
|
||||
public CLIPACTIONRECORD(SWF swf, SWFInputStream sis, long pos, Tag tag) throws IOException {
|
||||
@@ -118,8 +116,9 @@ public class CLIPACTIONRECORD implements ASMSource, Exportable, ContainerItem, S
|
||||
keyCode = sis.readUI8("keyCode");
|
||||
actionRecordSize--;
|
||||
}
|
||||
hdrPos = sis.getPos();
|
||||
actionBytes = sis.readBytesEx(actionRecordSize, "actionBytes");
|
||||
int actionBytesPos = (int) sis.getPos();
|
||||
byte[] bytes = sis.readBytesEx(actionRecordSize, "actionBytes");
|
||||
actionBytes = new ByteArrayRange(swf.uncompressedData, actionBytesPos, bytes.length);
|
||||
this.pos = pos;
|
||||
}
|
||||
|
||||
@@ -142,7 +141,7 @@ public class CLIPACTIONRECORD implements ASMSource, Exportable, ContainerItem, S
|
||||
*/
|
||||
//public List<Action> actions;
|
||||
@Internal
|
||||
public byte[] actionBytes;
|
||||
public ByteArrayRange actionBytes;
|
||||
|
||||
/**
|
||||
* Returns a string representation of the object
|
||||
@@ -198,7 +197,12 @@ public class CLIPACTIONRECORD implements ASMSource, Exportable, ContainerItem, S
|
||||
@Override
|
||||
public ActionList getActions() throws InterruptedException {
|
||||
try {
|
||||
ActionList list = ActionListReader.readActionListTimeout(listeners, new SWFInputStream(swf, actionBytes), swf.version, 0, -1, toString()/*FIXME?*/);
|
||||
int prevLength = actionBytes.pos;
|
||||
SWFInputStream rri = new SWFInputStream(swf, actionBytes.array);
|
||||
if (prevLength != 0) {
|
||||
rri.seek(prevLength);
|
||||
}
|
||||
ActionList list = ActionListReader.readActionListTimeout(listeners, rri, swf.version, prevLength, prevLength + actionBytes.length, toString()/*FIXME?*/);
|
||||
return list;
|
||||
} catch (InterruptedException ex) {
|
||||
throw ex;
|
||||
@@ -210,17 +214,18 @@ public class CLIPACTIONRECORD implements ASMSource, Exportable, ContainerItem, S
|
||||
|
||||
@Override
|
||||
public void setActions(List<Action> actions) {
|
||||
actionBytes = Action.actionsToBytes(actions, true, swf.version);
|
||||
byte[] bytes = Action.actionsToBytes(actions, true, swf.version);
|
||||
actionBytes = new ByteArrayRange(bytes, 0, bytes.length);
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] getActionBytes() {
|
||||
return actionBytes;
|
||||
return actionBytes.getRangeData();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setActionBytes(byte[] actionBytes) {
|
||||
this.actionBytes = actionBytes;
|
||||
this.actionBytes = new ByteArrayRange(actionBytes);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -232,7 +237,7 @@ public class CLIPACTIONRECORD implements ASMSource, Exportable, ContainerItem, S
|
||||
|
||||
@Override
|
||||
public GraphTextWriter getActionBytesAsHex(GraphTextWriter writer) {
|
||||
return Helper.byteArrayToHexWithHeader(writer, actionBytes);
|
||||
return Helper.byteArrayToHexWithHeader(writer, actionBytes.getRangeData());
|
||||
}
|
||||
|
||||
List<DisassemblyListener> listeners = new ArrayList<>();
|
||||
|
||||
Reference in New Issue
Block a user