2026-01-11 12:10:58 -05:00
|
|
|
// Texture Format (2xtc / ctx2) - THQ Australia Engine
|
|
|
|
|
// Contains texture/image data
|
|
|
|
|
// Big-endian (Xbox 360, Wii)
|
|
|
|
|
|
2026-01-11 16:08:46 -05:00
|
|
|
type thqa_ctx2 ui("THQA Texture") byteorder BE
|
2026-01-11 12:10:58 -05:00
|
|
|
{
|
|
|
|
|
criteria {
|
|
|
|
|
require ascii(bytesat(0, 4)) == "2xtc";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Header
|
2026-01-11 16:08:46 -05:00
|
|
|
magic = ascii(read(4)) ui("Magic");
|
|
|
|
|
u32 version ui("Version");
|
|
|
|
|
u32 width ui("Width");
|
|
|
|
|
u32 height ui("Height");
|
2026-01-11 12:10:58 -05:00
|
|
|
|
|
|
|
|
// Format info
|
2026-01-11 16:08:46 -05:00
|
|
|
u32 texture_format ui("Format");
|
|
|
|
|
u32 mipmap_count ui("Mipmap Count");
|
|
|
|
|
u32 flags ui("Flags");
|
2026-01-11 12:10:58 -05:00
|
|
|
|
|
|
|
|
// Data info
|
2026-01-11 16:08:46 -05:00
|
|
|
u32 data_offset ui("Data Offset");
|
|
|
|
|
u32 data_size ui("Data Size");
|
2026-01-11 12:10:58 -05:00
|
|
|
|
|
|
|
|
// Decode format type
|
|
|
|
|
format_name = "Unknown";
|
|
|
|
|
if (texture_format == 0x00) {
|
|
|
|
|
format_name = "RGBA8888";
|
|
|
|
|
}
|
|
|
|
|
if (texture_format == 0x01) {
|
|
|
|
|
format_name = "RGB888";
|
|
|
|
|
}
|
|
|
|
|
if (texture_format == 0x02) {
|
|
|
|
|
format_name = "DXT1";
|
|
|
|
|
}
|
|
|
|
|
if (texture_format == 0x03) {
|
|
|
|
|
format_name = "DXT3";
|
|
|
|
|
}
|
|
|
|
|
if (texture_format == 0x04) {
|
|
|
|
|
format_name = "DXT5";
|
|
|
|
|
}
|
|
|
|
|
if (texture_format == 0x52) {
|
|
|
|
|
format_name = "Xbox360 DXT1";
|
|
|
|
|
}
|
|
|
|
|
if (texture_format == 0x53) {
|
|
|
|
|
format_name = "Xbox360 DXT3";
|
|
|
|
|
}
|
|
|
|
|
if (texture_format == 0x54) {
|
|
|
|
|
format_name = "Xbox360 DXT5";
|
|
|
|
|
}
|
|
|
|
|
|
2026-01-11 16:08:46 -05:00
|
|
|
format_name = format_name ui("Format Name");
|
2026-01-11 12:10:58 -05:00
|
|
|
|
|
|
|
|
// Read texture data
|
|
|
|
|
if (data_offset > 0 && data_size > 0) {
|
|
|
|
|
seek(data_offset);
|
2026-01-11 16:08:46 -05:00
|
|
|
texture_data = read(data_size) ui("Texture Data");
|
2026-01-11 12:10:58 -05:00
|
|
|
}
|
|
|
|
|
}
|