Difference between revisions of "Subsystem"

From Crash Bandicoot Hacking Wiki
Jump to navigation Jump to search
(Created page with "A subsystem is a self-contained system within a larger system. In each of the Crash games, there exist a number of different subsystems. Each subsystem handles a different asp...")
 
m (6 revisions imported: Initial import from Wikia)
 
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
A subsystem is a self-contained system within a larger system. In each of the Crash games, there exist a number of different subsystems. Each subsystem handles a different aspect of the game's function. Many of these subsystems are associated with the type of entry that they primarily operate upon. In fact, an entry's type is just the ID of the subsystem that operates upon its data.
+
A subsystem is a self-contained system within a larger system. In each of the Crash games, there exist a number of different subsystems. Each subsystem handles a different aspect of the game's function. Many of these subsystems are associated with the type of entry that they primarily operate upon. In fact, an entry's type is just the ID of the subsystem that operates upon its data; thus, both terms entry type and subsystem ID are inclusively interchangeable with subsystem type.
  
 
== Subsystem Table ==
 
== Subsystem Table ==
 +
Each of the Crash games has a subsystem table. Each entry in the subsystem table contains a 4 character acronym or identifier string, and a number of callback functions specific to the subsystem with that identifier.
 +
 +
=== Location ===
 +
The subsystem table is located at the following addresses in each of the Crash games:
 +
* Crash 1 - <code>0x514DC</code>
 +
 +
=== Structure ===
 +
The subsystem table has the following structure in each of the Crash games, with the exception that Crash 2 (and 3?) omit the last callback, <code>(*deinit)()</code>:
 +
 +
<syntaxhighlight lang="cpp">
 +
struct subsystem
 +
{
 +
  char name[4];
 +
  unsigned long pad;
 +
  void (*init)();
 +
  void (*postinit)();
 +
  void (*onload)(entry*);
 +
  void (*onfree)(entry*);
 +
  void (*deinit)();
 +
} subsystems[NS_COUNT_SUBSYSTEMS];
 +
</syntaxhighlight>
 +
 +
==== Subsystem name ====
 +
Each subsystem specifies a 4 character acronym as its name. See below for a list of the subsystem names in each game.
 +
 +
==== Callbacks ====
 +
Each entry in the subsystem table may or may not specify the following callbacks:
 +
* <code>init</code> - Called during subsystem initialization to initialize this subsystem
 +
* <code>postinit</code> - Called during subsystem initialization after...
 +
* <code>onload</code> - Called after an entry of this subsystem type is paged into memory
 +
* <code>onfree</code> - Called after an entry of this subsystem type is loaded out of memory
 +
* <code>deinit</code> - Called during subsystem deinitialization (Crash 1 only)
 +
The <code>init</code> and <code>postinit</code> callbacks of each subsystem are called during Paging and Subsystem Initialization; each of these callbacks refers to a routine that initializes its associated subsystem.
 +
...
 +
All together, a subsystem's callbacks simulate 5 polymorphic functions that would otherwise override a subsystem base class's virtual functions of the same name.
 +
 +
== Subsystem names ==
 +
 +
=== Crash 1 ===
 +
There are a total of 21 subsystems in Crash 1. 
 +
 +
Note that entries of type 0 do not exist. For this reason, the first subsystem has the name NONE. 
 +
 +
