List of Header Blocks

Viewing revision 9 (by Thierry on 09-14-25, 11:55 am)
(revisions:  1  2  3  4  5  6  7  8  9  10  11  12  13  14  15 )

Contents
1. Block 1 - Level header (General settings)
2. Block 2 - Camera (view parameters)
3. Block 3 - Bottom Background
4. Block 4 - Tileset
5. Block 5 - Top Background
6. Block 6 - Entrances
7. Block 7 - Sprites/StageObjects
8. Block 8 - Views
9. Block 9 - Zones
10. Block 10 - Progress paths
11. Block 11 - Paths
12. Block 12 - Progress paths nodes
13. Block 13 - Paths nodes
14. Block 14 - Sprite sets/Object Banks

1. Block 1 - Level header (General settings)

32 bytes01 02 03 ?? 05/06 07/08 FF FF FF FF 13/14 ?? ?? FF FF 19/20 FF FF FF FF ?? ?? 27/28 29/30 ?? ??
Byte 1Start entrance ID
Byte 2Midway entrance ID
Byte 3Misc parameters:
  • Nybble 1:
     0: None
     2: Level wrap
  • Nybble 2:
     0: None
     1: Start level as Mini Mario
     2: Floaty Physics
     3: Both of the above
Bytes 5-6 Time limit:
(reverse the bytes before converting to decimal)
  • Expected range: 0 to 999 (E7 03)
  • Glitchy values: 1000 (E8 03) to 65535 (FF FF)
  • Values of 1000 and above will work in-game, however the timer can only display up to 999, (thereby making the timer look frozen until 998 is reached). Beware, using these will prevent NSMBe from opening the level
  • High values can be functionally infinite (65535*0.75{tick length} = over 13 hours), and thereby work as a way to "freeze" the timer
  • However, setting the timer too high will result in a long wait for it to tick down upon clearing a level via the flag pole
    (unless you break the goal flag as Mega Mario, which skips the timer delay)
