mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-06-08 12:53:55 +00:00
Changed Full path inside bundle is displayed as SWF name instead simple name
Fixed Storing SWF configuration for files inside bundles and/or binarydata
This commit is contained in:
@@ -183,6 +183,7 @@ import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
@@ -1279,11 +1280,11 @@ public final class SWF implements SWFContainerItem, Timelined {
|
||||
}
|
||||
|
||||
public SWF(InputStream is, String file, String fileTitle, ProgressListener listener, boolean parallelRead, boolean checkOnly, boolean lazy) throws IOException, InterruptedException {
|
||||
this(is, file, fileTitle, listener, parallelRead, checkOnly, lazy, null, Utf8Helper.charsetName);
|
||||
this(is, file, fileTitle, listener, parallelRead, checkOnly, lazy, null, Charset.defaultCharset().name());
|
||||
}
|
||||
|
||||
public SWF(InputStream is, String file, String fileTitle, ProgressListener listener, boolean parallelRead, boolean checkOnly, boolean lazy, UrlResolver resolver) throws IOException, InterruptedException {
|
||||
this(is, file, fileTitle, listener, parallelRead, checkOnly, lazy, resolver, Utf8Helper.charsetName);
|
||||
this(is, file, fileTitle, listener, parallelRead, checkOnly, lazy, resolver, Charset.defaultCharset().name());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1489,12 +1490,15 @@ public final class SWF implements SWFContainerItem, Timelined {
|
||||
return file;
|
||||
}
|
||||
|
||||
public String getTitleOrShortFileName() {
|
||||
if (fileTitle != null) {
|
||||
return fileTitle;
|
||||
}
|
||||
return new File(file).getName();
|
||||
}
|
||||
|
||||
public String getShortFileName() {
|
||||
String title = getFileTitle();
|
||||
if (title == null) {
|
||||
return "";
|
||||
}
|
||||
return new File(title).getName();
|
||||
return new File(getTitleOrShortFileName()).getName();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1507,10 +1511,10 @@ public final class SWF implements SWFContainerItem, Timelined {
|
||||
}
|
||||
if (swfList != null) {
|
||||
if (swfList.isBundle()) {
|
||||
return swfList.name + "/" + getShortFileName();
|
||||
return swfList.name + "/" + getTitleOrShortFileName();
|
||||
}
|
||||
}
|
||||
return getShortFileName();
|
||||
return getTitleOrShortFileName();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -3379,7 +3383,7 @@ public final class SWF implements SWFContainerItem, Timelined {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getShortFileName();
|
||||
return getTitleOrShortFileName();
|
||||
}
|
||||
|
||||
public void deobfuscate(DeobfuscationLevel level) throws InterruptedException {
|
||||
|
||||
@@ -1557,7 +1557,7 @@ public class SWFInputStream implements AutoCloseable {
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
if (logErrors) {
|
||||
logger.log(Level.SEVERE, "Error during tag reading. SWF: " + swf.getShortFileName() + " ID: " + tag.getId() + " name: " + tag.getName() + " pos: " + data.getPos(), ex);
|
||||
logger.log(Level.SEVERE, "Error during tag reading. SWF: " + swf.getTitleOrShortFileName() + " ID: " + tag.getId() + " name: " + tag.getName() + " pos: " + data.getPos(), ex);
|
||||
}
|
||||
ret = new TagStub(swf, tag.getId(), "Error", data, null);
|
||||
}
|
||||
|
||||
@@ -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.configuration.Configuration;
|
||||
import com.jpexs.decompiler.flash.configuration.SwfSpecificCustomConfiguration;
|
||||
import com.jpexs.decompiler.flash.tags.base.CharacterTag;
|
||||
import com.jpexs.decompiler.flash.types.BasicType;
|
||||
import com.jpexs.decompiler.flash.types.annotations.Internal;
|
||||
@@ -31,6 +32,7 @@ import com.jpexs.helpers.utf8.Utf8Helper;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.nio.charset.Charset;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -78,9 +80,13 @@ public class DefineBinaryDataTag extends CharacterTag {
|
||||
binaryData = sis.readByteRangeEx(sis.available(), "binaryData");
|
||||
|
||||
if (Configuration.autoLoadEmbeddedSwfs.get()) {
|
||||
String path = getSwf().getShortPathTitle()+"/DefineBinaryData (" + getCharacterId() + ")";
|
||||
SwfSpecificCustomConfiguration conf = Configuration.getSwfSpecificCustomConfiguration(path);
|
||||
String charset = conf == null ? Charset.defaultCharset().name() : conf.getCustomData(SwfSpecificCustomConfiguration.KEY_CHARSET, Charset.defaultCharset().name());
|
||||
|
||||
try {
|
||||
InputStream is = new ByteArrayInputStream(binaryData.getArray(), binaryData.getPos(), binaryData.getLength());
|
||||
SWF bswf = new SWF(is, null, "(SWF Data)", Configuration.parallelSpeedUp.get());
|
||||
SWF bswf = new SWF(is, null, "(SWF Data)", Configuration.parallelSpeedUp.get(), charset);
|
||||
innerSwf = bswf;
|
||||
bswf.binaryData = this;
|
||||
} catch (IOException | InterruptedException ex) {
|
||||
|
||||
@@ -233,7 +233,7 @@ public abstract class FontTag extends DrawableTag implements AloneTag {
|
||||
int fontId = getFontId();
|
||||
String selectedFont = swf.sourceFontNamesMap.get(fontId);
|
||||
if (selectedFont == null) {
|
||||
SwfSpecificConfiguration swfConf = Configuration.getSwfSpecificConfiguration(swf.getShortFileName());
|
||||
SwfSpecificConfiguration swfConf = Configuration.getSwfSpecificConfiguration(swf.getShortPathTitle());
|
||||
String key = fontId + "_" + getFontNameIntag();
|
||||
if (swfConf != null) {
|
||||
selectedFont = swfConf.fontPairingMap.get(key);
|
||||
@@ -494,6 +494,9 @@ public abstract class FontTag extends DrawableTag implements AloneTag {
|
||||
}
|
||||
|
||||
public DefineFontNameTag getFontNameTag() {
|
||||
if (swf == null) {
|
||||
return null;
|
||||
}
|
||||
for (Tag t : swf.getTags()) {
|
||||
if (t instanceof DefineFontNameTag) {
|
||||
DefineFontNameTag dfn = (DefineFontNameTag) t;
|
||||
|
||||
Reference in New Issue
Block a user