diff options
| author | 2022-06-26 17:49:14 -0500 | |
|---|---|---|
| committer | 2022-06-28 19:22:16 -0500 | |
| commit | 5e7e55b98a22b8db0e3f8982837a306b6b66f61e (patch) | |
| tree | 91f1389534b7f490364b2cc48753fe95010c9e42 /src/input_common/drivers/sdl_driver.cpp | |
| parent | Merge pull request #8512 from german77/nnResult (diff) | |
| download | yuzu-5e7e55b98a22b8db0e3f8982837a306b6b66f61e.tar.gz yuzu-5e7e55b98a22b8db0e3f8982837a306b6b66f61e.tar.xz yuzu-5e7e55b98a22b8db0e3f8982837a306b6b66f61e.zip | |
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 | |||
| 438 | using namespace std::chrono_literals; | 438 | using namespace std::chrono_literals; |
| 439 | while (initialized) { | 439 | while (initialized) { |
| 440 | SDL_PumpEvents(); | 440 | SDL_PumpEvents(); |
| 441 | SendVibrations(); | ||
| 442 | std::this_thread::sleep_for(1ms); | 441 | std::this_thread::sleep_for(1ms); |
| 443 | } | 442 | } |
| 444 | }); | 443 | }); |
| 444 | vibration_thread = std::thread([this] { | ||
| 445 | Common::SetCurrentThreadName("yuzu:input:SDL_Vibration"); | ||
| 446 | using namespace std::chrono_literals; | ||
| 447 | while (initialized) { | ||
| 448 | SendVibrations(); | ||
| 449 | std::this_thread::sleep_for(10ms); | ||
| 450 | } | ||
| 451 | }); | ||
| 445 | } | 452 | } |
| 446 | // Because the events for joystick connection happens before we have our event watcher added, we | 453 | // Because the events for joystick connection happens before we have our event watcher added, we |
| 447 | // can just open all the joysticks right here | 454 | // can just open all the joysticks right here |
| @@ -457,6 +464,7 @@ SDLDriver::~SDLDriver() { | |||
| 457 | initialized = false; | 464 | initialized = false; |
| 458 | if (start_thread) { | 465 | if (start_thread) { |
| 459 | poll_thread.join(); | 466 | poll_thread.join(); |
| 467 | vibration_thread.join(); | ||
| 460 | SDL_QuitSubSystem(SDL_INIT_JOYSTICK | SDL_INIT_GAMECONTROLLER); | 468 | SDL_QuitSubSystem(SDL_INIT_JOYSTICK | SDL_INIT_GAMECONTROLLER); |
| 461 | } | 469 | } |
| 462 | } | 470 | } |