XPlor/definitions/asura/chunks/fcsr_chunk.xscript
njohnson d0510d7ab2 Update Asura archive XScript definitions
- Enhanced chunk parsing
- Improved structure definitions

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-08 00:38:33 -05:00

56 lines
1.7 KiB
Plaintext

// FCSR - File/Resource Chunk (reversed "RSCF")
// Contains embedded file data with path and type information
// Primary chunk type for storing assets in Asura archives
type fcsr_chunk [display="FCSR Resource"] byteorder BE
{
// Save chunk start position
chunk_start = pos();
// Standard 16-byte Asura chunk header
chunk_id = ascii(read(4));
u32 chunk_size;
u32 version;
u32 flags;
chunk_id = chunk_id [ui, readonly, display="Chunk ID"];
chunk_size = chunk_size [ui, readonly, display="Chunk Size"];
version = version [ui, readonly, display="Version"];
flags = flags [ui, readonly, display="Flags"];
// Resource metadata
u32 resource_type;
u32 unknown1;
u32 resource_size;
resource_type = resource_type [ui, readonly, display="Resource Type"];
unknown1 = unknown1 [ui, readonly, display="Unknown"];
resource_size = resource_size [ui, readonly, display="Resource Size"];
// Resource file path (null-terminated)
resource_path = cstring();
resource_path = resource_path [ui, readonly, display="Resource Path"];
// Get filename from path and set as chunk name for tree display
export_name = basename(resource_path);
_name = export_name;
// Calculate where resource data starts
resource_offset = chunk_start + chunk_size - resource_size;
// Export resource if size > 0
if (resource_size > 0 && resource_offset >= pos()) {
// Seek to resource data
seek(resource_offset);
// Read resource data
resource_data = read(resource_size);
// Export the file
write_file(export_name, resource_data);
// Preview all resources (C++ handles routing to image/audio/hex viewer)
preview(export_name, resource_data);
}
}