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

Author Topic: What kind of programs allow you to see the game's code?  (Read 3576 times)

mistajack

  • Newbie
  • *
  • Posts: 3
    • View Profile
What kind of programs allow you to see the game's code?
« on: November 21, 2014, 11:12:12 am »
Hello, I am new here (to this scene as well) and for the past couple of days I have been looking through various information based around ROM hacking. I think this is a great source for information based on what I have read, but I think I am missing a key component. See, I would like to download a game's ROM - let's say a NES, SNES, or N64 ROM and open up the game's file so that the code appears on screen... like a back-end development. I see all these programs for translating the games and changing tiles and etc. around to make hacks, but I am most interested in analyzing the code for the games and figuring out how they get things to work. Am I missing something here? Does anything like this exist and could you please point me in the right direction? I am running on a mac but if need be I can work on getting Windows XP or something working on here.

Thank you all for your time, your help, and have a great day!

Zoinkity

  • Hero Member
  • *****
  • Posts: 565
    • View Profile
Re: What kind of programs allow you to see the game's code?
« Reply #1 on: November 21, 2014, 11:44:33 am »
What you're looking for is a disassembler.  It disassembles processor code into something (somewhat more) humanly-readable.  The one you'll need is dependant on the processor used in that system.

Some emulators have a debugger with this feature built-in.  You can browse the code, set breakpoints to stop it at certain points, and trace what's executing when.

For the NES you'd want to look at FCEUX.

Unsure about SNES, but there's plenty of people here who can give you recommendations.

Pickings for N64 are rather sparse.  The old standby is Nemu64.  I've heard there's some arms of Mupen that have some decent capability, and if your specs are high enough there's the debug arm of MESS, but despite its age nothing matches Nemu for general-purpose work. 

Even with a good debugger though it takes time, practice, and a bit of reading to know what you're looking at.  Code works on data, and there's always some rhyme or reason to how data is structured.

henke37

  • Hero Member
  • *****
  • Posts: 643
    • View Profile
Re: What kind of programs allow you to see the game's code?
« Reply #2 on: November 21, 2014, 06:55:28 pm »
I like IDA myself, it is nice in that it automatically deciphers flow control for you.

mz

  • Sr. Member
  • ****
  • Posts: 447
  • Whore
    • View Profile
Re: What kind of programs allow you to see the game's code?
« Reply #3 on: November 21, 2014, 07:06:30 pm »
I use IDA for PSX games, but then I tried to work on some GB/C games, but IDA didn't detect the ROM bank switching, so I couldn't use it for these games.

What would you use for Game Boy ROMs?
There has to be a better life.

mistajack

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: What kind of programs allow you to see the game's code?
« Reply #4 on: November 21, 2014, 07:22:36 pm »
Thank you for the helpful answers, all! I will begin to look into this things. :)
Are these Windows only or am I in luck as a Mac guy?

mz

  • Sr. Member
  • ****
  • Posts: 447
  • Whore
    • View Profile
Re: What kind of programs allow you to see the game's code?
« Reply #5 on: November 21, 2014, 07:27:30 pm »
Quote
IDA is a Windows, Linux or Mac OS X hosted multi-processor disassembler and debugger that offers so many features it is hard to describe them all
https://www.hex-rays.com/products/ida/ :P
There has to be a better life.

mistajack

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: What kind of programs allow you to see the game's code?
« Reply #6 on: November 21, 2014, 08:55:50 pm »
Fantastic, thanks! I've been sleeping rather than looking into my answers :P sorry

KingMike

  • Forum Moderator
  • Hero Member
  • *****
  • Posts: 7071
  • *sigh* A changed avatar. Big deal.
    • View Profile
Re: What kind of programs allow you to see the game's code?
« Reply #7 on: November 22, 2014, 11:36:11 am »
Because disassemblers can't tell code from data, there's no easy way.
The only way I've done is FCEUX and manually copy+pasting code blocks from the debugger.
I've done a bit with bgb for Game Boy. But again, you'd have to manually copy+paste (and a bit annoyingly, bgb asks for the start point and SIZE of code to disassemble, rather than the start and end points :P ).
"My watch says 30 chickens" Google, 2018

Zoinkity

  • Hero Member
  • *****
  • Posts: 565
    • View Profile
Re: What kind of programs allow you to see the game's code?
« Reply #8 on: November 23, 2014, 09:21:02 am »
One big advantage of using an emulator-based debugger is not only seeing exactly what data the code is acting on as it works with it but everything is going to be uncompressed.  One of the biggest hickups when people start romhacking is having absolutely no clue how to handle compression.

Also, since you're working with the runtime the question of "what's data" and "what's code" is a lot more obvious.

As a standalone debugger, IDA is very, very good.

IIMarckus

  • Jr. Member
  • **
  • Posts: 68
  • Something terrible has happened here!
    • View Profile
    • IIMarckus’s homepage
Re: What kind of programs allow you to see the game's code?
« Reply #9 on: November 24, 2014, 05:45:56 pm »
What would you use for Game Boy ROMs?
For the Pokémon Red disassembly, we used mostly a combination of a simple disassembler plus data extraction tools written in Python and manual work with BGB.

Kea

  • Jr. Member
  • **
  • Posts: 54
    • View Profile
Re: What kind of programs allow you to see the game's code?
« Reply #10 on: November 25, 2014, 02:44:06 pm »
For the GBA, I would recommend No$GBA's debugger; it was recently released as freeware, so now anybody can use it. It's the best GBA debugger commonly available as far as I know.