List of Header Blocks

Viewing diff between revisions 14 (previous) and 15 (current)
(revisions:  1  2  3  4  5  6  7  8  9  10  11  12  13  14  15 )

<style>
.hds th h2 {
margin: 0.5em;
display: inline-block!important;
}
.hds td:first-child {
width: 20%!important;
}
.hds th {
text-align: left!important;
white-space: nowrap!important;
}
.cell_end {
width: 1.4em;
}
</style>
<div class="hds">
<table class="outline margin"><tbody>
<tr class="header0"><th colspan="3">
<h2>Block 1 - Level header (General settings)</h2>
</th></tr>
<tr class="cell0"><td>32 bytes</td><td colspan="2">01 02 03 ?? 05/06 07/08 FF FF FF FF 13/14 ?? ?? FF FF 19/20 FF FF FF FF ?? ?? 27/28 29/30 ?? ??</td>
<tr class="cell1"><td colspan="3"></td></tr>
<tr class="cell0"><td>Byte 1</td><td>Start entrance ID</td><td class="cell_end"></td></tr>
<tr class="cell1"><td>Byte 2</td><td>Midway entrance ID</td><td class="cell_end"></td></tr>
<tr class="cell0"><td>Byte 3</td><td>Misc parameters:
<ul><li>Nybble 1:
&nbsp;0: None
&nbsp;2: Level wrap
</li><li>Nybble 2:
&nbsp;0: None
&nbsp;1: Start level as Mini Mario
&nbsp;2: Floaty Physics
&nbsp;3: Both of the above
</li>
</ul></td><td class="cell_end"></td></tr>
<tr class="cell1"><td>Bytes 5-6</td><td>
Time limit:
<sup>(reverse the bytes before converting to decimal)</sup>
<ul><li>Expected range: 0 to 999 (E7 03)</li>
<li>Glitchy values: 1000 (E8 03) to 65535 (FF FF)
<li>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</li>
<li>High values can be functionally infinite (65535*0.75{tick length} = over 13 hours), and thereby work as a way to "freeze" the timer</li>
<li>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)</li>
</li>
</ul></td><td class="cell_end"></td></tr>
<tr class="cell0"><td>Bytes 7-8</td><td>Bottom BG ID
<sup>(The BG slot "255 - None" in NSMBe sets both bytes to FF)</sup>
</td><td class="cell_end"></td></tr>
<tr class="cell1"><td>Byte 9</td><td>Unknown, 0xFF
<sup><i>(Set to 0x03 in Unused level 3)</i></sup>
</td><td class="cell_end"></td></tr>
<tr class="cell0"><td>Bytes 13-14</td><td>Tileset ID
<sup>(Set both to FF to make tileset 1 Disappear. Not compatible with NSMBe level editor)</sup>
</td><td class="cell_end"></td></tr>
<tr class="cell1"><td>Bytes 19-20</td><td>Top BG ID
<sup>(The BG slot "255 - None" in NSMBe sets both to FF)</sup>
</td><td class="cell_end"></td></tr>
<tr class="cell0"><td>Bytes 27-28</td><td>Sound Set</td><td class="cell_end"></td></tr>
<tr class="cell1"><td>Bytes 29-30</td><td>Sprite draw settings:
<ul>Offset in RAM: 0235FE74 (US), 02357A64 (EU) - <i>This variable can be changed at runtime with immediate effect</i>

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.

