Points of Required Attention™
Smaghetti, a new Super Mario Advance 4 editor, is currently in development! Check out the thread HERE!

Please chime in on a proposed restructuring of the ROM hacking sections.
Views: 88,312,885
Main | FAQ | Uploader | IRC chat | Radio | Memberlist | Active users | Latest posts | Calendar | Stats | Online users | Search 03-28-24 11:07 AM
Guest: Register | Login

0 users currently in ROM Hacking | 3 guests | 1 bot

Main - ROM Hacking - Hacking Super Mario Kart Music New thread | New reply

Pages: 1 2

messiaen
Posted on 09-21-09 01:04 AM (rev. 2 of 09-21-09 03:17 AM) Link | Quote | ID: 115696


Cheep-cheep
Level: 32

Posts: 145/193
EXP: 203941
Next: 2501

Since: 05-26-08
From: Porto Alegre, Brazil

Last post: 4414 days
Last view: 4742 days
So, I'm trying to work on an addmusic-derived music importer for Super Mario Kart. I've got the basic stuff working however I'm having trouble on the insertion part.

Until now, I was relying on the offsets for the Select Player screen Dirtbag gave me to do a few tests. In this case, the data is compressed in the ROM at 0x61e28. Before the actual pattern pointers/music data, there are these 4 bytes:

2102 00D0

0x00D0 is a pointer to where the following data will be uploaded in the SPC-RAM. I'm not sure about what the first numbers do (perhaps the size of the data block to be uploaded to SPC-RAM?). Replacing the music data that follows works nicely, however sequences bigger than about 0x200 will crash the game.

But what is puzzling me is that I can't replace other decompressed sequences in the game. For instance, the Ghost Valley music pattern pointers beggins at 0x339 in the unheadered ROM, but when I replace it the data gets uploaded to the SPC-RAM at 0xD000 however some of the data around that region is overwritten, causing the sequence not to work.

Can someone offer some insight ? I know pretty much zero about SNES and SPC hacking, so this is new territory to me. Also, could someone explain how to work out the actual location of music data in the ROM from the pointers to music data in Stifu's SMK notes? So far what I have been doing is to dump the SPC RAM, go to $D000 (unheadered) and search for that in the ROM, however I don't understand how that pointer table in Stifu's note works.

This is a small test I did a few days ago. Note that is only a really quick test, before I even got all the loop stuff to work:



Thanks in advance.

Edit: Found some good information in these old d4's notes. Seems like I missed the fact that most tracks are indeed compressed, which is probably why I couldn't replace other tracks.

smkdan
Posted on 09-21-09 08:38 AM (rev. 2 of 09-21-09 12:08 PM) Link | Quote | ID: 115714


Ninji
Level: 36

Posts: 218/238
EXP: 287972
Next: 20138

Since: 05-26-07

Last post: 4033 days
Last view: 3982 days
The standard format for the header is:

bytes 1-2: size of block
bytes 3-4: ARAM address to start uploading to

If size of block == 0000 then ARAM address is actually the jump address for the SPC700. Make sure you get this right or you will crash the SPC700 when it tries to jump to a bogus address and make the entire game hang eventually if not immediately.

If size of block != 0000 then upload another block.

so it looks like it fits, atleast for the address part. I am assuming it uses the boot ROM to upload like other first party games. If it is actually using this format then it's uploading 0x221 bytes to 0xD000.

messiaen
Posted on 09-30-09 04:51 AM Link | Quote | ID: 116365


Cheep-cheep
Level: 32

Posts: 146/193
EXP: 203941
Next: 2501

Since: 05-26-08
From: Porto Alegre, Brazil

Last post: 4414 days
Last view: 4742 days
Thanks smkdan. Even after adjusting the block size in the header things weren't working right. I looked at the tracks from the game and after the music data there's always these 4 bytes: "00 00 00 08". Appending this after the music data mde things work. Is this usual in the N-SPC format or something specific to Mario Kart?

I've written a simple inserter using the Lunar Compress DLL, but what I need to do now is to repoint the music data to avoid corrupting the ROM when inserting data larger than the original.

I have a question about SNES pointers. To read pointers, I just read them as little endian and them get rid of the first nibble in the third byte. Ie:

28 1E [C]6 = 0x61e28
01 98 [8]4 = 0x49801

Now I have read from a DataCrystal article Dirtbag pointed to me that the "C" before the address means it's a pointer to ROM data. But what about "8" (as in the second pointer above) ? What's the difference and should I worry about it when moving data around?

smkdan
Posted on 09-30-09 06:18 AM Link | Quote | ID: 116371


Ninji
Level: 36

Posts: 219/238
EXP: 287972
Next: 20138

Since: 05-26-07

