Note: Hex editing is considered an advanced feature of NSMB Editor. Also, ALWAYS back up your level (or better: your ROM) before hex editing in case you do something wrong
Also, hex editing is now nearly useless. Now, the editor lets you edit nearly everything in a level, so there's no need to manually hex edit a level. I'll leave it here just in case. ~Dirbaio
There have been some questions lately about how to hex edit levels in New Super Mario Bros to access and edit features not yet implemented by the GUI editor. This is a tutorial on how to do that.
1)
Select your level, then hit the Hex Edit button.
2)
There are 14 "Blocks" you can edit, selectable by using the drop down box.
I've underlined most of the bits pairs of two. Most data is stored as a numeric variable that takes up 4 characters.
However, notice that I underlined a few of them as just pairs. That is because
some data is stored as a numeric value that only takes two characters.
Treeki, Tanks, myself, and some other people have done extensive research on what each block does, and we reported our findings in the long stickied thread.
3)
I will explain how to edit the data using block 8, which contains the information for views. A View has several variables, as you can see in the image.
Using the information found in
this post and
this post, we will edit the dimensions of the view in my world 1-1.
4)
The first thing that is confusing is how to convert hex into decimal.
Decimal is called "Base 10"
This is what we use most of the time with our math. We count 10 numbers before we increment the tenth's place.
We go:
0, 1, 2, 3, 4, 5, 6, 7, 8, 9
Then, we've run out of numbers, so we go:
10, 11, 12, 13, 14, 15, 16, 17, 18, 19
Hex is called "Base 16"
In this base, we count 16 numbers before we increment the tenth's place.
We go:
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F
Then, we go:
10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 1A, 1B, 1C, 1D, 1E, 1F
To convert between the two, you can do it in your head, but its tricky. The best way to do it is to use the Windows Calculator.
To convert from Dec to Hex, make sure you're in Dec mode first, then type in your number, then click Hex. It works this way vice-versa.
5)
So, lets say we want to use 6688 for our X position for our view.
We convert it into Hex, and we find that 6688 in Dec is equal to 1A20 in hex.
Before we can plug that into the editor, we need to make one minor, simple adjustment. The four digit values must be switched around by pairs of two.
We use: 1A20, which is equal to 6688.
First, break it in two two pairs: 1A 20
Then, swap their order: 20 1A.
Now, 201A is the value we have to plug into editor to use a value of 6688.
This is confusing to deal with and tricky to remember, but it gets easier.
--
Now, lets use a value of 586, which is equal to 24A. This is tricky because its only 3 digits, not 4.
So, before we can swap its order, we need to realize that 24A = 024A
Now, we can swap it: 4A02
Plug that into the editor for a value of 586.
--
Some variables are only two digits, like the ID. You do not need to swap anything here.
____________________