Dizzy611 / DancingMadFF6

An MSU-1 modification for Final Fantasy 6
Other
27 stars 1 forks source link

Music not playing after sleep? #17

Closed Dizzy611 closed 7 years ago

Dizzy611 commented 7 years ago

Not sure I've run into this issue myself (will have to test again, don't remember running into it), but two different users on the Qhimm forums state that the music does not resume after the "sleep" jingle plays.

No idea why this would happen, I'll have to look into it.

Dizzy611 commented 7 years ago

This may be related to issue #4 or a duplicate. If so, the sleep jingle is not using the same calls as the figaro->sabin->figaro one.

Dizzy611 commented 7 years ago

Fixing this the "obvious" way (not setting the playing track to 0x51/silence) just causes a recurrence of the old Double Play bug that the 0x51 set was supposed to avoid, so it doesn't work. An alternate fix that seems to work, but has not been tested thoroughly yet (I will be testing it in the event-fix-experimental branch so as to avoid polluting tested-and-working code ahead of release.), is as follows (this is such a hack, but oh well):

When succesfully playing an MSU-1 track, zero a flag called "ReplayFlag" When setting PlayTrack to #$51 at the end of the call to play an MSU-1 track (setting the SPC to the 'silence' track), set the "ReplayFlag" flag to #$01. When playing an SPC music jingle, if "ReplayFlag" is #$01, set it to #$02. When asked to play #$51 (silence), if ReplayFlag is #$02 (we silenced the SPC on the track before, then played an SPC jingle, and now the game is requesting to play the 'last track' before the jingle, which it thinks is #$51), we instead load the contents of MSUCurrentTrack/MSUCurrentVolume (which will contain the last MSU track and volume that were played before the jingle) and stick those in PlayTrack and PlayVolume before continuing.

Essentially, what this means is that the game should now correctly handle the following sequence of events:

MSU-1 is asked to play a track An event happens, SPC plays a little ditty, silences the MSU-1 MSU-1 is asked to play the track from before.

Potential side effects? If ReplayFlag ends up at #$02 and then track 0x51 is played by accident (which as far as I can tell could only happen in genuine cases of the game trying to play track 0x51, and even then should be highly improbable), then the game may burst into whatever the MSU-1 last played during what should otherwise be a silent moment. Look for bugs of this nature.

On the other hand, we could avoid one instance of this problem altogether if we mandated having an MSU-1 version of track 0x38 (the sleeping jingle), since then we'd be going MSU to MSU to MSU, which should work fine. But I don't really want to do that.

edale2 commented 7 years ago

I was just thinking of finding a replacement of the sleeping jingle to turn to PCM, as I read this, but was thinking it would break your fix. then you say it would solve the problem, lol.

I'll look into it.

edale2 commented 7 years ago

We could always go retro: https://www.youtube.com/watch?v=PY0nSYmaGrA ;)

edale2 commented 7 years ago

I can rip any of the individual songs from this (assuming I can't find a flac somewhere): https://www.youtube.com/watch?v=mNgFYB6bMRs

edale2 commented 7 years ago

https://mega.nz/#!CMRWkI7a!Tf8b2wJz_j20_njwWhFO5yL3AVWGumltrIKFLQLBJxc

Best I could find was a rip of the PlayStation port's copy of the in-game sound (in it's native .xa format, which I had to convert to FLAC before converting to WAV, else the end PCM ended up severely corrupted for some reason). But with it comes a new bug.

MSU audio on track 56 results in at most a second of the track playing before the sleep ends, music cuts out, and the screen fades back in (so sleep happens in a fraction of the time).

I'll bet this is another case where the fix is simply setting the SPC to play at 0 volume, rather than playing trac 51. Betting sleep is set to end when the SPC track ends.

edale2 commented 7 years ago

Oh, this happens with both master and experimental patches.

Experimental DOES fix the music resume though.

edale2 commented 7 years ago

And now I've given myself a conundrum.

When I found the Playstation rip of 'Good Night' (the official name of the sleep jingle in pretty much every Final Fantasy game), I also found the rips of the ENTIRE Playstation soundtrack.

https://www.zophar.net/music/playstation-psf/final-fantasy-vi Apparently the native format is PSF, and just a few of the tracks are .xa...

I kinda wanna convert them to a PCM pack for this, timing would be a breeze, and so should looping; so I could probably do the whole thing in a day or two... but is it really worth doing?

They're definitely an improvement on the SNES soundtrack, but I'm not sure they're an improvement over the OST (in fact, I might call them a downgrade from the OST in some cases).

On the flip side, it would be cool to be able to play FFVI with the Playstation soundtrack on the SNES...

What do you think?

Dizzy611 commented 7 years ago

