summaryrefslogtreecommitdiffstats
path: root/src/input_common/main.cpp
diff options
context:
space:
mode:
authorTobias <thm.frey@gmail.com>2018-09-11 03:29:59 +0200
committerbunnei <bunneidev@gmail.com>2018-09-11 03:29:59 +0200
commit804115b2a46d25408b34e3e08e83d3f926fd9968 (patch)
treee34636fd7928333756ef2d1282a2e2ef9c908069 /src/input_common/main.cpp
parentMerge pull request #1286 from bunnei/multi-clear (diff)
downloadyuzu-804115b2a46d25408b34e3e08e83d3f926fd9968.tar
yuzu-804115b2a46d25408b34e3e08e83d3f926fd9968.tar.gz
yuzu-804115b2a46d25408b34e3e08e83d3f926fd9968.tar.bz2
yuzu-804115b2a46d25408b34e3e08e83d3f926fd9968.tar.lz
yuzu-804115b2a46d25408b34e3e08e83d3f926fd9968.tar.xz
yuzu-804115b2a46d25408b34e3e08e83d3f926fd9968.tar.zst
yuzu-804115b2a46d25408b34e3e08e83d3f926fd9968.zip
Diffstat (limited to '')
-rw-r--r--src/input_common/main.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/input_common/main.cpp b/src/input_common/main.cpp
index b12623d55..37f572853 100644
--- a/src/input_common/main.cpp
+++ b/src/input_common/main.cpp
@@ -3,6 +3,7 @@
// Refer to the license.txt file included.
#include <memory>
+#include <thread>
#include "common/param_package.h"
#include "input_common/analog_from_button.h"
#include "input_common/keyboard.h"
@@ -17,6 +18,10 @@ namespace InputCommon {
static std::shared_ptr<Keyboard> keyboard;
static std::shared_ptr<MotionEmu> motion_emu;
+#ifdef HAVE_SDL2
+static std::thread poll_thread;
+#endif
+
void Init() {
keyboard = std::make_shared<Keyboard>();
Input::RegisterFactory<Input::ButtonDevice>("keyboard", keyboard);
@@ -30,6 +35,12 @@ void Init() {
#endif
}
+void StartJoystickEventHandler() {
+#ifdef HAVE_SDL2
+ poll_thread = std::thread(SDL::PollLoop);
+#endif
+}
+
void Shutdown() {
Input::UnregisterFactory<Input::ButtonDevice>("keyboard");
keyboard.reset();
@@ -39,6 +50,7 @@ void Shutdown() {
#ifdef HAVE_SDL2
SDL::Shutdown();
+ poll_thread.join();
#endif
}