Kodewerx
https://www.kodewerx.org/forum/

Debug Menus
https://www.kodewerx.org/forum/viewtopic.php?f=2&t=6887
Page 1 of 1

Author:  Abystus [ Thu Jul 16, 2009 2:31 pm ]
Post subject:  Debug Menus

Does anyone have tips to hacking these elusive bastards? And no I don't mean changing 0 to 1 in a list of 500 different addresses. Like are they tied into the routines that call other menus within the game, or are they something you can find by other means? I know the method probably changes per game (if a debug menu even exists in the game), however I have not found a definitive solution to even coming remotely close to finding them if they are present.

Enhacklopedia Reference:

Debug Menus

To Do

:P

Author:  Parasyte [ Thu Jul 16, 2009 4:39 pm ]
Post subject:  Re: Debug Menus

Text references are the best way to go about hacking debug menus.

Basically, if debug text exists, that is a good sign that it is used somewhere (but somehow disabled/inaccessible). Also, keep in mind that it may not always be simple ASCII text. Using a relative search is often a simple way to locate text which may not be encoded in the standard ASCII character set. Another thing to keep in mind when looking for debug text is that the menus may be written in a language other than English. Typically, Japanese is a big one.

So, now that you've located some debug text of some sort (it looks interesting to you) how do you go about the actual hack? Answer: cross-references. A "cross reference" is pretty much what it sounds like; a reference (usually a pointer) to the text, located in another section of the program. Find the pointer, and then find the code that looks up that pointer (assuming the pointer is a simple piece of data, rather than being explicitly "assembled" directly in code -- both are quite common).

From there, your most helpful tool is the debugger; back-trace the hell out of the code. That means, generally put, that you should locate cross-references to code [backwards] often several layers deep. For example, "call" or "jump" type instructions that lead to the code which accesses the debug text, and so on. A common technique is placing breakpoints at each of these places, until you actually find that one of those "call" instructions hits somewhere in the game. (It could be before the game starts up, during the title/options screens, in the pause screen, right in the middle of gameplay... pretty much anywhere.) When you find a nice "hit" -- start tracing forward. Notice any branches that skip over the other calls leading to the final routine.

If you find some offending branches, my suggestion is researching them closely; don't just reverse their effect and leave it at that! You might actually find something useful, like a button combination to unlock something never before seen.

All said, it does not really end there. I've seen cases where the cross-references only went back so far, and then completely dried up; there was absolutely no caller into the main "show the debug menu" function. At that point, you can safely start writing your own hook somewhere to show the debug menu when appropriate. Other times, the branches (mentioned above) simply checked a variable in memory which was never written anywhere; that's an easy one, just write the expected value with a simple code. At other times, the text was read early on but it was never shown. Instead, it could cached for use later, by storing it into some temporary memory. And in that case, you would be looking for cross-references to the cached area, and any reasons the program is not making better use of it. ;) The list goes on...

I suppose the general idea is just basic reverse engineering. Use anything available within the program as a guide to reach your goal.

Author:  HyperHacker [ Fri Jul 17, 2009 5:39 pm ]
Post subject:  Re: Debug Menus

In a lot of pre-N64 games you'll find debug routines that are simply branched over or have their call NOPed out. N64 and later tend to have enable flags in RAM that are just never set.

It's also worth hacking a menu modifier (i.e. a code to activate any given menu, or change which menu will be opened from a certain action), and try all values from 0 upward (until you find the game is just crashing or doing nothing special every time). Often you can find debug menus this way.

Then there are some games that seem to have a lot of debug text which is never referenced anywhere. :(

Author:  Abystus [ Fri Jul 17, 2009 6:35 pm ]
Post subject:  Re: Debug Menus

Well it appears that hacking these types of codes takes a bit of dedication to a specific game :P. I am just learning the asm routines for the nes/snes processor as a starting point to being able to hack with this method. I've learned a good bit so far and I feel that the information provided on this subject was well above the quality of response I thought I might receive due to my lack of knowledge in this area. Thank you both for taking your time to explain this subject in the detail that you did.

- Abystus

Page 1 of 1 All times are UTC - 8 hours [ DST ]
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/