Closed sulix closed 1 year ago
This one will be a bit tricky to test, because the inability to skip video seems to happen in two distinct ways:
Neither of these bugs seems to be systematic, so I will do multiple tests with your patch and report here once I am confident that it improves the situation for either of the symptoms.
No worries. I'm pretty sure this fixes the unskippable video issue — I haven't been able to reproduce it since, and it makes sense that this could be the cause.
I never encountered the second issue, so who knows…
At the moment, we "emulate" SDL_EVENTTHREAD by calling SDL_PumpEvents() in SDL_PeekEvent(). But some games don't even do this, so events aren't pumped at all, particularly while (e.g.) videos are playing, which is often just a tight SDL_DisplayYUVOverlay() loop.
If we SDL_PumpEvents() from within PresentScreen(), we should at least get events as long as the screen is being updated.
The complexity here is that SDL_PumpEvents() itself calls PresentScreen() to get a minimal framerate from things rendering directly to the front buffer. So we add a quick check to avoid SDL_PumpEvents() from entering infinite recursion by calling itself.
Should fix the difficulty with skipping videos in Alpha Centauri mentioned in #278.