-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PPSSPP on Retroarch crashes when restarting, closing, loading/saving state, enabling rewind support, or leaving Retroarch, but only when “Synchronize Audio” is enabled. #12841
Comments
What is that setting even for? I seem to remember someone mentioning a bug about some audio setting or code in libretro/retroarch that caused crashes, but it was a while ago. Not sure if it's the same one. That said, I think there have been various issues with save states and graphics resets in libretro. One problem is that libretro/retroarch are not designed for emulators that use threads, but rather for emulators of older systems. Using libretro/retroarch apparently also disables a lot of graphics features we use, as users have reported being stuck with OpenGL 2.x feature sets. -[Unknown] |
That setting keeps the speed of the audio consistent with the game; without it, the audio speeds up slightly but noticeably. Are you thinking of this issue? It’s what got me to look in the audio settings, but it deals with having the mixer enabled, not audio synchronization; this crash doesn’t seem to have anything to do with that. |
Yes, that's exactly what I was thinking of. Hm, PPSSPP just sends audio as it's generated by the game (games generate short bursts of audio data throughout each frame.) PPSSPP itself synchronizes everything based on display refresh. But notably, PSP games ran at 59.97 so if libretro is forcing 60 FPS even, you'll have 0.05% less audio than expected each second (the game will also run that much slower than it did on a real PSP.) Actually, or it might be more depending on how it forces. But either way, I'd guess that's the cause of the sync issue. Presumably the setting controls how libretro reacts to buffer underruns (i.e. when it is looking for that missing 0.05% of audio), but I'm not sure how that would result in crashes. -[Unknown] |
There’s a setting in RetroArch (Video > Synchronization > Sync to Exact Content Framerate) that, well, syncs up the game’s framerate and makes it so audio synchronization doesn’t have to be enabled (I also realized that part of the reason why the audio is desynced so much is that I use a 75 Hz monitor; setting the refresh rate to 60 Hz also doesn’t desync audio). Also, with “Synchronize Audio” disabled, restarting works fine unless I spam it. RetroArch crashes when rewinding, and enabling support for rewinding seems to make the games speed up heavily. Savestates and closing the game and RetroArch all seem to work fine. I should probably just switch to standalone PPSSPP, it doesn’t have any of these problems. |
I will note that rewind, even in PPSSPP proper, may impact performance a bit. Internally, that just creates periodic save states automatically. Even compared to the PS1, the PSP had significantly more RAM - and this just takes time to save. If your device's RAM and emulation is fast enough, it may fit within a frame with the emulation... but otherwise you may experience dropped frames. I'm not sure why enabling libretro's rewind would speed things up, though. Unless your device does thermal throttling. -[Unknown] |
Seems to be more of a problem with Retroarch, seeing as disabling audio syncing also fixes the Yaba Sanshiro core from crashing on exit. |
Good luck getting it fixed, I reported that loading save states (and only loading, saving worked fine) was broken over 2 years ago, right when a new commit broke that feature, and nobody bothered to try to figure out what the problem was. I came here looking to see if it had been solved yet, only to find the original issue completely removed (not closed). I'm amazed you figured out a fix, however, your solution does not work for me. With audio sync disabled, and 'Sync to Exact Content Framerate' enabled, the game seems to run in fast forward. Wise move to switch to the standalone. The RetroArch core doesn't seem to get much maintenance. Edit: Actually, with the latest RetroArch and latest PPSSPP, both save and load states DO work for me, with no settings needing to be changed. However, using RetroArch's autosave feature, to automatically save a game on exit (so that you restart where you left off later) does NOT work properly (I suspect RetroArch completely closes before it can happen), and trying to manually load your auto save state (if you have auto load state turned off) makes the game hang/crash. Your problem of RetroArch crashing when you reset the game happens for me with Audio Sync enabled, but not when manually closing RetroArch or hitting escape. Enabling rewind causes no problems on my end, but, as you mentioned, performance takes a hit. |
A somewhat crude way to solve the fast forwarding issue would be to increase the Vsync Swap Interval value, but I definitely wouldn't recommend doing that over simply using the standalone version. |
I don't know if it is the same issue on Android's Retroarch PPSSPP core or not, but when I turned off "Audio synchronization" the "Close content" function immediately works, but with "Audio Synchronization" enabled, there will be a freeze of the retroarch so that I'll need to force quit. The function "Sync to Exact Content Framerate" cannot help the content to be run in right FPS when Audio Sync is turned off. This bug seems appeared for a long time. I hope anyone would help to fix it. |
I can confirm this issue still exists. Disabling audio synchronization fixes the problem, but the game starts to run with double speed. |
Also still happening on my end (Android, windows works fine), crashing when closing content. Disabling audio synchronization let's you close content normally, but the game's fps is super sped up. Turning "Sync to exact content framerate" does not help normalize the game speed. |
I had this issue at one time, then when I updated the core on 5-17-2020 (that is the 'date modified' in windows), save and load states worked once again without issue. I tried updating the core the other day, and load states once again crashed games. Luckily I had backed up the core from 5-17-2020. Whoever is responsible for updating this core is obviously not paying much attention to this. |
Idk if it helps, this is what I get on my Linux VM with gdb (it doesn't seem to crash on Windows, or more rarely anyway):
|
On Linux at least, this freeze is specific to glcore and does not occur on vulkan. It occurs only when closing content and loading the dummy core, not when closing retroarch fully with the core running. I pulled both a gdb backtrace and strace in case they help. Unlike some core freezes, this one stops strace dead with no further output whatsoever. @Jamiras's interpretation of the issue seems likely from my perspective:
|
I think the libretro code handles audio pretty differently from our other ports, but maybe the issue is that it's trying to push audio after it's already supposed to have shutdown or something? Does it know at this point about shutdown? Line 87 in cbf2d3a
I'd argue that libretro should probably insta-fail this API if you call it after shutdown rather than deadlocking, but I understand that libretro isn't designed for multithreaded programming or to handle programming design from the past few decades. -[Unknown] |
using vulkan for the driver solved the problem for me |
Using Vulkan also fixed this for me |
What happens?
When loading a game on PPSSPP with “Synchronize Audio” enabled, restarting the game, closing the game, loading or saving state, enabling rewind, or leaving Retroarch, either by restarting it, closing it from the menu, or using the
Esc
key, PPSSPP will either segfault or hang. If “Synchronize Audio” is disabled, either before the game loads or after it has already loaded, this does not happen.What should happen?
It shouldn’t crash.
What hardware, operating system, and PPSSPP version? On desktop, GPU matters for graphical issues.
Arch Linux, RetroArch 1.8.5 Rev. 8bcd74bf42, PPSSPP v1.9.3-640-g6df422800. This seems to occur for any game, but I tested it specifically on “Lunar - Silver Star Harmony (USA) (PSP) (PSN)”.
Logs
Here’s a log generated by RetroArch. It comes from a segfault when trying to restart the game.
I tried getting a stack trace using gdb, but it doesn’t seem to work. It gives the message “During startup program terminated with signal SIGSEGV, Segmentation fault,” and when I try to run the backtrace command, it simply says “No stack.” Maybe I’m just not doing it right?
The text was updated successfully, but these errors were encountered: