ROM Hack How to Import a Patch for NSMB

TheBeefBai

Well-Known Member
OP
Newcomer
Joined
Feb 18, 2017
Messages
67
Trophies
0
XP
520
Country
United Kingdom
Hi there,

Since schools here in the UK have been shut and I have to stay at home, I've decided to play through the whole NSMB series from DS to U Deluxe. My issue though is that after playing the newer ones so much, I've noticed some minor issues that bug me a little, like not being able to use Select to drop the item in your inventory. I found a code on NSMBHD by Skawo but it didnt't have any instructions on how to apply it to the game. If anyone could lend me a hand getting this sorted it'd be greatly appreciated.

P.S. I've included a text file below with the patch code in it

Thanks :yaynds:
 

Attachments

  • InvOnSel.txt
    388 bytes · Views: 117

FAST6191

Techromancer
Editorial Team
Joined
Nov 21, 2005
Messages
36,798
Trophies
3
XP
28,321
Country
United Kingdom
Short enough that we can have a codebox to make life I a bit easier.
InvOnSelect.txt (I assume that is Inventory on Select rather than invulnerable).
Code:
hook_0211F844_ov_0A:
	STMFD	        SP!, {R0, R1, LR}
	LDR	        R0, =0x04000130
	LDRB	        R0, [R0]
	LSR	        R0, #2
	ANDS	        R0, #1
	LDMNEFD	        SP!, {R0, R1, PC}
	LDR		R0, =0x0208B698
	LDR		R1, =0x009500DA
	STR		R1, [R0]
	LDR		R1, =0x09600D40
	STR		R1, [R0, #0x8]
	LDR		R1, =0x1
	STR		R1, [R0, #0x4]
	STR		R1, [R0, #0xC]
	LDMFD	        SP!, {R0, R1, PC}

Anyway I am not sure what ended up going for this one as the NSMB hacking community did some fun things with assembly coding as far as getting it in there where just about everybody else (even pokemon) uses binary patches on the whole ROM, or on individual files and bundles the patch with something like ndstool to pull it apart and put it back together, possibly also a batch file to handle it all. There is good reason to do it that way (changes are far easy to both hacker and layman) but I would prefer to see both or a section in a readme. Anyway at best that is crying over milk possibly spilt a decade ago so enough of that.

A link that might get you started, or might not if drama happened (and it often does) and someone split things off and went their own way.
https://nsmbhd.net/thread/1281-how-asm-hacks-are-setup-tutorial/
Hopefully that will start to get you somewhere. Ultimately it should be a matter of "install this, put the file here, press compile, go" but I would not put any kind of real money on it.

You could probably port that to a direct patch as well even without all that, though it might need some skill rather than just assemble and overwrite.
hook_0211F844_ov_0A
Hooking is the process by which you add code to an existing program. ov_0A is probably overlay 0A (for code that is good to have but not always needed DS games set aside an area of memory to swap in and out as necessary), though I don't know if this requires something from the kit. 0211F844

https://web.archive.org/web/20200128125654/http://problemkaputt.de/gbatek.htm#armcpureference for various instructions
http://imrannazar.com/ARM-Opcode-Map for more. http://www.coranac.com/tonc/text/asm.htm if you want a crash course in things.

Looking that 0x04000130 is the location of the "GBA" keys (the extra ones added for the DS are just after) so that looks fairly self contained, and for something that small (essentially having a button fire an in game function as opposed to when it normally happens) it is what I would expect. The LDR command is basically copy this data into the register, though square brackets mean use it as a memory address.
0x0208B698 is likely where the state of the box is held, not sure what the numbers starting with 9 are.
 

TheBeefBai

Well-Known Member
OP
Newcomer
Joined
Feb 18, 2017
Messages
67
Trophies
0
XP
520
Country
United Kingdom
Short enough that we can have a codebox to make life I a bit easier.
InvOnSelect.txt (I assume that is Inventory on Select rather than invulnerable).
Code:
hook_0211F844_ov_0A:
    STMFD            SP!, {R0, R1, LR}
    LDR            R0, =0x04000130
    LDRB            R0, [R0]
    LSR            R0, #2
    ANDS            R0, #1
    LDMNEFD            SP!, {R0, R1, PC}
    LDR        R0, =0x0208B698
    LDR        R1, =0x009500DA
    STR        R1, [R0]
    LDR        R1, =0x09600D40
    STR        R1, [R0, #0x8]
    LDR        R1, =0x1
    STR        R1, [R0, #0x4]
    STR        R1, [R0, #0xC]
    LDMFD            SP!, {R0, R1, PC}

Anyway I am not sure what ended up going for this one as the NSMB hacking community did some fun things with assembly coding as far as getting it in there where just about everybody else (even pokemon) uses binary patches on the whole ROM, or on individual files and bundles the patch with something like ndstool to pull it apart and put it back together, possibly also a batch file to handle it all. There is good reason to do it that way (changes are far easy to both hacker and layman) but I would prefer to see both or a section in a readme. Anyway at best that is crying over milk possibly spilt a decade ago so enough of that.

A link that might get you started, or might not if drama happened (and it often does) and someone split things off and went their own way.
https://nsmbhd.net/thread/1281-how-asm-hacks-are-setup-tutorial/
Hopefully that will start to get you somewhere. Ultimately it should be a matter of "install this, put the file here, press compile, go" but I would not put any kind of real money on it.

You could probably port that to a direct patch as well even without all that, though it might need some skill rather than just assemble and overwrite.
hook_0211F844_ov_0A
Hooking is the process by which you add code to an existing program. ov_0A is probably overlay 0A (for code that is good to have but not always needed DS games set aside an area of memory to swap in and out as necessary), though I don't know if this requires something from the kit. 0211F844

https://web.archive.org/web/20200128125654/http://problemkaputt.de/gbatek.htm#armcpureference for various instructions
http://imrannazar.com/ARM-Opcode-Map for more. http://www.coranac.com/tonc/text/asm.htm if you want a crash course in things.

Looking that 0x04000130 is the location of the "GBA" keys (the extra ones added for the DS are just after) so that looks fairly self contained, and for something that small (essentially having a button fire an in game function as opposed to when it normally happens) it is what I would expect. The LDR command is basically copy this data into the register, though square brackets mean use it as a memory address.
0x0208B698 is likely where the state of the box is held, not sure what the numbers starting with 9 are.

Cheers mate, I did try following that tutorial you linked at the start but it kept giving me an error when I tried to decompile the rom. I made sure I was using an NTSC rom but it could be that I just missed something simple because I tried to do it at like 11pm :rofl:. If I need anything else I'll drop another post into this thread :yay:
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    K3Nv2 @ K3Nv2: Nut on the hill