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

Author Topic: A question regarding snes stat hacking  (Read 3306 times)

Ven0m

  • Jr. Member
  • **
  • Posts: 7
    • View Profile
A question regarding snes stat hacking
« on: February 22, 2013, 09:53:13 pm »
So to start im trying to manipulate some data in the game Arcana for snes. Im kinda new at this but have
been able to change text with HxD. Next i thought i would go on to changing some basic stats like HP.
Using Geiger's Snes9x Debugger ive been able to locate the main characters hp and change it using the find
new cheat function.
Next i wanted to use HxD to make the changes permanent, however im having trouble understanding the correlation between
the rom address for HP and actually finding it with HxD.  For example using the "find new cheat function":
characters HP is located at: 7E12F3
but when using the Hex Editor that location is not found.  which is to be expected.
when i open the built in Hex Editor in Snes9x im able to find the location and change it
but when i hit save rom it seems it only saves it while im playing and not upon restart.

So after all that i would like to know or shown the proper guide to tell me how to make those changes permanent.

Also it should be noted that ive already read "The Definitive Guide to ROM Hacking for Complete Beginners" which has a
section on stat hacking but refers the reader to a non existent document.
Thank you in advance for any help  :thumbsup:


FAST6191

  • Hero Member
  • *****
  • Posts: 3019
    • View Profile
Re: A question regarding snes stat hacking
« Reply #1 on: February 23, 2013, 05:59:12 am »
We are actually having a fairly similar discussion in the thread below/above yours- http://www.romhacking.net/forum/index.php/topic,15931.0.html though such a thing would probably not have been obvious unless you already knew the answer to what you were asking for so do not feel bad there.

Still eh... that is not quite how things work.

I am not much of a SNES hacker and I am in something of a rush so I will probably go for general concept.

The value you found is a RAM value* which is something the game holds when it is running (and probably stores in the save) but not so much in the ROM (it needs to do this as ROM= Read Only Memory). In the case of HP in a RPG it is almost certainly a calculated value (HP= constitutionx4 + level x100 and such like I am sure you have seen in guides before). Now the game might store starting/base values for a character, a class or some such it in a small table and may even forgo said table entirely once the character is made and stored in the save.

This is probably where I talk about the memory map.
Hardware works best when it can all talk to each other and does not need specialist methods to do so and this means across an entire memory system. Now the likes of the SNES does like to complicate matters a bit but I will avoid that (read I do not know it well enough to truly comment) for now.
Listing of the SNES one
http://en.wikibooks.org/wiki/Super_NES_Programming/SNES_memory_map
7E12F3 decodes as
Bank 7E - banks are one of the complexities I mentioned (SNES is 16 bits which is rather limiting in what size it can address)
12F3 would put it in the LowRAM and that is nowhere in the ROM image.

Most people looking to change it would probably go for infinite health which means you need to either control the function that handles that area of memory (the SNES debuggers are amazing so that should not be too hard to set a breakpoint for a write to that location and edit the thing doing the writing) or make a function to hold that area of memory. It would not be too hard to make a new function that say doubles the HP there though (assuming the doubled value is small to be held there).

The other would be to find the part of the ROM itself that leads to the HP value in the first place. I mentioned above that some games will have a base value and do things from there so you might have to run character creation a few times to figure this one out.

Hopefully it has got you pointed in the right direction and hopefully someone else will be along that can expand upon it.

Ven0m

  • Jr. Member
  • **
  • Posts: 7
    • View Profile
Re: A question regarding snes stat hacking
« Reply #2 on: February 23, 2013, 04:27:42 pm »
Thanx fast i think thats at least enough info for me to research the specifics and give
me a push in the right direction.  I still welcome some input from others that maybe deal
more specifically with snes however its nice to have something to go by. Thanks again

FinS

  • Full Member
  • ***
  • Posts: 192
    • View Profile
    • nothing much
Re: A question regarding snes stat hacking
« Reply #3 on: February 24, 2013, 09:00:51 am »
Here is a quick tutorial to get you started.  Another tool you will need is a text editor designed to handle large files like notepad++. You already have Geiger's Debugger.

First get to a point where the HP will soon be loaded such as this one.


Then set up the debugger to create a log.

1. click Breakpoints
2. fill in the ram address that will be written to ($7e12f3)
3. tick write because you want to catch when the HP is written to it
4. finally you can either tick log now or, if you are quick, proceed with the game and switch back to the Debug panel to tick the log switch
5. you will see a line come up in the debugger indicating the ram address is being written to. press Step Into once to include that line in your log.
6. *Important* untick the log switch to complete the operation

There is a log folder in Geiger's directory.  Since you are looking for the last operation completed you will want to find the last log that was produced if there are multiple logs. Open it up in Notepad++.

1. Highlight the ram address that the HP value came from ($00:1393 is effectively the same as $7e:1393. they both refer to the same ram bank.)
2. click search / find in the menu (sorry I didn't circle that but you will see it)
3. make sure the address is in the text field. make sure you are searching up because you are finding the last time that address was referenced. click find next.

Profit.

You will see the HP was obtained from an index of values at rom location $5:ad52.
Take note this is SNES addressing. you can use Lunar Address to translate it to a hex editor address which is $2ad52. Add $200 if it has a header($2af52).

Ven0m

  • Jr. Member
  • **
  • Posts: 7
    • View Profile
Re: A question regarding snes stat hacking
« Reply #4 on: February 24, 2013, 01:57:40 pm »
Wow, Thanx alot!! :o i wasnt expecting a reply with pics and everything.
After FAST6191 reply i was able to make some headway but after a few too many glasses of
wine i called it a night, However without your post im not sure i would have grasped the
snes addressing which im sure understanding will prove to be a great help in further snes
endeavors.

Thanx again