diff options
author | german77 <juangerman-13@hotmail.com> | 2022-06-27 00:49:14 +0200 |
---|---|---|
committer | Narr the Reg <juangerman-13@hotmail.com> | 2022-06-29 02:22:16 +0200 |
commit | 5e7e55b98a22b8db0e3f8982837a306b6b66f61e (patch) | |
tree | 91f1389534b7f490364b2cc48753fe95010c9e42 | |
parent | Merge pull request #8512 from german77/nnResult (diff) | |
download | yuzu-5e7e55b98a22b8db0e3f8982837a306b6b66f61e.tar yuzu-5e7e55b98a22b8db0e3f8982837a306b6b66f61e.tar.gz yuzu-5e7e55b98a22b8db0e3f8982837a306b6b66f61e.tar.bz2 yuzu-5e7e55b98a22b8db0e3f8982837a306b6b66f61e.tar.lz yuzu-5e7e55b98a22b8db0e3f8982837a306b6b66f61e.tar.xz yuzu-5e7e55b98a22b8db0e3f8982837a306b6b66f61e.tar.zst yuzu-5e7e55b98a22b8db0e3f8982837a306b6b66f61e.zip |
Diffstat (limited to '')
-rw-r--r-- | src/core/hle/service/hid/controllers/npad.cpp | 4 | ||||
-rw-r--r-- | src/input_common/drivers/sdl_driver.cpp | 10 | ||||
-rw-r--r-- | src/input_common/drivers/sdl_driver.h | 1 |
3 files changed, 12 insertions, 3 deletions
diff --git a/src/core/hle/service/hid/controllers/npad.cpp b/src/core/hle/service/hid/controllers/npad.cpp index c08b0a5dc..7afdbfb96 100644 --- a/src/core/hle/service/hid/controllers/npad.cpp +++ b/src/core/hle/service/hid/controllers/npad.cpp @@ -820,11 +820,11 @@ bool Controller_NPad::VibrateControllerAtIndex(Core::HID::NpadIdType npad_id, const auto now = steady_clock::now(); - // Filter out non-zero vibrations that are within 10ms of each other. + // Filter out non-zero vibrations that are within 15ms of each other. if ((vibration_value.low_amplitude != 0.0f || vibration_value.high_amplitude != 0.0f) && duration_cast<milliseconds>( now - controller.vibration[device_index].last_vibration_timepoint) < - milliseconds(10)) { + milliseconds(15)) { return false; } 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); } } diff --git a/src/input_common/drivers/sdl_driver.h b/src/input_common/drivers/sdl_driver.h index 0846fbb50..7dc7a93c7 100644 --- a/src/input_common/drivers/sdl_driver.h +++ b/src/input_common/drivers/sdl_driver.h @@ -128,5 +128,6 @@ private: std::atomic<bool> initialized = false; std::thread poll_thread; + std::thread vibration_thread; }; } // namespace InputCommon |