Difference between revisions of "NSD"

From Crash Bandicoot Hacking Wiki
Jump to navigation Jump to search
(Crash 1)
(Crash 2)
 
(9 intermediate revisions by 4 users not shown)
Line 1: Line 1:
NSD is a custom file format created by Naughty Dog for use in the Crash games. The [[CD-ROM Directory Structure|root directory]] of a Crash game CD will have several sub-directories, with names S0, S1, S2, and S3; within these sub-directories are pairs of files with the name S00000**.NSD/.NSF. Each pair corresponds to a specific level in the game, and these files contain the game data for that level. An NSD file is essentially an index for its paired NSF file, but in Crash 1 it contains additional information such as a level descriptor/header and a loading screen descriptor.  
+
NSD (most likely to stand for '''N'''aughty Dog '''S'''oftware '''D'''ata or '''N'''aughty Dog '''S'''ystem '''D'''ata) is a custom file format created by Naughty Dog for use in the Crash games. The [[CD-ROM Directory Structure|root directory]] of a Crash game CD will have several sub-directories, with names S0, S1, S2, and S3; within these sub-directories are pairs of files with the name S00000**.NSD/.NSF. Each pair corresponds to a specific "level" in the game, and these files contain the game data for that level. An NSD file is essentially an index for its paired NSF file, but it also contains additional information such as a level descriptor/header and a loading screen descriptor.  
  
 
== Format ==
 
== Format ==
 
+
=== Crash 1 Prototype ===
 +
{| class="article-table"
 +
!Offset
 +
!Field
 +
!Size
 +
!Value
 +
|-
 +
|0x0
 +
|Entry Hash Table Offsets
 +
|4 bytes x 256
 +
|*
 +
|-
 +
|0x400
 +
|Chunk Count
 +
|4 bytes
 +
|c
 +
|-
 +
|0x404
 +
|Entry Count
 +
|4 bytes
 +
|s
 +
|-
 +
|0x408
 +
|Entry Hash Table
 +
|4 bytes x 2 x s
 +
|*
 +
|}
 +
Remaining data (object type --> executable EID type, level ID, initial zone EID and magic number) is stored inside an LDAT entry in the respective NSF file.
 
=== Crash 1 ===
 
=== Crash 1 ===
 
