diff options
author | liamwhite <liamwhite@users.noreply.github.com> | 2022-07-14 20:41:29 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-14 20:41:29 -0400 |
commit | 9627c550a0c4403813af23d6bdf5348aef0d08d7 (patch) | |
tree | df0f702a3777a500dc09bdbb136f339b6c6ca0a7 /src/input_common/drivers/sdl_driver.cpp | |
parent | 802bbb226389c073cc82821b021a7b1209c5f12f (diff) | |
parent | 5e7e55b98a22b8db0e3f8982837a306b6b66f61e (diff) |
Merge pull request #8510 from german77/vibration
input_common: sdl: lower vibration frequency and use it's own unique thread
Diffstat (limited to 'src/input_common/drivers/sdl_driver.cpp')
-rw-r--r-- | src/input_common/drivers/sdl_driver.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/input_common/drivers/sdl_driver.cpp b/src/input_common/drivers/sdl_driver.cpp index 446c027d3..00474ac77 100644 --- a/src/input_common/drivers/sdl_driver.cpp +++ b/src/input_common/drivers/sdl_driver.cpp @@ -438,10 +438,17 @@ SDLDriver::SDLDriver(std::string input_engine_) : InputEngine(std::move(input_en using namespace std::chrono_literals; while (initialized) { SDL_PumpEvents(); - SendVibrations(); std::this_thread::sleep_for(1ms); } }); + vibration_thread = std::thread([this] { + Common::SetCurrentThreadName("yuzu:input:SDL_Vibration"); + using namespace std::chrono_literals; + while (initialized) { + SendVibrations(); + std::this_thread::sleep_for(10ms); + } + }); } // Because the events for joystick connection happens before we have our event watcher added, we // can just open all the joysticks right here @@ -457,6 +464,7 @@ SDLDriver::~SDLDriver() { initialized = false; if (start_thread) { poll_thread.join(); + vibration_thread.join(); SDL_QuitSubSystem(SDL_INIT_JOYSTICK | SDL_INIT_GAMECONTROLLER); } } |