Bolded entries in the table indicate that (while the subsystem exists) there do not exist entries of that subsystem type in any NSF file.
 +
{| class="article-table" border="1" cellspacing="0" rules="NONE" cols="3"
 +
! align="LEFT" height="47" width="69" |ID       
 +
! align="LEFT" width="67" |Name
 +
! align="LEFT" width="215" |Proposed Unabbreviated Name/Entry Content Description
 +
|-
 +
| align="RIGHT" height="17" sdnum="1033;" sdval="0" |'''0'''
 +
| align="LEFT" |'''NONE'''
 +
| align="LEFT" |'''None'''
 +
|-
 +
| align="RIGHT" height="17" sdnum="1033;" sdval="1" |1
 +
| align="LEFT" |SVTX
 +
| align="LEFT" |Object Model Vertices/Animation
 +
|-
 +
| align="RIGHT" height="17" sdnum="1033;" sdval="2" |2
 +
| align="LEFT" |TGEO
 +
| align="LEFT" |Object Model Polygons
 +
|-
 +
| align="RIGHT" height="17" sdnum="1033;" sdval="3" |3
 +
| align="LEFT" |WGEO
 +
| align="LEFT" |World Geometry
 +
|-
 +
| align="RIGHT" height="17" sdnum="1033;" sdval="4" |4
 +
| align="LEFT" |SLST
 +
| align="LEFT" |Display List
 +
|-
 +
| align="RIGHT" height="17" sdnum="1033;" sdval="5" |5
 +
| align="LEFT" |TPAG
 +
| align="LEFT" |Texture Page
 +
|-
 +
| align="RIGHT" height="17" sdnum="1033;" sdval="6" |6
 +
| align="LEFT" |LDAT
 +
| align="LEFT" |Level Data
 +
|-
 +
| align="RIGHT" height="17" sdnum="1033;" sdval="7" |7
 +
| align="LEFT" |ZDAT
 +
| align="LEFT" |Zone Data
 +
|-
 +
| align="RIGHT" height="17" sdnum="1033;" sdval="8" |'''8'''
 +
| align="LEFT" |'''CPAT'''
 +
| align="LEFT" |'''Color Palette'''
 +
|-
 +
| align="RIGHT" height="17" sdnum="1033;" sdval="9" |'''9'''
 +
| align="LEFT" |'''BINF'''
 +
| align="LEFT" |'''Binary File'''
 +
|-
 +
| align="RIGHT" height="17" sdnum="1033;" sdval="10" |'''10'''
 +
| align="LEFT" |'''OPAT'''
 +
| align="LEFT" |'''Object/Process Allocation Table'''
 +
|-
 +
| align="RIGHT" height="17" sdnum="1033;" sdval="11" |11
 +
| align="LEFT" |GOOL
 +
| align="LEFT" |GOOL Executable
 +
|-
 +
| align="RIGHT" height="17" sdnum="1033;" sdval="12" |12
 +
| align="LEFT" |ADIO
 +
| align="LEFT" |Audio
 +
|-
 +
| align="RIGHT" height="17" sdnum="1033;" sdval="13" |13
 +
| align="LEFT" |MIDI
 +
| align="LEFT" |Music
 +
|-
 +
| align="RIGHT" height="17" sdnum="1033;" sdval="14" |14
 +
| align="LEFT" |INST
 +
| align="LEFT" |Instruments
 +
|-
 +
| align="RIGHT" height="17" sdnum="1033;" sdval="15" |15
 +
| align="LEFT" |IMAG
 +
| align="LEFT" |Image Data
 +
|-
 +
| align="RIGHT" height="17" sdnum="1033;" sdval="16" |'''16'''
 +
| align="LEFT" |'''LINK'''
 +
| align="LEFT" |'''Link to another entry?'''
 +
|-
 +
| align="RIGHT" height="17" sdnum="1033;" sdval="17" |17
 +
| align="LEFT" |MDAT
 +
| align="LEFT" |Map Data
 +
|-
 +
| align="RIGHT" height="17" sdnum="1033;" sdval="18" |18
 +
| align="LEFT" |IPAL
 +
| align="LEFT" |Palettes for fading transitions
 +
|-
 +
| align="RIGHT" height="17" sdnum="1033;" sdval="19" |19
 +
| align="LEFT" |PBAK
 +
| align="LEFT" |Demo playback
 +
|-
 +
| align="RIGHT" height="17" sdnum="1033;" sdval="20" |20
 +
| align="LEFT" |CVTX
 +
| align="LEFT" |Cutscene Model Vertices/Animation
 +
|}
 +
 +
