mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-09-27 15:20:47 +00:00
Added #1290 Export to FlashDevelop project
This commit is contained in:
@@ -327,6 +327,7 @@ public class ScriptPack extends AS3ClassTreeItem {
|
||||
convertData.ignoreFrameScripts = exportSettings.ignoreFrameScripts;
|
||||
convertData.exportEmbed = exportSettings.exportEmbed;
|
||||
convertData.exportEmbedFlaMode = exportSettings.exportEmbedFlaMode;
|
||||
convertData.assetsDir = exportSettings.assetsDir;
|
||||
toSource(abcIndex, writer2, abc.script_info.get(scriptIndex).traits.traits, convertData, exportSettings.mode, parallel, exportSettings.ignoreFrameScripts);
|
||||
} catch (FileNotFoundException ex) {
|
||||
logger.log(Level.SEVERE, "The file path is probably too long", ex);
|
||||
|
||||
@@ -38,6 +38,8 @@ public class ConvertData {
|
||||
public boolean exportEmbed;
|
||||
|
||||
public boolean exportEmbedFlaMode;
|
||||
|
||||
public String assetsDir = "/_assets/";
|
||||
|
||||
public ConvertData() {
|
||||
deobfuscationMode = Configuration.autoDeobfuscate.get() ? 1 : 0;
|
||||
|
||||
@@ -91,9 +91,9 @@ public class InstanceInfo {
|
||||
return "name_index=" + abc.constants.getMultiname(name_index).toString(abc.constants, fullyQualifiedNames) + " super_index=" + supIndexStr + " flags=" + flags + " protectedNS=" + protectedNS + " interfaces=" + Helper.intArrToString(interfaces) + " method_index=" + iinit_index + "\r\n" + instance_traits.toString(abc, fullyQualifiedNames);
|
||||
}
|
||||
|
||||
public GraphTextWriter getClassHeaderStr(GraphTextWriter writer, ABC abc, List<DottedChain> fullyQualifiedNames, boolean allowPrivate, boolean allowEmbed) {
|
||||
public GraphTextWriter getClassHeaderStr(String assetsDir, GraphTextWriter writer, ABC abc, List<DottedChain> fullyQualifiedNames, boolean allowPrivate, boolean allowEmbed) {
|
||||
|
||||
final String ASSETS_DIR = "/_assets/";
|
||||
final String ASSETS_DIR = assetsDir; // "/_assets/";
|
||||
if (allowEmbed) {
|
||||
if (abc.getSwf() != null) {
|
||||
String className = getName(abc.constants).getNameWithNamespace(abc.constants, false).toRawString();
|
||||
@@ -106,14 +106,15 @@ public class InstanceInfo {
|
||||
fileName = Helper.makeFileName(fileName);
|
||||
|
||||
if (ct instanceof DefineBinaryDataTag) {
|
||||
writer.appendNoHilight("[Embed(source=\"" + ASSETS_DIR + fileName + ".bin\", mimeType=\"application/octet-stream\")]").newLine();
|
||||
DefineBinaryDataTag db = (DefineBinaryDataTag) ct;
|
||||
writer.appendNoHilight("[Embed(source=\"" + ASSETS_DIR + fileName + (db.innerSwf != null ? ".swf" : ".bin")+ "\", mimeType=\"application/octet-stream\")]").newLine();
|
||||
}
|
||||
if (ct instanceof ImageTag) {
|
||||
ImageTag it = (ImageTag) ct;
|
||||
writer.appendNoHilight("[Embed(source=\"" + ASSETS_DIR + fileName + ((ImageTag) ct).getImageFormat().getExtension() + "\")]").newLine();
|
||||
}
|
||||
if (ct instanceof DefineSpriteTag) {
|
||||
writer.appendNoHilight("[Embed(source=\"" + ASSETS_DIR + "assets.swf\", symbol=\"" + Helper.escapeActionScriptString(className) + "\")]").newLine();
|
||||
writer.appendNoHilight("[Embed(source=\"" + ASSETS_DIR + "assets.swf\", symbol=\"" + "symbol" + ct.getCharacterId() + "\")]").newLine();
|
||||
}
|
||||
if (ct instanceof DefineSoundTag) {
|
||||
//should be mp3, otherwise it won't work. Should we convert this?
|
||||
|
||||
@@ -108,7 +108,7 @@ public class TraitClass extends Trait implements TraitWithSlot {
|
||||
|
||||
@Override
|
||||
public GraphTextWriter toStringHeader(Trait parent, ConvertData convertData, String path, ABC abc, boolean isStatic, ScriptExportMode exportMode, int scriptIndex, int classIndex, GraphTextWriter writer, List<DottedChain> fullyQualifiedNames, boolean parallel, boolean insideInterface) {
|
||||
abc.instance_info.get(class_info).getClassHeaderStr(writer, abc, fullyQualifiedNames, false, false /*??*/);
|
||||
abc.instance_info.get(class_info).getClassHeaderStr(convertData.assetsDir, writer, abc, fullyQualifiedNames, false, false /*??*/);
|
||||
return writer;
|
||||
}
|
||||
|
||||
@@ -170,7 +170,7 @@ public class TraitClass extends Trait implements TraitWithSlot {
|
||||
}
|
||||
|
||||
//class header
|
||||
instanceInfo.getClassHeaderStr(writer, abc, fullyQualifiedNames, false, allowEmbed);
|
||||
instanceInfo.getClassHeaderStr(convertData.assetsDir, writer, abc, fullyQualifiedNames, false, allowEmbed);
|
||||
writer.endTrait();
|
||||
writer.startBlock();
|
||||
writer.startClass(class_info);
|
||||
|
||||
Reference in New Issue
Block a user