gpsp icon indicating copy to clipboard operation
gpsp copied to clipboard

Random crashes between screen transitions in certain games

Open hugorsgarcia opened this issue 3 years ago • 20 comments

The games I mostly played are Yoshi's Island, Metroid Fusion and Metroid Zero Mission. Sometimes these games crashes but I noticed this crashes are random, but only happen between screen transition. It does not happen everytime it is random but does happen always during a screen transition. In case of Yoshi's Island happens after you enter a tunnel. And in case of Metroid games during the doors transitions. I've also played Castlevania Aria of Sorrow from beginning to the end on Gpsp some weeks ago and it crashed 4 or 5 times within a 6 - 7 hours playthrough also during screen transitions

hugorsgarcia avatar Aug 26 '21 17:08 hugorsgarcia

Would be useful to mention the platform you are using and a few other details :P Otherwise we are hunting in the dark. Also mention the exact version of the gpsp core you are using. Thanks!

davidgfnet avatar Aug 27 '21 19:08 davidgfnet

GPSP core version : ( V0.9.1 b61bec2 ) RetroArch : 1.9.8 Platform : Sony PlayStation 2 Playing from a USB flash drive. Roms are US versions and unzipped

hugorsgarcia avatar Aug 30 '21 16:08 hugorsgarcia

One more thing : This was also happening in some older version from around two weeks ago

hugorsgarcia avatar Aug 30 '21 16:08 hugorsgarcia

I have a gut feeling about this bug and I'm trying to reproduce it first. Removing the dedicated BIOS translation cache (merging it in the ROM cache) could have a race condition where: ROM cache is flushed, RAM is not, there's a SWI emitted in the RAM cache. This call would have a direct branch from ram-cache to rom-cache and would be invalid after the RAM flush. I will try to reproduce it although I already know this is a possible bug and it really aligns with what you see (crashes after many hours, usually race conditions, that happen on scene changes (big recompilation -> flush) and it's more reproducible on low-mem devices like PS2). Thanks for the report and stay tuned for the fix :)

davidgfnet avatar Sep 02 '21 23:09 davidgfnet

I have a gut feeling about this bug and I'm trying to reproduce it first. Removing the dedicated BIOS translation cache (merging it in the ROM cache) could have a race condition where: ROM cache is flushed, RAM is not, there's a SWI emitted in the RAM cache. This call would have a direct branch from ram-cache to rom-cache and would be invalid after the RAM flush. I will try to reproduce it although I already know this is a possible bug and it really aligns with what you see (crashes after many hours, usually race conditions, that happen on scene changes (big recompilation -> flush) and it's more reproducible on low-mem devices like PS2). Thanks for the report and stay tuned for the fix :)

Well I don't think is a serious bug by any means, when I saw this happening first I started to do lots of save states, so when it crashes I just load and is fine so it doesn't hurt the experience. Now about the save states : This is something you should do when reproducing it. From what I've seeing is a common problem across other emulators that run on PS2 : crashes after many save and load states. This also happens with picodrive and snes station on PS2.

hugorsgarcia avatar Sep 02 '21 23:09 hugorsgarcia

Picodrive on PS2 by SP193 is open source if you want to give a look but snes station is a snes emulator but is closed never had the source release

hugorsgarcia avatar Sep 03 '21 00:09 hugorsgarcia

Here is a record I did that show the issue There are also some slowdowns during cutscenes : 8:42 - 35:18 - 58:32 The game crashes around 1:21:42 during a door transition and right after a loading state.

https://www.youtube.com/watch?v=tL5VYf9iiS0 GpSP version : 0.91 f51ed9 RetroArch version : 1.99

hugorsgarcia avatar Sep 07 '21 16:09 hugorsgarcia

You did not mention it would crash literally right after loading a savestate :D In any case I pushed some changes that fix a known bug that could be the cause of what you are experiencing. I managed to reproduce it on low-mem devices (like PS2) and happens indeed more often on things like scene changes. Please wait ~24h and download the latest nightly to test again and check whether it still happens or it was fixed :)

davidgfnet avatar Sep 09 '21 22:09 davidgfnet

I just tested again, the first thing a did was to load state to get back where I was. It loaded fine. Then I press start to see the map to know where I have to go (is metroid you have to use the map a lot ) as soon as I press start screen goes black and it crashed. Is the map screen also considered a screen transition ? There is always a 1-2 seconds delay to open the map even on a real GBA

hugorsgarcia avatar Sep 14 '21 01:09 hugorsgarcia

Are you using the latest nightly? Please just double check it :P Also, note that I changed the savestate code so old savestats won't be compatible. However retroarch doesn't really tell you I think, so it will just produce a crash at some point. Can you load the game from a savegame (If you are playing metroid I imagine you save every now and then right?) and then try to use the savestates but never load an old-format savestate? Sorry but it was necessary to implement the savestates again, they were a bit broken, I hope the new format is future-proof though :)

