Register - Login
Views: 85788030
Main - Memberlist - Active users - Calendar - Wiki - IRC Chat - Online users
Ranks - Rules/FAQ - JCS - Stats - Latest Posts - Color Chart - Smilies
09-26-17 06:08:13 PM

Jul - NSMB Hacking (Archive) - [Tutorial] How to Hex Edit NSMB New poll - New thread - New reply
Next newer thread | Next older thread
Garmichael
Member
Level: 24


Posts: 46/121
EXP: 73104
For next: 5021

Since: 06-24-09
From: Seattle, Wa

Since last post: 6.0 years
Last activity: 6.0 years

Posted on 08-30-09 02:26:08 PM (last edited by dirbaio at 03-02-11 03:49 PM) Link | Quote
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.

Ninji

Boomboom
Why did my user title say I'm a toaster anyway
Level: 83


Posts: 479/1988
EXP: 5402858
For next: 29363

Since: 07-26-07
From: Rogueport

Since last post: 83 days
Last activity: 74 days

Posted on 08-30-09 04:18:54 PM Link | Quote
Stickied. Great tutorial
Ehm
Member
Level: 46


Posts: 102/532
EXP: 675096
For next: 36678

Since: 06-13-09
From: Canada

Since last post: 120 days
Last activity: 77 days

Posted on 08-31-09 12:34:32 PM Link | Quote
agreed ^__^ Okay, so I get conversions and counting now, and where things need to go in Block 8. But do you guys have a list of possible variables and what they do? For example, what are the max X, Y, H and W variables I can use, and how do I apply more than one in an area (you know how some areas have more than one gray outlined area)? and if H and W are for the camera's total height and width, what do X and Y edit?
Ninji

Boomboom
Why did my user title say I'm a toaster anyway
Level: 83


Posts: 480/1988
EXP: 5402858
For next: 29363

Since: 07-26-07
From: Rogueport

Since last post: 83 days
Last activity: 74 days

Posted on 08-31-09 12:40:15 PM Link | Quote
Originally posted by m64m
agreed ^__^ Okay, so I get conversions and counting now, and where things need to go in Block 8. But do you guys have a list of possible variables and what they do? For example, what are the max X, Y, H and W variables I can use, and how do I apply more than one in an area (you know how some areas have more than one gray outlined area)? and if H and W are for the camera's total height and width, what do X and Y edit?

You won't want to make your level area go past 512x256 tiles, or 8192x4096 pixels - I'm not sure how the game will behave here since this is the max size for levels.

X and Y are the position of the grey outlined area (the bit you can view in-game).
If an area has more than one of them, block 8 will be bigger - notice how Garmichael's screenshot contains "30 00 B0 00 80 10 40 01 00 00 1A 00 00 00 00 01"?
That string is for the first grey outlined area. If a level has more than one, there will be multiple strings; one for each.
Ehm
Member
Level: 46


Posts: 103/532
EXP: 675096
For next: 36678

Since: 06-13-09
From: Canada

Since last post: 120 days
Last activity: 77 days

Posted on 08-31-09 01:00:59 PM Link | Quote
okay so in Hex, to enter a max width and height of 512x256 tiles, I'd put 200x100 in Block 8?
Ninji

Boomboom
Why did my user title say I'm a toaster anyway
Level: 83


Posts: 481/1988
EXP: 5402858
For next: 29363

Since: 07-26-07
From: Rogueport

Since last post: 83 days
Last activity: 74 days

Posted on 08-31-09 01:07:12 PM Link | Quote
Originally posted by m64m
okay so in Hex, to enter a max width and height of 512x256 tiles, I'd put 200x100 in Block 8?

Not exactly. Block 8 uses pixels instead of tiles, so you'd want 2000x1000. This means that the width/height values would be "00 20 00 10".

Also, remember that this is the max area the entire level can be in - not just one particular "room". So if you wanted to use this size, you'd need to set the X/Y position to 0.
Ehm
Member
Level: 46


Posts: 104/532
EXP: 675096
For next: 36678

Since: 06-13-09
From: Canada

Since last post: 120 days
Last activity: 77 days

Posted on 08-31-09 01:31:44 PM Link | Quote
for sure. I just wanted to get a feel for the coding. how would I go about a camera pathway? Like this:



Should I put the total width and height, and just use scroll control sprites to form the camera pathway?
dirbaio
For future reference, "Responsible disclosure" isn't "acting like a douche about an exploit and demanding compensation".
Level: NaN


Posts: 40/-1288
EXP: NaN
For next: 0

Since: 07-28-09
From: Spain

Since last post: 6.0 years
Last activity: 5.0 years

Posted on 08-31-09 02:26:00 PM Link | Quote
yes. the views are only rectangles. To make more advanced control of the camera you must use scroll controls and scroll stops...
Ehm
Member
Level: 46


Posts: 105/532
EXP: 675096
For next: 36678

Since: 06-13-09
From: Canada

Since last post: 120 days
Last activity: 77 days

Posted on 08-31-09 02:34:35 PM Link | Quote
okay, thanks everyone for the info ^__^ If I have any further Hex questions I'll post 'em here.
Garmichael
Member
Level: 24


Posts: 48/121
EXP: 73104
For next: 5021

Since: 06-24-09
From: Seattle, Wa

Since last post: 6.0 years
Last activity: 6.0 years

Posted on 08-31-09 09:18:51 PM (last edited by Garmichael at 08-31-09 09:19 PM) Link | Quote
Another trick you can use to control the camera without using any sprites is found in the second half of This Post, under "I found something else..."
Ehm
Member
Level: 46


Posts: 106/532
EXP: 675096
For next: 36678

Since: 06-13-09
From: Canada

Since last post: 120 days
Last activity: 77 days

Posted on 09-01-09 08:21:36 AM Link | Quote
how would you go about setting up the panning blocks?
dirbaio
For future reference, "Responsible disclosure" isn't "acting like a douche about an exploit and demanding compensation".
Level: NaN


Posts: 41/-1288
EXP: NaN
For next: 0

Since: 07-28-09
From: Spain

Since last post: 6.0 years
Last activity: 5.0 years

Posted on 09-01-09 09:06:34 AM Link | Quote
http://nsmbhacking.wikidot.com/camera

Simply you have to imagine the level divided into square blocks of 16 tiles (256 pixels). If a block is empty, the camera will NEVER pan into it. You can use that to control the camera.
Ehm
Member
Level: 46


Posts: 112/532
EXP: 675096
For next: 36678

Since: 06-13-09
From: Canada

Since last post: 120 days
Last activity: 77 days

Posted on 09-02-09 12:45:35 PM Link | Quote
ah. This explains quite a few camera issues I had XD
Next newer thread | Next older thread
Jul - NSMB Hacking (Archive) - [Tutorial] How to Hex Edit NSMB New poll - New thread - New reply




Rusted Logic

Acmlmboard - commit 2f1bc75 [2017-08-27]
©2000-2017 Acmlm, Xkeeper, Inuyasha, et al.

28 database queries, 8 query cache hits.
Query execution time: 0.119774 seconds
Script execution time: 0.011019 seconds
Total render time: 0.130793 seconds