irixxxx / picodrive

Fast MegaDrive/MegaCD/32X emulator
Other
52 stars 24 forks source link

Snatcher (Sega CD) freezes at various points in the game. #29

Closed LevelUp-ErikJ closed 2 years ago

LevelUp-ErikJ commented 3 years ago

When playing Snatcher for the Sega CD, the game will freeze for extended periods of time at certain point in the game. It'll take up to five or so minutes for gameplay to resume.

Known instances of freezing occur at the following points in Act One (SPOILERS AHEAD):

In all of these instances, the game is essentially frozen until the text finally appears. This issue occurs with both BIN/CUE and .CHD file formats. The version of PicoDrive I am using is the most recent version for the FunKey S. In addition, this issue seems non-existent when loading the BIN/CUE files on the Raspberry Pi version.

Attached are savestates to let you recreate the first instance of the freezing.

Snatcher SaveStates.zip

irixxxx commented 3 years ago

Had this report before but couldn't reproduce it. Thanks for the save file, that should definitely help.

DrUm78 commented 3 years ago

Yep, reported on the FK Discord. But for sure, irixxxx will fix it quickly. ;)

irixxxx commented 3 years ago

thanks :-)

irixxxx commented 3 years ago

It's probably not some incompatibility on the CD side, possibly a cpu synchroniation problem. I'm on it.

LevelUp-ErikJ commented 3 years ago

Okay. Can't wait for the fix to drop! Snatcher's the perfect game for me to pick up and play while on my break.

On Fri, Sep 24, 2021, 12:34 PM irixxxx @.***> wrote:

It's probably not some incompatibility on the CD side, possibly a cpu synchroniation problem. I'm on it.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/irixxxx/picodrive/issues/29#issuecomment-926768035, or unsubscribe https://github.com/notifications/unsubscribe-auth/AVXM2HYXA5LZQ2Y3OYEAUTLUDSSC7ANCNFSM5EO5TSPA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

irixxxx commented 3 years ago

I'm through with the simple routes I can think off. Currently at doing a full trace and disassembly of the 68k code. This is going to take much longer than I expected :-/

irixxxx commented 3 years ago

This is a rather tough one. To keep you in the loop:

There's more disassembly and tracing to do to detect the root cause for this.

LevelUp-ErikJ commented 3 years ago

Well, that's... complicated. So would it be more effective to patch the game or update the emulator? Obviously, the end goal of an emulator is to simulate a game system as accurately and as fast as possible, but at the same time, it seems like Snatcher is the only game out of my Genesis and Sega CD library that has this issue. Of course, the ONE game that I wanted to play the most refuses to work.

On Sat, Oct 2, 2021, 6:11 PM irixxxx @.***> wrote:

This is a rather tough one. To keep you in the loop:

  • the delay you are experiencing is an in-game timeout of 3600 frames (exactly a minute)
  • besides the timeout it waits for 4 bits in a bitmask stored in memory to be zero
  • one of the bits however stays at 1, which is why waiting only terminates through the timeout
  • there is 1 code location where this bit is set and 3 where it is cleared, but it is not obvious to me what the meaning of this bit is There's more disassembly and tracing to do to detect the root cause for this.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/irixxxx/picodrive/issues/29#issuecomment-932827025, or unsubscribe https://github.com/notifications/unsubscribe-auth/AVXM2H6NTOLWNAD4FO4NLYLUE57QTANCNFSM5EO5TSPA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

irixxxx commented 3 years ago

Hmm, you could maybe try to patch that. If you have cue/bin, look for the binary bytes 31 fc 0e 10 78 4e in the bin file and change that 0e 10 to, e.g., 02 58 for 10s instead of 60s. That would however only be a hack, and it's unclear whether this would help with all the occurrences of this...

LevelUp-ErikJ commented 3 years ago

Any way to shorten that from 10 seconds to 5 or so? Or even 1?

On Sun, Oct 3, 2021, 4:12 AM irixxxx @.***> wrote:

Hmm, you could maybe try to patch that. If you have cue/bin, look for the binary bytes 31 fc 0e 10 78 4e in the bin file and change that 0e 10 to, e.g., 02 58 for 10s instead of 60s. That would however only be a hack, and it's unclear whether this would help with all the occurrences of this...

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/irixxxx/picodrive/issues/29#issuecomment-932886164, or unsubscribe https://github.com/notifications/unsubscribe-auth/AVXM2H3M7VPYSPUWTCMNNFLUFAF6JANCNFSM5EO5TSPA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

irixxxx commented 3 years ago