<sup><i><li><u>Speculation:</u>
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</li></i></sup>
<sup>Sprite list: (items, goomba, koopa, paragoomba, paratroopa, event trigger block, arrows, etc //TODO: complete)</sup>

<li>Layers:
<ul>
<li>Front (default): displays in front of everything else</li>
<li>Behind3D (-1 layer): displays behind 3D objects</li>
<li>BehindTiles (-2 layer): displays behind tiles</li>
<li>BehindTopBG (-3 layer): displays behind top background</li>
<li><span style="opacity: 0.5;">BehindBottomBG (-4 layer): <i>{setting does not appear to exist}</i></span></li>
</li></ul>

Effects:
<ul>
<li>None: No effect, default</li>
<li>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</li>
<li>NoFlipX: Sprites cannot flip on the X axis. Affected enemies will "moonwalk" to the right</li>
<li>NoTransform: Disables non-reflective transforms. Sprites cannot squish/stretch or rotate. Items will hover weirdly and enemies cannot spin while in "defeated" animation</li>
<li>Transparent: Sprites are semi-opaque (~70% transparency)</li>
<li>Invisible/Corrupt (WhileNoAffine): Sprites display as invisible or corrupted, but only when no affine transform is active</li>
<li>Invisible/Corrupt (constant): (Might be the missing BehindBottomBG parameter)</li>
</ul></ul>
Some values:

[table]
[trh][td][td][td][td][td]<small>Layers</small>[td]
[tr][td]<div style="text-align: center;"><small><small><b>Effects</b></small></small></div>[td][td]Front[td]Behind3D[td]BehindTiles[td]BehindTopBG
[tr][td]No effect[td][td]00 00[td]11 07[td]3F 07[td]15 07
[tr][td]Transparent[td][td]01 07[td]07 07[td]4D 07[td]29 07
[tr][td]NoTransform[td][td]14 07[td]12 07[td]40 07[td]16 07
[tr][td]Transparent, NoTransform[td][td]02 07[td]06 07[td]4E 07[td]2A 07
[/table]

[table]
[trh][td][td][td][td][td]Mirroring[td][td][td]
[tr][td]NoFlipX[td]05 30[td]|[td]FlipY[td]20 30[td]|[td]FlipY, NoFlipX[td]B0 30
[tr][td]NoFlipX, Transparent[td]E0 00[td]|[td]FlipY, Transparent[td]02 30[td]|[td]FlipY, NoFlipX, Transparent[td]0A 01
[tr][td]NoFlipX, NoTransform[td]70 00[td]|[td]FlipY, NoTransform[td]04 00[td]|[td]FlipY, NoFlipX, NoTransform[td]A0 00
[tr][td]NoFlipX, Transparent, NoTransform[td]03 01[td][td][td][td][td][td]
[/table]

[table]
[trh][td][td]Dysfunctional
[tr][td]Invisible/Corrupt (WhileNoAffine)[td]1B 07
[tr][td]Invisible/Corrupt (constant)[td]1C 07
[/table]
</td><td class="cell_end"></td></tr>
</tbody></table>


<table class="outline margin"><tbody>
<tr class="header0"><th colspan="3">
<h2>Block 2 - Camera (view parameters)</h2>
</th></tr>
<tr class="cell0"><td>24 bytes (per view)</td><td colspan="2">01/02/03/04 05/06/07/08 09/10/11/12 13/14/15/16 ?? ?? 19 20 ?? ?? ?? ??</td></tr>
<tr class="cell1"><td colspan="3"></td></tr>
<tr class="cell0"><td>Bytes 1-4</td><td>Camera top offset</td><td class="cell_end"></td></tr>
<tr class="cell1"><td>Bytes 5-8</td><td>Camera bottom offset</td><td class="cell_end"></td></tr>
<tr class="cell0"><td>Bytes 9-12</td><td>Camera top offset "special"</td><td class="cell_end"></td></tr>
<tr class="cell1"><td>Bytes 13-16</td><td>Camera bottom offset "special"</td><td class="cell_end"></td></tr>
<tr class="cell0"><td>Byte 19</td><td>Vertical scroll (toggle) - 0x00 disabled, 0x0F enabled</td><td class="cell_end"></td></tr>
<tr class="cell1"><td>Byte 20</td><td><span style="opacity: 0.5;"><sup>Unknown. Lower byte of B19?
Camera shenanigans can turn the level invisible if paired with Byte19 0x0F
</sup></span></td><td class="cell_end"></td></tr>
<tr class="cell0"><td>Note on 4-bytes settings</td><td>
The maximum range is split in two in order to accommodate positive and negative numbers
<sup>
Max: 2147483647 (FF FF FF 7F)
Min: -2147483648 (00 00 00 80)
</sup></td><td class="cell_end"></td></tr>
</tbody></table>


<table class="outline margin"><tbody>
<tr class="header0"><th colspan="3">
<h2>Block 3 - Bottom Background</h2>
</th></tr>
<tr class="header0"><th colspan="3">
<h2>Block 4 - Tileset</h2>
</th></tr>
<tr class="header0"><th colspan="3">
<h2>Block 5 - Top Background</h2>
</th></tr>
<tr class="cell0"><td>20 bytes</td><td colspan="2"></td></tr>
<tr class="cell1"><td colspan="3"></td></tr>
<tr class="cell0"><td>Bytes 1-2</td><td>Entry ID? (multibg)</td><td class="cell_end"></td></tr>
<tr class="cell0"><td>Bytes 3-4</td>
<td>
Tilemap ID (NSC)
<sup><i>-carries with it the jyotyu palette type, e.g. 3 -> underground palette
-carries with it the presence/absence of parallax scrolling</i></sup>
</td><td class="cell_end"></td></tr>
<tr class="cell1"><td>Bytes 5-6</td><td>Palette ID (NCL)</td><td class="cell_end"></td></tr>
<tr class="cell0"><td>Bytes 11 and 13 (BG)</td><td>Horizontal and Vertical scrolling settings

<sup>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
<ul>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
</ul>
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
<ul>
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)
</ul></sup></td><td class="cell_end"></td></tr>
<tr class="cell1"><td><span style="opacity: 0.5;"><sup>Byte 12</sup></span></td><td>
<span style="opacity: 0.5;"><sup>Unknown. Does not seem to pair with or interfere with byte 11</sup></span>
</td><td class="cell_end"></td></tr>
<tr class="cell0"><td><span style="opacity: 0.5;"><sup>Byte 14</sup></span></td><td>
<span style="opacity: 0.5;"><sup>Unknown. Some values make the background disappear (0x02), some freeze the game (0x01), and some cause a crash (0xFF)</sup></span>
</td><td class="cell_end"></td></tr>
<tr class="cell1"><td><sup>Byte 16</sup></td><td>
<sup>Unknown
<i>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</i></sup>
<sup><i>Set byte 13 to 0x40 and byte 16 to 0x10 simultaneously in order to disable vertical scrolling instead</i></sup>
</td><td class="cell_end"></td></tr>
</tbody></table>
<table class="outline margin"><tbody>
<tr class="cell1"><td>
[url]https://tcrf.net/New_Super_Mario_Bros.#Per-zone_backgrounds_and_terrain[/url]
[url]https://bookstack.nsmbcentral.net/books/new-super-mario-bros/page/background-scrolling-data-info[/url]
[url]https://nsmbhd.net/thread/1583-reverse-engineering-level-header-bg-and-tileset-datablocks/[/url]
[url]https://nsmbhd.net/thread/539-loading-backgrounds-from-view/[/url]
[url]https://nsmbhd.net/thread/991-multibackground-experiments/[/url]
[url]https://nsmbhd.net/thread/3157-multibg-ii-the-return/[/url]
[url]https://nsmbhd.net/thread/6228-beta-multibg-take-three/[/url]
</td></tr>
</tbody></table>


