What causes this weird SM crash? Sound driver crash, then door transition lockup

Started by andlabs, December 05, 2020, 09:59:11 PM

Previous topic - Next topic

andlabs

I've seen this happen in a few older hacks, but can only remember two right now (since I happen to be replaying them). The crash is the same: when entering a specific room, the sound driver crashes, but the game continues. The sound driver sometimes crashes with a bombastic sound, and sometimes just holds a note or ambient effect sound, and sometimes both, and sometimes neither. As soon as you touch a door tile, the game locks up, with only animations (such as palette cycles) continuing. The three pictures under each game below show the room before the affected room, the affected room, and the lockup when exiting the affected room. This also happens regardless of emulator (bsnes v080, snes9x v1.56.2 (GTK+ port v85), and some version of zsnes I forget now).

In Kill Time (the precursor to Super Kill Time), this happens in the room before Draygon (SMILE room pointer: 7D78F). However, it only happens *some of the time*, so it's really up to luck whether it happens or not. It also happens with both doors in, and happens both before and after beating Draygon. I've attached an SRAM file saved at the save station directly above it (it's a half-hack); both it and the below screenshots show the after-beating-Draygon state.



In Paddle, it happens in a Lower Norfair room a few rooms after you get Plasma Beam (SMILE room pointer: 7ACB3). It happens no matter what I try to do. Fortunately this room is not required to beat the game, but it's still annoying, and when I first played this hack I thought it was required, so I never actually beat the game. Sadly there's no convenient save in that area, but I have left a snes9x-gtk v1.56.2 (GTK+ port v85) savestate attached just in case it loads for you there too.



Given how rare this is I imagine whatever is causing this is either very obscure or has been fixed already, but it'd be nice if this could be patched up after the fact somehow (especially since there's another "classic" hack I can't beat due to a similar unrelated crashing bug, but that'll happen when I investigate reproducing that particular bug some more). So has anyone seen this yet, or know what's going on here? Thanks!

Quote58

I did a little bit of digging with the hack named Paddle, but didn't find the exact source. Here's the interesting stuff though:
-In geigers debugger, entering the room gives this message:
Sound CPU executing STOP at 0120
FF             STOP                         A:F
X: 04 V: FF S: CB P: Nupbhizc 225 0988

-The crash itself is at $808077, where the game uploads to the APU, and this is basically the game crashing if it fails enough times
-The door transition doesn't make it past:
$82:E664 22 F4 8E 80 JSL $808EF4[$80:8EF4]  ; Check if music is queued
-Most interesting however, is that the IRQ interrupt for scrolling the screen does not finish (when trying to leave the room via the save room door. The top door fails at the first music check instead), even though music should already be dealt with. Most likely this means something corrupted is being uploaded to the APU and it fails after a couple of seconds into it
-No other door transition code has been touched, in fact the only 'speed up' the hack uses is changing the colour division factor from C to 1 so that it fades in a single step. And just in case I did try changing that back but predictably it didn't change anything

I don't have time to go further into it tonight, but my guess from what I've seen is that the music or sound effects instructions in SPC ram are getting corrupted by as little as a single byte, giving the APU the wrong instruction.

Hope this extra info helps in some way!

andlabs

Heh, I should have thought of the possibility of the game being stuck waiting for the sound driver to respond =P Good insight! The question then would be what's causing the APU to be told to stop. Also I'll need to find and try out this "geigers debugger" (or start using bsnes-plus).

Super Kill Time actually does have a room that has the same problem in the same way as Kill Time: it's the portal room in the Wrecked Ship. That's right after the start of the game, so.

Black Falcon

Actually these rooms just have invalid music track settings, which lock up all sounds.

In Paddle, room 7ACB3 has its music settings set to "18 - Lower Norfair" for Song Index and "06 - Song Two" for play index, which locks up the music emulation because the Lower Norfair track does not have a second variant. Setting it to "05 - Song one" fixes it.

In Kill Time, it's pretty much the same deal with the music set to "1B - Maridia" and the play index at "07 - Song Three". What's interesting here is that it doesn't crash all the time, yet the game does not play any music but all the sounds. I think the author thought it'd be a nice feature to build tension before the boss fight or something.
I recommend just setting it to "04 - Statue Hall" to avoid any random crashing.


andlabs

All right. And for Super Kill Time, it's room 7AA82, it's set to 07 Song Three, and I changed it to 00 No Change instead.

Here are the resultant hex tweaks for all three:

Kill Time:
$7D7A6 from $07 to $04 (cheat code: 8FD7A604)
$7D7C0 from $07 to $04 (cheat code: 8FD7C004)
though for the boss-defeated state Elevator might be better, I don't know which that is
also I may have done something wrong with SMILE because it changed $10D10E from $00 to $FF but that doesn't seem to be necessary so I probably changed a random tile type somewhere

Paddle:
$7ACC5 from $06 to $05 (cheat code: 8FACC505)
oh and it turns out the reason why there was no convenient save was because there was a save room right under the first screenshot, meaning that the save room was past the broken one

Super Kill Time:
$7AA94 from $07 to $00 (cheat code: 8FAA9400)

Thanks again!