=== Crash 2 ===
 +
There are a total of 22 subsystems in Crash 2. 
 +
 +
Note that entries of type 0 do not exist. For this reason, the first subsystem has the name NONE. 
 +
 +
Bolded entries in the table indicate that (while the subsystem exists) there do not exist entries of that subsystem type in any NSF file.
 +
{| class="article-table" border="1" cellspacing="0" rules="NONE" cols="3"
 +
! align="LEFT" height="47" width="69" |ID       
 +
! align="LEFT" width="67" |Name
 +
! align="LEFT" width="215" |Proposed Unabbreviated Name/Entry Content Description
 +
|-
 +
| align="RIGHT" height="17" sdnum="1033;" sdval="0" |'''0'''
 +
| align="LEFT" |'''NONE'''
 +
| align="LEFT" |'''None'''
 +
|-
 +
| align="RIGHT" height="17" sdnum="1033;" sdval="1" |1
 +
| align="LEFT" |SVTX
 +
| align="LEFT" |Object Model Vertices/Animation
 +
|-
 +
| align="RIGHT" height="17" sdnum="1033;" sdval="2" |2
 +
| align="LEFT" |TGEO
 +
| align="LEFT" |Object Model Polygons and Textures
 +
|-
 +
| align="RIGHT" height="17" sdnum="1033;" sdval="3" |3
 +
| align="LEFT" |WGEO
 +
| align="LEFT" |World Geometry
 +
|-
 +
| align="RIGHT" height="17" sdnum="1033;" sdval="4" |4
 +
| align="LEFT" |SLST
 +
| align="LEFT" |Display List
 +
|-
 +
| align="RIGHT" height="17" sdnum="1033;" sdval="5" |5
 +
| align="LEFT" |TPAG
 +
| align="LEFT" |Texture Page
 +
|-
 +
| align="RIGHT" height="17" sdnum="1033;" sdval="6" |'''6'''
 +
| align="LEFT" |'''LDAT'''
 +
| align="LEFT" |'''Level Data'''
 +
|-
 +
| align="RIGHT" height="17" sdnum="1033;" sdval="7" |7
 +
| align="LEFT" |ZDAT
 +
| align="LEFT" |Zone Data
 +
|-
 +
| align="RIGHT" height="17" sdnum="1033;" sdval="8" |'''8'''
 +
| align="LEFT" |'''CPAT'''
 +
| align="LEFT" |'''Color Palette'''
 +
|-
 +
| align="RIGHT" height="17" sdnum="1033;" sdval="9" |'''9'''
 +
| align="LEFT" |'''BINF'''
 +
| align="LEFT" |'''Binary File'''
 +
|-
 +
| align="RIGHT" height="17" sdnum="1033;" sdval="10" |'''10'''
 +
| align="LEFT" |'''OPAT'''
 +
| align="LEFT" |'''Object/Process Allocation Table'''
 +
|-
 +
| align="RIGHT" height="17" sdnum="1033;" sdval="11" |11
 +
| align="LEFT" |GOOL
 +
| align="LEFT" |GOOL Executable
 +
|-
 +
| align="RIGHT" height="17" sdnum="1033;" sdval="12" |12
 +
| align="LEFT" |ADIO
 +
| align="LEFT" |Audio
 +
|-
 +
| align="RIGHT" height="17" sdnum="1033;" sdval="13" |13
 +
| align="LEFT" |MIDI
 +
| align="LEFT" |Music
 +
|-
 +
| align="RIGHT" height="17" sdnum="1033;" sdval="14" |14
 +
| align="LEFT" |INST
 +
| align="LEFT" |Instruments
 +
|-
 +
| align="RIGHT" height="17" sdnum="1033;" sdval="15" |15
 +
| align="LEFT" |VCOL
 +
| align="LEFT" |Special collision rules/map
 +
|-
 +
| align="RIGHT" height="17" sdnum="1033;" sdval="16" |'''16'''
 +
| align="LEFT" |'''LINK'''
 +
| align="LEFT" |'''Link to another entry?'''
 +
|-
 +
| align="RIGHT" height="17" sdnum="1033;" sdval="17" |'''17'''
 +
| align="LEFT" |'''MDAT'''
 +
| align="LEFT" |'''Map Data'''
 +
|-
 +
| align="RIGHT" height="17" sdnum="1033;" sdval="18" |'''18'''
 +
| align="LEFT" |'''IPAL'''
 +
| align="LEFT" |'''Palettes for fading transitions'''
 +
|-
 +
| align="RIGHT" height="17" sdnum="1033;" sdval="19" |19
 +
| align="LEFT" |PBAK
 +
| align="LEFT" |Demo playback
 +
|-
 +
| align="RIGHT" height="17" sdnum="1033;" sdval="20" |20
 +
| align="LEFT" |SDIO
 +
| align="LEFT" |Speech audio
 +
|-
 +
| align="RIGHT" height="17" sdnum="1033;" sdval="20" |21
 +
| align="LEFT" |VIDO
 +
| align="LEFT" |Sprite
 +
|}
 +
