Romhacking.net

Romhacking => Newcomer's Board => Topic started by: mgroves on September 25, 2018, 09:54:33 pm

Title: How to find memory locations for scores / lives / etc
Post by: mgroves on September 25, 2018, 09:54:33 pm
I'm trying to use the Nintaco API to do some game automation experiments. The API is easy enough for me to use, and I've already gotten it to press buttons, show text, etc. But to do anything interesting, I need to know the memory location of things like the current score, the current number of lives, the current level, etc.

For well known games, these memory locations might be documented here on this site, but for a game that isn't documented, how should I go about doing it?

I've already tried a naive search of RAM for the score value, but no dice. Any other suggestions, ideas, or documents I should check out?
Title: Re: How to find memory locations for scores / lives / etc
Post by: STARWIN on September 26, 2018, 06:38:55 am
A major external source for these are cheat codes, which often show the RAM location in the code. I don't know if this holds true for all systems and all cheat devices though.

For something primitive like NES, FCEUX already has a cheat search tool included that you can use in Tools -> Cheats. Check its documentation on how to use it. I would recommend avoiding the greater or less functions there, as values can be packed within bytes.
Title: Re: How to find memory locations for scores / lives / etc
Post by: mgroves on September 26, 2018, 10:56:59 am
That worked great, thank you! I was able to find the bytes for the score very quickly. They are stored in a bit of an odd way, but FCEUX cheat tools helped me find them.

For the record, the score in Zombie Nation is stored in $001A and $001B.
Title: Re: How to find memory locations for scores / lives / etc
Post by: Psyklax on September 26, 2018, 01:17:04 pm
Simple: use a cheat finder like STARWIN says. You reset the search, do something to change what you want to find (lives, score, X and Y position etc), search for memory locations that are not the same as before, change that thing again, search again... eventually you'll find a memory location that was different at those specific moments, which is probably the one you want. In most cases, this is enough, though some games can be weird.