Well, fill that value with the time you want in 1/60 seconds. So, 01 2C for 5s, 00 78 for 2s etc. I'm however convinced that it wouldn't be without risk for game play to make this too short. And remember, it's just a hack. It doesn't solve the emulator issue :-/

LevelUp-ErikJ commented 3 years ago

Yep. I know it's just a hack. But if it's successful, it should work across other emulators that suffer the same issue.

On Sun, Oct 3, 2021, 11:26 AM irixxxx @.***> wrote:

Well, fill that value with the time you want in 1/60 seconds. So, 01 2C for 5s, 00 78 for 2s etc. I'm however convinced that it wouldn't be without risk for game play to make this too short. And remember, it's just a hack. It doesn't solve the emulator issue :-/

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/irixxxx/picodrive/issues/29#issuecomment-932973207, or unsubscribe https://github.com/notifications/unsubscribe-auth/AVXM2H3XVRRXIWJSVB64W3LUFBYYXANCNFSM5EO5TSPA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

DrUm78 commented 3 years ago

Yes of course but what irixxxx meant is that it is a dirty hack on rom side, not a proper one on the emulator one (so the emulator is not accurate here), which he does not like I think (and he's right). :)

But if that allows you to play Snatcher, that's nice then. :)

LevelUp-ErikJ commented 3 years ago

Yeah. I know it doesn't excuse the emulator's inaccuracies. This hack is more like putting a bandaid on a stab wound when it really needs stitches.

On Sun, Oct 3, 2021, 11:34 AM DrUm78 @.***> wrote:

Yes of course but what irixxxx meant if that's a dirty hack on rom side, not a proper one on the emulator one (so the emulator is not accurate here), which he does not like I think (and he's right I think).

But if that allows you to play Snatcher, that's nice then. :)

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/irixxxx/picodrive/issues/29#issuecomment-932974525, or unsubscribe https://github.com/notifications/unsubscribe-auth/AVXM2HY6IVAHHA3ZXC2MQKDUFBZY7ANCNFSM5EO5TSPA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

LevelUp-ErikJ commented 3 years ago

Well, I got the game to hang for just about 1 second, which is far more tolerable. Gonna pack it into a CHD and see if it still works.

On Sun, Oct 3, 2021, 11:54 AM Erik Jacob @.***> wrote:

Yeah. I know it doesn't excuse the emulator's inaccuracies. This hack is more like putting a bandaid on a stab wound when it really needs stitches.

On Sun, Oct 3, 2021, 11:34 AM DrUm78 @.***> wrote:

Yes of course but what irixxxx meant if that's a dirty hack on rom side, not a proper one on the emulator one (so the emulator is not accurate here), which he does not like I think (and he's right I think).

But if that allows you to play Snatcher, that's nice then. :)

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/irixxxx/picodrive/issues/29#issuecomment-932974525, or unsubscribe https://github.com/notifications/unsubscribe-auth/AVXM2HY6IVAHHA3ZXC2MQKDUFBZY7ANCNFSM5EO5TSPA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

LevelUp-ErikJ commented 3 years ago

Never mind. It freezes indefinitely when you meet Napoleon.

On Sun, Oct 3, 2021, 12:55 PM Erik Jacob @.***> wrote:

Well, I got the game to hang for just about 1 second, which is far more tolerable. Gonna pack it into a CHD and see if it still works.

On Sun, Oct 3, 2021, 11:54 AM Erik Jacob @.***> wrote:

Yeah. I know it doesn't excuse the emulator's inaccuracies. This hack is more like putting a bandaid on a stab wound when it really needs stitches.

On Sun, Oct 3, 2021, 11:34 AM DrUm78 @.***> wrote:

Yes of course but what irixxxx meant if that's a dirty hack on rom side, not a proper one on the emulator one (so the emulator is not accurate here), which he does not like I think (and he's right I think).

But if that allows you to play Snatcher, that's nice then. :)

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/irixxxx/picodrive/issues/29#issuecomment-932974525, or unsubscribe https://github.com/notifications/unsubscribe-auth/AVXM2HY6IVAHHA3ZXC2MQKDUFBZY7ANCNFSM5EO5TSPA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

LevelUp-ErikJ commented 2 years ago

Any updates? I'm not sure if modifying the binary file any further will be of any use.

irixxxx commented 2 years ago

I found at least the hang at the factory ruins. It's a bug in pcm data handling - when sample looping was programmed the 1st sample of the loop was lost. See commit fe8611f

irixxxx commented 2 years ago

Oh now that I know what to search for: https://gendev.spritesmind.net/forum/viewtopic.php?f=5&t=908&p=16221&hilit=1511e#p16221

irixxxx commented 2 years ago

@LevelUp-ErikJ could you please try the latest code and see if the problem is solved?

DrUm78 commented 2 years ago

This part is fixed for me, the text shows instantly now! 👍

Leaving the Turbocycle after arriving at the Abandoned Factory. Music plays and the background is animated, but the text doesn't load for several minutes.

LevelUp-ErikJ commented 2 years ago

Still frozen at the Abandoned Factory. Are you using the BIN/CUE, or the CHD? Also, did you use a specific dump of the game?

On Mon, Nov 1, 2021, 6:29 AM irixxxx @.***> wrote:

@LevelUp-ErikJ https://github.com/LevelUp-ErikJ could you please try the latest code and see if the problem is solved?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/irixxxx/picodrive/issues/29#issuecomment-956115947, or unsubscribe https://github.com/notifications/unsubscribe-auth/AVXM2HZD7HV4PPLXT2IFEQDUJZTXTANCNFSM5EO5TSPA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

LevelUp-ErikJ commented 2 years ago

Now it's freezing in spots it never froze before, like when you're looking at Little John.

On Mon, Nov 1, 2021, 12:21 PM Erik Jacob @.***> wrote:

Still frozen at the Abandoned Factory. Are you using the BIN/CUE, or the CHD? Also, did you use a specific dump of the game?

On Mon, Nov 1, 2021, 6:29 AM irixxxx @.***> wrote:

@LevelUp-ErikJ https://github.com/LevelUp-ErikJ could you please try the latest code and see if the problem is solved?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/irixxxx/picodrive/issues/29#issuecomment-956115947, or unsubscribe https://github.com/notifications/unsubscribe-auth/AVXM2HZD7HV4PPLXT2IFEQDUJZTXTANCNFSM5EO5TSPA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

irixxxx commented 2 years ago

I normally use self-made dumps from my own collection, in cue/bin format. bin file has md5sum 148048ad700070616087e455579664e4. I just made a chd from it, that works as well.

Which picodrive version did you use? Self-compiled from this repo? The only other current version is the funkey version from DrUm78.

irixxxx commented 2 years ago

At least with the saves you attached I cannot see the problem anymore with a version compiled from current master.

LevelUp-ErikJ commented 2 years ago

Hmm. I'll try compiling it myself. What tools do I need to compile a fresh copy of Picodrive? Also, were you using bin/cue or chd?

On Mon, Nov 1, 2021, 12:30 PM irixxxx @.***> wrote:

At least with the saves you attached I cannot see the problem anymore with a version compiled from current master.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/irixxxx/picodrive/issues/29#issuecomment-956386046, or unsubscribe https://github.com/notifications/unsubscribe-auth/AVXM2H2SSZLYMK6DVPZ6KGTUJ26DDANCNFSM5EO5TSPA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

irixxxx commented 2 years ago

On linux, just type "./configure&&make". If you need a version for some other hardware, read the boilerplate.

LevelUp-ErikJ commented 2 years ago

Hang on. I ran the OPK from GMENU2X, and the freezing didn't happen with Little John.

On Mon, Nov 1, 2021, 12:34 PM irixxxx @.***> wrote:

On linux, just type "./configure&&make". If you need a version for some other hardware, read the boilerplate.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/irixxxx/picodrive/issues/29#issuecomment-956388674, or unsubscribe https://github.com/notifications/unsubscribe-auth/AVXM2H2J5TODPV6T4V4U2VLUJ26PXANCNFSM5EO5TSPA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

DrUm78 commented 2 years ago

If you use RetroFE, you need to launch my latest OPK at least once under GMenu2X so it updates the binary for RetroFE too. This needs to be done for each OPK update. https://github.com/DrUm78/picodrive-irixxxx/releases

irixxxx commented 2 years ago

feedback, anyone?

LevelUp-ErikJ commented 2 years ago

Still testing. So far, so good. I'll give you a definite answer when I finish the game.

On Tue, Nov 2, 2021, 5:22 PM irixxxx @.***> wrote:

feedback, anyone?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/irixxxx/picodrive/issues/29#issuecomment-958176453, or unsubscribe https://github.com/notifications/unsubscribe-auth/AVXM2H225Q6RPN47PSDT7CLUKBJA3ANCNFSM5EO5TSPA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

irixxxx commented 2 years ago

After having received feedback from other sources I think this is fixed for the originally reported parts of the game. If you find more of them, please reopen.