• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Forum moderator applications are now open! Click here for details.
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

[Guide] Adding Extra Songs to a Fire Red ROM

linkandzelda

Ex-rom hacker turned indie game developer
777
Posts
17
Years
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.

Requirments:
1. Hex editor
2. Sappy
3. A-Map
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:

352kk6p.jpg



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:

2uzbk7c.jpg



This is how song that are in FR are placed onto the song table.
They are structured like this:

29zqxp2.jpg



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:

zthp3n.jpg



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:

20us8c1.jpg



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:

11gpm2s.jpg



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:

ftzv9v.jpg



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:

aniplx.jpg



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.
Link


Credits: Me XD
 
Last edited by a moderator:

linkandzelda

Ex-rom hacker turned indie game developer
777
Posts
17
Years
thanks dude. part 3 will come soon. making sappy and a-map show new names for our songs.

link
 

Thrace

@tion
1,048
Posts
16
Years
  • Age 33
  • Seen Oct 2, 2016
Wow, nice tutorial LaZ :D

Though I can't see myself needing this (I've never even opened Sappy before) I might have a go at this tomorrow.
Mac emulation on XP is a bad idea.
 

linkandzelda

Ex-rom hacker turned indie game developer
777
Posts
17
Years
xd. thanks. its not mac emulation btw.... its the best mac theme for xp.
 

Magnius

Pokemon Music Hacking Guru
295
Posts
18
Years
  • Seen Feb 17, 2014
Sweet, so now there's almost no point in overwriting music. This should certainly help Zel out in Shiny Gold(Now he can keep the Kanto themes without overwriting them).
 

ZodiacDaGreat

Working on a Mobile System
429
Posts
17
Years
Great News, I made something useful for repointing stuff. You can get it here or at my thread in the toolbox.

To use just enter the offset from which you want to repoint and the lenght in HEX, then enter your new offset below... Bam... Table repointed.

Enjoy :)
 
1
Posts
14
Years
  • Seen Oct 17, 2009
it didn't quite work for me, even though I tried redoing it 3 times over, and then a really horrible thing happened and Hex Workshop didn't switch from my main file so now my rom is hosed ;A;
 

Jambo51

Glory To Arstotzka
736
Posts
14
Years
  • Seen Jan 28, 2018
Fantastic. Worked perfectly after multiple tries (i made some silly errors haha).

I just have one note, if you're adding a new song and you overwrite an old pointer that you added and it's placed BEFORE the song table in the rom, the song WILL NOT play in game.

Like if song table is at 0x9D1000 and it points to a header at 0x850000, sappy will play the song, but it wont work in the game. But if the header is at 0xA50000 it works perfectly.

Another note, if you add extra songs, make sure you don't repoint them in a hex editor. It plays the song but there's a weird reverb effect if you do that.
Instead, when inserting the song, just change the header in sappy.

Would post pictures, but can't yet.

Perhaps you should add that into your tutorial, LinkandZelda.
 
Last edited:
9
Posts
15
Years
  • Seen Dec 7, 2011
Is this my problem or something is wrong?
This ROM I have has its copyright image (the 1st screen when you opened the ROM where it says Copyright Nintendo and else) changed into other stuff. So when rewritting the song table offsets it will never reach the titlescreen , anything before the title screen still works, though (referring to Gengar Vs Nidoran)

PS: 900000 did translate as 000090, right?
 

Pokepal17

More cowbell~
1,519
Posts
15
Years
Is this my problem or something is wrong?
This ROM I have has its copyright image (the 1st screen when you opened the ROM where it says Copyright Nintendo and else) changed into other stuff. So when rewritting the song table offsets it will never reach the titlescreen , anything before the title screen still works, though (referring to Gengar Vs Nidoran)

PS: 900000 did translate as 000090, right?

Your rom crashed. So try again, and read the tutorial carefull. BTW, 0x900000 would be 00009008

The 08 means it will point into the first 16mb of thr ROM. :P
 
224
Posts
16
Years
  • Seen Mar 8, 2016
Is this my problem or something is wrong?
This ROM I have has its copyright image (the 1st screen when you opened the ROM where it says Copyright Nintendo and else) changed into other stuff. So when rewritting the song table offsets it will never reach the titlescreen , anything before the title screen still works, though (referring to Gengar Vs Nidoran)

PS: 900000 did translate as 000090, right?

You must have messed up somewhere (this happened to me like twice and I found some silly errors such as not repointing at the right offsets).
 
9
Posts
15
Years
  • Seen Dec 7, 2011
Yeah I was able to solve the problem when typing 00009008 instead of 000090.
Thanks.

Also, I'd like to mention something important.

When modifying the values in ROM via HEX Editor, make sure Sappy or VBA is not loading the same ROM it's editing, or it WILL fail, no matter your actions are correct or not.

For the easiest way, just close both programs.
 

NoriakiZ

Rookie
18
Posts
15
Years
  • Seen Jun 28, 2012
For some reason, Hex WS is only showing 2 numbers at a time. Are you using a different setting or something? Using the newest version of Hex WS.

I really hate being a n00b. -_-
 
Back
Top