|
|
@ -438,10 +438,17 @@ SDLDriver::SDLDriver(std::string input_engine_) : InputEngine(std::move(input_en
|
|
|
|
using namespace std::chrono_literals;
|
|
|
|
using namespace std::chrono_literals;
|
|
|
|
while (initialized) {
|
|
|
|
while (initialized) {
|
|
|
|
SDL_PumpEvents();
|
|
|
|
SDL_PumpEvents();
|
|
|
|
SendVibrations();
|
|
|
|
|
|
|
|
std::this_thread::sleep_for(1ms);
|
|
|
|
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
|
|
|
|
// Because the events for joystick connection happens before we have our event watcher added, we
|
|
|
|
// can just open all the joysticks right here
|
|
|
|
// can just open all the joysticks right here
|
|
|
@ -457,6 +464,7 @@ SDLDriver::~SDLDriver() {
|
|
|
|
initialized = false;
|
|
|
|
initialized = false;
|
|
|
|
if (start_thread) {
|
|
|
|
if (start_thread) {
|
|
|
|
poll_thread.join();
|
|
|
|
poll_thread.join();
|
|
|
|
|
|
|
|
vibration_thread.join();
|
|
|
|
SDL_QuitSubSystem(SDL_INIT_JOYSTICK | SDL_INIT_GAMECONTROLLER);
|
|
|
|
SDL_QuitSubSystem(SDL_INIT_JOYSTICK | SDL_INIT_GAMECONTROLLER);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|