Differences
This shows you the differences between two versions of the page.
ff3:ff3us:tutorial:music:songdata [2018/02/22 08:37] madsiur [Details on song channels] |
ff3:ff3us:tutorial:music:songdata [2019/02/12 12:05] |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ===== Insert Manually a Song Available on the Forum ===== | ||
- | In this tutorial we'll be importing in FF3us a song that is already in FF6 music format. There is no need for musical knowledge to be able to complete the following steps. The only things that will help is being familiar with the hexadecimal system as well as some basic ROM hacking knowledge like what is an offset, the difference between an absolute and hirom offset and how to use an hex editor. | ||
- | ==== 1. Getting the file and tool ==== | ||
- | We'll be using the FFIV song [[https:// | ||
- | |||
- | ==== 2. Files we will be importing ==== | ||
- | Extract the files from **FF4_prologue.7z** and you will see the following files: | ||
- | |||
- | {{ff3: | ||
- | |||
- | **prologue.spc** is the song in SNES format. Those can be played with a SPC player or with winamp and a plug-in. For more info on SPC file and how to play them, use Google or check the great [[https:// | ||
- | |||
- | All songs in our song database have the three same files. Some songs, mostly done by tsushiy and having a samll " | ||
- | |||
- | ==== 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?"// | ||
- | |||
- | I decided for the example to take the $EEAF01 spot, which has 767 free bytes, which is more than enough. As shown in the image below, I select with the mouse the pointer block, I do **Ctrl+c**, **Ctrl+g** to enter my destination (you can scroll a long time for the same result) and then **Right-Click-> | ||
- | |||
- | {{ff3: | ||
- | |||
- | The next thing to do is to change the following code. It's the only place pointers are read and you have to modify each LDA instruction so new base offset, new base offset + 1, new base offset + 2. This is not an ASM course so I'm not explaining further except only mentioning you have a total of 9 bytes to change. | ||
- | |||
- | **Original code**\\ | ||
- | {{ff3: | ||
- | |||
- | **Modified code**\\ | ||
- | {{ff3: | ||
- | |||
- | Last thing to do is changing the total number of songs. The offset is $C53C5E. It's a single byte that should be $55. Increase it of one each time you add a new song (replacing an existing one does not count). So congratulation you have not expanded pointer and can add as much songs as you want up to a limit of 255! | ||
- | |||
- | ==== 4. Verifying the song length ==== | ||
- | The next thing to do is verifying if your song fit in the spot you have chosen. If you expanded the song pointers and put your song in expanded ROM, you'll likely won't have to consider the following but some info is still important. Open the **prelude_DATA.bin** file with HxD. The first two bytes (inverted) are the amount of bytes the song take. In our case it is 0x044C bytes, as seen below. | ||
- | |||
- | {{ff3: | ||
- | |||
- | You have to verify the song will not " | ||
- | |||
- | {{ff3: | ||
- | |||
- | {{ff3: | ||
- | |||
- | We are below the limit with our 0x044C bytes for //The Prelude// so we are ready to insert the song! | ||
- | |||
- | ==== 5. Copying the song data ==== | ||
- | Copy all the content of **prelude_DATA.bin** (// | ||
- | |||
- | {{ff3: | ||
- | |||
- | You can optionally put //00// or //FF// at the place of the rest of the old song. This 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 and you can calculate its position will the below formula. It's simply pointers base offset + (song ID multiplied by 3). The other method is doing a hex search in HxD with the old offset of the song. In the case of as an example $C8EFA6, search for //A6EFC8//. | ||
- | |||
- | {{ff3: | ||
- | |||
- | {{ff3: | ||
- | |||
- | ==== 7. Changing the song instruments ==== | ||
- | Now the other part of the job is changing the song channels instruments. It's the same logic to calculate the beginning of a song instruments, | ||
- | |||
- | {{ff3: | ||
- | |||
- | Once the instruments data is pasted, save your ROM. Note that you can save (// | ||
- | |||
- | {{ff3: | ||
- | |||
- | You'll notice //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: | ||
- | |||
- | ==== Details on song channels ==== | ||
- | A thing that differs between songs available on the forum and original songs are the channel pointers in the song. Below is a channel of //The Prelude// and the song at the end loop toward the beginning of the blue section. The last command is F6 02 04 which mean continue by going back to 0x0402 byte after the start of the song. Every song in the original game have these command relative to their offset in the ROM meaning this F6 command would look like as F6 8E F3 ($C8F38E). It would not be exactly this because a song don't redo the first channel commands twice but I talk about this because such a tutorial would not have been possible with an unmodified original song, because when you move it you need to change all the song loop commands and channel pointers at beginning of song data. By having the custom song channel pointers start at 00 00 and not the song offset last two bytes, we easy the process a lot. | ||
- | {{ff3: | ||
- | |||
- | Below, a loop command of an original song pointing at $C8F9B9. In the case of a custom song, we would see more or less F6 0X YZ, likely something below 0x0A00. | ||
- | |||
- | {{ff3: | ||
- | |||
- | ==== Conclusion ==== | ||
- | |||
- | ==== Result in-game ==== | ||
- | {{ff3: |