Ru's Buildfile Adventures | Tutorials

Music Insertion

Before you get into any actual insertion, it’s necessary to define what each song you want to insert as which ID. I strongly recommend making a MusicDefinition.event file and list each song as what you want in the table. Each ID must be unique, and there must be no overlap.


Here is an example above.

Insertion Time.

  1. Create a Folder and an Event Installer Dedicated to custom music. Make sure you #include "MusicFolder/MusicInstaller.event" in your main buildfile event.
  2. (Not Necessary but what I did) Is get the patch files for drumfix and NIMAP 2 from FEBuilder and place them in the MusicFolder.
  3. Collect all your S files into another subfolder.
  4. Download s2ea and have each S file run through the exe.
  5. Make another dedicated subfolder for the new event files and place them all there.

Include this in the start of the MusicInstaller.event

#include "drumfix_fe8.event"
ALIGN 4
voicegroup000:
#incbin "FE8_NI_Map_2.bin"

And now, add this after. engage are placeholders to keep the offsets intact. Feel free to make it whatever you want.

#ifndef SongTableOffset
#define SongTableOffset engage engage engage
#define SongTable(engage) engage
#endif

#define BattleMusicGroup 0
#define MapMusicGroup 1
#define SFXGroup 6

Your new event files contain the music that you want to insert within your buildfile. Open the first one and you should see something like this in the beginning of the file.

Your custom song may have something different like Song01. For every music file, you MUST replace every instance of Song01 or something similar with the name you want to give it.
If you’re using Notepad ++, simply ctrl+f, and go the replace option to change it the name you want it to have, then select REPLACE ALL.

Now, to begin #including each entry, make sure to have { } brackets to avoid overlap within the files.

Follow this template to the space.

{
#include MusicEvents/sample.event"
SongTable(sampleID, sample, MapMusicGroup)
}

The sampleID is what you defined in the beginning, the sample in the middle entry is what you replaced Song01 with, and MapMusicGroup relegates that certain song to be map music. You can choose between Battle Music, Map Music or making it a sound effect.

An example entry:

{
#include MusicEvents/BlessingoftheGeneralsI.event"
SongTable(BlessingoftheGeneralsIID, BlessingoftheGeneralsI, MapMusicGroup)
}

Adding entries to the soundroom

  1. Create a text file called MusicNames in the “Text” folder of the buildfile and attach it to the text buildfile event.

  2. Create another event called SoundroomInstaller.event and attach it to your master installer.

Add this to the start:

#define SoundRoomEntry(songid,length,name) "WORD songid length 0 name"
#define SoundRoomTerminator "WORD 0xFFFFFFFF 0 0 0"

This sets up finding the Name and SongID entry for your soundroom. How you set up the soundroom is determined by the order in which you put them.

To set up the name of each entry, go to the MusicNames file you made earlier, and follow this template:

## sample
Sample[X]

Simply add the text entry to the 3rd option in the template above, and you should get something like this:

Example:
ALIGN 4
NewSoundRoom:
SoundRoomEntry(BlessingoftheGeneralsIID, 0, BOTG1Text)
SoundRoomEntry(AdvanceID, 0, AdvanceText)
SoundRoomTerminator

SoundRoomTerminator is what ends the table, so make sure to keep that at the end of your Sound Room table.

Be sure to add this at the end. Clendo’s tutorial talks about this. What you’re doing is setting up the pointer NewSoundRoom as the substitute for the original soundroom. So when the game is calling the SoundRoom, the pointer it goes to will be NewSoundRoom, which is your table.

PUSH
ORG $1BC14
POIN NewSoundRoom
ORG $1BCC4
POIN NewSoundRoom
ORG $AECA8
POIN NewSoundRoom
ORG $AECD0
POIN NewSoundRoom
ORG $AED2C
POIN NewSoundRoom
ORG $AEEBC
POIN NewSoundRoom
ORG $AF438
POIN NewSoundRoom
ORG $AF830
POIN NewSoundRoom
ORG $AFE30
POIN NewSoundRoom
ORG $B0080
POIN NewSoundRoom
ORG $B042C
POIN NewSoundRoom
POP

And you’re done, when you build and enter your game, you should have your custom layout already set, along with the music you have added.

5 Likes