Note: LDAT entries for each level are mentioned in the NSD, meaning they were in the NSF at some point.
 +
=== Crash 3 ===
 +
There are a total of 22 subsystems in Crash 3. 
 +
 +
Note that entries of type 0 do not exist. For this reason, the first subsystem has the name NONE. 
 +
 +
Bolded entries in the table indicate that (while the subsystem exists) there do not exist entries of that subsystem type in any NSF file.
 +
{| class="article-table" border="1" cellspacing="0" rules="NONE" cols="3"
 +
! align="LEFT" height="47" width="69" |ID       
 +
! align="LEFT" width="67" |Name
 +
! align="LEFT" width="215" |Proposed Unabbreviated Name/Entry Content Description
 +
|-
 +
| align="RIGHT" height="17" sdnum="1033;" sdval="0" |'''0'''
 +
| align="LEFT" |'''NONE'''
 +
| align="LEFT" |'''None'''
 +
|-
 +
| align="RIGHT" height="17" sdnum="1033;" sdval="1" |1
 +
| align="LEFT" |SVTX
 +
| align="LEFT" |Object Model Vertices/Animation
 +
|-
 +
| align="RIGHT" height="17" sdnum="1033;" sdval="2" |2
 +
| align="LEFT" |TGEO
 +
| align="LEFT" |Object Model Polygons and Textures
 +
|-
 +
| align="RIGHT" height="17" sdnum="1033;" sdval="3" |3
 +
| align="LEFT" |WGEO
 +
| align="LEFT" |World Geometry
 +
|-
 +
| align="RIGHT" height="17" sdnum="1033;" sdval="4" |4
 +
| align="LEFT" |SLST
 +
| align="LEFT" |Display List
 +
|-
 +
| align="RIGHT" height="17" sdnum="1033;" sdval="5" |5
 +
| align="LEFT" |TPAG
 +
| align="LEFT" |Texture Page
 +
|-
 +
| align="RIGHT" height="17" sdnum="1033;" sdval="6" |'''6'''
 +
| align="LEFT" |'''LDAT'''
 +
| align="LEFT" |'''Level Data'''
 +
|-
 +
| align="RIGHT" height="17" sdnum="1033;" sdval="7" |7
 +
| align="LEFT" |ZDAT
 +
| align="LEFT" |Zone Data
 +
|-
 +
| align="RIGHT" height="17" sdnum="1033;" sdval="8" |'''8'''
 +
| align="LEFT" |'''CPAT'''
 +
| align="LEFT" |'''Color Palette'''
 +
|-
 +
| align="RIGHT" height="17" sdnum="1033;" sdval="9" |'''9'''
 +
| align="LEFT" |'''BINF'''
 +
| align="LEFT" |'''Binary File'''
 +
|-
 +
| align="RIGHT" height="17" sdnum="1033;" sdval="10" |'''10'''
 +
| align="LEFT" |'''OPAT'''
 +
| align="LEFT" |'''Object/Process Allocation Table'''
 +
|-
 +
| align="RIGHT" height="17" sdnum="1033;" sdval="11" |11
 +
| align="LEFT" |GOOL
 +
| align="LEFT" |GOOL Executable
 +
|-
 +
| align="RIGHT" height="17" sdnum="1033;" sdval="12" |12
 +
| align="LEFT" |ADIO
 +
| align="LEFT" |Audio
 +
|-
 +
| align="RIGHT" height="17" sdnum="1033;" sdval="13" |13
 +
| align="LEFT" |MIDI
 +
| align="LEFT" |Music
 +
|-
 +
| align="RIGHT" height="17" sdnum="1033;" sdval="14" |14
 +
| align="LEFT" |INST
 +
| align="LEFT" |Instruments
 +
|-
 +
| align="RIGHT" height="17" sdnum="1033;" sdval="15" |15
 +
| align="LEFT" |VCOL
 +
| align="LEFT" |Special collision rules/map
 +
|-
 +
| align="RIGHT" height="17" sdnum="1033;" sdval="16" |'''16'''
 +
| align="LEFT" |'''LINK'''
 +
| align="LEFT" |'''Link to another entry?'''
 +
|-
 +
| align="RIGHT" height="17" sdnum="1033;" sdval="17" |17
 +
| align="LEFT" |RAWD
 +
| align="LEFT" |Special data/raw data
 +
|-
 +
| align="RIGHT" height="17" sdnum="1033;" sdval="18" |'''18'''
 +
| align="LEFT" |'''IPAL'''
 +
| align="LEFT" |'''Palettes for fading transitions'''
 +
|-
 +
| align="RIGHT" height="17" sdnum="1033;" sdval="19" |19
 +
| align="LEFT" |PBAK
 +
| align="LEFT" |Demo playback
 +
|-
 +
| align="RIGHT" height="17" sdnum="1033;" sdval="20" |20
 +
| align="LEFT" |SDIO
 +
| align="LEFT" |Speech audio
 +
|-
 +
| align="RIGHT" height="17" sdnum="1033;" sdval="20" |21
 +
| align="LEFT" |VIDO
 +
| align="LEFT" |Sprite
 +
|}
 +
