Basics of Hex Editing
View Single Post
November 28th, 2010 (12:39 PM). Edited November 30th, 2010 by miksy91.
Dark Energy is back in action! ;)
Join Date: Oct 2008
Location: A small country in the North
Now, some of you might think "nah, I won't bother reading this because it's hard an all...".
Really, there isn't anything magical about editing data with a hex editor. The only skill you really need is to know how to convert numbers of decimal system into hexadecimal system. You can additionally use Calculator to do this
There are 16 different numbers in hexadecimal system whileas there are only 10 in the "normal" number system (0, 1, 2,...8, 9).
In hexadecimal system, those are: 0, 1, 2, ..., 8, 9, A, B, C, D, E, F.
After F it goes to 10, 11, 12,.., 1E, 1F, 20 etc.
Doesn't sound too hard now does it ?
Now that you know what different numbers in hexadecimal system mean, it's time to download a hex editor ! Hex editor is a tool that can be used for hacking any game you desire. By opening the ROM with it, it shows what the ROM looks like - it's full of bytes, nothing else. So, hacking is actually only changing bytes.
GoldFinger is a fine hex editor which I use myself, you can download any hex editor you want to but this one is kinda user-friendly.
Get it here:
So do as you normally do when hacking a game.
1) Open the ROM with the tool (in this case your hex editor).
2) Edit the data you wish to edit.
However, editing the data isn't as easy as you may have gotten used to.
The problem is that first you've to locate the offset, where the data you wish to edit, is located.
Now as a simple example, let's change the specifics of a person in Viridian City in Pokemon FireRed. Open AdvanceMap and go to the event data of the person next to the pokecenter (on the right).
Below, you'll see its offset is at 3B4EDC.
Now, open the same Pokemon FireRed ROM with a hex editor.
Under "Edit" click Goto and type in the offset of the person.
You should see this:
Here, you can see that the "real" data of the person we're editing is 06 12 00 00 21 00 1A 00 03 03 20 00 00 00 00 00 8F 5A 16 08...
Now, let's take another look at the data of the person with AdvanceMap.
[Person event no.] = 6 (refers to 06)
[Picture no.] = 18 (12, notice that 12 in hexadecimal is 18 in decimal)
[Unknown] = 00 00 (00 00)
[X position] = 21 (21 00, if it would be 21 01, the person would be at 1 * FF + 21 = 120)
[Y position] = 1A (1A 00)
[Unknown] = 03 (03)
[Movement type] = "Walk up and down" (03, notice that this is the 4th in the list (00, 01, 02, 03))
[Movement] = 20 (20)
[Unknown] = 00 (00)
[Trainer] = No (00, Yes possibly 01 ?)
[Unknown] = 00 (00)
[View radius] = 00 00 (00 00)
[Script offset] = $165A8F (8F 5A 16 08, 08 is still a part of the script pointer and shouldn't be changed unless you know what you're doing. See shiny quagsire's definition for this a couple of posts below.)
The following bytes are 00's as well...
It seems Lu-Ho wanted to keep X and Y location bytes still in hexadecimal whileas Picture no. bytes are in decimal instead.
But yeah, now that you've read it through don't tell me it was that hard
Scripting is a lot harder if done the "hardcore" way.
All in all, editing trainers or doing some mapping with a hex editor isn't any harder than this - it's only changing bytes from one to another.
My Rom Hack
Learn how to hack GB/C games:
Check my GameBoy/Color hacking videos in Youtube
-The video set uses Pokemon Silver (U) rom for demonstrations
View Public Profile
Send a private message to miksy91
Find all posts by miksy91
Find threads started by miksy91
Ignore Posts by miksy91