Glitch City Laboratories Forums

Lab δ: Tech => Emulation & ROM Hacking => Topic started by: WithLightsOut on February 27, 2008, 03:31:21 pm

Title: Hacking tutorial
Post by: WithLightsOut on February 27, 2008, 03:31:21 pm
I'm new to hacking (never done it).

What is a good way to get started? i.e. tools, games, ect...

Thanks
Title: Re: help please?
Post by: IIMarckus on February 28, 2008, 12:30:34 am
For starters, you need a ROM. If you're starting out, I heartily recommend Pokemon Gold, as it has nice clean programming (unlike Red, Blue, and Yellow), and has a fair amount of tools for it (unlike Crystal). If you want to do GBA games, you certainly can, but the ROMs are much more complex and they also fall under the "too many tools" syndrome -- some things are best done with a hex editor.


So, a hex editor should be your next requirement. Translhextion (http://www.romhacking.net/utils/219/) is a solid choice; it has its bad points, but you shouldn't have any major problems with it.

And, of course, an emulator. VisualBoyAdvance (http://vba.ngemu.com/downloads.shtml) should be fine for our purposes.



Open Pokemon Gold in your hex editor. On the leftmost side, you'll see a list of numbers going "00000000, 00000010, 00000020," and so on. This is the offset, or file position. When somebody says "Such-and-such data is located at offset 18AC42," this means to scroll to that offset. (You can also get to a specific offset by hitting Ctrl+G and typing in "x18AC42" or whatever the offset is.)

In the middle you'll see rows of two-digit hexadecimal numbers. These are the bytes that make up our file. When we edit these, it'll change what happens in the game. Each byte has a value that can go from 00 to FF (the hexadecimal equivalent of 0 to 255).

On the right is the ASCII representation of each byte. ASCII is a method of storing text where one byte equals one letter -- 41 is 'A', 42 is 'B', 43 is 'C', and so on.


Now, let's start with something simple: editing text. This would be easy if Pokemon games used the ASCII standard to store their text -- but they don't! Instead of the above, Pokemon Gold makes 80 'A', 81 'B', and so on. So what to do?

ROM hackers came up with the solution to this some time ago. It's called "Thingy tables." A Thingy table is a text file that tells the hex editor what byte represents what letter. To make the Thingy table for Gold, open Windows Notepad and copy the following text into a new file:
Code: [Select]
7F=
80=A
81=B
82=C
83=D
84=E
85=F
86=G
87=H
88=I
89=J
8A=K
8B=L
8C=M
8D=N
8E=O
8F=P
90=Q
91=R
92=S
93=T
94=U
95=V
96=W
97=X
98=Y
99=Z
A0=a
A1=b
A2=c
A3=d
A4=e
A5=f
A6=g
A7=h
A8=i
A9=j
AA=k
AB=l
AC=m
AD=n
AE=o
AF=p
B0=q
B1=r
B2=s
B3=t
B4=u
B5=v
B6=w
B7=x
B8=y
B9=z
F6=0
F7=1
F8=2
F9=3
FA=4
FB=5
FC=6
FD=7
FE=8
FF=9
Then save it as "gold.tbl". Be sure to include the quotation marks when you save!


I've purposely left this table incomplete. When you're hacking and you find out that another byte represents a character, add it to your table!


Now, you should have your table file, gold.tbl. To use it in Translhextion, go to Script > Open Thingy Table, open the table, and then click the box that says "Thingy View Active."

Not everything in this ROM is text, of course. To find some, go to offset 195624. This is Oak's speech at the beginning of the game. Don't change the 00; this is a special control code that means "Print text until you reach a 57." Starting with the next byte, replace with this:

93 A7 A8 B2 7F A8 B2 7F A0 7F A7 A0 A2 AA E7 4F 93 A4 B2 B3 A8 AD A6 E8 E8 E8 57

"This is a hack! Testing..."

Save your ROM, and try it out!
(http://i262.photobucket.com/albums/ii89/iimarckus/withlightsout.png)

That's how you edit text. Experiment, and you'll be able to do more on your own!


The next thing most people want to do is rearrange the maps. There are multiple tools to do this; I recommend MegaMap (http://www.skeetendo.net/files/MegaMap.rar). (You may need some extra files to get MegaMap to ron, such as zerolib.dll (http://www.skeetendo.net/programs/agixp.rar) or MSCOMCT2.OCX (http://www.ocxdump.com/download-ocx-files_new.php/ocxfiles/M/MSCOMCT2.OCX/6.00.88046/download.html).) It has some quirks: mainly that it's only partially translated (from German). However, it's a great editor, and IMO better than Goldmap.
Title: Re: help please?
Post by: WithLightsOut on February 28, 2008, 06:35:51 pm
Thanks for the help!


I can't find 195624 though
Title: Re: help please?
Post by: IIMarckus on February 28, 2008, 08:50:34 pm
On the leftmost side, you'll see a list of numbers going "00000000, 00000010, 00000020," and so on. This is the offset, or file position. When somebody says "Such-and-such data is located at offset 18AC42," this means to scroll to that offset. (You can also get to a specific offset by hitting Ctrl+G and typing in "x18AC42" or whatever the offset is.)
So hit Ctrl+G and type "x195624". 195624 will be the fifth byte on the row marked "195620".
Title: Re: help please?
Post by: WithLightsOut on February 29, 2008, 04:06:07 pm
I did what you said but when it got to where Professor Oak talks, it just started the game over. What did i do wrong? :???:
Title: Re: help please?
Post by: IIMarckus on February 29, 2008, 05:29:25 pm
Sounds like you overwrote the 00 that starts the text. Don't do that; only replace the bytes after it.
Title: Re: help please?
Post by: WithLightsOut on February 29, 2008, 09:12:02 pm
Yep that was it but now another problem (I think) XD

When I copied in the line you said "
93 A7 A8 B2 7F A8 B2 7F A0 7F A7 A0 A2 AA E7 4F 93 A4 B2 B3 A8 AD A6 E8 E8 E8 57" he said colors and letters lol
Title: Re: help please?
Post by: IIMarckus on February 29, 2008, 09:34:11 pm
I don't get that result when I try. Could you post a screenshot of what you're getting?
Title: Re: help please?
Post by: WithLightsOut on March 02, 2008, 08:22:52 pm
(http://i84.photobucket.com/albums/k15/ash-land/goldcopy.jpg)
Title: Re: help please?
Post by: IIMarckus on March 02, 2008, 11:02:11 pm
You need to type the bytes in the left (middle) column. You can switch between columns by pressing Tab.

(http://i262.photobucket.com/albums/ii89/iimarckus/good.png)
(http://i262.photobucket.com/albums/ii89/iimarckus/bad.png)
Title: Re: help please?
Post by: WithLightsOut on March 03, 2008, 06:11:03 pm
Now I got it!

Thanks  ;D
Title: Re: help please?
Post by: Brocco Guy on April 06, 2008, 07:29:22 pm
For starters, you need a ROM. If you're starting out, I heartily recommend Pokemon Gold, as it has nice clean programming (unlike Red, Blue, and Yellow), and has a fair amount of tools for it (unlike Crystal). If you want to do GBA games, you certainly can, but the ROMs are much more complex and they also fall under the "too many tools" syndrome -- some things are best done with a hex editor.


So, a hex editor should be your next requirement. Translhextion (http://www.romhacking.net/utils/219/) is a solid choice; it has its bad points, but you shouldn't have any major problems with it.

And, of course, an emulator. VisualBoyAdvance (http://vba.ngemu.com/downloads.shtml) should be fine for our purposes.



Open Pokemon Gold in your hex editor. On the leftmost side, you'll see a list of numbers going "00000000, 00000010, 00000020," and so on. This is the offset, or file position. When somebody says "Such-and-such data is located at offset 18AC42," this means to scroll to that offset. (You can also get to a specific offset by hitting Ctrl+G and typing in "x18AC42" or whatever the offset is.)

In the middle you'll see rows of two-digit hexadecimal numbers. These are the bytes that make up our file. When we edit these, it'll change what happens in the game. Each byte has a value that can go from 00 to FF (the hexadecimal equivalent of 0 to 255).

On the right is the ASCII representation of each byte. ASCII is a method of storing text where one byte equals one letter -- 41 is 'A', 42 is 'B', 43 is 'C', and so on.


Now, let's start with something simple: editing text. This would be easy if Pokemon games used the ASCII standard to store their text -- but they don't! Instead of the above, Pokemon Gold makes 80 'A', 81 'B', and so on. So what to do?

ROM hackers came up with the solution to this some time ago. It's called "Thingy tables." A Thingy table is a text file that tells the hex editor what byte represents what letter. To make the Thingy table for Gold, open Windows Notepad and copy the following text into a new file:
Code: [Select]
7F=
80=A
81=B
82=C
83=D
84=E
85=F
86=G
87=H
88=I
89=J
8A=K
8B=L
8C=M
8D=N
8E=O
8F=P
90=Q
91=R
92=S
93=T
94=U
95=V
96=W
97=X
98=Y
99=Z
A0=a
A1=b
A2=c
A3=d
A4=e
A5=f
A6=g
A7=h
A8=i
A9=j
AA=k
AB=l
AC=m
AD=n
AE=o
AF=p
B0=q
B1=r
B2=s
B3=t
B4=u
B5=v
B6=w
B7=x
B8=y
B9=z
F6=0
F7=1
F8=2
F9=3
FA=4
FB=5
FC=6
FD=7
FE=8
FF=9
Then save it as "gold.tbl". Be sure to include the quotation marks when you save!


I've purposely left this table incomplete. When you're hacking and you find out that another byte represents a character, add it to your table!


Now, you should have your table file, gold.tbl. To use it in Translhextion, go to Script > Open Thingy Table, open the table, and then click the box that says "Thingy View Active."

Not everything in this ROM is text, of course. To find some, go to offset 195624. This is Oak's speech at the beginning of the game. Don't change the 00; this is a special control code that means "Print text until you reach a 57." Starting with the next byte, replace with this:

93 A7 A8 B2 7F A8 B2 7F A0 7F A7 A0 A2 AA E7 4F 93 A4 B2 B3 A8 AD A6 E8 E8 E8 57

"This is a hack! Testing..."

Save your ROM, and try it out!
(http://i262.photobucket.com/albums/ii89/iimarckus/withlightsout.png)

That's how you edit text. Experiment, and you'll be able to do more on your own!


The next thing most people want to do is rearrange the maps. There are multiple tools to do this; I recommend MegaMap (http://www.skeetendo.net/files/MegaMap.rar). (You may need some extra files to get MegaMap to ron, such as zerolib.dll (http://www.skeetendo.net/programs/agixp.rar) or MSCOMCT2.OCX (http://www.ocxdump.com/download-ocx-files_new.php/ocxfiles/M/MSCOMCT2.OCX/6.00.88046/download.html).) It has some quirks: mainly that it's only partially translated (from German). However, it's a great editor, and IMO better than Goldmap.
Whenever I do this, it comes out with so many # it will drive you bananas.
Title: Re: help please?
Post by: IIMarckus on April 07, 2008, 09:20:10 am
Whenever I do this, it comes out with so many # it will drive you bananas.
Whenever you do what? Could you be more specific?
Title: Re: help please?
Post by: Brocco Guy on April 07, 2008, 01:49:39 pm
Um...
When I make the Thingy Table and put it into the Hex Editor (For Gold) it comes out with a few P's and then _ and so on, (it's not understandable) and then #####################!
Title: Re: help please?
Post by: IIMarckus on April 07, 2008, 08:37:24 pm
Are you using the correct ROM?

Is the "Thingy View Active" box checked?

Are you at the right offset?
Title: Re: help please?
Post by: Brocco Guy on April 08, 2008, 05:29:17 am
Right offset?
Gold Rom.
Thingy View Active.
Title: Re: help please?
Post by: IIMarckus on April 08, 2008, 09:41:52 am
To get to the right offset, press Ctrl+G and type in x195624.

If you still don't see any text, then open your ROM in VisualBoyAdvance and take a screenshot of your ROM information -- it should look like this. (http://i262.photobucket.com/albums/ii89/iimarckus/confirm.png)
Title: Re: help please?
Post by: Brocco Guy on April 08, 2008, 02:41:29 pm
Okay, thanks!
Can you make it so
01=Bulbasaur?