Last post: 4033 days
Last view: 3982 days

I looked at the tracks from the game and after the music data there's always these 4 bytes: "00 00 00 08". Appending this after the music data mde things work. Is this usual in the N-SPC format or something specific to Mario Kart?


The first 2 bytes mean size of block = 0 so stop uploading, the next two bytes are even used. the spc end will set it as the new destination in ARAM to start writing to, but it gets terminated so it's useless. The first two 00 00 bytes are the essential bits. The jump address in my above post is irrelevant because this game along with SMW uses a slightly modified copy of the bootrom code to handle the upload. This isn't 100% tied into N-SPC cause it's only upload code, not actual playback of the sequence data. This seems to be used all the way through to YI though, don't see why they'd change it up.

for the hell of it, the location of this will be of interest if you want to trace the upload incase something goes wrong (see RHDN for latest bsnes that lets you trace SPC with ease):

..10ac movw  $014,ya          A:00 X:01 Y:d0 SP:01cb YA:d000 NvpbhizC ;dest pointer = $D000 in ARAM


$014 is the pointer used in upload. note YA = D000 which is where it is sending the data. This one is actually used.

..10ac movw  $014,ya          A:00 X:01 Y:08 SP:01cb YA:0800 nvpbhizc ;move uploaded $0800 into $014, but never used cause it isnt uploading more
..10ae mov y,$00f4 A:00 X:01 Y:08 SP:01cb YA:0800 nvpbhizc
..10b1 mov a,$00f5 A:00 X:01 Y:50 SP:01cb YA:5000 nvpbhizc
..10b4 mov $00f4,y A:00 X:01 Y:50 SP:01cb YA:5000 nvpbhiZc ;non-zero in $2140 = upload more, but not here
..10b7 bne $1086 A:00 X:01 Y:50 SP:01cb YA:5000 nvpbhiZc
..10b9 mov x,#$31 A:00 X:01 Y:50 SP:01cb YA:5000 nvpbhiZc ;reset i/o port and timer
..10bb mov $00f1,x A:00 X:31 Y:50 SP:01cb YA:5000 nvpbhizc
..10be ret A:00 X:31 Y:50 SP:01cb YA:5000 nvpbhizc


this one is not, the 00 08 bytes you posted are used (see YA again) but the SNES told the SPC to stop uploading so it gets trashed and it returns to the main N-SPC code.

For the SNES pointers the way this works for hirom is that both C+ and 8+ pointers can point to ROM but there are strings attached for the 8+ ones.

Say if you had $8xxxxx then the bold 'x' letters must lie within $8000-$FFFF or it won't be accessing the ROM at all. it will get RAM, or other internal stuff, or even accidentally poke the DSP-1. With the C0+ pointers there isn't any such restriction, the entire range is ROM. It's like this so the snes can actually reset itself properly and that you can access some ROM, system control register and RAM in one bank. C0+ pointers are more flexible in this regard when repointing things.

messiaen
Posted on 11-08-09 11:05 PM Link | Quote | ID: 119031


Cheep-cheep
Level: 32

Posts: 151/193
EXP: 203941
Next: 2501

Since: 05-26-08
From: Porto Alegre, Brazil

Last post: 4414 days
Last view: 4742 days
Haven't worked on this for a while, so I'll just release what I have for now: a MML importer almost fully compatible with SMW's addmusic (it's actually built from romi's addmusic) and a simple inserter (requires Lunar Compress.dll).

A warning, the inserter will corrupt your ROM if the inserted file is bigger than the original one. Right now the only option is to manually change the music pointer table at 0x1f47b so that it points to a free area of the ROM. Once I know more how SMK editors such as MAKE deal with extending the ROM and using the extra space I will make it automatically repoint stuff.

Download.

Here's a conversion of a .mml file from SMWCentral to SMK:



A few differences from Romi's addmusic: intro command ('/') isn't supported, and you can only specify one string of musical data to each channel. For instance, this won't work:

#0 v180
#1 v200
#2 v220
#0 c
#1 d
#2 e

So change to this:

#0 v180 c
#1 v200 d
#2 v220 e

Instrument list can be found on d4s's notes.

Stifu
Posted on 11-10-09 12:20 AM Link | Quote | ID: 119083


Cobrat
Level: 56

Posts: 297/666
EXP: 1358148
Next: 40028

Since: 02-22-07

Last post: 656 days
Last view: 278 days
Hey messiaen,

You might want to use the compressor used in Epic Edit rather than Lunar Compress. It's open source, and has a higher compression rate.

As for repointing stuff, having a look at our SMK notes (although I haven't uploaded the updated version yet) or at the Epic Edit sources should tell you how to remap data (it's in Rom/Game.cs, looking for "Offsets.TrackMaps" for example).

