SDL2Driver: Invoke dispatcher on main thread (#3818)
This commit is contained in:
parent
d9053bbe37
commit
204c031fef
5 changed files with 31 additions and 21 deletions
|
@ -28,6 +28,8 @@ namespace Ryujinx.SDL2.Common
|
|||
}
|
||||
}
|
||||
|
||||
public static Action<Action> MainThreadDispatcher { get; set; }
|
||||
|
||||
private const uint SdlInitFlags = SDL_INIT_EVENTS | SDL_INIT_GAMECONTROLLER | SDL_INIT_JOYSTICK | SDL_INIT_AUDIO | SDL_INIT_VIDEO;
|
||||
|
||||
private bool _isRunning;
|
||||
|
@ -154,10 +156,13 @@ namespace Ryujinx.SDL2.Common
|
|||
|
||||
while (_isRunning)
|
||||
{
|
||||
while (SDL_PollEvent(out SDL_Event evnt) != 0)
|
||||
MainThreadDispatcher?.Invoke(() =>
|
||||
{
|
||||
HandleSDLEvent(ref evnt);
|
||||
}
|
||||
while (SDL_PollEvent(out SDL_Event evnt) != 0)
|
||||
{
|
||||
HandleSDLEvent(ref evnt);
|
||||
}
|
||||
});
|
||||
|
||||
waitHandle.Wait(WaitTimeMs);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue