Mario64 Sequenced Music format by messiaen at 11:35 AM EDT on October 22, 2008
Hello, first post here!
I've been researching Mario64's sequenced music format. It doesn't use MIDI or the 'compact' sequence format found in other N64 games, but rather some custom format.
I created a simple parser tool to help me, you can download it along with ripped 'sequences' (the .m64 files) in this folder.
Depending on the track, it can output a fairly good result, but there are many details I'm still mising. Here are some practical examples of music modification in SM64:
(Mario Kart 64 music playing in Mario 64 after some manual editing).
I have to upload a more recent specification to my site, I discovered a lot more about the format.
by unknownfile at 9:45 AM EST on November 11, 2008
The music driver is probably shared across several N64 games, probably both LoZ games and Starfox. This is probably not the N64 generic driver, but very nice stuff nonetheless.
Did you mean to link this one for SMB3? http://br.youtube.com/watch?v=69-CPbZkPxE
I love this project, keep up the good work and don't worry about double-posting. That really only applies to multiple posts when you could edit a single one, and this is your thread anyway.
Wave Race 64 Offset by jurassicPieter at 12:36 PM EST on November 23, 2008
It would be cool to have a midi converter or anything. Anyway the Wave Race 64 US version 1.1 sequence bank offset is 7AE8B0 and has 33 sequences. 3 more than the USF. Also what procedure do you use to find these sequence bank offsets yourself?
I just found it by opening the rom, enter the offset of super mario 64 and look for the nearest 0003 signature that worked well(which sadly is very common in the rom)
by unknownfile at 12:53 PM EST on November 23, 2008
The USF set was ripped using the Shindou Edition, so it's natural that tracks are missing.
So, I have christened this driver "Nintendo generic", since it is used across several games, but is not like the other N64 generic driver (alSeqp, "Smashy").
You want to give us details on the driver subroutines?
Thanks everybody for the support :), I sure learned a lot while trying to understand this format.
To find the sequence "bank", you can either search for "00 03 00 xx" [xx being the sequence count (hex) you can get from the USF] or for the sequences themselves - which always begin with 0xD380, 0xD360 or 0xD320 - and scroll up from there. There is an utility in my site (seq_rip.exe) which will rip the sequences into individual files.
I'm not sure if I would call this format "generic" because these may be the only three games that use it (but I'm not 100% sure about it), because this is an very early format. Something I want to look now is at the sequences from the PAL version of Mario64 (it uses a few different commands) and provide a better support in my parser for Mario Kart/Wave Race.
I can't provide much technical information besides the specs I posted because pretty much I've discovered was by experimenting with the sequences themselves or by looking at portions of the sequence player to find some command lenghts.
hm, looking for the sequence bank by just checking the rom is like looking for a needle in a haystack. 00 03 00 xx is very common, D3 80, D3 60 and D3 20 are all very common too. And xx is not always certain(think of removed non-working songs, dynamic songs, different version etc.)
And i think it might work on other games but that the revision byte 03 is probably different( 00,01 and 02 are probably only used in super mario 64 beta's running on emulators because the real hardware was not made yet).
It's impossible to write a program that will find it all automatically, but i could write a program that will give all possible occurences and the human can pick which one it probably is.
See if i can make that. Would be cool to see if other games are using it. And might give you something extra to figuring out the midi.
I was looking at some of the Zelda 64 sequences and turns out that the format is more similar than I once thought, so with some modifications the parser might be able to tacke Zelda64 as well.
However I can't understand the "sequence bank" pointers. 0x30860 is the first sequence, so I think they are located between 0x303B0 and this.
This is for the normal (non-debug) Ocarina of Time ROM, it would be probably better to look for that on a Debug ROM as it might be more useful for hacking, but I couldn't find it yet (anyone wants to give some help on that?)
Edit: With some manual modifications, I got a Zelda64 sequence to run on Mario 64 :). Some of the sequences are more close to the Mario Kart64/Wave Race64 format, while others use a structure which is a bit different.
JurassicPieter: that's a nice idea. You can try also searching for 0xD320D7 or 0xD320D5, 0xD5 and 0xD7 being the two commands you would normally expect on the sequence beggining. The "20" after 0xD3 can be exchanged with 60 or 80. Also, usually all sequences start on an offset multiple of 0x10.
edited 10:07 AM EST November 26, 2008
by unknownfile at 1:34 PM EST on November 26, 2008
Can you check Starfox64? Pretty sure it uses the same stuff...
Indeed it uses the same format (first sequence at 0xFB220) !! So, it's really a generic Nintendo format, although not all games use exactly the same format.
So far, there are apparently three different versions:
Mario 64 (probably the first version) Mario Kart 64 / Wave Race 64 / Star Fox 64 Zelda (the most different but still pretty close)
Edit: Some Starfox sequences begin also with 0xD3E0.
Here is a starfox sequence played from Mario64: http://br.youtube.com/watch?v=kjLqJYWQgQE
Edit2: Yet another (1997 Nintendo) game which uses the same format: Yoshi's Story.
It's impossible to write a program that will find it all automatically, but i could write a program that will give all possible occurences and the human can pick which one it probably is.
I wrote a similar program to scan RAM dumps while doing some Hoot related stuff. Maybe it can help you out.
It takes the hex string (0x not needed) and a file extension (for multiple file checking) and returns a list of offsets to the queried hex bytes. If you want the source, just let me know. Just some pretty straight forward stream examination.
That's a interesting tool, and as someone who's just giving his first steps in programming I'd like to see the source. If anyone wants to use that method be sure that the ROM is in ABCD order. The z64 or v64 extension doesn't always means a specific byte order. AFAIR, there are some byte-swappers at dextrose.com.
I have found that 1080 Snowboarding also uses the same base format. Each game presents some minimal variations, but I'll try to cover some of them in my WIP specification (link on previous posts).
That's a interesting tool, and as someone who's just giving his first steps in programming I'd like to see the source.
I've updated the source with some comments to help explain things. One thing I noticed while reviewing the source is that you can enter multiple search strings separated by commas. I'd forgotten I added that. Be sure to put the whole list of search strings in quotation marks so the app doesn't get the arguments confused. BTW: This is a C# app and I use Visual C# 2008 Express Edition to build it.
If anyone wants to use that method be sure that the ROM is in ABCD order.
Agreed. This tool searches in sequential order, so if the bytes are reversed in your game image, be sure to reverse the search string bytes to match that.
Thanks for the source, I think I'll try something similar in C for misc romhacking purposes :).
I was looking at the USF Rip (I gotta learn to do this kind of stuff :D) of Mario 64 and I was wondering what are these alternate versions of Hazy Maze Cave and Dire Dire Docks? Also, why is the sequence 01 "End Level" missing?
Something very strange is that the first sequence (number 00) is rather akward. What happens is that this sequence is played all the time, along with the regular ones, kind like a second music layer. I don't know if it's used to initialize stuff or what, and it doesn't seem to support any instrument besides a simple "click". Any idea what may be the use of this? First I thought it could be used to initialize stuff, but I'm not sure about it, it doesn't seem to have any purpose.
Have been working on it. I tested it on the Super Mario 64 rom, said it should look for mininum number of songs 35 and maximum 35 and that offsets should be incrementing. Only one result came out of it.
Now all i need is make it possible to add arguments instead of changing the programming code.
Zelda branch by messiaen at 4:11 PM EST on December 7, 2008
Lol, keep breaking promises and delaying. No progress and only some time this thursday.I tested it on many roms even some of the older nintendo games, but so far no luck in most games. Should check pilotwings though, i think it will probably work on that game.
I keep having fun with a youtube fad i created which is expanding, just look for kk slider parody to know what i mean.
Good work Messiaen with the parser tool working on oot.
Sorry, random, but could someone check whether Animal Forest *dobutsu no mori", uses this Generic Nintendo format? It IS made by Nintendo EAD... So it might do :). I know for sure it doesn't use the smashy one...
If no one can, could you tell me how I could find out?
EDIT: okay, I doubt it does, because the instruments sound nothing like those in Mario 64... xD
Oh my wow! That's amazing! Thank you for looking into that messiaen! :) Does that mean I can use one of your tools to rip the music out? Or will you have to update it first?
"I keep having fun with a youtube fad i created which is expanding, just look for kk slider parody to know what i mean."
Yeah, I made one of those: http://uk.youtube.com/watch?v=i9-FWVrTkqA. I didn't realise it had already been done... But mines still pretty awesome ;], don't ya fink? :D xD
Paha, thanks :D. Now I gotta get on with some holiday work, and *not* get distracted by making more songs xD. My girlfriend has ordered me to, or else I can't see her this Saturday.. Now that's a good way to get me doing it =P.