summaryrefslogtreecommitdiff
path: root/src/input_common/drivers/sdl_driver.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/input_common/drivers/sdl_driver.cpp')
-rw-r--r--src/input_common/drivers/sdl_driver.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/input_common/drivers/sdl_driver.cpp b/src/input_common/drivers/sdl_driver.cpp
index 446c027d3..de388ec4c 100644
--- a/src/input_common/drivers/sdl_driver.cpp
+++ b/src/input_common/drivers/sdl_driver.cpp
@@ -1,6 +1,5 @@
1// Copyright 2018 Citra Emulator Project 1// SPDX-FileCopyrightText: 2018 Citra Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#include "common/logging/log.h" 4#include "common/logging/log.h"
6#include "common/math_util.h" 5#include "common/math_util.h"
@@ -438,10 +437,17 @@ SDLDriver::SDLDriver(std::string input_engine_) : InputEngine(std::move(input_en
438 using namespace std::chrono_literals; 437 using namespace std::chrono_literals;
439 while (initialized) { 438 while (initialized) {
440 SDL_PumpEvents(); 439 SDL_PumpEvents();
441 SendVibrations();
442 std::this_thread::sleep_for(1ms); 440 std::this_thread::sleep_for(1ms);
443 } 441 }
444 }); 442 });
443 vibration_thread = std::thread([this] {
444 Common::SetCurrentThreadName("yuzu:input:SDL_Vibration");
445 using namespace std::chrono_literals;
446 while (initialized) {
447 SendVibrations();
448 std::this_thread::sleep_for(10ms);
449 }
450 });
445 } 451 }
446 // Because the events for joystick connection happens before we have our event watcher added, we 452 // Because the events for joystick connection happens before we have our event watcher added, we
447 // can just open all the joysticks right here 453 // can just open all the joysticks right here
@@ -457,6 +463,7 @@ SDLDriver::~SDLDriver() {
457 initialized = false; 463 initialized = false;
458 if (start_thread) { 464 if (start_thread) {
459 poll_thread.join(); 465 poll_thread.join();
466 vibration_thread.join();
460 SDL_QuitSubSystem(SDL_INIT_JOYSTICK | SDL_INIT_GAMECONTROLLER); 467 SDL_QuitSubSystem(SDL_INIT_JOYSTICK | SDL_INIT_GAMECONTROLLER);
461 } 468 }
462} 469}