summaryrefslogtreecommitdiff
path: root/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp
diff options
context:
space:
mode:
authorFiloppi <filippotarpini@hotmail.it>2021-05-15 11:32:00 +0300
committerFiloppi <filippotarpini@hotmail.it>2021-06-07 11:07:05 +0300
commitf90d851e2519d46f62e2037896053bc546e7133b (patch)
treeadb9a2b7b18c5581aa4b995fc2cea4ddd25a233d /Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp
parentc285ae57fb0027a3e6da12b7097e15e0485ee526 (diff)
ControllerInterface: mixed comments
Diffstat (limited to 'Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp')
-rw-r--r--Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp b/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp
index afdf768435..c4ef52a2a9 100644
--- a/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp
+++ b/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp
@@ -37,6 +37,10 @@
ControllerInterface g_controller_interface;
+// We need to save which input channel we are in by thread, so we can access the correct input
+// update values in different threads by input channel. We start from InputChannel::Host on all
+// threads as hotkeys are updated from a worker thread, but UI can read from the main thread. This
+// will never interfere with game threads.
static thread_local ciface::InputChannel tls_input_channel = ciface::InputChannel::Host;
void ControllerInterface::Initialize(const WindowSystemInfo& wsi)
@@ -272,7 +276,11 @@ void ControllerInterface::UpdateInput()
{
std::lock_guard lk(m_devices_mutex, std::adopt_lock);
for (const auto& d : m_devices)
+ {
+ // Theoretically we could avoid updating input on devices that don't have any references to
+ // them, but in practice a few devices types could break in different ways, so we don't
d->UpdateInput();
+ }
}
}