Skip to content

Importing STRM64 exports into a decomp repository

Gregory Heskett edited this page Feb 24, 2024 · 10 revisions

This is a guide that will run through the step-by-step process on importing the files generated by STRM64 into your game. This guide covers the steps for all decomp-based repos, with the exception of some PC Port repos (as there is an issue with one of the conversion tools when used with MinGW; the fix for this has not been pushed upstream at the time of making this guide). This guide is for the US version of the game only, as EU/SH sequences are not currently supported and JP has some edge cases to worry about here.

STEP 0: Building your decomp repo

This is a prerequisite step before attempting to import new streams into the game. Building the game at least once will ensure all assets have been extracted from the ROM, which may make following along with this guide easier.

STEP 1: Importing the generated files

AIFF Files

Navigate to the sound/samples folder in your decomp repository. Create a new folder called streamed_audio (case-sensitive). Copy all newly generated files with the .aiff file extension into this folder. Make sure not to rename these files without also modifying the generated JSON soundbank.

M64 File

Navigate to the sound/sequences/us folder in your decomp repository. Paste the newly generated file with the .m64 extension into this folder.

  • Notice that the generated M64 file starts with XX. Change it to be one greater than the largest hexadecimal entry in the folder. These files must be displayed in hexadecimal numerical order, or the game may not compile.
    • For example, if the filename with the largest entry begins with 29, your filename should be changed to begin with 2A.
    • Windows explorer may not show these files in the correct order, so be careful not to assign repeats.

JSON File

Navigate to the sound/sound_banks folder in your decomp repository. Paste the newly generated file with the .json extension into this folder.

  • Notice that the generated JSON file starts with XX. Change it to be one greater than the largest hexadecimal entry in the folder. It is recommended to keep these entries in hexadecimal numerical order, but is not a hard requirement to do so.
    • For example, if the filename with the largest entry begins with 2F, your filename should be changed to begin with 30.
    • Windows explorer may not show these files in the correct order, so be careful not to assign repeats.

STEP 2: Adding a table entry to sequences.json

Navigate to the sound folder in your decomp repository, and open up sequences.json. Add a comma to the very end of the last entry, and add a new line. In quotes, add the filename of your M64 file (without the extension) and follow it with a colon. Then within brackets and additional quotes, add the filename of your JSON file (also without the extension). Save and close the file.

  • For example, if your M64 file is named 23_my_sequence.m64 and your JSON file is named 26_my_soundbank.json, your entry should look like this:
    image
  • Sequences must appear in hexadecimal incremental order. If this is not done properly, the game may not compile.

STEP 3: Adding a new sequence enum

Navigate to the include folder in your decomp repository, and open up seq_ids.h. Add a new entry to the SeqId enum one above SEQ_COUNT and name it appropriately. Remember to save the file.

  • Your entry should look something like this:
    image
  • Note the enum entry should match the index of the entry added to sequences.json. If you reordered the entries in that file for any reason, you will need to do so here as well.

STEP 4: Adding a sequence volume table entry

Anybody using HackerSM64 version 2.1 or newer may skip this step.

For everybody else, navigate to the src/audio folder in your decomp repository, and open up external.c. Scroll down until you find the sBackgroundMusicDefaultVolume table. Add a new entry to the end of the table, and assign it a value that matches the master volume of the sequence file. By default if you did not pass a volume argument into STRM64, this value will be 127. Save and close the file.

  • Your entry should look something like this:
    image
  • Note the table entry should match the index of the enum entry added to seq_ids.h. If you reordered the entries in that file for any reason, you will need to do so here as well.

STEP 5: Testing your audio

The simplest way to test whether your audio imports work is to just replace any call to play a sequence. To replace the file select sequence, navigate to the levels/menu folder in your decomp repository, and open up script.c. Find the reference to SEQ_MENU_FILE_SELECT in the file and replace it with the new enum entry you created in step 3. Remember to save the file.

  • Your entry should look something like this:
    image

Once you're ready, go ahead and build the game. If the game doesn't compile, read back and make sure you've followed everything correctly. Once the game is built, start it up and visit the file select menu. If you can hear your audio and everything sounds good, then you are all done!