davidgfnet avatar Sep 15 '21 18:09 davidgfnet

When it crashed the first time I played I was loading the old state, so you are probably right. After this I overwrite the state next to a door to test again. I tried dozens and dozens of times loading the sate (the new one ) and passing through doors and opening the map. It didn't crash again. Then I did a 1 hour playthrough with no crashes. But I only did these tests in Metroid Fusion because was the game were his was happening the most. I think now this bug is like 99% fixed. If it happens again will be very rare.

hugorsgarcia avatar Sep 15 '21 18:09 hugorsgarcia

Ok I will keep this open for a while, just in case. But close it in a few days if you do not report a crash :) I did my own testing and managed to reproduce the bug and fix it (and verify it). It's a hard bug to reproduce but I was able to do so using many ROMs and qemu, so I'm relatively confident that this should be now fixed :)

davidgfnet avatar Sep 15 '21 22:09 davidgfnet

If there is any game or test you want to try tell me. I like bug hunting.

hugorsgarcia avatar Sep 17 '21 01:09 hugorsgarcia

I was able to reproduce this bug today in Donkey Kong 2. Load a state and then enter a stage in the game. Sometimes will freeze. I had to tried this around 15 times to get the freeze. But depends on your lucky. I recorded with my phone : https://www.youtube.com/watch?v=xMmjl_8Y6iY GpSP Version : 33f1e25099c64d08723d751c0f8dbf576914d4df

hugorsgarcia avatar Sep 17 '21 01:09 hugorsgarcia

I continue playing DK2 for around 45 minutes until this bug happened again and it crashed. This time wasn't right after the load state it had passed some minutes since the last one GpSP Version : 33f1e25099c64d08723d751c0f8dbf576914d4df

hugorsgarcia avatar Sep 17 '21 12:09 hugorsgarcia

Oh so you are just reloading an state over and over and at some point it fails, I see. Can you send me the savestate for DK2 that you use in that video? And the hash of the ROM you used too. Are you using the original BIOS? Can you send me the hash of your BIOS too? I suspect this could be an issue perhaps with Retroarch itself, like running out of memory or something like that. Thanks!

davidgfnet avatar Sep 27 '21 18:09 davidgfnet

Well I don't have that savestate anymore. yes I do use a original gba bios

BIOS MD5 : a860e8c0b6d573d191e4ec7db1b1e4f6 DK 2 MD5 : a1f160ee30ed36edea341a6f1c6a4efc I don't think the problem is retroarch because I did the same load/save over and over again in other cores like snes9x and picodrive it never crashed. I used turbo control to keep loading indefinitely. For example there are screen transitions between stages on demons of asteborg a mega drive game that is very demanding on the hardware by far the most advanced mega drive game thre is it has 16mb size. That why I tried to replicate the this bug with this title because it's a very big game. But it never crash even transition between stages right after the load states. Could not replicate with snes9x2002 either using similar methods. So definitely think it's a GpSP bug. RetroArch itself does crash on PS2. But mostly when you are browsing files on USB or when you change cores. This is a very old problem but it has nothing to do with crashes during gameplay

hugorsgarcia avatar Oct 05 '21 00:10 hugorsgarcia

@hugogacia360 I know it has been a couple of years but there have been major changes within that time to the gpsp core and many issues have been identified and fixed. Looking to get some of these older issues closed if possible - is this still a problem?

andymcca avatar Jul 31 '23 17:07 andymcca

@hugogacia360 I know it has been a couple of years but there have been major changes within that time to the gpsp core and many issues have been identified and fixed. Looking to get some of these older issues closed if possible - is this still a problem?

I don't know. My PS2 died around 2 years ago ( may God comfort him) but now I have a another one. I think I will give a look at again

hugorsgarcia avatar Dec 05 '23 00:12 hugorsgarcia

@hugogacia360 I know it has been a couple of years but there have been major changes within that time to the gpsp core and many issues have been identified and fixed. Looking to get some of these older issues closed if possible - is this still a problem?

Unfortunately most issues were not fixed. I tested games like Gunstar Super Heroes and Golden Sun and those the same issues. Even Metroid Fusion which worked pretty well at the time I opened this issue is now crashing too

hugorsgarcia avatar Dec 08 '23 22:12 hugorsgarcia