ekeeke / Genesis-Plus-GX

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

Crash issue related to region switching #475

Closed Sonia-7 closed 1 year ago

Sonia-7 commented 1 year ago

Hello. I don't know if I should really be reporting this here, but I was told to do so from another repo so here I am. Instead of repeating everything that was posted there, I'll just point to the appropriate comment: https://github.com/TASEmulators/BizHawk/issues/3482#issuecomment-1342088293

So yeah, the problem is in that thread and the last comment is detailing what's causing the crash. I wonder if it's something that can be fixed?

ekeeke commented 1 year ago

From the linked comment, it looks more like a misuse of audio_xxx functions control flow in libretro dedicated code (libretro.c) than a core issue. Surely I could add safeguards in all audio functions to prevent this but some of these functions (namely audio_set_rate and audio_update) can be called during emulation runtime so I would prefer not to have unnecessary checks in them and have frontend developers properly respecting the control flow.

A simple fix seems indeed to force system_hw to zero either in retro_load_game (before check_variables is called) or at the end of retro_unload_game, to prevent audio or system from being reinited due to settings changes before they were actually inited, but as I am not that well confident with libretro specific code (which is maintained by libretro devs, not me), I suggest you report this into libretro repository, under https://github.com/libretro/Genesis-Plus-GX/issues

Note that I am not sure to understand (from the linked issue report) what the issue actually is i.e how to exactly reproduce it and if it actually occurs in every libretro frontend (including Retroarch) or is specific to Bizhawk use of libretro code, so you might want to clarify that as well when you report it.

Sonia-7 commented 1 year ago

Not sure if you've noticed it (sorry if you have), but the issue got fixed over there, so it can be pushed into upstream here now.