Hacking tutorial
Posted by: WithLightsOut
Date: 2008-02-27 15:31:21
What is a good way to get started? i.e. tools, games, ect…
Thanks
Glitch City Laboratories closed on 1 September 2020 (announcement). This is an archived copy of a thread from Glitch City Laboratories Forums.
You can join Glitch City Research Institute to ask questions or discuss current developments.
You may also download the archive of this forum in .tar.gz, .sql.gz, or .sqlite.gz formats.
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
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.)
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 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 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: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!
[img]http://i262.photobucket.com/albums/ii89/iimarckus/withlightsout.png[/img]
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. (You may need some extra files to get MegaMap to ron, such as zerolib.dll or MSCOMCT2.OCX.) 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.