News: 11 March 2016 - Forum Rules
Current Moderators - DarkSol, KingMike, MathOnNapkins, Azkadellia, Danke

Author Topic: [SMB3] Requesting Help for Simple Hack/Edit  (Read 1324 times)

ljmill

  • Newbie
  • *
  • Posts: 3
    • View Profile
[SMB3] Requesting Help for Simple Hack/Edit
« on: May 06, 2016, 03:43:13 pm »
Hello all!

I recently discovered the amazing world of ROM hacks. It's completely rejuvinated my love for retro gaming. I'm very glad I found this community.

---

I've been playing Luigi's Chronicles 2 (SMB3 hack--as I'm sure you all know) and I really enjoy it. I was planning on purchasing the cart version of it from a website and it was stated that they had edited the hack so that you started with 99 lives, which to me sounds spectacular. Since I've been playing these ROM's on multiple different platforms (PC, DS/3DS, etc etc), I thought maybe I would try my hand at doing this myself. From here on out I'll probably sound like a complete noob, but I'm gonna try to explain what I've done so far.. bare with me   :laugh:

I've been messing around with the debugger and hex editor in FCEUX. I've managed to create a 'cheat' that grants 99 lives but I can't figure out how to make a hard edit so that I start with 99 lives every time I boot up the game. I figured out the address of the lives is 0736, so I added a breakpoint in the debugger to find where it was located in the Hex Editor.

The breakpoint points me to "0F:9123:DE 36 07        DEC $0736,X @ $0736 = #$03". Edit: I went to 00736 and changed the value to 63 (99 lives)

However, I've hit a dead-end. When I edit the value at 0736 to 63 and save the ROM, it resets back to the default 04 when I reset the game. I'm not sure what to do from this point to achieve my goal of having it load with 99 lives on startup. Can anyone help me out here? Infact, I'm not even sure if this is the right place to make the edit as the breakpoint hops around when you reset the game. I've examined each breakpoint location in the hex editor and I'm still stumped. My ignorance has hit a brickwall, so I come for help :)

Sorry again for the noobishness. Thanks guys, appreciate it
« Last Edit: May 06, 2016, 04:00:27 pm by ljmill »

nesrocks

  • Hero Member
  • *****
  • Posts: 570
    • View Profile
    • nesrocks.com
Re: [SMB3] Requesting Help for Simple Hack/Edit
« Reply #1 on: May 06, 2016, 05:11:12 pm »
That's because that address is temporary, it is only in the NES memory (it's not called RAM, thanks Disch  :thumbsup:), not the ROM. You need to scroll on the debugger and see where it passed the value in the ROM to memory address $0736.

Or better yet, do this: reset the game, go to the title screen and set a breakpoint looking for writes to $0736. Then press start. You will maybe come accross a LDA instruction that gets a value from ROM and loads to the accumulator, and then on the next line it stores that value to the memory address you've found (using STA). Then you right click on the left to the debugger (there's an empty column on the left that doesn't look like much) at the line that loads it and edit the value in the hex editor that will pop up (in this case it would be two bytes  A9 03 if it's 3 lives). Make sure to only edit the 03 as the A9 is the LDA instruction. Then reset the game again, turn off the breakpoint, press start and see if it changed it. That is assuming this is how the game does it, I'm just guessing.

edit: I tested it here. The method works, but it passes the 04 lives when you turn on the game, not when you press start. So set the breakpoint, hit reset. First it writes 00 to it twice, so you click "run" to see the next write. Sure enough, the third write is it. Rom address $308E1.

0C:A8D0:A9 04       LDA #$04
0C:A8D2:8D 36 07  STA $0736 = #$00

#$00 shows the value currently in $0736. If you click "step into" it will execute the line and it will show = #$04 there.

You will notice that values bigger than $63 are reset to $63 in the game. That's because the game has logic to not allow more than 99 lives.

Something that is not really clear is that the first time you open the hex editor in fceux it is showing only Nes memory. You need to click view and change it to ROM. Only edits to the ROM are permanent.
« Last Edit: May 06, 2016, 06:27:29 pm by nesrocks »

ljmill

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: [SMB3] Requesting Help for Simple Hack/Edit
« Reply #2 on: May 06, 2016, 10:25:12 pm »
Thanks for the response :) I think I need to brush up on the machine codes or whatever those abbreviations are called (LDA, BRK, STA etc)

I just woke up from a looong nap and I went to View->ROM File and hit reset. Magically the # of lives went to 99. I must have made an edit somewhere that I forgot about. At any rate, I got it working.. but I think I'm going to try to do it again from scratch to try and figure out how I did that. hahaha, this really intrigues me.

I might have more questions on this matter, will post again if so

EDIT: I replicated it. Thank you for the detailed post nesrocks. The issue was, I wasn't looking at the line above the breakpoint, only below it.  :laugh: So I observed the breakpoints as it was starting the game. Watched it re-write to 0, then sure enough on the third breakpoint is when it sets the # of lives. I looked at the line above the breakpoint and found it in the NES Memory, right clicked and had it send me to the location in the ROM File, set it to 63 and voila.

THANK YOU!
« Last Edit: May 06, 2016, 10:48:40 pm by ljmill »

nesrocks

  • Hero Member
  • *****
  • Posts: 570
    • View Profile
    • nesrocks.com
Re: [SMB3] Requesting Help for Simple Hack/Edit
« Reply #3 on: May 06, 2016, 11:08:30 pm »
You're welcome. I find this page very useful http://www.6502.org/tutorials/6502opcodes.html

The reason it only worked when you reset is that apparently the game only has code to read that particular ROM address when the game is booted up. So you will not see changes made to ROM addresses until they are read or executed.

ljmill

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: [SMB3] Requesting Help for Simple Hack/Edit
« Reply #4 on: May 06, 2016, 11:14:43 pm »
Oh nice, thank you for that link. I bookmarked it as I'm sure it will be a great resource. Man I am happy. This game is too hard with only 4 lives hahaha

Quick Curly

  • Full Member
  • ***
  • Posts: 108
    • View Profile
Re: [SMB3] Requesting Help for Simple Hack/Edit
« Reply #5 on: May 07, 2016, 11:59:31 am »
First, I just want to express my excitement for a post about one of my hacks with Googie, Luigi's Chronicles 2! Thank you for your interest and support, ljmill! ;D

Next, I just wanted to add that there are actually two values that apply to the number of starting lives, depending on the situation.

0x308E1 - 04 - Starting number of lives at the start of a new game.
0x3D2D6 - 04 - Starting number of lives at the start of a continued game.

So, for consistency for any SMB3 hack, you'll most likely want to modify both values in the ROM to be the same. :thumbsup:

Thank you again for your post and interest! I hope that you continue to have fun with the hack, and that we get to see you around again! Take care. :)

henke37

  • Hero Member
  • *****
  • Posts: 643
    • View Profile
Re: [SMB3] Requesting Help for Simple Hack/Edit
« Reply #6 on: May 08, 2016, 04:11:56 am »
One thing worth noting is that this game has an annotated disassembly. No need to guess where things are then.