When last we left off, everything was terrible and there was no documentation anywhere. Well, there's still very little in the way of documentation, but not everything is terrible any more!
Update: Part 3, the climatic conclusion to this series is now available.
And thus, progress was made.
Let's get right to the good stuff that I really want to show off: MUSIC!The biggest development since the last post is that I now have music playing in the game and it sounds pretty frickin' sweet! I have about half the soundtrack replaced in the game right now and the only tracks I have that aren't in the game are the epilogue and credit scroll. So you can't play from start to finish without noticing that things are missing, but you can wander around much of the game and not notice!
How did this happen?
This is a great question and not one I can entirely answer. I was working with my patch code and trying to figure out why nothing was working when it just started working! There's very little in the way of helpful documentation out there and I've been largely unsuccessful in getting help in forums (though admittedly I haven't tried as hard as I absolutely can... yet) but I think that the reason it began working has something to do with getting my assembler to write with 8-bit registers instead of 16-bit registers. I'm not 100% sure on this though, but I've been thoroughly avoiding looking this gift horse in the mouth for the time being and just focusing on getting everything else working before going back and fixing this.At the end of this adventure, whether it ends in success or I give up out of frustration, I'd like to post what code I've got online in the hopes of helping others somehow. Perhaps when they come looking for a way to program for the MSU-1 on Google!
Why isn't this done yet?
There are, of course, problems still. The music doesn't play in the latest version of Higan and it doesn't play in bSNES v060 (which is the oldest version I can find online and the one that has debugging tools). Instead, it only plays in bSNES v075. I have no explanation for why this is, though I'm sure it relates to why my code suddenly started playing music. Time will tell on this one.Another problem is that although I've got about half the soundtrack inserted into the game, I don't even have the other half of the soundtrack! As you can hear in the video above, I've been using the Zelda ReOrchestrated album for A Link to the Past as a source for the music. The main reasons I've done this is because these songs sound great and they're pretty close to the in game tracks in terms of pacing and such, so they match up with cut scenes and events in-game well. Though perhaps the most important reason I chose to use ZREO's soundtrack is because it's free to download. Anyone can download the soundtrack, convert the music via an application (WAV2MSU) and a batch file I can distribute with my patch and then just have everything work together in the same folder. I could die happy if Blake Robinson did the entire soundtrack to this game so that I could just use that, but then people would have to pay for the soundtrack, and I'd like to have a freely distributable version to go with the patch. The ZREO soundtrack is not complete though, and missing tracks are things such as the Guessing Game House theme which people don't cover very often since they aren't as memorable as, say, the Dark World theme. So not having half the music in the game is a big problem.
Then there's still a handful of programming problems to tackle, with the main one right now being fading the music out. In Zelda 3 when you transition between areas and the game tells the music to change, the SPC code gently fades out the currently playing music for about a second as the screen changes, then the new music kicks in. Since I'm bypassing the SPC almost entirely now, I don't get this and there are sharp transitions between pieces of music as you can see in the above video with the transition from the church to the light world theme or the transition into Kakariko Village towards the end.
Things are looking up
The good news is that all of the above problems are being dealt with. Where the last blog post on this ended in despair and uncertainty, this new one ends with hope.Byuu, the guy who made bSNES/higan, is pretty active on his own forums so figuring out why the rom plays music in one version of his program and not another is probably just a matter of getting his attention for about five minutes so he can point out what I'm doing wrong. Then I can go and correct it. Even if I can't flag him down though, things are at a point where it works SOMEWHERE which is a lot better than when it didn't work at all anywhere!
A music major friend of mine, Shane Johnson, has agreed to help fill out the soundtrack! So there won't be any sudden silences or shifts to the original soundtrack. This is fantastic news and is much better than my fallback plan (learn to compose).
Finally, I've been trying to get the fade out loop to work with varying degrees of failure. In theory it should be pretty simple, just check to see if we're fading out and if so decrease the volume by a smidge and do this once per frame. The problem is finding the right way to do this without throwing off the rest of the program. For example, I would think that the NMI function would be the place to do this, but when I do, I get something like this:
Which is not ideal. I'm confident that I can fix this if I just spend more time experimenting and studying the code, but it might take a while.
If you know anything about any of this or would like to offer your help in general, please feel free to get in touch with me!
I once tried to get that done with Donkey Kong Country 2. Luigi Blood himself tried to do the patching and I did the Soundtrack. My work was fully done, but the patch was not. The game decided to do some funny crap, like not playing the sound effects anymore. But maybe some of the mentioned sources can help you to fill out the last few missing songs, too: http://www.dreimer.eu/msu/order.txt If you need any help, feel free to ask me. mail@dreimer.de
ReplyDeleteThe progress you made is impressive and the results couldn't be better. Way to go, congratulations.
ReplyDeleteWell, check this out:
ReplyDeleteI think I got the Fading work a bit...
http://bszelda.zeldalegends.net/stuff/Con/zelda3_msu.zip
(use the native Version on unheadered Rom)
Hey, I downloaded your zip file yesterday, but I haven't had the chance to look into it yet. I did glance at the readme files though and it sounds like you totally finished the project! I'm really looking forward to checking it out in emulator tomorrow!
DeleteMight help you get this working in Higan
ReplyDeletehttp://www.smwcentral.net/?p=viewthread&t=71558&page=1&pid=1111792#p1111792
I played around with this today. It didn't work right for me until I renamed the .pcm files the same as the rom with -0 -1 -2 etc before the extension.
ReplyDeleteAfter further playing around with this I managed to get it going on my sd2snes. I had to carefully read byuu's msu1 document to understand how to get it going. Apparently when you write to register 2005 it starts seeking for the song. If you write to the control register (2007) while it's still seeking it will ignore your write and won't play the song. I added a wait loop reading the status register (2000) until it returned that it wasn't busy seeking and then I wrote to control (2007) after it was finished seeking the song and now it works great. Here's a captured video of it running on a sd2snes from my console.
ReplyDeletehttps://www.youtube.com/watch?v=Jw5lstar3J0&feature=youtu.be
I'm glad to hear you got it working! Let me know if you manage to get fading working without glitches.
DeleteI got the fade working:
ReplyDeletehttps://www.youtube.com/watch?v=9aMipGg9TcU
https://www.youtube.com/watch?v=bmbCTDCSVDQ
Each came continuously either reads or writes to 2140 once every frame or so. I just set a jump point there and read / write to a free ram location if the volume should increase or decrease. When it gets close to either max or min it sets itself to max or min and then sets my ram address to do nothing.
err, each game haha
DeleteHi Mike, I'm the developer of the sd2snes. If you still need any assistance getting this to work on real hardware feel free to ask.
ReplyDeleteHello Mike. I am Brazilian and I am having trouble programming the MSU-1. My wav2msu tool does not open. Could you tell me in detail how I do sound tracks for the MSU-1?
ReplyDeleteI can't find create an XML file for mapping, either PCM tracks and data files.
Hello there. I start a project (snes killer instinct msu1 additions) and i will need some help. Thank you.
ReplyDelete