[Guide] Adding Extra Songs to a Fire Red ROM
View Single Post
October 21st, 2008, 02:51 PM
n00b desu ka?
Join Date: Dec 2006
Location: Hastings, England
Adding Extra Songs to a Fire Red ROM.
Created by linkandzelda.
Hello. I'm linkandzelda.
This is my first tutorial for the PokéCommunity so hope you enjoy it. This tutorial is for FR only.
It will show you how to add in extra slots for inserting songs into your GBA Pokémon hacks.
1. Hex editor
4. Know how to use the tools above.
5. Some patience and a brain.
1. Repointing the song table.
Ok were gonna start by opening up or FR Rom in Sappy. Pretty easy but if you cant do that then you should'nt be following this guide.
Next were going to look for the location of tha song table. Look at the picture bellow for the location:
Now open your Rom with a hex editor and goto the location of your song table. I use Hex Workshop but it will work with any hex editor.
Once your there you should see something like this:
This is how song that are in FR are placed onto the song table.
They are structured like this:
Our next job is to find where our song table ends. This is a simple task and heres how to do it.
keep looking through the table until you see 0000 0000 0000 0000 and then other random bytes. this is the end of the table.
It should look like this:
Now you need to go back to the beginning of the song table and highlight from 0x4A32CC until 0x4A3DA8. Thats the song table.
Once you've highlighted the text you need to copy it.
Now we are going to repoint that table to a custom location. Find some free space after 0x800000. This is where we are going to place a copy of the table.
I used 0x960000 but you can use what you like. Before you paste the table in there is a slight calculation we have to do first.
Open up the windows calculator and switch it into scientific view.
What we need to do is find out how much bytes the table is taking up. We need to know this so that we can highlight the right amount of bytes to overight when we paste in the copyed table. The way to do this is to subtract the offset of where the table ends with where it starts. Then we are left with the size of the table.
When you do this make sure you switch it over to hex mode. Enter in 4A3DA8. Subtract 4A32CC from it. you should be left with ACD.
Now we have the size of the table we can calculate how much to highlight. Open the calculator again and enter in the offset to the beginning of your free space. Then add ACD to it. In my case it was very easy as I had 0x960000 so the result was 960ACD. If you chose another location then your result will be different to mine.
Ok. So we now know how much free space the table will take up we can highlight it and paste in the table.
Note: To hex workshop users: You can select a block of bytes from the coursor to an end postion using select block from the edit menu. This is usfull to select your data to then paste over. I don't know about other editors. They may have a similar option.
Now that the table is in the new location we need to first tell Sappy where it is. Minimize the hex editor and make your way to the folder you keep Sappy in.
Now locate a file named Sappy.xml and make a backup of it. Now open it with a hex editor or xml editor.
This is Sappy's config file. All the locations of the song tables are kept here also along with the names Sappy gives to it's songs. were gonna start be searching for the header of our Rom. Sappy list it's infomation by the Roms header. Were useing FR so make a search for BPRE. if your useing a hex editor then you should see something like this:
Can you see the circled area? Thats the location that Sappy looks for the song table. Now change that to the location of your new table. As you can see from the picture that i have already done it.
Note: After doing this you can only use sappy with your modified rom. Thats why I said to make a backup of the .xml so you can swap them round.
After you've replaced the offset save the changes and close Sappy.xml off.
Now you have almost completed the first part. Check the results by opening the Rom in sappy and try to play a song. It should play corectly.
Note the table offset has now changed to somwhere around your new offset.
The last part is to tell the Rom where to find the new table. we've told Sappy were to find it but not the Rom so open the Rom in a hex editor.
This is the part that confused me and caused damage to the Rom. Make a backup to be sure nothing can go wrong.
Now we need to tell the Rom that our table has moved to a new place. To do this we need to find the location that points to the old table. We do this by searching for the offset of the old table in reverse hex. So search for CC324A08. Thats the pointer to the old table in reverse.
You should come to this location:
There are five pointers to the song table. The highlighted one is to be changed last. For some reason if you change it before then it crashes the titlescreen and editing it back does not fix it.
Replace the other 4 pointers with your new pointer in reverse. To reverese a pointer is simple. 0x4A32CC becomes CC324A. you need to convert the pointer to your table into this format otherwise the Rom cant read it. This is one of the most important parts.
After you have replaced the 4 pointers save and open your Rom with VBA. If it reaches the titlescreen without a problem then your good to go. If it didn't make it to the titlescreen then you went wrong somewhere and probably have to restart.
If it worked for you then good. Now make a backup of your Rom because the next step could ruin everything. After you made a backup goto the power switch of your Computer and switch it off............. XD joking. We are now going to try changing that first pointer to the song table. If done last like this then it should work fine. Well it did for me. If it dos'nt then I can't help. Now test the rom again in VBA. If you reach the titlescreent hen you were sucsesful.
Congratulations. You have just repointed the song table in a FR Rom. This step is required to proceed onto step 2. If you like you can go onto do step 2 now.
2. Extending the song table and adding new songs.
Lets begin with the structure again.
Open your rom in a hex editor and goto the end of our new song table. This is where we make space for new songs to be added in. Put in about 2 lines of 0's.
That will create space for new songs.
Now open the Rom in Sappy and goto the last song, number 346: Teachy TV. Once there click over to song number 347 or just type 347 into the box. You will think nothing has changed but actully it has. Sappy was looking at those 0's you placed earlyer. As they are blank it said nothing. Were going to do something about that.
Go back into the rom opened in a hex editor and return to the end of your table. Following the scructure of the table type in the offset of the last song into the next space. Like this:
Now save and load up sappy. Goto song number 347 and play. It should be the teachy tv. Just to be sure that it worked open your rom in A-Map and change the muisc of a map to the Teachy tv. Note the number displayed to the left and add one to it. It is a hex number. Now test the map with VBA and it should be the teachy TV!.
Congratulations. You have just extended the song table and inserted an extra song. Now all you have to do is insert some custom tracks to that space and............Oh. It replaces the teachy tv also. Sorry but were not quite finished. You probably didnt notice but try switching between song number 346 and 347. If you watch carfully you will notice that the only thing that changes is the table offset. That is because when you inserted the tracks over our new slot you wrote the header infomation onto the teachy tv's header. Thats because we copyed it. No worrys. Were going to go back into the Rom with a hex editor and create our own header for our song................XD joking. Were lucky that Sappy does this for us. All we have to do find 2 lots of free space. One load for the tracks of our song data. And another for the new header that Sappy will make for us.
Now really open your Rom with a hex editor and find 2 lots of free space. You will need about 1 line for each songs header. Make a note of the offset your putting the header so you can insert other songs on the next line. Once you have your free space goto insert your tracks as normal over our new spot but make sure it looks something like the picture below:
I wouldnt recommend assembling a song useing any new slots you create. For the simple reason of you not chooseing where the header is placed. Whereas if you insert tracks you can choose where it's placed. If your insert window looks like mine then insert the tracks. Now check the teachy tv to see if it still is the teachy tv lol. It should be still the teachy tv. Our new track should now be your inserted tracks. Just to double check open the rom with VBA again and see if the music changed from the teachy tv to your new tracks. Remember to change the music in the map header to our new track number.
Congratulations. You have now completed the tutorial. You can add as many songs into your rom as you like useing this method. Just dont't forget to add in more 0's to the end of the song table.
One quick note. As this is still in beta stages I have no idea if there are any after effects. I dought that there is and if you are a talented rom hacker then you should know this aswell.
Hope this helps people.
Credits: Me XD
Click for the latest Pokémon: Liquid Crystal news
Last edited by Harold; April 15th, 2010 at
View Public Profile
Send a private message to linkandzelda
Visit linkandzelda's homepage!
Find all posts by linkandzelda
Find threads started by linkandzelda