- Volition VPP: Unified BE/LE types using inheritance pattern - THQA PAK: Child types now inherit byte order from parent - Various XScript definition updates and fixes Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
85 lines
2.3 KiB
Plaintext
85 lines
2.3 KiB
Plaintext
type fastfile ui("Fast File", root) byteorder LE
|
|
{
|
|
criteria {
|
|
// Simplified: just check file extension for now
|
|
require _ext == "ff";
|
|
}
|
|
|
|
// Read header bytes needed for detection
|
|
company_s = ascii(bytesat(0, 2)) ui("Company");
|
|
filetype_s = ascii(bytesat(2, 2)) ui("File Type");
|
|
signage_s = ascii(bytesat(4, 1));
|
|
magic_s = ascii(bytesat(5, 3)) ui("Magic");
|
|
version_i = u32at(8) ui("Version");
|
|
|
|
// Detect game based on header signature
|
|
detected_game = "UNKNOWN";
|
|
|
|
if (company_s == "IW" && filetype_s == "ff") {
|
|
detected_game = "COD4";
|
|
}
|
|
|
|
if (company_s == "Ta" && filetype_s == "ff") {
|
|
detected_game = "COD8";
|
|
}
|
|
|
|
// Read platform field (byte 12-16)
|
|
platform_u32 = u32at(12);
|
|
|
|
// Detect platform based on version and platform field
|
|
detected_platform = "UNKNOWN";
|
|
|
|
// Early version-based platform detection
|
|
if (version_i == 5) { detected_platform = "PC"; }
|
|
if (version_i == 6) { detected_platform = "XBOX360"; }
|
|
if (version_i == 12) { detected_platform = "PS3"; }
|
|
if (version_i == 14) { detected_platform = "WII"; }
|
|
// version match replaced
|
|
if (version_i > 276 && version_i < 1000) {
|
|
if (platform_u32 == 0) { detected_platform = "PC"; }
|
|
if (platform_u32 == 1) { detected_platform = "XBOX360"; }
|
|
if (platform_u32 == 2) { detected_platform = "PS3"; }
|
|
if (platform_u32 == 3) { detected_platform = "WII"; }
|
|
if (platform_u32 == 4) { detected_platform = "WIIU"; }
|
|
}
|
|
|
|
// Set globals early so they're available for all parsing
|
|
ctx_set("game", detected_game);
|
|
ctx_set("platform", detected_platform);
|
|
ctx_set("version", version_i);
|
|
ctx_set("company", company_s);
|
|
|
|
// ---- UI fields ----
|
|
is_unsigned = (signage_s == "u") ui("Is Unsigned");
|
|
game_s = detected_game ui("Game");
|
|
platform_s = detected_platform ui("Platform");
|
|
|
|
if (version_i == 5) {
|
|
byteorder LE;
|
|
} else {
|
|
byteorder BE;
|
|
}
|
|
|
|
seek(0);
|
|
|
|
u16 company_u16;
|
|
u16 file_type_u16;
|
|
|
|
u8 u_char;
|
|
u8 v1;
|
|
u8 v0a;
|
|
u8 v0b;
|
|
|
|
u32 platform_u32 ui("Platform ID");
|
|
|
|
// Read and decompress zone file
|
|
compressed_zone = read(EOF);
|
|
decompressed_zone = compressed_zone |> zlib;
|
|
|
|
// Export decompressed zone file FIRST (before parsing)
|
|
write_file(_basename + ".zone", decompressed_zone);
|
|
|
|
// Then parse the zone structure
|
|
zonefile = decompressed_zone |> parse zonefile;
|
|
}
|