{| class="article-table"
 
{| class="article-table"
Line 11: Line 38:
 
|-
 
|-
 
|0x0
 
|0x0
|Entry Hash Table Offsets
+
|Entry Hash Table Offsets<!--Setting this whole list to 0 or adding entries to the NSD without changing this does not affect the game at all-->
 
|4 bytes x 256
 
|4 bytes x 256
 
|*
 
|*
Line 26: Line 53:
 
|-
 
|-
 
|0x408
 
|0x408
|Unknown
+
|Entry containing object type -> executable EID type(**)
 
|4 bytes
 
|4 bytes
 
|*
 
|*
Line 46: Line 73:
 
|-
 
|-
 
|0x418
 
|0x418
|Offset of Uncompressed Chunks
+
|Offset of Uncompressed Chunks (in sectors)
 
|4 bytes
 
|4 bytes
 
|*
 
|*
Line 56: Line 83:
 
|-
 
|-
 
|0x420
 
|0x420
|Compressed Chunk Offsets
+
|Compressed Chunk Info (size 6 bits in sectors, then offset in sectors)
 
|4 bytes x 64
 
|4 bytes x 64
 
|*
 
|*
Line 81: Line 108:
 
|-
 
|-
 
|0x520 + (8 x s) + 0xC
 
|0x520 + (8 x s) + 0xC
|Initial Camera Path (Item Index)
+
|Initial Camera Path (Camera Item Index)
 
|4 bytes
 
|4 bytes
 
|*
 
|*
Line 95: Line 122:
 
|*
 
|*
 
|-
 
|-
|?  
+
|0x520 + (8 x s) + 0x118
|Descriptor for 'loading screen' image
+
|Misc images (loading screens, etc.)
|?
+
|62720 bytes each image
|
+
|}
 +
<nowiki>(**) - Possibly completely useless.</nowiki>
 +
 
 +
===Crash 2===
 +
{| class="article-table"
 +
!Offset
 +
!Field
 +
!Size
 +
!Value
 +
|-
 +
|0x0
 +
|Entry Hash Table Offsets
 +
|4 bytes x 256
 +
|*
 +
|-
 +
|0x400
 +
|Chunk Count
 +
|4 bytes
 +
|c
 +
|-
 +
|0x404
 +
|Entry Count
 +
|4 bytes
 +
|s
 +
|-
 +
|0x408
 +
|Entry containing object type -> executable EID type(**) (DAT?L where ? is the level's ID shortened to 1 character)
 +
|4 bytes
 +
|*
 +
|-
 +
|0x40C
 +
|Unknown
 +
|4 bytes
 +
|*
 +
|-
 +
|0x410
 +
|Unknown
 +
|4 bytes
 +
|*
 +
|-
 +
|0x414
 +
|Unknown
 +
|4 bytes
 +
|*
 +
|-
 +
|0x418
 +
|Unknown
 +
|4 bytes
 +
|*
 +
|-
 +
|0x41C
 +
|Unknown
 +
|4 bytes
 +
|*
 +
|-
 +
|0x420
 +
|Unknown
 +
|4 bytes x 64
 +
|*
 +
|-
 +
|0x520
 +
|Entry Hash Table
 +
|4 bytes x 2 x s
 +
|*
 +
|-
 +
|0x520 + (8 x s)
 +
|Number of spawn points present in the NSD
 +
|4 bytes
 +
|p
 +
|-
 +
|0x520 + (8 x s) + 0x4
 +
|Unknown
 +
|4 bytes
 +
|*
 +
|-
 +
|0x520 + (8 x s) + 0x8
 +
|Level ID
 +
|4 bytes
 +
|*
 +
|-
 +
|0x520 + (8 x s) + 0xC
 +
|Entity count
 +
|4 bytes
 +
|*
 +
|-
 +
|0x520 + (8 x s) + 0x10
 +
|Object Type -> Executable EID map
 +
|4 bytes x 64
 +
|*
 +
|-
 +
|0x520 + (8 x s) + 0x1DC
 +
|Spawn points (semi-optional, only starting spawn points are needed)
 +
|24 bytes x p
 +
|*
 +
|-
 +
|0x520 + (8 x s) + 0x1DC + (24 x p)
 +
|Misc images (loading screens, etc.)
 +
|62720 bytes each
 +
|*
 +
|}
 +
<nowiki>(**) - Possibly completely useless.</nowiki>
 +
 
 +
===Crash 3===
 +
{| class="article-table"
 +
!Offset
 +
!Field
 +
!Size
 +
!Value
 +
|-
 +
|0x0
 +
|Entry Hash Table Offsets
 +
|4 bytes x 256
 +
|*
 +
|-
 +
|0x400
 +
|Chunk Count
 +
|4 bytes
 +
|c
 +
|-
 +
|0x404
 +
|Entry Count
 +
|4 bytes
 +
|s
 +
|-
 +
|0x408
 +
|Entry containing object type -> executable EID type(**) (DAT?L where ? is the level's ID shortened to 1 character)
 +
|4 bytes
 +
|*
 +
|-
 +
|0x40C
 +
|Unknown
 +
|4 bytes
 +
|*
 +
|-
 +
|0x410
 +
|Unknown
 +
|4 bytes
 +
|*
 +
|-
 +
|0x414
 +
|Unknown
 +
|4 bytes
 +
|*
 +
|-
 +
|0x418
 +
|Unknown
 +
|4 bytes
 +
|*
 +
|-
 +
|0x41C
 +
|Unknown
 +
|4 bytes
 +
|*
 +
|-
 +
|0x420
 +
|Unknown
 +
|4 bytes x 64
 +
|*
 +
|-
 +
|0x520
 +
|Entry Hash Table
 +
|4 bytes x 2 x s
 +
|*
 +
|-
 +
|0x520 + (8 x s) + 0x0
 +
|Spawn points present in the NSD count
 +
|4 bytes
 +
|p
 +
|-
 +
|0x520 + (8 x s) + 0x4
 +
|Unknown
 +
|4 bytes
 +
|*
 +
|-
 +
|0x520 + (8 x s) + 0x8
 +
|Level ID
 +
|4 bytes
 +
|*
 +
|-
 +
|0x520 + (8 x s) + 0xC
 +
|Object count
 +
|4 bytes
 +
|*
 +
|-
 +
|0x520 + (8 x s) + 0x14
 +
|Object Type -> Executable EID map
 +
|4 bytes x 128
 +
|*
 +
|-
 +
|0x520 + (8 x s) + 0x2DC
 +
|Spawn points (optional, only starting spawn points are needed)
 +
|24 bytes x p
 +
|*
 +
|-
 +
|0x520 + (8 x s) + 0x2DC + (24 x p)
 +
|Misc images (loading screens, etc.)
 +
|62720 bytes each
 +
|*
 
|}
 
|}
 +
<nowiki>(**) - Possibly completely useless.</nowiki>
  
 
== Structure ==
 
== Structure ==

Latest revision as of 22:35, 13 December 2019

NSD (most likely to stand for Naughty Dog Software Data or Naughty Dog System Data) is a custom file format created by Naughty Dog for use in the Crash games. The root directory of a Crash game CD will have several sub-directories, with names S0, S1, S2, and S3; within these sub-directories are pairs of files with the name S00000**.NSD/.NSF. Each pair corresponds to a specific "level" in the game, and these files contain the game data for that level. An NSD file is essentially an index for its paired NSF file, but it also contains additional information such as a level descriptor/header and a loading screen descriptor.

Format

Crash 1 Prototype

Offset Field Size Value
0x0 Entry Hash Table Offsets 4 bytes x 256 *
0x400 Chunk Count 4 bytes c
0x404 Entry Count 4 bytes s
0x408 Entry Hash Table 4 bytes x 2 x s *

Remaining data (object type --> executable EID type, level ID, initial zone EID and magic number) is stored inside an LDAT entry in the respective NSF file.

Crash 1

Offset Field Size Value
0x0 Entry Hash Table Offsets 4 bytes x 256 *
0x400 Chunk Count 4 bytes c
0x404 Entry Hash Table Size 4 bytes s
0x408 Entry containing object type -> executable EID type(**) 4 bytes *
0x40C Unknown 4 bytes *
0x410 Unknown 4 bytes *
0x414 Unknown 4 bytes *
0x418 Offset of Uncompressed Chunks (in sectors) 4 bytes *
0x41C Compressed Chunk Count 4 bytes *
0x420 Compressed Chunk Info (size 6 bits in sectors, then offset in sectors) 4 bytes x 64 *
0x520 Entry Hash Table 4 bytes x 2 x s *
0x520 + (8 x s) + 0x0 Level Header Magic Number 4 bytes 0x1
0x520 + (8 x s) + 0x4 Level ID 4 bytes *
0x520 + (8 x s) + 0x8 Initial Zone EID 4 bytes *
0x520 + (8 x s) + 0xC Initial Camera Path (Camera Item Index) 4 bytes *
0x520 + (8 x s) + 0x10 Unknown 4 bytes *
0x520 + (8 x s) + 0x14 Object Type -> Executable EID map 4 bytes x 64 *
0x520 + (8 x s) + 0x118 Misc images (loading screens, etc.) 62720 bytes each image

(**) - Possibly completely useless.

Crash 2

Offset Field Size Value
0x0 Entry Hash Table Offsets 4 bytes x 256 *
0x400 Chunk Count 4 bytes c
0x404 Entry Count 4 bytes s
0x408 Entry containing object type -> executable EID type(**) (DAT?L where ? is the level's ID shortened to 1 character) 4 bytes *
0x40C Unknown 4 bytes *
0x410 Unknown 4 bytes *
0x414 Unknown 4 bytes *
0x418 Unknown 4 bytes *
0x41C Unknown 4 bytes *
0x420 Unknown 4 bytes x 64 *
0x520 Entry Hash Table 4 bytes x 2 x s *
0x520 + (8 x s) Number of spawn points present in the NSD 4 bytes p
0x520 + (8 x s) + 0x4 Unknown 4 bytes *
0x520 + (8 x s) + 0x8 Level ID 4 bytes *
0x520 + (8 x s) + 0xC Entity count 4 bytes *
0x520 + (8 x s) + 0x10 Object Type -> Executable EID map 4 bytes x 64 *
0x520 + (8 x s) + 0x1DC Spawn points (semi-optional, only starting spawn points are needed) 24 bytes x p *
0x520 + (8 x s) + 0x1DC + (24 x p) Misc images (loading screens, etc.) 62720 bytes each *

(**) - Possibly completely useless.

Crash 3

Offset Field Size Value
0x0 Entry Hash Table Offsets 4 bytes x 256 *
0x400 Chunk Count 4 bytes c
0x404 Entry Count 4 bytes s
0x408 Entry containing object type -> executable EID type(**) (DAT?L where ? is the level's ID shortened to 1 character) 4 bytes *
0x40C Unknown 4 bytes *
0x410 Unknown 4 bytes *
0x414 Unknown 4 bytes *
0x418 Unknown 4 bytes *
0x41C Unknown 4 bytes *
0x420 Unknown 4 bytes x 64 *
0x520 Entry Hash Table 4 bytes x 2 x s *
0x520 + (8 x s) + 0x0 Spawn points present in the NSD count 4 bytes p
0x520 + (8 x s) + 0x4 Unknown 4 bytes *
0x520 + (8 x s) + 0x8 Level ID 4 bytes *
0x520 + (8 x s) + 0xC Object count 4 bytes *
0x520 + (8 x s) + 0x14 Object Type -> Executable EID map 4 bytes x 128 *
0x520 + (8 x s) + 0x2DC Spawn points (optional, only starting spawn points are needed) 24 bytes x p *
0x520 + (8 x s) + 0x2DC + (24 x p) Misc images (loading screens, etc.) 62720 bytes each *

(**) - Possibly completely useless.

Structure

Crash 1

struct NSD
{
  union
  {
    unsigned long entryhashoffsets[256];
    unsigned long *entryhashbuckets[256];
  }
  unsigned long chunkcount;
  unsigned long entryhashcount;
  unsigned long unk_408;
  unsigned long unk_40C;
  unsigned long unk_410;
  unsigned long unk_414;
  unsigned long uncompressedoffset;
  unsigned long compressedcount;
  unsigned long compressedoffsets[64];
  hashpair      entryhash[entryhashcount];
  struct levelheader
  {
    const unsigned long magic = ?
    unsigned long levelID;
    unsigned long firstzone;
    unsigned long firstcampath;
    unsigned long unknown;
    unsigned long execeidmap[64];
  };
};

Purpose

TBD