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

Author Topic: How do you figure out what each bits do in a hex editor?  (Read 781 times)

geneOTV

  • Newbie
  • *
  • Posts: 2
    • View Profile
How do you figure out what each bits do in a hex editor?
« on: February 16, 2019, 03:30:52 pm »
Hello everyone!

I am a complete noob when it comes to ROM hacking, so I apologize if the question is a bit broad. I have a read a few guides on hexadecimal and I think I have a good understanding of hex and concepts like endianness, floating point, hex operations etc. I opened up a ROM(Pokemon Soul Silver) in a hex editor, but I'm completely lost after that. It's just a wall of numbers. Where do I even start changing things?

Thank you

nesrocks

  • Hero Member
  • *****
  • Posts: 560
    • View Profile
    • nesrocks.com
Re: How do you figure out what each bits do in a hex editor?
« Reply #1 on: February 16, 2019, 04:01:27 pm »
I'm not familiar with GBA hacking, but in general, the bytes in a rom can represent two things: data or a cpu instruction. You can find what each assembly command gets compiled to (its byte value) if you know what the cpu for the system is and then looking up somewhere the instruction set for that cpu. So you can learn to read the rom in hex form and start changing some values and running the game to see what it does. This is usually something more practical on very small games, such as atari ones.

With big roms like GBA roms there will be thousands and thousands of bytes to look at, so you'll want to use an emulator with a debugger function. It will show you the instructions in assembly code so it becomes easier to read. Notice it cannot know what is data and what is code, so it will show everything as code. Some emulators have an option to mark which bytes were executed as code or read as data in real time as the game is played, which helps a lot.

Zanerus

  • Jr. Member
  • **
  • Posts: 53
    • View Profile
Re: How do you figure out what each bits do in a hex editor?
« Reply #2 on: February 16, 2019, 04:51:37 pm »
Lets start with a link and a few questions.

https://projectpokemon.org/home/forums/topic/39011-rom-hacking-tool-and-resource-collection/

What is your goal for this project or are you just aiming to learn? If there's a certain goal I'd say start looking for notes online. An easy first excerises that helped me read code was to learn RAM hacking via gameshark codes. How data works in the ram vs the ROM is oftentimes the same, so crashing the ram wont delete your saves and such.

geneOTV

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: How do you figure out what each bits do in a hex editor?
« Reply #3 on: February 16, 2019, 05:49:46 pm »
-snip-

So, I don't have any specific goal right now. I'm just trying to learn the fundamentals and then move on to larger things. Do you recommend having a certain goal?

Also, thanks for the link.

Disch

  • Hero Member
  • *****
  • Posts: 2673
  • NES Junkie
    • View Profile
Re: How do you figure out what each bits do in a hex editor?
« Reply #4 on: February 16, 2019, 07:37:54 pm »
I'm just trying to learn the fundamentals and then move on to larger things. Do you recommend having a certain goal?

From my personal experience, I learn best when there's something I actually want to accomplish.  Having a goal that is outside my current reach is what drives me to expand my horizons and learn what I need to learn in order to achieve that goal.  When I learn something new, I can ask "how can I used this to solve my problem?".  And without that question, it's much harder to know whether or not the stuff you're learning is useful or in any way relevant.

So I would say yes.  Set a goal, but start simple like "I want to change some text" or "I want to change how much HP this pokemon has".

It's also worth noting that having a goal makes asking questions (and getting answers) easier.  Questions that ask for how to reach a specific end result are much easier to answer then big open-ended Qs where we (or even you) are not even sure what kind of answer you're looking for.