<table class="outline margin"><tbody>
<tr class="header0"><th colspan="3">
<h2>Block 6 - Entrances</h2></td></tr>
</th></tr>
<tr class="cell0"><td>20 bytes (per entrance)</td><td colspan="2">01/02 03/04 05/06 07/08 09 10 11 12 13 ?? 15 16 ?? ?? 19 20</td></tr>
<tr class="cell1"><td colspan="3"></td></tr>
<tr class="cell0"><td>Bytes 1-2</td><td>X position</td><td class="cell_end"></td></tr>
<tr class="cell1"><td>Bytes 3-4</td><td>Y position</td><td class="cell_end"></td></tr>
<tr class="cell0"><td>Bytes 5-6</td><td>Camera X</td><td class="cell_end"></td></tr>
<tr class="cell1"><td>Bytes 7-8</td><td>Camera Y</td><td class="cell_end"></td></tr>
<tr class="cell0"><td>Byte 9</td><td>Entrance ID</td><td class="cell_end"></td></tr>
<tr class="cell1"><td>Byte 10</td><td>Destination Area</td><td class="cell_end"></td></tr>
<tr class="cell0"><td>Byte 11</td><td>Connected Pipe ID / Destination Level</td><td class="cell_end"></td></tr>
<tr class="cell1"><td>Byte 12</td><td>Destination World</td><td class="cell_end"></td></tr>
<tr class="cell0"><td>Byte 13</td><td>Destination Entrance</td><td class="cell_end"></td></tr>
<tr class="cell1"><td>Byte 15</td><td>Entrance type</td><td class="cell_end"></td></tr>
<tr class="cell0"><td>Byte 16</td><td>Misc settings:
<ul><i>
<li>Bit 0: Bottom screen</li>
<li>Bit 3: Connected pipe</li>
<li>Bit 4: Fading screen transition</li>
<li>Bit 7: Exit only</li>
</i></ul></td><td class="cell_end"></td></tr>
<tr class="cell1"><td>Byte 19<td>View ID (exit)
<sup><i>Note this parameter applies to the <b>origin</b> entrance, rather than the destination one</i></sup>
</td><td class="cell_end"></td></tr>
<tr class="cell0"><td>Byte 20<td>
Go to World Map (toggle)
<ul>0xFF ON, 0x00 OFF (apply to the DESTINATION entrance)
<sup>[i]Relevant code can be seen at [url=http://tcrf.net/Notes:New_Super_Mario_Bros.]TCRF.net/Notes:New Super Mario Bros.[/url][/i]</sup>
</ul></td><td class="cell_end"></td></tr>
</tbody></table>
<table class="outline margin"><tbody>
<tr class="cell1"><td>
[url]https://nsmbhd.net/thread/2762-different-area-overflows/[/url]
[url]https://nsmbhd.net/thread/2517-going-to-any-level-from-any-world/[/url]
[url]https://nsmbhd.net/thread/1823-going-to-any-level-of-current-world/[/url]
</td></tr>
</tbody></table>


<table class="outline margin"><tbody>
<tr class="header0"><th colspan="3">
<h2>Block 7 - Sprites/StageObjects</h2>
</th></tr>
<tr class="cell0"><td>
12 bytes (per sprite)
<i><span style="opacity: 0.5;">+ 4 bytes (end bytes)</span></i>
</td><td colspan="2">01/02 03/04 05/06 07 08 09 10 11 12 <span style="opacity: 0.5;">FF FF FF FF</span></td></tr>
<tr class="cell1"><td colspan="3"></td></tr>
<tr class="cell0"><td>Byte 1-2</td><td>Sprite/Stage Actor ID</td><td class="cell_end"></td></tr>
<tr class="cell1"><td>Bytes 3-4</td><td>X position</td><td class="cell_end"></td></tr>
<tr class="cell0"><td>Bytes 5-6</td><td>Y position</td><td class="cell_end"></td></tr>
<tr class="cell1"><td>Bytes 07-12</td><td>Sprite07-08, 09-12</td><td>Event IDs, Sprite data (ordered BB AA - FF EE DD CC)</td><tdCC)
<sup>[url=https://nsmbhd.net/post/75645/](source)[/url]</sup>
</td><td
class="cell_end"></td></tr>
<tr class="cell0"><td>End bytes</td><td>"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
<ul><i>
None / FF: Crashes
FF FF / FF FF FF FF: Works as intended
FF FF FF: Glitchy camera behavior
</i></ul></td><td class="cell_end"></td></tr>
</tbody></table>


<table class="outline margin"><tbody>
<tr class="header0"><th colspan="3">
<h2>Block 8 - Views</h2>
</th></tr>
<tr class="cell0"><td>16 bytes (per view)<td colspan="2">01/02 03/04 05/06 07/08 09 10 11 12 13 14 15 16
<tr class="cell1"><td colspan="3"></td></tr>
<tr class="cell0"><td>Bytes 1-2<td>X position</td><td class="cell_end"></td></tr>
<tr class="cell1"><td>Bytes 3-4<td>Y position</td><td class="cell_end"></td></tr>
<tr class="cell0"><td>Bytes 5-6<td>Width</td><td class="cell_end"></td></tr>
<tr class="cell1"><td>Bytes 7-8<td>Height</td><td class="cell_end"></td></tr>
<tr class="cell0"><td>Byte 9<td>View ID</td><td class="cell_end"></td></tr>
<tr class="cell1"><td>Byte 10<td>Camera ID</td><td class="cell_end"></td></tr>
<tr class="cell0"><td>Byte 11<td>Music ID</td><td class="cell_end"></td></tr>
<tr class="cell1"><td><span style="opacity: 0.5;">Bytes 12, 13, 14</span></td><td><span style="opacity: 0.5;">Unknown</span>
<sup><i>Presumably background/tileset IDs for a defunct 'per-view' asset switching feature [url=https://nsmbhd.net/thread/1583-reverse-engineering-level-header-bg-and-tileset-datablocks/](source)[/url]</i></sup>
</td><td class="cell_end"></td></tr>
<tr class="cell0"><td>Byte 15<td>3D lighting</td><td class="cell_end"></td></tr>
<tr class="cell1"><td>Byte 16<td>Progress Path ID</td><td class="cell_end"></td></tr>
</tbody></table>


<table class="outline margin"><tbody>
<tr class="header0"><th colspan="3">
<h2>Block 9 - Zones</h2>
</th></tr>
<tr class="cell0"><td>12 bytes (per zone)</td><td colspan="2">01 02 03 04 05 06 07 08 09 ?? ?? ??</td></tr>
<tr class="cell1"><td colspan="3"></td></tr>
<tr class="cell0"><td>Bytes 1-2</td><td>X position</td><td class="cell_end"></td></tr>
<tr class="cell1"><td>Bytes 3-4</td><td>Y position</td><td class="cell_end"></td></tr>
<tr class="cell0"><td>Bytes 5-6</td><td>Width</td><td class="cell_end"></td></tr>
<tr class="cell1"><td>Bytes 7-8</td><td>Height</td><td class="cell_end"></td></tr>
<tr class="cell0"><td>Byte 9</td><td>Zone ID</td><td class="cell_end"></td></tr>
</tbody></table>


<table class="outline margin"><tbody>
<tr class="header0"><th colspan="3">
<h2>Block 10 - Progress paths</h2>
</th></tr>
<tr class="header0"><th colspan="3">
<h2>Block 11 - Paths</h2>
</th></tr>
<tr class="cell0"><td>8 bytes (per path)</td><td colspan="2">01/02 03/04 05/06 ?? ??</td></tr>
<tr class="cell1"><td colspan="3"></td></tr>
<tr class="cell0"><td>Bytes 1-2</td><td>Path ID</td><td class="cell_end"></td></tr>
<tr class="cell1"><td>Bytes 3-4</td><td>Nth path in level (starts from 0)</td><td class="cell_end"></td></tr>
<tr class="cell0"><td>Bytes 5-6</td><td>Total number of nodes</td><td class="cell_end"></td></tr>
</tbody></table>


<table class="outline margin"><tbody>
<tr class="header0"><th colspan="3">
<h2>Block 12 - Progress paths nodes</h2>
</th></tr>
<tr class="header0"><th colspan="3">
<h2>Block 13 - Paths nodes</h2>
</th></tr>
<tr class="cell0"><td>16 bytes (per node)<td colspan="2">01/02 03/04 05/06 07/08 09/10 11/12 13/14 15/16</td></tr>
<tr class="cell1"><td colspan="3"></td></tr>
<tr class="cell0"><td>Bytes 1-2</td><td>X position</td><td class="cell_end"></td></tr>
<tr class="cell1"><td>Bytes 3-4</td><td>Y position</td><td class="cell_end"></td></tr>
<tr class="cell0"><td>Bytes 5-6</td><td>Node setting 1</td><td class="cell_end"></td></tr>
<tr class="cell1"><td>Bytes 7-8</td><td>Node setting 2</td><td class="cell_end"></td></tr>
<tr class="cell0"><td>Bytes 9-10</td><td>Node setting 3</td><td class="cell_end"></td></tr>
<tr class="cell1"><td>Bytes 11-12</td><td>Node setting 4</td><td class="cell_end"></td></tr>
<tr class="cell0"><td>Bytes 13-14</td><td>Node setting 5</td><td class="cell_end"></td></tr>
<tr class="cell1"><td>Bytes 15-16</td><td>Node setting 6</td><td class="cell_end"></td></tr>
</tbody></table>


<table class="outline margin"><tbody>
<tr class="header0"><th colspan="3">
<h2>Block 14 - Sprite sets/Object Banks</h2>
</th></tr>
<tr class="cell1"><td>16 bytes</td><td>01 02 03 04 05 06 07 08 09 10 ?? ?? ?? ?? ?? 16</td><td class="cell_end"></td></tr>
</tbody></table>