Skip to content

Instantly share code, notes, and snippets.

@ughman
Last active October 7, 2015 13:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ughman/3170834 to your computer and use it in GitHub Desktop.
Save ughman/3170834 to your computer and use it in GitHub Desktop.
(Incomplete) Technical Details of Crash Bandicoot 2

Read this first

There's a much better version available at https://dl.dropbox.com/s/fu29g6xn97sa4pl/crash2fileformat.html with better formatting, more information, and some diagrams.

Crash Bandicoot 2 Technical Information

This document is intended to contain information relevant to the modification of the game Crash Bandicoot 2. The following terminology is used in this document:

Term Definition
Byte An 8-bit quantity of data.
Half A 16-bit quantity of data, stored as 2 bytes little-endian.
Word A 32-bit quantity of data, stored as 4 bytes little-endian.
Tx Type x. (e.g. A T5 chunk is a type 5 chunk.)

SYSTEM.CNF File

This file appears to be relevant to the Playstation boot process. The SCxx_xxx.xx file is mentioned in this file.

SCxx_xxx.xx File

This file appears to be the main game executable.

NSD Files

The format and purpose of these files is unknown. Each of these files has a matching NSF file.

NSF Files

These files are each a set of concatenated chunks (see "Chunks"). Each of these files has a matching NSD file.

Chunks

Each chunk is exactly 65536 (64K) bytes in size. There are 5 types of chunks: 0, 1, 3, 4, and 5. (T0, T1, T3, T4, and T5) The basic header of a chunk is:

Name Type Value
Magic Half 0x1234
Type Half

T0/T3/T4/T5 Chunks

Each non-T1 chunk contains a set of entries. The header for entry-containing chunks is:

Name Type Value
Magic Half 0x1234
Type Half
??? Word 1 + chunkid * 2
Entry Count Word
??? Word
Offsets Word[Entry Count + 1]

chunkid is n where the chunk is the n + 1th chunk in the NSF file. Each entry begins at Offsets[i] and ends before Offsets[i + 1]. Offsets are relative to the start of the chunk. T4 chunks always contain exactly one T14 entry and nothing else.

T1 Chunks

The format of T1 chunks is unknown, but they definitely contain texture data, either 8 bpp (usually) or 16 bpp (Universal logo in *3C.NSF). The header for T1 chunks is:

Name Type Value
Magic Half 0x1234
Type Half 1
??? Word
??? Word 5
??? Word

Entries

Entries are variable-length. There are 13 types of entries: 1, 2, 3, 4, 7, 11, 12, 13, 14, 15, 19, 20, and 21. Entries contain a set of items whose formats are entry-dependent. The header for entries is:

Name Type Value
Magic Word 0x100FFFF
??? Word
Type Word
Item Count Word
Offsets Word[Item Count + 1]

Each item begins at Offsets[i] and ends before Offsets[i + 1]. Offsets are relative to the start of the entry.

Not all of the entry formats are described below.

Entry Type Overview

Entry Type Chunk Type Contents
T1 T0 ???
T2 T0 ???
T3 T0 ???
T4 T0 ???
T7 T0 Entities
T11 T0 ???
T12 T3 Sound Effects
T13 T0 Music
T14 T4 Wavebanks
T15 T0 ???
T19 T0 Demos
T20 T5 Speech
T21 T0 ???

T1 chunks do not contain entries.

T3 Entries

T3 entries only appear in T0 chunks. T3 entries always contain exactly 7 items, whose formats are unknown.

T7 Entries

T7 entries only appear in T0 chunks. T7 entries always contain at least 2 items.

The format of the first 2 items is unknown.

The rest of the items are game entities such as crystals and penguins. Their header format is:

Name Type Value
Length Word The length of this item.
??? Word 0
??? Word 0
Field Count Word
Field Info Byte[8 * Field Count]

The field info format is:

Name Type
Type Half
Offset Half
??? Byte
Element Size Byte
??? Half

Offset is relative to the start of the "Field Count" part of the entity header, and points to the following structure:

Name Type
Element Count Half
??? Half
Element Data Byte[Element Size][Element Count]

The structure is word-aligned. The format of these elements is field-specific, and not described in this document (yet).

T11 Entries

T11 entries only appear in T0 chunks. T11 entries always contain at least 3 items, whose formats are unknown.

T12 Entries

T13 entries contain sound effect data. T12 entries only appear in T3 chunks. T12 entries always contain exactly 1 item, which is playstation ADPCM audio data.

T13 Entries

T13 entries contain music. T13 entries only appear in T0 chunks. T13 entries always contain exactly 3 items.

The format of the first item is:

Name Type Value
SEP Track Count Word
??? Word
??? Word
??? Word
??? Word
??? Word
??? Word
??? Word
??? Word

The second item is either nothing (0 bytes) or a VH file (used with a VB file, see "T14 Entries").

The third item is a SEP file (the number of tracks is indicated in the first item of the entry). Typically, this will contain two tracks, the first being actual level music, and the second being aku aku invincibility music.

T14 Entries

T14 entries contain wavebank data for music playback. T14 entries only appear in T4 chunks. T14 entries always contain exactly 2 items.

The format of the first item is:

Name Type Value
Part Number Word A value from 0 to 3.
Length Word The length of the second item.

The second item is part of a VB file. When the second item of each T14 entry is concatenated (ascendingly ordered by Part Number), the resulting data is a VB file. This VB file, when appended to the VH file from the appropriate T13 entry, forms a VAB file. This VAB file contains the instrument data necessary to properly play back the music in the level. It is not music itself, however; see "T13 Entries" for information on music sequence data.

T15 Entries

T15 entries only appear in T0 chunks. T15 entries always contain exactly 1 item, the format of which is unknown.

T19 Entries

T19 entries are probably related to demos, as they appear in NSF files for levels with demos, and no other NSF files. T19 entries only appear in T0 chunks. T19 entries always contain exactly 1 item, the format of which is unknown.

T20 Entries

T20 entries contain speech audio data. T20 entries only appear in T5 chunks. T20 entries always contain exactly 1 item, which is playstation ADPCM audio data.

SEP Files

???

VAB Files

???

Playstation ADPCM Audio

???

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment