ekeeke / Genesis-Plus-GX

An enhanced port of Genesis Plus - accurate & portable Sega 8/16 bit emulator
Other
673 stars 193 forks source link

The Amazing Spider-Man Vs. The Kingpin Random Freezes loading next audio track #505

Closed darthchewy closed 1 year ago

darthchewy commented 1 year ago

I think this might be a bug in gens plus gx. I know there is some latency when loading audio tracks in sega cd. but amazing spider-man vs kingpin will full on freeze for up to 5-7 seconds sometimes changing to the next track. It's really random but it freezes hard enough to where you think the game crashed. It's noticable in the world map when changing audio tracks but it's completely random. I'm trying to recreate this in kega fusion but I can't so far and it's popping up enough in retroarch for me to say something.

BooBerry commented 1 year ago

I play this game quite a bit, and have never encountered this issue. If I had to guess this is likely related to the rip of the game you're using. I'm using the multiple BIN + CUE file (which is verified against the Redump set hashes) and never experienced this problem.

ekeeke commented 1 year ago

I don't know how to change audio tracks in the world map and could not notice it playing a few levels but I was able to reproduce what looks like to be the described issue in option menu (with any of the redump images or BIOS model).

There are actually two ways of reproduce it if someone wants to try on real hardware or other emulators:

1/ highlight "BG MUSIC" and repeatetively press A button to disable/enable BG music, which will alternate between each audio tracks => after some attempts, BG music will eventually remain stuck to OFF when you enable it, then after a few seconds, it switches back to ON, music playback starts and controls are responsive again

2/ highlight "BG MUSIC" and press B button to enter Test Mode then switch between audio tracks using A/C buttons to select track + B button to play selected track => after some attempts, game will eventually be frozen and audio silenced, then after a few seconds, selected audio track starts playing normally but this time, controls remain unresponsive (reset required)

The thing is, this issue is indeed random but also very rare (one time every 15 to 20 attempts I would say, sometimes much rarer) so it could actually be a bug in original software.

A quick debug showed that when this happens, the game sends multiple PLAY commands successively to switch between different tracks before finally sending the one starting the selected track and letting it play normally. Since there is latency after each PLAY command before the disc starts seeking new position + seek time delay, this results in a very noticeable delay before the selected track starts playing.

Note that Kega Fusion does not emulate this latency or seek delay afaik, so it would be unnoticeable even if it also occurred in it.

ekeeke commented 1 year ago

Should be fixed by this commit as I can not reproduce above error cases anymore after these changes