Bytes 7-8Bottom BG ID
(The BG slot "255 - None" in NSMBe sets both bytes to FF)
Byte 9Unknown, 0xFF
(Set to 0x03 in Unused level 3)
Bytes 13-14Tileset ID
(Set both to FF to make tileset 1 Disappear. Not compatible with NSMBe level editor)
Bytes 19-20Top BG ID
(The BG slot "255 - None" in NSMBe sets both to FF)
Bytes 27-28Sound Set
Bytes 29-30Sprite draw settings:
    Offset in RAM: 0235FE74 (US), 02357A64 (EU) - This variable can be changed at runtime with immediate effect

    Applies various different experimental effects onto the 2D sprites on the OBJ layer. Can move said layer back and forth relative to other layers. Is likely a leftover debug feature.
    Some sprites ignore effects (e.g. Event Trigger block) and so does the UI.

  • Speculation:
    Together, the two bytes form an index into small lookup tables. The first byte picks the table family; the second byte picks a variant inside that family. Some indices are valid, some point to junk.
    Effects aren't orthogonal. For example, "Transparent or "NoTransform" may only exist as certain family/variant combinations, not as toggles you can freely combine.
    Note: The first nybble of each byte repeats in a predictable pattern, the second byte is haphazard
    Note2: Setting the second byte to 07 significantly stabilizes the results

  • Sprite list: (items, goomba, koopa, paragoomba, paratroopa, event trigger block, arrows, etc //TODO: complete)

  • Layers:
    • Front (default): displays in front of everything else
    • Behind3D (-1 layer): displays behind 3D objects
    • BehindTiles (-2 layer): displays behind tiles
    • BehindTopBG (-3 layer): displays behind top background
    • BehindBottomBG (-4 layer): {setting does not appear to exist}


    Effects:
    • None: No effect, default
    • FlipY: Sprites are flipped on the Y axis according to the point of origin/anchor point, which is typically either at the bottom or center of the sprite
    • NoFlipX: Sprites cannot flip on the X axis. Affected enemies will "moonwalk" to the right
    • NoTransform: Disables non-reflective transforms. Sprites cannot squish/stretch or rotate. Items will hover weirdly and enemies cannot spin while in "defeated" animation
    • Transparent: Sprites are semi-opaque (~70% transparency)
    • Invisible/Corrupt (WhileNoAffine): Sprites display as invisible or corrupted, but only when no affine transform is active
    • Invisible/Corrupt (constant): (Might be the missing BehindBottomBG parameter)

Some values:

Layers
Effects
FrontBehind3DBehindTilesBehindTopBG
No effect00 0011 073F 0715 07
Transparent01 0707 074D 0729 07
NoTransform14 0712 0740 0716 07
Transparent, NoTransform02 0706 074E 072A 07

Mirroring
NoFlipX05 30|FlipY20 30|FlipY, NoFlipXB0 30
NoFlipX, TransparentE0 00|FlipY, Transparent02 30|FlipY, NoFlipX, Transparent0A 01
NoFlipX, NoTransform70 00|FlipY, NoTransform04 00|FlipY, NoFlipX, NoTransformA0 00
NoFlipX, Transparent, NoTransform03 01

Dysfunctional
Invisible/Corrupt (WhileNoAffine)1B 07
Invisible/Corrupt (constant)1C 07


2. Block 2 - Camera (view parameters)

24 bytes (per view)01/02/03/04 05/06/07/08 09/10/11/12 13/14/15/16 ?? ?? 19 20 ?? ?? ?? ??
Bytes 1-4Camera top offset
Bytes 5-8Camera bottom offset
Bytes 9-12Camera top offset "special"
Bytes 13-16Camera bottom offset "special"
Byte 19Vertical scroll (toggle) - 0x00 disabled, 0x0F enabled
Byte 20Unknown. Lower byte of B19?
Camera shenanigans can turn the level invisible if paired with Byte19 0x0F
Note on 4-bytes settings The maximum range is split in two in order to accommodate positive and negative numbers
Max: 2147483647 (FF FF FF 7F)
Min: -2147483648 (00 00 00 80)


3. Block 3 - Bottom Background

4. Block 4 - Tileset

5. Block 5 - Top Background

20 bytes
Bytes 1-2Entry ID? (multibg)
Bytes 3-4 Tilemap ID (NSC)
-carries with it the jyotyu palette type, e.g. 3 -> underground palette
-carries with it the presence/absence of parallax scrolling

Bytes 5-6Palette ID (NCL)
Bytes 11 and 13 (BG)Horizontal and Vertical scrolling settings

Nybble 1 determines the background's start position (AKA the initial offset), as well as which parts of the background do loop
Beware, any value above 0x5 freezes the game
    0x0, 0x2,
    0x3: Starts from bottom of view offset by 32px
    0x1: Starts from top of view offset by 32px
    0x4: Starts from bottom of view offset by 32px
    0x5: Starts from top of view offset by 32px

    0x0-0x3: Loops the entire background
    0x4: Loops the top half
    0x5: Loops the bottom half

Nybble 2 sets the speed at which the BG scrolls relative to the tile layer when the camera moves
Can be used to sync up background and foreground
    0x6: 6.25% FG speed
    0x7: 9.375% FG speed
    0x3: 12.5% FG speed
    0x8: 20.3125% FG speed
    0x2: 25% FG speed
    0x1: 50% FG speed
    0x5: 75% FG speed
    0x0, 0x9-0xC: Synced with FG speed
    0x4: 120% FG speed (Unused)
    0xD: 200% FG speed (Unused)
    0xE: 400% FG speed (Unused)
    0xF: 800% FG speed (Unused)
Byte 12 Unknown. Does not seem to pair with or interfere with byte 11
Byte 14 Unknown. Some values make the background disappear (0x02), some freeze the game (0x01), and some cause a crash (0xFF)
Byte 16 Unknown
Set to 0x10 to override the parallax scrolling of backgrounds (that have parallax scrolling applied to only a select few rows) to instead scroll the entire background

Set byte 13 to 0x40 and byte 16 to 0x10 simultaneously in order to disable vertical scrolling instead
https://tcrf.net/New_Super_Mario_Bros.#Per-zone_backgrounds_and_terrain
https://bookstack.nsmbcentral.net/books/new-super-mario-bros/page/background-scrolling-data-info
https://nsmbhd.net/thread/1583-reverse-engineering-level-header-bg-and-tileset-datablocks/
https://nsmbhd.net/thread/539-loading-backgrounds-from-view/
https://nsmbhd.net/thread/991-multibackground-experiments/
https://nsmbhd.net/thread/3157-multibg-ii-the-return/
https://nsmbhd.net/thread/6228-beta-multibg-take-three/


6. Block 6 - Entrances

20 bytes (per entrance)01/02 03/04 05/06 07/08 09 10 11 12 13 ?? 15 16 ?? ?? 19 20
Bytes 1-2X position
Bytes 3-4Y position
Bytes 5-6Camera X
Bytes 7-8Camera Y
Byte 9Entrance ID
Byte 10Destination Area
Byte 11Connected Pipe ID / Destination Level
Byte 12Destination World
Byte 13Destination Entrance
Byte 15Entrance type
Byte 16Misc settings:
  • Bit 0: Bottom screen
  • Bit 3: Connected pipe
  • Bit 4: Fading screen transition
  • Bit 7: Exit only
Byte 19View ID (exit)
Note this parameter applies to the origin entrance, rather than the destination one
Byte 20 Go to World Map (toggle)
https://nsmbhd.net/thread/2762-different-area-overflows/
https://nsmbhd.net/thread/2517-going-to-any-level-from-any-world/
https://nsmbhd.net/thread/1823-going-to-any-level-of-current-world/


7. Block 7 - Sprites/StageObjects

12 bytes (per sprite)
+ 4 bytes (end bytes)
01/02 03/04 05/06 07 08 09 10 11 12 FF FF FF FF
Byte 1-2Sprite/Stage Actor ID
Bytes 3-4X position
Bytes 5-6Y position
Bytes 07-08, 09-12Event IDs, Sprite data (ordered BB AA - FF EE DD CC)
(source)
End bytes"FF FF FF FF" is auto-generated at the end of the list by NSMBe (even in the absence of entries), without which the level crashes
    None / FF: Crashes
    FF FF / FF FF FF FF: Works as intended
    FF FF FF: Glitchy camera behavior


8. Block 8 - Views

16 bytes (per view)01/02 03/04 05/06 07/08 09 10 11 12 13 14 15 16
Bytes 1-2X position
Bytes 3-4Y position
Bytes 5-6Width
Bytes 7-8Height
Byte 9View ID
Byte 10Camera ID
Byte 11Music ID
Bytes 12, 13, 14Unknown
Presumably background/tileset IDs for a defunct 'per-view' asset switching feature (source)
Byte 153D lighting
Byte 16Progress Path ID


9. Block 9 - Zones

12 bytes (per zone)01 02 03 04 05 06 07 08 09 ?? ?? ??
Bytes 1-2X position
Bytes 3-4Y position
Bytes 5-6Width
Bytes 7-8Height
Byte 9Zone ID


10. Block 10 - Progress paths

11. Block 11 - Paths

8 bytes (per path)01/02 03/04 05/06 ?? ??
Bytes 1-2Path ID
Bytes 3-4Nth path in level (starts from 0)
Bytes 5-6Total number of nodes


12. Block 12 - Progress paths nodes

13. Block 13 - Paths nodes

16 bytes (per node)01/02 03/04 05/06 07/08 09/10 11/12 13/14 15/16
Bytes 1-2X position
Bytes 3-4Y position
Bytes 5-6Node setting 1
Bytes 7-8Node setting 2
Bytes 9-10Node setting 3
Bytes 11-12Node setting 4
Bytes 13-14Node setting 5
Bytes 15-16Node setting 6


14. Block 14 - Sprite sets/Object Banks

16 bytes01 02 03 04 05 06 07 08 09 10 ?? ?? ?? ?? ?? 16