Super Mario 64 DS hacking resource by Mega-Mario 0. Table of Contents 1. The basics 2. The level headers 3. The internal file IDs 1. The basics Details about files and overlays inside a NDS ROM can be found in GBATek. The game's levels have headers that define the objects in the level, the music played, the sky used, and such. These headers are stored in the ROM's overlays, at a different offset inside each overlay for each level. The table below tells the overlay ID and header offset for each level. Note: in different versions of the game, certain levels' headers may be located at different offsets. The table only tells the offsets for European and USA ROMs, and therefore is not complete. Level ID Level Overlay ID Header offset EUR USA 0 Test map #1 8 0x70 1 Castle Grounds 9 0x1A3C 2 Castle - 1st floor 10 0x10FC 3 Castle Backyards 11 0x20C 4 Castle - basement 12 0xAB4 5 Castle - 2nd floor 13 0x6A4 6 Bob-Omb Battlefield 14 0x2294 7 Whomp's Fortress 15 0x2378 0x2358 8 Jolly Roger Bay 16 0x29F0 9 Jolly Roger Bay - ship 17 0x8D8 10 Cool, Cool Mountain 18 0x1D8C 11 Cool, Cool Mountain - slider 19 0x1AC8 12 Big Boo's Haunt 20 0x275C 13 Hazy Maze Cave 21 0x2724 0x2704 14 Lethal Lava Land 22 0x2088 15 Lethal Lava Land - volcano 23 0x9E8 16 Shifting Sand Land 24 0x1814 17 Shifting Sand Land - pyramid 25 0x1A4C 18 Dire, Dire Docks 26 0x1DB8 19 Snowman's Land 27 0x1F2C 20 Snowman's Land - igloo 28 0x230 21 Wet-Dry World 29 0x1E30 22 Tall Tall Mountain 30 0x3D08 0x3C48 23 Tall Tall Mountain - slider 31 0x3BC 24 Tiny-Huge Island - huge 32 0x1DDC 0x1DBC 25 Tiny-Huge Island - tiny 33 0xA40 26 Tiny-Huge Island - mountain 34 0x2F58 0x2F78 27 Tick Tock Clock 35 0xF1C 28 Rainbow Ride 36 0x18CC 0x190C 29 The Princess' Secret Slide 37 0x4C 30 The Secret Aquarium 38 0x78 31 ? Switch 39 0x298 32 The Secret Under the Moat 40 0x88 33 "Metal Switch" 41 0x78C 34 Over the Rainbows 42 0x78 35 Bowser in the Dark World - map 43 0x9A4 36 Bowser in the Dark World - fight 44 0x210 37 Bowser in the Fire Sea - map 45 0x1334 0x1314 38 Bowser in the Fire Sea - fight 46 0x3C0 39 Bowser in the Sky - map 47 0x8B8 40 Bowser in the Sky - fight 48 0x484 41 Test map #2 49 0x5C 42 "Vs Cross" 50 0x64 43 "Vs Island" 51 0x36C 44 Goomboss Battle - map 52 0xB28 45 Goomboss Battle - fight 53 0x1358 46 Big Boo Battle - map 54 0x110 47 Big Boo Battle - fight 55 0x7F4 48 Chief Chilly Challenge - map 56 0x1AAC 49 Chief Chilly Challenge - fight 57 0x380 50 Play Room 58 0x5C8 51 "Vs Main" 59 0x3A8 Note that the overlays are compressed. Here (http://nsmb-editor.googlecode.com/svn/trunk/NSMBe4/ROM.cs) is overlay decompression code by Treeki (look for DecompressOverlay()). 2. The level headers The header of a level is found inside its overlay at the offset specified in the previous table. It is 28 bytes long and is formatted as such: Offset Size Description 0x00 4 ??? 0x04 4 ??? 0x08 2 File ID(*) of the course 3D model 0x0A 2 File ID(*) of the course collision map 0x0C 2 File ID(*) of the minimap tileset 0x0E 2 File ID(*) of the minimap palette 0x10 4 Address(**) of the object tables list 0x14 1 Number of object tables 0x15 1 ??? 0x16 2 World/minimap position scale. Units unknown. 0x18 1 Bit 0-3: ??? (always 0xF) | Bit 4-7: skybox (1-11, or 0=none) 0x19 3 ??? (always zero) (*) - Internal file ID. The way they are interpreted is described in 3. The internal file IDs. (**) - RAM address. Subtract the overlay's base RAM address to it to get an offset inside the overlay. 3. The internal file IDs The file IDs found in the levels' headers, and maybe others, are internal file IDs. The game interprets them in two possible ways: 3.1. If the internal ID is below 0x8000 The game reads a NitroFS file ID from a table that maps internal file IDs below 0x8000 to NitroFS file IDs. This table is generated upon startup, from a table found in overlay 0 that maps internal file IDs to filenames. For European ROMs: the overlay 0 table contains 2058 entries and is located at offset 0x13098. For USA ROMs: the table contains 1824 entries and is located at offset 0x1123C. 3.2. If the internal ID is above (or equal to) 0x8000 The corresponding file is located in a NARC archive. Bit 8-11 of the ID tell the NARC file to look in (1 = ARCHIVE/vs1.narc, 2 = ARCHIVE/vs2.narc, ...). Bit 0-7 of the ID tell the ID of the file inside the NARC archive.