Note: LDAT entries for each level are mentioned in the NSD, meaning they were in the NSF at some point.

Latest revision as of 17:44, 27 April 2019

A subsystem is a self-contained system within a larger system. In each of the Crash games, there exist a number of different subsystems. Each subsystem handles a different aspect of the game's function. Many of these subsystems are associated with the type of entry that they primarily operate upon. In fact, an entry's type is just the ID of the subsystem that operates upon its data; thus, both terms entry type and subsystem ID are inclusively interchangeable with subsystem type.

Subsystem Table

Each of the Crash games has a subsystem table. Each entry in the subsystem table contains a 4 character acronym or identifier string, and a number of callback functions specific to the subsystem with that identifier.

Location

The subsystem table is located at the following addresses in each of the Crash games:

  • Crash 1 - 0x514DC

Structure

The subsystem table has the following structure in each of the Crash games, with the exception that Crash 2 (and 3?) omit the last callback, (*deinit)():

struct subsystem
{
  char name[4];
  unsigned long pad;
  void (*init)();
  void (*postinit)();
  void (*onload)(entry*);
  void (*onfree)(entry*);
  void (*deinit)();
} subsystems[NS_COUNT_SUBSYSTEMS];

Subsystem name

Each subsystem specifies a 4 character acronym as its name. See below for a list of the subsystem names in each game.

Callbacks

