Asm file format

[V] Knobby

Volition Staff
The asm file is formatted as follows:
Code:
name of the container(length followed by characters, not null terminated)
uint8 container type
uint16 flags
uint16 primitive count
uint32 packfile base offset
uint8 compression type
string (stub container parent name, length followed by characters again)
int32 aux data size(can tag random data to the end of a container, that data immediately follows this int32 if > 0)
int32 total compressed packfile read size

// some primitives are shared and actually written to str2 files for a long enough time that we
// have to deal with the same file in different versions/sizes written to different streaming containers
// so we store the cpu and gpu size of the primitive as we wrote it to the str2
for each primitive {
  uint32 cpu size
  uint32 gpu size
}

for each primitive {
  primitive name (usually cpu filename, but can just be filename with no extension, length followed by chars)
  uint8 primitive type
  uint8 allocator
  uint8 flags
  uint8 extension index (extensions possible defined per primitive type like .peg/.vbm for textures. This is an index into the array of possible extensions for this specific primitive)
  int32 cpu size
  int32 gpu size
  uint8 allocation group (magical 255 means a shared primitive, the grouping system allows us to do a single allocation for multiple files so that things can group up into slot based allocators as needed).
}

Container flags seems mostly runtime, the only one I think we write out is 1<<8 for a passive container(meaning we don't actually issue file reads for this container)

Primitive flags are much the same, but we actually have a few more:
Code:
#define STREAM2_PRIMITIVE_ADD_DISABLED	(1<<3)		// disable me upon adding to a container
#define STREAM2_PRIMITIVE_PATCHABLE	(1<<5)		// when reading this primitive, check to see if it is patched in a patch packfile first
#define STREAM2_PRIMITIVE_CAN_FAIL	(1<<6)		// set this if it's ok that the primitive fails to allocate or stream
 
Back
Top