mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-05-26 14:07:26 +00:00
reading list of flash tags from iggy file - WIP
This commit is contained in:
@@ -37,25 +37,26 @@ public class IggyExtractor extends AbstractDataStream implements AutoCloseable {
|
||||
subFileEntries.add(new IggySubFileEntry(this));
|
||||
}
|
||||
|
||||
List<ByteArrayDataStream> indexStreams = new ArrayList<>();
|
||||
List<byte[]> indexDatas = new ArrayList<>();
|
||||
List<ByteArrayDataStream> flashStreams = new ArrayList<>();
|
||||
|
||||
for (int i = 0; i < subFileEntries.size(); i++) {
|
||||
IggySubFileEntry entry = subFileEntries.get(i);
|
||||
ByteArrayDataStream entryStream = getEntryDataStream(i);
|
||||
if (entry.type == IggySubFileEntry.TYPE_INDEX) {
|
||||
indexStreams.add(entryStream);
|
||||
indexDatas.add(getEntryData(i));
|
||||
} else if (entry.type == IggySubFileEntry.TYPE_FLASH) {
|
||||
flashStreams.add(entryStream);
|
||||
flashStreams.add(getEntryDataStream(i));
|
||||
}
|
||||
}
|
||||
|
||||
IggyFlashHeader64 fh64 = null;
|
||||
IggyFlashHeader32 fh32 = null;
|
||||
|
||||
for (ByteArrayDataStream fs : flashStreams) {
|
||||
if (is64()) {
|
||||
IggyFlashHeader64 fh = new IggyFlashHeader64(fs);
|
||||
System.out.println("" + fh);
|
||||
fh64 = new IggyFlashHeader64(fs);
|
||||
} else {
|
||||
IggyFlashHeader32 fh = new IggyFlashHeader32(fs);
|
||||
fh32 = new IggyFlashHeader32(fs);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,13 @@
|
||||
package com.jpexs.decompiler.flash.iggy;
|
||||
|
||||
import com.jpexs.decompiler.flash.iggy.annotations.IggyArrayFieldType;
|
||||
import com.jpexs.decompiler.flash.iggy.annotations.IggyFieldType;
|
||||
import com.jpexs.decompiler.flash.tags.Tag;
|
||||
import com.jpexs.decompiler.flash.tags.TagTypeInfo;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -46,7 +52,7 @@ public class IggyFlashHeader32 implements StructureInterface {
|
||||
long unk_38;
|
||||
@IggyFieldType(DataType.uint32_t)
|
||||
long unk_3C;
|
||||
float unk_40;
|
||||
float frame_rate;
|
||||
@IggyFieldType(DataType.uint32_t)
|
||||
long unk_44;
|
||||
@IggyFieldType(DataType.uint32_t)
|
||||
@@ -75,6 +81,11 @@ public class IggyFlashHeader32 implements StructureInterface {
|
||||
long unk_78; // Maybe number of classes / as3 names
|
||||
@IggyFieldType(DataType.uint32_t)
|
||||
long unk_7C;
|
||||
@IggyFieldType(value = DataType.uint16_t, count = 20)
|
||||
String name;
|
||||
|
||||
List<Integer> tagIds = new ArrayList<>();
|
||||
List<Long> tagIdsExtendedInfo = new ArrayList<>();
|
||||
|
||||
// Offset 0x80 (outside header): there are *unk_28* relative offsets that point to flash objects.
|
||||
// The flash objects are in a format different to swf but there is probably a way to convert between them.
|
||||
@@ -104,7 +115,7 @@ public class IggyFlashHeader32 implements StructureInterface {
|
||||
unk_34 = stream.readUI32();
|
||||
unk_38 = stream.readUI32();
|
||||
unk_3C = stream.readUI32();
|
||||
unk_40 = stream.readFloat();
|
||||
frame_rate = stream.readFloat();
|
||||
unk_44 = stream.readUI32();
|
||||
unk_48 = stream.readUI32();
|
||||
unk_4C = stream.readUI32();
|
||||
@@ -120,6 +131,26 @@ public class IggyFlashHeader32 implements StructureInterface {
|
||||
unk_74 = stream.readUI32();
|
||||
unk_78 = stream.readUI32();
|
||||
unk_7C = stream.readUI32();
|
||||
StringBuilder nameBuilder = new StringBuilder();
|
||||
do {
|
||||
char c = (char) stream.readUI16();
|
||||
if (c == '\0') {
|
||||
break;
|
||||
}
|
||||
nameBuilder.append(c);
|
||||
} while (true);
|
||||
name = nameBuilder.toString();
|
||||
|
||||
while (true) {
|
||||
long typeLen = stream.readUI16(); //TODO: check whether it's really UI16 - 64bit works with UI32
|
||||
if (typeLen == 0) {
|
||||
break;
|
||||
}
|
||||
long tagLength = stream.readUI16();
|
||||
int tagType = (int) ((typeLen >>> 6) + 10) & 0x3FF;
|
||||
tagIds.add(tagType);
|
||||
tagIdsExtendedInfo.add(tagLength);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -148,7 +179,7 @@ public class IggyFlashHeader32 implements StructureInterface {
|
||||
sb.append("unk_34 ").append(unk_34).append("\r\n");
|
||||
sb.append("unk_38 ").append(unk_38).append("\r\n");
|
||||
sb.append("unk_3C ").append(unk_3C).append("\r\n");
|
||||
sb.append("unk_40 ").append(unk_40).append("\r\n");
|
||||
sb.append("frame_rate ").append(frame_rate).append("\r\n");
|
||||
sb.append("unk_44 ").append(unk_44).append("\r\n");
|
||||
sb.append("unk_48 ").append(unk_48).append("\r\n");
|
||||
sb.append("unk_4C ").append(unk_4C).append("\r\n");
|
||||
@@ -163,6 +194,17 @@ public class IggyFlashHeader32 implements StructureInterface {
|
||||
sb.append("unk_74 ").append(unk_74).append("\r\n");
|
||||
sb.append("unk_78 ").append(unk_78).append("\r\n");
|
||||
sb.append("unk_7C ").append(unk_7C).append("\r\n");
|
||||
sb.append("name ").append(name).append("\r\n");
|
||||
Map<Integer, TagTypeInfo> map = Tag.getKnownClasses();
|
||||
sb.append("tags:").append("\r\n");
|
||||
for (int i = 0; i < tagIds.size(); i++) {
|
||||
TagTypeInfo tti = map.get(tagIds.get(i));
|
||||
sb.append(" tag ").append(tagIds.get(i)).append(":").append(tti == null ? "?" : tti.getName());
|
||||
if (tagIdsExtendedInfo.get(i) > 0) {
|
||||
sb.append(" (special: ").append(tagIdsExtendedInfo.get(i)).append(")");
|
||||
}
|
||||
sb.append("\r\n");
|
||||
}
|
||||
sb.append("]");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
package com.jpexs.decompiler.flash.iggy;
|
||||
|
||||
import com.jpexs.decompiler.flash.iggy.annotations.IggyFieldType;
|
||||
import com.jpexs.decompiler.flash.tags.Tag;
|
||||
import com.jpexs.decompiler.flash.tags.TagTypeInfo;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -43,7 +48,7 @@ public class IggyFlashHeader64 implements StructureInterface {
|
||||
long unk_50;
|
||||
@IggyFieldType(DataType.uint32_t)
|
||||
long unk_54;
|
||||
float unk_58;
|
||||
float frame_rate;
|
||||
@IggyFieldType(DataType.uint32_t)
|
||||
long unk_5C;
|
||||
@IggyFieldType(DataType.uint64_t)
|
||||
@@ -72,7 +77,16 @@ public class IggyFlashHeader64 implements StructureInterface {
|
||||
long unk_B0; // Maybe number of classes / as3 names
|
||||
@IggyFieldType(DataType.uint32_t)
|
||||
long unk_B4;
|
||||
@IggyFieldType(value = DataType.uint16_t, count = 20)
|
||||
String name;
|
||||
|
||||
List<Integer> tagIds = new ArrayList<>();
|
||||
List<Long> tagIdsExtendedInfo = new ArrayList<>();
|
||||
|
||||
/*@IggyArrayFieldType(value = DataType.uint32_t, count = 20)
|
||||
long unk_offsets_a[] = new long[20];
|
||||
@IggyArrayFieldType(value = DataType.uint32_t, count = 20)
|
||||
long unk_offsets_b[] = new long[20];*/
|
||||
// Offset 0xB8 (outside header): there are *unk_40* relative offsets that point to flash objects.
|
||||
// The flash objects are in a format different to swf but there is probably a way to convert between them.
|
||||
// After the offsets, the bodies of objects pointed above, which apparently have a code like 0xFFXX to identify the type of object, followed by a (unique?) identifier
|
||||
@@ -101,7 +115,7 @@ public class IggyFlashHeader64 implements StructureInterface {
|
||||
unk_4C = stream.readUI32();
|
||||
unk_50 = stream.readUI32();
|
||||
unk_54 = stream.readUI32();
|
||||
unk_58 = stream.readFloat();
|
||||
frame_rate = stream.readFloat();
|
||||
unk_5C = stream.readUI32();
|
||||
unk_60 = stream.readUI64();
|
||||
unk_68 = stream.readUI64();
|
||||
@@ -116,7 +130,26 @@ public class IggyFlashHeader64 implements StructureInterface {
|
||||
unk_AC = stream.readUI32();
|
||||
unk_B0 = stream.readUI32();
|
||||
unk_B4 = stream.readUI32();
|
||||
StringBuilder nameBuilder = new StringBuilder();
|
||||
do {
|
||||
char c = (char) stream.readUI16();
|
||||
if (c == '\0') {
|
||||
break;
|
||||
}
|
||||
nameBuilder.append(c);
|
||||
} while (true);
|
||||
name = nameBuilder.toString();
|
||||
|
||||
while (true) {
|
||||
long typeLen = stream.readUI32();
|
||||
if (typeLen == 0) {
|
||||
break;
|
||||
}
|
||||
long tagLength = stream.readUI32();
|
||||
int tagType = (int) ((typeLen >>> 6) + 10) & 0x3FF;
|
||||
tagIds.add(tagType);
|
||||
tagIdsExtendedInfo.add(tagLength);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -144,7 +177,7 @@ public class IggyFlashHeader64 implements StructureInterface {
|
||||
sb.append("unk_4C ").append(unk_4C).append("\r\n");
|
||||
sb.append("unk_50 ").append(unk_50).append("\r\n");
|
||||
sb.append("unk_54 ").append(unk_54).append("\r\n");
|
||||
sb.append("unk_58 ").append(unk_58).append("\r\n");
|
||||
sb.append("frame_rate ").append(frame_rate).append("\r\n");
|
||||
sb.append("unk_5C ").append(unk_5C).append("\r\n");
|
||||
sb.append("unk_60 ").append(unk_60).append("\r\n");
|
||||
sb.append("unk_68 ").append(unk_68).append("\r\n");
|
||||
@@ -159,6 +192,17 @@ public class IggyFlashHeader64 implements StructureInterface {
|
||||
sb.append("unk_AC ").append(unk_AC).append("\r\n");
|
||||
sb.append("unk_B0 ").append(unk_B0).append("\r\n");
|
||||
sb.append("unk_B4 ").append(unk_B4).append("\r\n");
|
||||
sb.append("name ").append(name).append("\r\n");
|
||||
Map<Integer, TagTypeInfo> map = Tag.getKnownClasses();
|
||||
sb.append("tags:").append("\r\n");
|
||||
for (int i = 0; i < tagIds.size(); i++) {
|
||||
TagTypeInfo tti = map.get(tagIds.get(i));
|
||||
sb.append(" tag ").append(tagIds.get(i)).append(":").append(tti == null ? "?" : tti.getName());
|
||||
if (tagIdsExtendedInfo.get(i) > 0) {
|
||||
sb.append(" (special: ").append(tagIdsExtendedInfo.get(i)).append(")");
|
||||
}
|
||||
sb.append("\r\n");
|
||||
}
|
||||
sb.append("]");
|
||||
return sb.toString();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user