Each entry in the subsystem table may or may not specify the following callbacks:

  • init - Called during subsystem initialization to initialize this subsystem
  • postinit - Called during subsystem initialization after...
  • onload - Called after an entry of this subsystem type is paged into memory
  • onfree - Called after an entry of this subsystem type is loaded out of memory
  • deinit - Called during subsystem deinitialization (Crash 1 only)

The init and postinit callbacks of each subsystem are called during Paging and Subsystem Initialization; each of these callbacks refers to a routine that initializes its associated subsystem. ... All together, a subsystem's callbacks simulate 5 polymorphic functions that would otherwise override a subsystem base class's virtual functions of the same name.

Subsystem names

Crash 1

There are a total of 21 subsystems in Crash 1.

Note that entries of type 0 do not exist. For this reason, the first subsystem has the name NONE.

Bolded entries in the table indicate that (while the subsystem exists) there do not exist entries of that subsystem type in any NSF file.

ID Name Proposed Unabbreviated Name/Entry Content Description
0 NONE None
1 SVTX Object Model Vertices/Animation
2 TGEO Object Model Polygons
3 WGEO World Geometry
4 SLST Display List
5 TPAG Texture Page
6 LDAT Level Data
7 ZDAT Zone Data
8 CPAT Color Palette
9 BINF Binary File
10 OPAT Object/Process Allocation Table
11 GOOL GOOL Executable
12 ADIO Audio
13 MIDI Music
14 INST Instruments
15 IMAG Image Data
16 LINK Link to another entry?
17 MDAT Map Data
18 IPAL Palettes for fading transitions
19 PBAK Demo playback
20 CVTX Cutscene Model Vertices/Animation

Crash 2

There are a total of 22 subsystems in Crash 2.

Note that entries of type 0 do not exist. For this reason, the first subsystem has the name NONE.

Bolded entries in the table indicate that (while the subsystem exists) there do not exist entries of that subsystem type in any NSF file.

ID Name Proposed Unabbreviated Name/Entry Content Description
0 NONE None
1 SVTX Object Model Vertices/Animation
2 TGEO Object Model Polygons and Textures
3 WGEO World Geometry
4 SLST Display List
5 TPAG Texture Page
6 LDAT Level Data
7 ZDAT Zone Data
8 CPAT Color Palette
9 BINF Binary File
10 OPAT Object/Process Allocation Table
11 GOOL GOOL Executable
12 ADIO Audio
13 MIDI Music
14 INST Instruments
15 VCOL Special collision rules/map
16 LINK Link to another entry?
17 MDAT Map Data
18 IPAL Palettes for fading transitions
19 PBAK Demo playback
20 SDIO Speech audio
21 VIDO Sprite

Note: LDAT entries for each level are mentioned in the NSD, meaning they were in the NSF at some point.

Crash 3

There are a total of 22 subsystems in Crash 3.

Note that entries of type 0 do not exist. For this reason, the first subsystem has the name NONE.

Bolded entries in the table indicate that (while the subsystem exists) there do not exist entries of that subsystem type in any NSF file.

ID Name Proposed Unabbreviated Name/Entry Content Description
0 NONE None
1 SVTX Object Model Vertices/Animation
2 TGEO Object Model Polygons and Textures
3 WGEO World Geometry
4 SLST Display List
5 TPAG Texture Page
6 LDAT Level Data
7 ZDAT Zone Data
8 CPAT Color Palette
9 BINF Binary File
10 OPAT Object/Process Allocation Table
11 GOOL GOOL Executable
12 ADIO Audio
13 MIDI Music
14 INST Instruments
15 VCOL Special collision rules/map
16 LINK Link to another entry?
17 RAWD Special data/raw data
18 IPAL Palettes for fading transitions
19 PBAK Demo playback
20 SDIO Speech audio
21 VIDO Sprite

Note: LDAT entries for each level are mentioned in the NSD, meaning they were in the NSF at some point.