Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
ff3:ff3us:tutorial:music:songdata [2018/02/21 23:58] madsiur |
ff3:ff3us:tutorial:music:songdata [2018/04/23 00:08] lockirby2 |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ===== Insert | + | ===== Manually |
+ | In this tutorial, we'll be using FF3us to import a song that is already in the FF6 music format. You do not need musical knowledge to complete the following steps. The only thing that will help is being familiar with the hexadecimal system, offsets, the difference between an absolute and HiROM offset, and hex editors. | ||
- | ==== Getting the correct tools and files ==== | + | ==== 1. Getting the file and tool ==== |
- | We'll be using the FFIV song [[https:// | + | We'll be using the FFIV song [[https:// |
+ | ==== 2. Files we will be importing ==== | ||
+ | Extract the files from **FF4_prologue.7z**, | ||
- | ==== Result in-game ==== | + | {{ff3: |
+ | |||
+ | **prologue.spc** is the song in SNES format. These files can be played with an SPC player or by using winamp and a plug-in. For more info on SPC files and how to play them, use Google or check out the great [[https:// | ||
+ | |||
+ | We provide the same three files for every song in our song database. Some songs (most were made by tsushiy and have a " | ||
+ | |||
+ | ==== 3. Choosing the right spot ==== | ||
+ | The first thing that you have to ask yourself is //"Do I want to replace an existing song or expand the number of existing songs?"// | ||
+ | |||
+ | For this example, I chose the spot at $EEAF01, which contains 767 free bytes. This is more than enough to contain the song pointers. As shown in the image below, I: | ||
+ | |||
+ | - Select the pointer block with the mouse | ||
+ | - // | ||
+ | - //Ctrl+G// to jump directly to $EEAF01 (it would take a long time to reach it by scrolling) | ||
+ | - // | ||
+ | |||
+ | Let's say that I want to put my song at $F30540, which is in expanded ROM. I would type **40 05 F3** at $EEB0000 (see right picture above). In this example, you would use song ID $56 to play your new song from event code. As you may have guessed, pointers are always inverted regardless of whether they are two or three bytes long. As for the old pointer data that you copied, you can overwrite it with 00 or FF since you moved it, giving you room for other things if needed. | ||
+ | |||
+ | {{ff3: | ||
+ | |||
+ | The next thing to do is to change the following code, which is the only place where these pointers are read from. You have to modify the three LDA instructions to the new base offset, the new base offset + 1, and the new base offset + 2. This is not an ASM course, so I will not explain this further except for mentioning that you have a total of 9 bytes to change. | ||
+ | |||
+ | **Original code**\\ | ||
+ | {{ff3: | ||
+ | |||
+ | **Modified code**\\ | ||
+ | {{ff3: | ||
+ | |||
+ | The last thing to do is to change the total number of songs. The offset where this value is stored is $C53C5E. It's a single byte that should be $55. Increase it by one each time you add a new song (replacing an existing one does not count). Congratulations! You have now expanded the pointers, so you can add up to 255 songs! | ||
+ | |||
+ | ==== 4. Verifying the song length ==== | ||
+ | The next thing to do is to verify if your song fits in the spot that you have chosen. If you expanded the song pointers and put your song in expanded ROM, you likely won't have to consider the following, but some info is still important. Open the DATA file with HxD. The first two bytes (inverted) show the amount of space (in bytes) that the song takes up. In our case, the song is 0x044C bytes long, as seen below. | ||
+ | |||
+ | {{ff3: | ||
+ | |||
+ | You have to verify the song will not " | ||
+ | |||
+ | {{ff3: | ||
+ | |||
+ | {{ff3: | ||
+ | |||
+ | We are below the $0x04CC byte limit because //The Prelude// is only $0x044C bytes long, so we are ready to insert the song! | ||
+ | |||
+ | ==== 5. Copying the song data ==== | ||
+ | |||
+ | Now copy the song data to your ROM. | ||
+ | |||
+ | - Select and copy the content of // | ||
+ | - In your ROM file, press //Ctrl+G// and enter //" | ||
+ | - // | ||
+ | |||
+ | {{ff3: | ||
+ | |||
+ | Optionally, you can overwrite the rest of the old song with //00// or //FF//. That way, you can easily see where there is unused space. | ||
+ | |||
+ | {{ff3: | ||
+ | |||
+ | ==== 6. Changing the song pointer ==== | ||
+ | If you have to put your song elsewhere in the ROM, you need to modify the pointer. You can calculate its position with the formula below: | ||
+ | |||
+ | <Pointer Block Base Offset> + (<Song ID> * 3). | ||
+ | |||
+ | You can also do a hex search in HxD with the old offset of the song. For example, if the old offset of the song is $C8EFA6 (as with //" | ||
+ | |||
+ | After locating the pointer, change it to the new offset of the song (inverted). | ||
+ | |||
+ | {{ff3: | ||
+ | |||
+ | {{ff3: | ||
+ | |||
+ | ==== 7. Changing the instruments ==== | ||
+ | Now the other part of the job is changing the song channels' | ||
+ | |||
+ | {{ff3: | ||
+ | |||
+ | Once the instrument data is pasted, save your ROM. Note that you can save (// | ||
+ | |||
+ | {{ff3: | ||
+ | |||
+ | You'll notice that //The Prelude// has 6 instruments. As mentioned previously, some songs downloaded from the forum (not a majority) might have incorrect instruments. In such an event, you'll need to assign the correct instruments. There is a complete list of original instruments [[ff3: | ||
+ | |||
+ | {{ff3: | ||
+ | |||
+ | ==== 8. Details on song channels ==== | ||
+ | One thing that differs between songs available on the forum and original songs are the channel pointers in the song. The image below shows a channel of //The Prelude//. The song loops from the end of the highlighted section to its beginning. The last command is //F6 02 04//, which loops the song by going back to the offset that is 0x0402 bytes after the start of the song. For every song in the original game, these commands are relative to their offset in the ROM, so this F6 command would look similar to //F6 8E F3// ($C8F38E) instead. However, it would not be exactly this because a song don't redo the first channel commands. I wanted to talk about this because such a tutorial would not have been possible with an unmodified original song. If you moved or inserted a song, you would have needed to change every song loop command and channel pointer! By having the custom song channel pointers start at 00 00 and not the song offset' | ||
+ | |||
+ | {{ff3: | ||
+ | |||
+ | Below, there is a loop command of an original song pointing to $C8F9B9. In the case of a custom song, this command would be something like F6 0X XX instead, likely a number below 0x0A00. | ||
+ | |||
+ | {{ff3: | ||
+ | |||
+ | ==== 9. Conclusion ==== | ||
+ | |||
+ | This tutorial was aimed at beginners. The rest of music hacking is harder and require some practice. However, it is within the abilities of anyone who has the time and patience to learn. To serve as a conclusion, I've made a small video that shows the import and simultaneously pays a little tribute to those who contributed to the song database. | ||
+ | |||
+ | ==== 10. Result in-game ==== | ||
{{ff3: | {{ff3: |