From 87389e24863df58f02b42ad55e7ea9d14ba47ceb Mon Sep 17 00:00:00 2001 From: Joel Linn Date: Mon, 30 Nov 2020 21:11:54 +0100 Subject: [PATCH] [SDL2] Do not restrict callbacks to window thread --- src/xenia/hid/sdl/sdl_input_driver.cc | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/xenia/hid/sdl/sdl_input_driver.cc b/src/xenia/hid/sdl/sdl_input_driver.cc index ad6d68a8d..cfd08b431 100644 --- a/src/xenia/hid/sdl/sdl_input_driver.cc +++ b/src/xenia/hid/sdl/sdl_input_driver.cc @@ -81,6 +81,8 @@ X_STATUS SDLInputDriver::Setup() { assert_always(); return 0; } + // This callback will likely run on the thread that posts the event, which + // may be a dedicated thread SDL has created for the joystick subsystem. // Event queue should never be (this) full assert(SDL_PeepEvents(nullptr, 0, SDL_PEEKEVENT, SDL_FIRSTEVENT, @@ -409,7 +411,6 @@ X_RESULT SDLInputDriver::GetKeystroke(uint32_t users, uint32_t flags, } void SDLInputDriver::OnControllerDeviceAdded(const SDL_Event& event) { - assert(window()->loop()->is_on_loop_thread()); std::unique_lock guard(controllers_mutex_); // Open the controller. @@ -448,7 +449,6 @@ void SDLInputDriver::OnControllerDeviceAdded(const SDL_Event& event) { } void SDLInputDriver::OnControllerDeviceRemoved(const SDL_Event& event) { - assert(window()->loop()->is_on_loop_thread()); std::unique_lock guard(controllers_mutex_); // Find the disconnected gamecontroller and close it. @@ -460,7 +460,6 @@ void SDLInputDriver::OnControllerDeviceRemoved(const SDL_Event& event) { } void SDLInputDriver::OnControllerDeviceAxisMotion(const SDL_Event& event) { - assert(window()->loop()->is_on_loop_thread()); std::unique_lock guard(controllers_mutex_); auto idx = GetControllerIndexFromInstanceID(event.caxis.which); @@ -493,7 +492,6 @@ void SDLInputDriver::OnControllerDeviceAxisMotion(const SDL_Event& event) { } void SDLInputDriver::OnControllerDeviceButtonChanged(const SDL_Event& event) { - assert(window()->loop()->is_on_loop_thread()); std::unique_lock guard(controllers_mutex_); // Define a lookup table to map between SDL and XInput button codes.