Links:
SMK notes (HTML, CHM)
Epic Edit
Google Code (latest sources)

Hope that helps.

roxahris
Posted on 11-10-09 01:30 PM Link | Quote | ID: 119097


Level: 52

Posts: 485/568
EXP: 1069953
Next: 13887

Since: 02-19-07
From: Here?

Last post: 3894 days
Last view: 3857 days

addmusic
Ugh, people still use that? You'd think people would have moved onto a better way of editing music by now.

____________________
Love your lawn.

ScouB
Posted on 11-11-09 01:07 PM Link | Quote | ID: 119178

Newcomer
Level: 7

Posts: 5/7
EXP: 1371
Next: 77

Since: 03-24-09

Last post: 4903 days
Last view: 4698 days
Very interesting thread !

Good job !

Please keep us informed of the evolution of your work


messiaen
Posted on 11-11-09 04:17 PM Link | Quote | ID: 119187


Cheep-cheep
Level: 32

Posts: 152/193
EXP: 203941
Next: 2501

Since: 05-26-08
From: Porto Alegre, Brazil

Last post: 4414 days
Last view: 4742 days
Posted by Stifu
Hey messiaen,

You might want to use the compressor used in Epic Edit rather than Lunar Compress. It's open source, and has a higher compression rate.



Thanks, I may look at that. By the way, Dirtbag suggested I could perhaps use the original Track Layout/AI/Object Overlay Data space to put the new music data. Since MAKE expands the ROM and repoint stuff, the original data isn't used anymore. Does your editor do someting similar?

Posted by roxahris

addmusic
Ugh, people still use that? You'd think people would have moved onto a better way of editing music by now.


Still better than hex (by the way, Lilypond uses text-based files).

But thinking about alternatives, one could write a plug-in for some of the music notation programs out there, such as Finale or Sibelius. I know Sibelius has some sort of script language, not sure if it could handle exporting to N-SPC or something along that lines. Or perhaps one could search for a open music notation software and work from that.

Stifu
Posted on 11-11-09 04:53 PM Link | Quote | ID: 119188


Cobrat
Level: 56

Posts: 298/666
EXP: 1358148
Next: 40028

Since: 02-22-07

Last post: 656 days
Last view: 278 days
Posted by messiaen
By the way, Dirtbag suggested I could perhaps use the original Track Layout/AI/Object Overlay Data space to put the new music data. Since MAKE expands the ROM and repoint stuff, the original data isn't used anymore. Does your editor do someting similar?

Yes, Epic Edit does the same thing, basically. But not for data which has a fixed size, so it's not necessary to relocate it, like objects.

Deathkiller90
Posted on 09-18-14 03:52 AM (rev. 2 of 09-18-14 03:54 AM) Link | Quote | ID: 158432

Newcomer
Level: 3

Posts: 1/1
EXP: 58
Next: 70

Since: 09-18-14

Last post: 3479 days
Last view: 3479 days
The addmusic is broken, I tried using it properly (With the dll and without, changing it,) I just get an error saying "Side by side Configuration is incorrect" I used the cmd prompt properly. And tried redownloading, Only the most important one is broken, not the nspc.
I know its not the file i'm using because the error also happends when I just click it.

BLaBrake
Posted on 09-18-14 03:07 PM Link | Quote | ID: 158433


Goomba
Level: 14

Posts: 25/34
EXP: 11831
Next: 1240

Since: 06-27-14

Last post: 2398 days
Last view: 225 days
You have to do a google search and find these .dlls from somewhere. I can't give them to you because of Microsoft licensing, blah, blah, blah. http://imgur.com/fMNIdpI They shouldn't be too hard to find.

Another option is if you know how to use lunar compress already. Just use Stifu's offset notes to locate where the music goes and then recompress your .bin music file into the correct slot. Hope this helps...

MiniCompute
Posted on 09-19-14 11:32 AM Link | Quote | ID: 158441


Bubble
Level: 66

Posts: 605/981
EXP: 2415811
Next: 46040

Since: 04-25-07

Last post: 460 days
Last view: 669 days
Posted by BLaBrake
You have to do a google search and find these .dlls from somewhere. I can't give them to you because of Microsoft licensing, blah, blah, blah. http://imgur.com/fMNIdpI They shouldn't be too hard to find.

Another option is if you know how to use lunar compress already. Just use Stifu's offset notes to locate where the music goes and then recompress your .bin music file into the correct slot. Hope this helps...


Would you mind recording yourself on screen and show us how to insert the music to smk ?

I tried it myself and couldn't figure out what to do halfway into porting one song.
I'm visual learner so I learn faster if I see it done correctly by someone else.


BLaBrake
Posted on 09-19-14 06:04 PM Link | Quote | ID: 158442


Goomba
Level: 14

Posts: 26/34
EXP: 11831
Next: 1240

Since: 06-27-14

Last post: 2398 days
Last view: 225 days
I don't have time to make a video right now. I can try to when time permits, but that may be a while. Where are you getting hung up in the process? I can try to walk you through it.

MiniCompute
Posted on 09-19-14 09:16 PM Link | Quote | ID: 158444


Bubble
Level: 66

Posts: 606/981
EXP: 2415811
Next: 46040

Since: 04-25-07

Last post: 460 days
Last view: 669 days
Posted by BLaBrake
I don't have time to make a video right now. I can try to when time permits, but that may be a while. Where are you getting hung up in the process? I can try to walk you through it.


Log Name: Application
Source: SideBySide
Date: 9/19/2014 3:10:54 PM
Event ID: 33
Task Category: None
Level: Error
Keywords: Classic
User: N/A
Computer: MS
Description:
Activation context generation failed for "C:\Users\MikeXPTechnology\Documents\Mario Kart hacking\smk.exe". Dependent Assembly Microsoft.VC90.DebugCRT,processorArchitecture="x86",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="9.0.21022.8" could not be found. Please use sxstrace.exe for detailed diagnosis.
Event Xml:



33
2
0
0x80000000000000

22969
Application
MS



Microsoft.VC90.DebugCRT,processorArchitecture="x86",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="9.0.21022.8"


















C:\Users\MikeXPTechnology\Documents\Mario Kart hacking\smk.exe






















This is the problem the original proogrammer for this app may have made a tiny mistake.
http://blogs.msdn.com/b/cesardelatorre/archive/2011/03/27/the-application-has-failed-to-start-because-its-side-by-side-configuration-is-incorrect-error-related-to-mmc-exe-programs-and-weird-cause-amp-simple-solution.aspx
http://codeketchup.blogspot.sg/2012/07/how-to-correct-side-by-side.html


Can you look at the porgrams coding and see where it maybe erroring out ?


BLaBrake
Posted on 09-20-14 05:53 PM Link | Quote | ID: 158457


Goomba
Level: 14

Posts: 27/34
EXP: 11831
Next: 1240

Since: 06-27-14

Last post: 2398 days
Last view: 225 days
MikeTechno, I sent you a PM that should help...

MiniCompute
Posted on 09-21-14 06:47 AM Link | Quote | ID: 158466


Bubble
Level: 66

Posts: 609/981
EXP: 2415811
Next: 46040

Since: 04-25-07

Last post: 460 days
Last view: 669 days
Posted by BLaBrake
MikeTechno, I sent you a PM that should help...


Sweet jesus the program stopped erroring out, I refollow the directions and try it again later on today.
I may look into those dll licenses closer next week thanks for the tidbit.

MiniCompute
Posted on 09-22-14 09:08 PM Link | Quote | ID: 158486


Bubble
Level: 66

Posts: 614/981
EXP: 2415811
Next: 46040

Since: 04-25-07

Last post: 460 days
Last view: 669 days
Alright with the dlls in the directory the program opens up and closes ?

Could I please get some instructions to make it open all the way up to inserting the music ?
I have a 4kb mml ready to go I want to see it works out decently.

BLaBrake
Posted on 09-22-14 11:51 PM Link | Quote | ID: 158487


Goomba
Level: 14

Posts: 28/34
EXP: 11831
Next: 1240

Since: 06-27-14

Last post: 2398 days
Last view: 225 days
You have to run it in the command prompt (cmd.exe). Notes about how to use the commands are in my post a page or two back.

MiniCompute
Posted on 09-23-14 06:09 AM Link | Quote | ID: 158493


Bubble
Level: 66

Posts: 615/981
EXP: 2415811
Next: 46040

Since: 04-25-07

Last post: 460 days
Last view: 669 days
Posted by BLaBrake
You have to run it in the command prompt (cmd.exe). Notes about how to use the commands are in my post a page or two back.


Success I got it to excute and it sounds abit like you mention...
About your tutorial I'm going to copy everything into a word document and host it back up after you approve it.
Also before I leave aren't you MVS from smwcentral ? o0

~this music is too cheesy though~
Funny crap it is thanks for the help
Pages: 1 2


Main - ROM Hacking - Hacking Super Mario Kart Music New thread | New reply

Acmlmboard 2.1+4δ (2023-01-15)
© 2005-2023 Acmlm, blackhole89, Xkeeper et al.

Page rendered in 0.029 seconds. (342KB of memory used)
MySQL - queries: 127, rows: 167/167, time: 0.018 seconds.