Difference between revisions of "Entry"

From Crash Bandicoot Hacking Wiki
Jump to navigation Jump to search
(Types)
(Adding categories)
Line 365: 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]]

Revision as of 13:28, 8 August 2016

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 multiple key frames of animation for an object
2 Object Model Polygons 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 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 sound effect
13 MIDI MIDI contains the MIDI sequence(s) for a level's background music and/or a wavebank header (VH)
14 Instruments INST describes instruments used to play a MIDI
15 Image Data (Crash 1)
Video Collision (Crash 2/3)
IMAG (Crash 1)
VCOL (Crash 2/3)
contains 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 new level should be loaded when selected (Crash 1)
contains miscellaneous 3D terrain data (scenery in baron levels, water in levels with water) (Crash 3)
18 Palettes for fading transitions IPAL describes the CLUTs used during a fade transition
19 Demo playback PBAK contains a pre-recorded sequence of button presses for playback
20 Cutscene Model

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

CVTX (Crash 1)
SDIO (Crash 2/3)
contains vertices for cutscene models (Crash 1)
contains speech 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 in Crash 1 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.