• 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?".
  • 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.

Tool: M4A build in assembler (Music)

ipatix

Sound Expert
145
Posts
15
Years
M4A build in assembler

I think everyone who already hacked music knows that the "main" tool Sappy is very buggy and some of them are really nasty.

So I thought about making my own tool and now I want to present it to you.
I think you also should know Sappy's button "Assemble song". My tool actually does exactly the same job than this function but it doesn't "destroy" your ROM and it has also compatiblity to 32MB ROMs.
*UPDATE* the tools now also deletes the old song!

This tool should work for all games that are using the M4A engine (also called sappy engine).
I already tried out Wario Land 4, Golden Sun, Kirby NID, and of course Pokemon.

So let's have a look to the GUI:
m29_54cl51aa4.gif


The steps how to insert a song:
1. Make sure the "MPlayDef.s" library is placed in the same folder than the program.
2. Selcect your mid2agb output (.s file) and your ROM.
3. Type in the track group. Huh, I think you even don't know what it is. Which values you have insert here depends on the game you are using and on the type of song. So if you're using Pokemon games insert "0" for normal song, "1" for a sound effect and "2" for a fanfare and "3" for sound map sound efect (like rain).
4. Type in the songpointer offset. The songpointer is an entry of the songlist and it is needed to change the songpointer that it'll point to your new song. The songpointer is calculated like this:
Code:
songpointer_offset = ( song_number * 0x8 ) + songlist_offset
I will post the songlist offsets of Pokemon games below.
5. Just type in an offset of free space (it has to be word aligned).
6. Specify your soundbank/voicegroup
7. Define the "delete byte". The tool will fill the area of the old song with this byte.
8. Than click on "build in this song" and you will finally have a new sequence build in the ROM.

Just note that there are ways to make the program crash or even the song you'll insert:
-The input file is not an mid2agb output or the song syntax is not correct.
-You don't have write access to the programs folder (it will store temporary files there).

Also note that I won't bring out any updates for this toll because it does its job and I'm working on a new uitility that will be a little bit more blind user firendly than this one and will also contain diffrent functions like a music player and such or maybe an instrument set editor.

You can donwload the program from the file attatchment.
It should work on any OS that supports .NET 3.5 ( I used VC# 2008)

So now here are the offset of the songlists:
BPRE: 0x4A32CC
BPGE: 0x4A2BA8
AXVE: 0x45548C
AXPE: 0x4554E8
BPEE: 0x6B49F0
BPRD: 0x4A18F0
AXVD: 0x463428
BPED: 0x6C5BDC

So I hope you'll enjoy the tool!

PS: Greetings from Germany ;)
 
Last edited:

Platinum Lucario

The Legendary Master of [color=#D8D48C]Light[/colo
1,607
Posts
16
Years
Great, excellent! I am so glad we've finally gotten a better music assembler than what Sappy has. Sappy is rather unstable and can crash easily (and crash with certain loop points while testing out the song) and can only support a few .gba ROMs. I'm also looking forward to seeing a sound testing function on it so that anyone can test out their new song that they've inserted and being able to play every single soundbank in the ROM. Sappy could not support every single soundbank and some of them got replaced with simple beeps while testing out a song.

I would also like to suggest having a function that can edit the soundbank possitions and offsets and if there isn't a tool where you can convert a .wav file to a soundbank, then there should be a function in this tool to do so, that way anyone can record and convert their .wav to a soundbank. ;)
 
4
Posts
12
Years
  • Seen Oct 29, 2012
I'm a noob, so few questions if you don't mind.

1) 1. Make sure the "MPlayDef.s" library is placed in the same folder than the program.

What is this? I don't understand / I don't have a MPlayDef.s library? Where or how do I create one?

2) 6. Specify your soundbank/voicegroup

What is this? Is there a list of these anywhere? Or a method of locating them?

Thanks. All I wanna do is change a Pokémon battle theme x__X How difficult does this need to be D: I tried Sappy but it hates me.
 
3,830
Posts
14
Years
  • Age 27
  • OH
  • Seen Feb 26, 2024
I'm a noob, so few questions if you don't mind.

1) 1. Make sure the "MPlayDef.s" library is placed in the same folder than the program.

What is this? I don't understand / I don't have a MPlayDef.s library? Where or how do I create one?

2) 6. Specify your soundbank/voicegroup

What is this? Is there a list of these anywhere? Or a method of locating them?

Thanks. All I wanna do is change a Pokémon battle theme x__X How difficult does this need to be D: I tried Sappy but it hates me.
1. MPlayDef.s is an asm file containing info for every music command. It comes with the tool Mid2Agb.
2. There is a thread posted somewhere with all the voicegroups for FireRed, but the only way is to check through sappy.

EDIT: For those who don't get what track group really is, you could also think of it as a "priority" property. The lower the number, the less precedence it has. For example BG music is 0 so that sfx can play over top of it.
 
Last edited:
4
Posts
12
Years
  • Seen Oct 29, 2012
Thanks so much, actually managed to get a song imported now.

One thing I can't figure out (my sappy doesn't work), could someone tell me the soundbank offset for the wild battle theme in pokemon ruby?

Appreciated.
 

WrathOfArceus

Arceus Tamer
15
Posts
12
Years
  • Seen Aug 16, 2011
It Does not Work for me. When i open a Rom or S.file i get an annoying error
 

Full Metal

C(++) Developer.
810
Posts
16
Years
That's a pretty good indicator that you're doing something wrong.
You know what would be really helpful?
A screenshot, or even a description of what the error says.
...yup. Maybe then useful information can be given to you. (;
 

Full Metal

C(++) Developer.
810
Posts
16
Years
I just did what I had to do and nothing worked.

Then wouldn't it make sense to say you did not do what you had to do so therefor nothing worked the way you thought it ought? Hm?
Perhaps a screenshot would be nice to have, followed by step-by-step informations of what excatly you did.
 

Full Metal

C(++) Developer.
810
Posts
16
Years
^that^ makes debugging so much easier, believe it or not.
All the writer needs to do is wrap his code in try/catch statements now, and then he can figure out where the error comes from. :)
 

ipatix

Sound Expert
145
Posts
15
Years
@ruup20:

I'm sorry, the version I uploaded was out of date and didn't worked with .s with only 1 track.

I now uploaded a newer version!

@WrathOfArceus:
Can you give me your .s file or even tell me what kind of Unhandled Exception occurred (click on the details button).
 

SK3

Pokemon Hacking Company™ CEO
276
Posts
13
Years
Okay, so I loaded my ROM, loaded my .s file, put in the Song Pointer, the track data, and the soundbank offset. When I clicked assemble, I got the Unhandled Exception error, but I pressed continue, and the log continued to work. But then it got stuck on "Getting lengths of tracks". What did I do wrong?
 
Back
Top