Chunk

From Crash Bandicoot Hacking Wiki
Revision as of 11:23, 25 July 2015 by Wikia>WurlyFox (Created page with "Chunks are the highest level data containers in NSF files. Each chunk is 64kb (0x10000 bytes) in size, in congruence with the 64kb pages allocated to contain them. == Format ...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Chunks are the highest level data containers in NSF files. Each chunk is 64kb (0x10000 bytes) in size, in congruence with the 64kb pages allocated to contain them.

Format

Uncompressed chunks

Non-texture chunks

Offset Field Size Value
0x0 Magic Number 2 bytes 0x1234
0x2 Type 2 bytes !=1
0x4 ID 4 bytes *
0x8 Entry Count 4 bytes c
0xC Checksum 4 bytes *
0x10 Entry Offsets 4 x c bytes *
0x10 + (4 x c) Entries * x c bytes *

Texture chunks

Offset Field Size Value
0x0 Magic Number 2 bytes 0x1234
0x2 Type 2 bytes 1
0x4 Texture Page EID 4 bytes *
0x8 Tex. Page Entry Type 4 bytes 5
0xC Checksum 4 bytes *
0x10 Texture data 0xFFF0/65520 bytes *

Compressed chunks

Offset Field Size Value
0x0 Magic Number 2 bytes 0x1235
0x2 Unused 2 bytes *
0x4 Length 4 bytes l
0x8 Skip 4 bytes s
0xC Compressed data n bytes *
0xC+n Skipped data s bytes *
0xC+n+s Uncompressed data (0x10000 - l) bytes *

Types

Type Name
0 Normal Chunk
1 Texture Chunk
2 Prototype Sound Chunk
3 Sound Chunk
4 Wavebank Chunk
5 Speech Chunk

Chunk IDs/CIDs

Each chunk also has its own unique ID: chunk IDs have been assigned according to their sequence in the NSF file; the formula for a Chunk ID (referred to throughout this guide as CID) is: '(index << 1) - 1' or the sequence of odd numbers (which have have their LSB set). The reason for this will be explained shortly. **Texture chunks do NOT have their associated precomputed Chunk ID in the CID field-it is to be computed later.