XPlor/definitions/thqa/rcb.xscript

53 lines
1.4 KiB
Plaintext
Raw Normal View History

// RCB Texture file format - THQ Australia Engine
// Contains DXT compressed texture data in g4rc containers
// Big-endian (Xbox 360, Wii)
type thqa_rcb ui("THQA RCB Texture", root) byteorder BE
{
criteria {
require ascii(bytesat(0, 4)) == "g4rc";
}
// RCB files start with g4rc blocks
first_magic = ascii(read(4)) ui("Magic");
u32 first_type ui("Block Type");
u32 first_hash ui("Hash");
u32 first_size ui("Size");
// Type 0x07 = metadata, 0x12 = pixel data
block_type_desc = "Unknown";
if (first_type == 0x07) {
block_type_desc = "Metadata";
}
if (first_type == 0x12) {
block_type_desc = "Pixel Data";
}
block_type_name = block_type_desc ui("Block Type Name");
// Read block data if there's enough space
if (first_size > 0 && pos() + first_size <= size()) {
block_data = read(first_size);
// Look for pixel block if this was metadata
if (first_type == 0x07 && pos() + 16 <= size()) {
next_magic = ascii(read(4)) ui("Next Magic");
u32 next_type ui("Next Block Type");
u32 next_hash ui("Next Hash");
u32 next_size ui("Next Size");
if (next_type == 0x12) {
pixel_data_size = next_size ui("Pixel Data Size");
}
}
}
file_size = size() ui("Total File Size");
}
type thqa_dxt1_block ui("DXT1 Block") byteorder LE
{
u16 color0 ui("Color 0 (RGB565)");
u16 color1 ui("Color 1 (RGB565)");
u32 indices ui("Pixel Indices");
}