Hello guys! This is Dark Rayquaza speaking (or writing xD).
This site is considered my personal research laboratory by me and many others. Its also a site to put some tutorials and stuff related to Advanced ROM HACKING! This means the stuff i'll put here will be more advanced compared to what i'll put on the forums, etc. More related to... Huh... ASM! Thats it, ASM, the assembly language!
Requirements for this tutorial are:
Tools:
Visual Boy Advance 1.8.0 beta3
eXtreme Script Editor
VBA-SDL-H
Knowledge:
Scripting (level:Advanced/Master)
ASM (since this is an advanced tutorial, you must be able to understand a routine correctly)
Working with the 'Search for Cheats' function of Visual Boy Advance
Working with VBA-SDL-H (breakpoints)
Part 1-> Finding the data and routines to change
First, how did i got all the information? ASM is the answer. Well, i was decompiling some asm routines and then remembered of the safari zone, how difficult would be to change that little area of the game which had so many secrets behind.
Well, i did got there the 'easy' way: The specials 0xCD and 0xCE in Firered/Ruby and 0xD0 and 0xD1 in Emerald! This specials are the ones who start the safari zone effects on field and battle (the 30 balls and 500/600 steps).
But since this is one of my first ASM tutorials, i'll be teaching how to find the data to change.
We're gonna start with the balls.
This is for Emerald! Don't worry though, you can use the same technique to find the offsets for the other games.
At this point, lets find the offset in the RAM where the balls we have are stored!
First, we know that we're given 30 balls at the start of the safari. So, we're gonna load up a file save, go to the safari zone and start the safari game.
Now, before anything, DON'T waste any ball. Make sure you have 30 balls before this step.
Open up search for cheats, by clicking Ctrl + C. It should appear something like this:
Now, we're gonna set it up like this:
Why 8 bits? Because the balls can only vary from 0x00 to 0xFF (0-255). If you didn't know, 8 Bit = 1 Byte.
Click 'Start'. Now 'Search'. Ignore the warning. Click 'OK' to resume the game!
At this point, go to a wild patch, encounter a pokemon try to catch it, wasting some balls.
Remember your remaining safari balls. If i wasted 2 balls, then my current balls would be 28, 0x1C.
Open again the 'Search For Cheats', and configure it this way.
Time to search :D
Click Search now. It should appear something like this:
Lets understand better this screen now! It appeared some values. Well, we need to exclude the values until we reach our value, the one we want.
So, we know that we start with 0x1E balls (30). So the old value must be 1E. Lets scroll down all values until we find one with the old value = 1E. Luckily, there are only two: 02026d6b and 0203a04c.
Lets test them out! Note down the offsets, and open the memory view. First change the first offset to a value you want in a range 0x00 -> 0xFF. Now open the start menu in game. You should see in the left upper corner the current balls you have. If they changed, then Success! You have found the offset!...NOT! Unfortunately, that's not the offset. Lets test the second offset!
...And YAY! It's the offset we want!!
Using the same technique for FireRed and Ruby, the offsets where the balls we current have are stored are:
Ruby:02038808
Firered:02039994
Emerald:0203A04C
Great! We now have the offsets necessary to change in 'run-time' the number of Safari Balls the player currently has! To change it, just do a 'writebytetooffset' with the balls you want!
But what if we want to change the number of balls given in Start of the Safari Game??
This is where the VBA-SDL-H enters: we're gonna find the routine that writes 0x1E (30 balls) to those offsets.
VBA-SDL-H is a special version of the VisualBoyAdvance, without GUI (Graphical User Interface), made specially for Hackers to ease their work in finding ASM routines by using technology known as BreakPoints!