XPlor/definitions/thqa/rcb.xscript

82 lines
1.7 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 [root, display="THQA RCB Texture"] byteorder BE
{
criteria {
require ascii(bytesat(0, 4)) == "g4rc";
}
// RCB files start with g4rc blocks
first_magic = ascii(read(4));
ui("first_magic", "Magic");
u32 first_type;
ui("first_type", "Block Type");
u32 first_hash;
ui("first_hash", "Hash");
u32 first_size;
ui("first_size", "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", "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", "Next Magic");
u32 next_type;
ui("next_type", "Next Block Type");
u32 next_hash;
ui("next_hash", "Next Hash");
u32 next_size;
ui("next_size", "Next Size");
if (next_type == 0x12) {
pixel_data_size = next_size;
ui("pixel_data_size", "Pixel Data Size");
}
}
}
file_size = size();
ui("file_size", "Total File Size");
}
type thqa_dxt1_block [display="DXT1 Block"] byteorder LE
{
u16 color0;
ui("color0", "Color 0 (RGB565)");
u16 color1;
ui("color1", "Color 1 (RGB565)");
u32 indices;
ui("indices", "Pixel Indices");
}