mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-06-27 07:16:29 +00:00
Autoload binaryData when packer used
This commit is contained in:
committed by
Jindra Petřík
parent
efaf57e4a8
commit
eaabfcd278
@@ -1533,6 +1533,9 @@ public final class SWF implements SWFContainerItem, Timelined, Openable {
|
||||
}
|
||||
assignExportNamesToSymbols();
|
||||
assignClassesToSymbols();
|
||||
if (Configuration.autoLoadEmbeddedSwfs.get()) {
|
||||
loadAllEmbeddedSwfs();
|
||||
}
|
||||
SWFDecompilerPlugin.fireSwfParsed(this);
|
||||
} else {
|
||||
boolean hasNonUnknownTag = false;
|
||||
@@ -1560,6 +1563,16 @@ public final class SWF implements SWFContainerItem, Timelined, Openable {
|
||||
getASMs(true); // Add scriptNames to ASMs
|
||||
}
|
||||
|
||||
private void loadAllEmbeddedSwfs()
|
||||
{
|
||||
for (Tag t : getTags()) {
|
||||
if (t instanceof DefineBinaryDataTag) {
|
||||
DefineBinaryDataTag binaryData = (DefineBinaryDataTag) t;
|
||||
binaryData.loadEmbeddedSwf();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void resolveImported(UrlResolver resolver) {
|
||||
for (int p = 0; p < tags.size(); p++) {
|
||||
Tag t = tags.get(p);
|
||||
@@ -2472,7 +2485,7 @@ public final class SWF implements SWFContainerItem, Timelined, Openable {
|
||||
val >>= 8;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void createWavFromPcmData(OutputStream fos, int soundRateHz, boolean soundSize, boolean soundType, byte[] data) throws IOException {
|
||||
ByteArrayOutputStream subChunk1Data = new ByteArrayOutputStream();
|
||||
int audioFormat = 1; // PCM
|
||||
|
||||
@@ -88,30 +88,31 @@ public class DefineBinaryDataTag extends CharacterTag {
|
||||
public final void readData(SWFInputStream sis, ByteArrayRange data, int level, boolean parallel, boolean skipUnusualTags, boolean lazy) throws IOException {
|
||||
tag = sis.readUI16("tag");
|
||||
reserved = sis.readUI32("reserved");
|
||||
binaryData = sis.readByteRangeEx(sis.available(), "binaryData");
|
||||
binaryData = sis.readByteRangeEx(sis.available(), "binaryData");
|
||||
}
|
||||
|
||||
public void loadEmbeddedSwf()
|
||||
{
|
||||
String path = getSwf().getShortPathTitle() + "/DefineBinaryData (" + getCharacterId() + ")";
|
||||
SwfSpecificCustomConfiguration conf = Configuration.getSwfSpecificCustomConfiguration(path);
|
||||
String charset = conf == null ? Charset.defaultCharset().name() : conf.getCustomData(CustomConfigurationKeys.KEY_CHARSET, Charset.defaultCharset().name());
|
||||
|
||||
if (Configuration.autoLoadEmbeddedSwfs.get()) {
|
||||
String path = getSwf().getShortPathTitle() + "/DefineBinaryData (" + getCharacterId() + ")";
|
||||
SwfSpecificCustomConfiguration conf = Configuration.getSwfSpecificCustomConfiguration(path);
|
||||
String charset = conf == null ? Charset.defaultCharset().name() : conf.getCustomData(CustomConfigurationKeys.KEY_CHARSET, Charset.defaultCharset().name());
|
||||
|
||||
try {
|
||||
InputStream is = new ByteArrayInputStream(binaryData.getArray(), binaryData.getPos(), binaryData.getLength());
|
||||
detectPacker();
|
||||
String packerAdd = "";
|
||||
if (usedPacker != null) {
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
usedPacker.decrypt(is, baos);
|
||||
is = new ByteArrayInputStream(baos.toByteArray());
|
||||
packerAdd = " - " + usedPacker.getName();
|
||||
}
|
||||
|
||||
SWF bswf = new SWF(is, null, "(SWF Data" + packerAdd + ")", Configuration.parallelSpeedUp.get(), charset);
|
||||
innerSwf = bswf;
|
||||
bswf.binaryData = this;
|
||||
} catch (IOException | InterruptedException ex) {
|
||||
// ignore
|
||||
try {
|
||||
InputStream is = new ByteArrayInputStream(binaryData.getArray(), binaryData.getPos(), binaryData.getLength());
|
||||
detectPacker();
|
||||
String packerAdd = "";
|
||||
if (usedPacker != null) {
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
usedPacker.decrypt(is, baos);
|
||||
is = new ByteArrayInputStream(baos.toByteArray());
|
||||
packerAdd = " - " + usedPacker.getName();
|
||||
}
|
||||
|
||||
SWF bswf = new SWF(is, null, "(SWF Data" + packerAdd + ")", Configuration.parallelSpeedUp.get(), charset);
|
||||
innerSwf = bswf;
|
||||
bswf.binaryData = this;
|
||||
} catch (IOException | InterruptedException ex) {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user