mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-09-27 22:10:45 +00:00
do not copy big byte arrays 2...define binary tags
This commit is contained in:
@@ -738,7 +738,7 @@ public class SWFOutputStream extends OutputStream {
|
||||
if (value.eventFlags.clipEventKeyPress) {
|
||||
sos.writeUI8(value.keyCode);
|
||||
}
|
||||
sos.write(value.actionBytes.getRangeData());
|
||||
sos.write(value.actionBytes);
|
||||
}
|
||||
byte[] data = baos.toByteArray();
|
||||
writeUI32(data.length); //actionRecordSize
|
||||
@@ -1080,7 +1080,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.getRangeData());
|
||||
sos.write(value.actionBytes);
|
||||
}
|
||||
byte[] data = baos.toByteArray();
|
||||
if (isLast) {
|
||||
|
||||
@@ -12,7 +12,8 @@
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library.␍ */
|
||||
* License along with this library.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.exporters;
|
||||
|
||||
import com.jpexs.decompiler.flash.AbortRetryIgnoreHandler;
|
||||
@@ -55,7 +56,7 @@ public class BinaryDataExporter {
|
||||
@Override
|
||||
public void run() throws IOException {
|
||||
try (FileOutputStream fos = new FileOutputStream(file)) {
|
||||
fos.write(((DefineBinaryDataTag) t).binaryData);
|
||||
fos.write(((DefineBinaryDataTag) t).binaryData.getRangeData());
|
||||
}
|
||||
}
|
||||
}, handler).run();
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package com.jpexs.decompiler.flash.importers;
|
||||
|
||||
import com.jpexs.decompiler.flash.tags.DefineBinaryDataTag;
|
||||
import com.jpexs.helpers.ByteArrayRange;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -25,7 +26,7 @@ import com.jpexs.decompiler.flash.tags.DefineBinaryDataTag;
|
||||
public class BinaryDataImporter extends TagImporter {
|
||||
|
||||
public void importData(DefineBinaryDataTag binaryDataTag, byte[] newData) {
|
||||
binaryDataTag.binaryData = newData;
|
||||
binaryDataTag.binaryData = new ByteArrayRange(newData);
|
||||
binaryDataTag.setModified(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ public class DefineBinaryDataTag extends CharacterTag {
|
||||
@SWFType(BasicType.UI16)
|
||||
public int tag;
|
||||
|
||||
public byte[] binaryData;
|
||||
public ByteArrayRange binaryData;
|
||||
|
||||
@Reserved
|
||||
@SWFType(BasicType.UI32)
|
||||
@@ -77,18 +77,18 @@ public class DefineBinaryDataTag extends CharacterTag {
|
||||
public DefineBinaryDataTag(SWF swf) {
|
||||
super(swf, ID, "DefineBinaryData", null);
|
||||
tag = swf.getNextCharacterId();
|
||||
binaryData = new byte[0];
|
||||
binaryData = ByteArrayRange.EMPTY;
|
||||
}
|
||||
|
||||
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");
|
||||
binaryData = sis.readByteRangeEx(sis.available(), "binaryData");
|
||||
|
||||
if (Configuration.autoLoadEmbeddedSwfs.get()) {
|
||||
try {
|
||||
SWF bswf = new SWF(new ByteArrayInputStream(binaryData), Configuration.parallelSpeedUp.get());
|
||||
SWF bswf = new SWF(new ByteArrayInputStream(binaryData.getArray(), binaryData.getPos(), binaryData.getLength()), Configuration.parallelSpeedUp.get());
|
||||
bswf.fileTitle = "(SWF Data)";
|
||||
innerSwf = bswf;
|
||||
bswf.binaryData = this;
|
||||
@@ -105,8 +105,8 @@ public class DefineBinaryDataTag extends CharacterTag {
|
||||
|
||||
public boolean isSwfData() {
|
||||
try {
|
||||
if (binaryData.length > 8) {
|
||||
String signature = new String(binaryData, 0, 3, Utf8Helper.charset);
|
||||
if (binaryData.getLength() > 8) {
|
||||
String signature = new String(binaryData.getRangeData(0, 3), Utf8Helper.charset);
|
||||
if (Arrays.asList(
|
||||
"FWS", //Uncompressed Flash
|
||||
"CWS", //ZLib compressed Flash
|
||||
|
||||
Reference in New Issue
Block a user