I don't think its worth it. Our OST stuff is already taken from a (iirc) 2004 remaster of the official OST so it's as good as the "official" stuff is ever going to sound. You're probably right in that the PSX stuff would be a downgrade and while it might be "neat", it's probably not worth the effort for such a small difference in sound.

edale2 commented 7 years ago

Eh, I'll keep it in mind and might do it later as a stand-alone music pack if I still feel like doing it down the line, but'll probably just drop the idea.

edale2 commented 7 years ago

Also, odd thing with quimm, My first post went up immediately, my second post... has been waiting approval by a moderator for roughly 30 hours now...

edale2 commented 7 years ago

I've found a BEAUTIFUL OST remaster, completely by chance.

Dracula9AntiChapel, the guy that did the remaster qwertymodo used for his free MSU-1 audio pack for CHrono Trigger (for those that didn't want to pay for the symphonic version), has done a number of games OSTs, and FFVI is one of them.

He has an old version, which is complete, and a new version, which is about 1/2 way through the second disk.

When I asked about obtaining FLAC copies of his tracks (which didn't make the transition to MP3 gracefully...), he said not to use the old tracks, to wait for his new version of the remaster to be finished (which won't be until after he's done with his FFV remaster).

I'm DEFINITELY going to convert his music when I can, bu it's likely going to be a post-release music pack with how long it's probably going to be.

That said, I've asked if we could at least get a FLAC copy of his old version of "Nighty Night" (Good Night), since he hasn't done the new version of that yet, and we need it to bypass a bug. I'm hopeful he'll at least give us that.

https://www.youtube.com/watch?v=aOl6KvgJJkg&list=PLBdL0iJj-imYL0i1kzPXHwuLs5w5-YXXn&index=68

edale2 commented 7 years ago

Check out his new version of Omen 3 (Opening 3): https://www.youtube.com/watch?v=J_LbfE74078&index=3&list=PLBdL0iJj-imZZke8zQFKTo2Hb5dCcDK0X

It's got Magitech Armor walking sounds!!! (You KNOW how much I like ambient sounds)

edale2 commented 7 years ago

You know... I get the ENTIRE Playstation set of music converted into PCMs (I was bored, lol), Dancing Mad was the absolute last track I needed to do, and you know what happens? I realize that it only has parts 1, 4, and 5 of Dancing Mad it doesn't have parts 2 or 3, and Part 1 is just part 1, not the whole thing... and I can't find the PS version of Dancing Mad anywhere.

Sigh.

Dizzy611 commented 7 years ago

Hit this bug again, testing the experimental fix. Going to try something different, see how many times during the game it actually calls for track 51 (silence) without the msu mod, and if that number is fairly low maybe I could check for those specific scenarios, would simplify the code a bit

edale2 commented 7 years ago

Did you try getting it working with the PCM track of the sleep sound I supplied earlier? Last I tried it out it was still only giving a second of audio before ending the sleep cycle VERY quickly (haven't checked with the most recent patch you made me).

Looks like we're both doing playthroughs atm on the hunt for bugs and such atm, lol.

Dizzy611 commented 7 years ago

I haven't, no. I consider that a somewhat seperate issue, so I've been trying to fix how it behaves without an MSU sleep jingle first.

Right now I'm fastforwarding my way through a playthrough of the unmodified game to see if it ever actually calls to play track 0x51. Doing this by running bsnes-plus in debugging mode and setting breakpoints on write or read of address 0x1301 only if the data is 51. You see, there are two tracks in the SPC that are silence, 0x00 and 0x51, and while it calls for track 00 all the time I suspect my code is the only code that actually uses track 51. If that's true, then I can simplify my code a lot, because I can treat track 51 as basically a signal.

So far I've gotten to Locke and the Moogles without track 51 showing up at all.

My suspicion is that Track 51 was originally meant to be a song used at some point, and is simply never used because that song was cut early in development, but they couldn't be bothered to change their track numbering. And because of that, we're left with an empty, silent song in the middle of otherwise valid SPC code. The reason this is useful is because the way the SPC deals with being told completely invalid tracks isn't helpful to us (it ignores them completely instead of setting them as the playing track), so if we have a valid track that's silence, but isn't used as such, I can pass it around and have it get passed back to the MSU-1 as essentially a "resume" command.

Dizzy611 commented 7 years ago

Alright, on the assumption that I'm correct (I got to south figaro before deciding that it's a fair assumption I am, and if I'm wrong it'll show up in a bug later during my full testing), I've committed a fix that treats 0x51 as a special track used only by the MSU-1. If the MSU-1 play code is called with 0x51 in the PlayTrack area of RAM, then it assumes the game is trying to play the last track played and proceeds accordingly.

I also fixed a problem with the "figaro/sabin/figaro" (#4) fix that was causing the South Figaro inn to play silence even though other inns appeared to be fixed. Specifically the problem was that the game was attempting to manually fade the Good Night track by lowering its volume, and since volume lowering is essentially a call to play the same track at a different volume, my code was assuming the good night track should be placed in the "LastTrack" memory location. I've changed it so that it should only change the LastTrack location if the track currently being asked to play is not the same as the last track that was asked to be played.

If you'd like to help me test both these fixes, pick up the current IPS in Master branch from either the patch or installer directories, patch your ROM, and do 3 things, without any track in the "Good Night" slot:

  1. Watch the "cinematic" where you get to name Sabin near the beginning of the game, where it switches from edgar's theme to sabin's theme and back. Ideally, you should get the edgar theme in msu-1, then the sabin theme in msu-1, then the edgar theme in msu-1. What I'm expecting at this point however, due to some weirdness in this particular event routine, is that it will play the right track, but on SPC, for when the edgar theme returns. If it does that, that's okay for the time being. The problem here is that this particular event for some reason doesn't use the "Play Track" code that the rest of the game seems to use.

  2. Sleep at the "inn" at Figaro Castle. It should play the MSU-1 edgar theme, then the SPC good night theme, then the MSU-1 edgar theme again.

  3. Sleep at the inn in South Figaro. It should play the town theme (I think it might be Kids Run Through The City? not sure, but its one of the generic town themes), then the SPC good night theme, then the town theme again.

edale2 commented 7 years ago

Point 2: MSU audio - SPC good night - MSU audio... BUT there's a momentary auditory hiccup when the MSU audio resumes.

I'm not sure if it's something messing with the volume, or a second of the SPC audio kicking in for a second before being replaced by MSU, but it is noticeable.

edale2 commented 7 years ago

One note before this one. Edgar and Sabin share a theme song. The track that you say is Sabin's is actually titled "The Coin Song", and is the theme not of Edgar or Sabin, but instead it's the theme of all the flashbacks of Edgar and Sabin's past, revolving around the coin toss to decide their fate (where Edgar used a double-headed coin, heh).

Point 1: MSU Edgar theme - MSU Coin Song - SPC Edgar theme.

Entering/exiting the menu switches it back to MSU audio, I'd assume changing rooms would too.

edale2 commented 7 years ago

It'll take me a few min to get to South Figaro.

What type of audio bugs would you expect if the game itself calls track 51 for something?

edale2 commented 7 years ago

Point 3: Kids Run Through the City MSU - SPC good night - Kids Run Through the City MSU.

Seems to work fine here, anywhere else you need this build tested?

Now back to my playthrough, just made it to the Opera.

Dizzy611 commented 7 years ago

If the game calls for track 51, you would hear music where there's supposed to be silence, because the MSU code would play the last song it was asked to play, at the volume it was last asked to play at.

That hitch in Figaro castle is interesting, I'll have to investigate what's going on there in more detail.

Nothing else comes immediately to mind that needs testing other than making sure that my assumptions re: track 51 are correct. :P Which I'll be looking for as I continue testing

edale2 commented 7 years ago

http://fantasyanime.com/finalfantasy/ff6/saves/ff6save03Perfect_SouthFigaro.zip That gets you right outside Figaro Castle, Just enter and talk to Edgar to start the events therein.

Testing's easier when it only takes about 2 minutes to get where you need to be. ;-)

edale2 commented 7 years ago

Using the patch you made me in #27, that includes your old fix for this issue, Albrook's inn (first town after the Opera), no music after sleeping at the inn. I haven't been sleeping at many inns, so don't know how many are still broken with your old fix.

Here's hoping your new track 51 work pans out.

Dizzy611 commented 7 years ago

I've not yet encountered this at all in my playthrough since the "track 51" fix, so I'm closing this for now. If I run into it again I'll reopen it.

edale2 commented 7 years ago

MUCH better version of the sleep sound clip (and wow, it's small enough that I can just directly upload here without going through mega, lol):

ff3-56-2.zip

With the current Master branch: Resting in a tent on overworld: Clip plays properly, Overworld music ("searching for friends", post-airship WoR worldmap theme) resumes as normal. Resting in tent in dungeon: Need to test. Resting in Inn: Clip plays properly, but then keeps repeating until you leave the Inn (change screens). Will keep repeating the clip after entering/exiting the menu. Resting in relic shop of WoR Mobliz (bed, but not Inn): Clip plays properly, but then keeps repeating until you change screens or enter/exit the menu.

*edit- tested a tent at Mt Zozo (WoR) savepoint, clip kept repeating until entering/exiting the menu/changing screens.