Difference between revisions of "Entry"

From Crash Bandicoot Hacking Wiki
Jump to navigation Jump to search
(Created page with "Entries are the intermediate level data containers in NSF files. They are containers for 'items'-the lowest level data containers in NSF files. == Format == {| class="article...")
 
(Types)
 
(11 intermediate revisions by 5 users not shown)
Line 56: Line 56:
 
</syntaxhighlight>
 
</syntaxhighlight>
 
== Types ==
 
== Types ==
An entry's type determines the specific kind of content contained in its items.  
+
An entry's type determines the specific kind of content contained in its items.
{|
+
{| border="1"
+
|Type
|Type
 
 
|Name
 
|Name
 
|Subsystem
 
|Subsystem
 
|Description
 
|Description
 
|-
 
|-
| 1
+
|1
|Object Model Vertices/Animation  
+
|Object Model Vertices/Animation
 
|SVTX
 
|SVTX
|contains multiple key frames of animation for an object
+
|contains frames of shaded vertex animation for an object
|-
+
|-
| 2
+
|2
|Object Model Polygons 
+
|Object Model Geometry
 
|TGEO
 
|TGEO
 
|contains polygons used by a Type 1 entry
 
|contains polygons used by a Type 1 entry
|-
+
|-
| 3
+
|3
|World Geometry          
+
|World Geometry
 
|WGEO
 
|WGEO
 
|contains polygons and vertices for a section of the level
 
|contains polygons and vertices for a section of the level
|-
+
|-
| 4
+
|4
|Display List          
+
|Display List/Sort List
 
|SLST
 
|SLST
 
|contains delta encoded display lists, describing the change in z-ordering of polygon primitives at each point of a corresponding camera path
 
|contains delta encoded display lists, describing the change in z-ordering of polygon primitives at each point of a corresponding camera path
|-
+
|-
| 5
+
|5
|Texture Page          
+
|Texture Page
 
|TPAG
 
|TPAG
 
|describes texture/palette data used by polygons
 
|describes texture/palette data used by polygons
|-
+
|-
| 6
+
|6
|Level Data            
+
|Level Data
 
|LDAT
 
|LDAT
 
|contains a level's initial settings such as Crash's starting location
 
|contains a level's initial settings such as Crash's starting location
|-
+
|-
| 7
+
|7
|Zone Data            
+
|Zone Data
 
|ZDAT
 
|ZDAT
|contains a 'zone'-a collection of world models to render, objects to spawn, a camera path, collision octree, and misc attributes
+
|contains a 'zone' - a collection of world models to render, objects to spawn, a camera path, collision octree, and misc attributes
|-
+
|-
| 11  
+
|11
|GOOL Executable      
+
|GOOL Executable
 
|GOOL
 
|GOOL
 
|contains a header, compiled GOOL bytecode, const pool, state map, state descriptors, and animation sequence/text/sprite descriptors for an object
 
|contains a header, compiled GOOL bytecode, const pool, state map, state descriptors, and animation sequence/text/sprite descriptors for an object
|-
+
|-
| 12  
+
|12
|Audio
+
|Audio
 
|ADIO
 
|ADIO
|contains audio data for a sound effect
+
|contains audio data for a single sound effect
|-
+
|-
| 13  
+
|13
|MIDI
 
 
|MIDI
 
|MIDI
|contains the MIDI sequence for a level's background music
+
|MIDI
|-
+
|contains the MIDI sequence(s) for a level's background music (SEP) and/or a wavebank header (VH)
| 14  
+
|-
|Instruments
+
|14
 +
|Instruments
 
|INST
 
|INST
|describes instruments used to play a MIDI
+
|describes instrument data used to play a MIDI (VB)
|-
+
|-
| 15  
+
|15
|Image Data
+
|Image Data (Crash 1)<br />Video? Collision (Crash 2/3)
|IMAG
+
|IMAG (Crash 1)<br />VCOL (Crash 2/3)
|contains image data (for the loading screens?)
+
|contains raw image data (i.e. anti-piracy message, SCE screen)<sup>1</sup> (Crash 1)<br />contains special collision detection rules? (i.e. digging, chased by boulder) (Crash 2/3)
|-
+
|-
| 17  
+
|17
|Map Data
+
|Map Data (Crash 1)<br />Raw Data (Crash 3)
|MDAT
+
|MDAT (Crash 1)<br />RAWD (Crash 3)
|contains data describing how a new level should be loaded when selected
+
|contains data describing how a 16-bit image should be displayed on-screen (Crash 1)<br />contains miscellaneous 3D terrain data (scenery in baron levels, water in levels with water) (Crash 3)
|-
+
|-
| 18  
+
|18
|Palettes for fading transitions
+
|Palettes
 
|IPAL
 
|IPAL
|describes the CLUTs used during a fade transition
+
|describes a list of 256-color CLUTs used for IMAG and MDAT entries
|-
+
|-
| 19  
+
|19
|Demo playback
+
|Demo playback
 
|PBAK
 
|PBAK
|contains a pre-recorded sequence of button presses for playback  
+
|contains a pre-recorded sequence of button presses for playback
|-
+
|-
| 20  
+
|20
|Cutscene Model
+
|Colored Animation
Vertices/Animation
+
Vertices/Animation (Crash 1)<br />Stream Audio (Crash 2/3)
|CVTX
+
|CVTX (Crash 1)<br />SDIO (Crash 2/3)
|contain vertices for cutscene models
+
|contains frames of colored but non-shaded colored vertex animation for an object (Crash 1)<br />contains streamable audio (Crash 2/3)
+
|-
 +
|21
 +
|2D Animation/Video (Crash 2/3)
 +
|VIDO (Crash 2/3)
 +
|contains data for a sprite, animated or not (i.e. mount texture while digging, warp portal, save icons)
 
|}
 
|}
 +
<sup>1</sup> - NSD files may contain these kinds of entries, but without any header.
  
 
== Entry IDs/EIDs ==
 
== Entry IDs/EIDs ==
Line 361: Line 365:
 
=== Null EID ===
 
=== Null EID ===
 
The EID with value <code>0x6396347F</code>, which translates to <code>NONE!</code>, is used frequently throughout the game code. It represents a null EID.
 
The EID with value <code>0x6396347F</code>, which translates to <code>NONE!</code>, is used frequently throughout the game code. It represents a null EID.
 +
[[Category:Structure]]

Latest revision as of 20:16, 14 November 2022

Entries are the intermediate level data containers in NSF files. They are containers for 'items'-the lowest level data containers in NSF files.

Format

Offset Field Size Value
0x0 Magic Number 4 bytes 0x100FFFF
0x4 ID 4 bytes *
0x8 Type 4 bytes *
0xC Item Count 4 bytes c
0x10 Item Offsets c x 4 bytes *
0x10 + (c x 4) Items c x * bytes *

Structure

struct entry
{
  const unsigned long magic = 0x100FFFF;
  unsigned long EID;
  unsigned long type;
  unsigned long itemcount;
  union
  {
    unsigned long itemoffset[itemcount];
    item *itemptr[itemcount];
  };
  item items[itemcount];
};

Types

An entry's type determines the specific kind of content contained in its items.

Type Name Subsystem Description
1 Object Model Vertices/Animation SVTX contains frames of shaded vertex animation for an object
2 Object Model Geometry TGEO contains polygons used by a Type 1 entry
3 World Geometry WGEO contains polygons and vertices for a section of the level
4 Display List/Sort List SLST contains delta encoded display lists, describing the change in z-ordering of polygon primitives at each point of a corresponding camera path
5 Texture Page TPAG describes texture/palette data used by polygons
6 Level Data LDAT contains a level's initial settings such as Crash's starting location
7 Zone Data ZDAT contains a 'zone' - a collection of world models to render, objects to spawn, a camera path, collision octree, and misc attributes
11 GOOL Executable GOOL contains a header, compiled GOOL bytecode, const pool, state map, state descriptors, and animation sequence/text/sprite descriptors for an object
12 Audio ADIO contains audio data for a single sound effect
13 MIDI MIDI contains the MIDI sequence(s) for a level's background music (SEP) and/or a wavebank header (VH)
14 Instruments INST describes instrument data used to play a MIDI (VB)
15 Image Data (Crash 1)
Video? Collision (Crash 2/3)
IMAG (Crash 1)
VCOL (Crash 2/3)
contains raw image data (i.e. anti-piracy message, SCE screen)1 (Crash 1)
contains special collision detection rules? (i.e. digging, chased by boulder) (Crash 2/3)
17 Map Data (Crash 1)
Raw Data (Crash 3)
MDAT (Crash 1)
RAWD (Crash 3)
contains data describing how a 16-bit image should be displayed on-screen (Crash 1)
contains miscellaneous 3D terrain data (scenery in baron levels, water in levels with water) (Crash 3)
18 Palettes IPAL describes a list of 256-color CLUTs used for IMAG and MDAT entries
19 Demo playback PBAK contains a pre-recorded sequence of button presses for playback
20 Colored Animation

Vertices/Animation (Crash 1)
Stream Audio (Crash 2/3)

CVTX (Crash 1)
SDIO (Crash 2/3)
contains frames of colored but non-shaded colored vertex animation for an object (Crash 1)
contains streamable audio (Crash 2/3)
21 2D Animation/Video (Crash 2/3) VIDO (Crash 2/3) contains data for a sprite, animated or not (i.e. mount texture while digging, warp portal, save icons)

1 - NSD files may contain these kinds of entries, but without any header.

Entry IDs/EIDs

Like chunks, each entry has also been assigned a unique ID. Unlike CIDs, however, entry IDs (EIDs) have not been precomputed based on index. Each EID encodes a unique 5 character identifier string. Each entry has been assigned an EID that encodes an appropriate identifier.

Encoding scheme

EIDs use the following [32 bit] encoding scheme:

0EEEEEEDDDDDDCCCCCCBBBBBBAAAAAA1

where the [6 bit] fields A, B, C, D, and E, respectively, in that order, are indices of 5 characters in the following conversion table:

Index 0 1 2 3 4 5 6 7 8 9 A B C D E F
Char 0 1 2 3 4 5 6 7 8 9 a b c d e f
Index 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
Char g h i j k l m n o p q r s t u v
Index 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
Char w x y z A B C D E F G H I J K L
Index 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
Char M N O P Q R S T U V W X Y Z _ !

The conversion table above is used by the EID encoding and decoding routines and is located at the following addresses in each of the Crash games:

  • Crash 1 - 0x51728

Null EID

The EID with value 0x6396347F, which translates to NONE!, is used frequently throughout the game code. It represents a null EID.