XPlor/definitions/asura/chunks/lfsr_chunk.xscript

55 lines
1.2 KiB
Plaintext
Raw Normal View History

// LFSR - List File Reference Chunk
// Contains references to other files/archives
// Common in .cut, .ent, and other Asura files
type lfsr_chunk [display="LFSR List Reference"] byteorder BE
{
// Standard 16-byte Asura chunk header
chunk_id = ascii(read(4));
u32 chunk_size;
u32 version;
u32 flags;
chunk_id = chunk_id;
ui("chunk_id", "Chunk ID");
chunk_size = chunk_size;
ui("chunk_size", "Chunk Size");
version = version;
ui("version", "Version");
flags = flags;
ui("flags", "Flags");
// Number of file references
u32 entry_count;
entry_count = entry_count;
ui("entry_count", "Entry Count");
// Get type-specific index for naming
idx = ctx_get("_lfsr_idx");
// Read file reference path (null-terminated string)
if (entry_count > 0) {
ref_path = cstring();
ref_path = ref_path;
ui("ref_path", "Reference Path");
}
// Set indexed name (format: lfsr.0, lfsr.1, etc.)
set_name("lfsr." + idx);
// Additional data depends on version
// Some versions have extra 8 bytes per entry
data_size = chunk_size - 16 - 4;
if (entry_count > 0) {
// Account for string we already read
// Remaining data is entry metadata
}
}