diff options
Diffstat (limited to 'src/core/hle/service/hid/controllers/keyboard.cpp')
-rw-r--r-- | src/core/hle/service/hid/controllers/keyboard.cpp | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/core/hle/service/hid/controllers/keyboard.cpp b/src/core/hle/service/hid/controllers/keyboard.cpp index 871e5036a..c069bcbb2 100644 --- a/src/core/hle/service/hid/controllers/keyboard.cpp +++ b/src/core/hle/service/hid/controllers/keyboard.cpp @@ -5,14 +5,13 @@ #include "core/core_timing.h" #include "core/hid/emulated_devices.h" #include "core/hid/hid_core.h" +#include "core/hle/service/hid/controllers/applet_resource.h" #include "core/hle/service/hid/controllers/keyboard.h" -#include "core/hle/service/hid/controllers/shared_memory_format.h" +#include "core/hle/service/hid/controllers/types/shared_memory_format.h" namespace Service::HID { -Keyboard::Keyboard(Core::HID::HIDCore& hid_core_, - KeyboardSharedMemoryFormat& keyboard_shared_memory) - : ControllerBase{hid_core_}, shared_memory{keyboard_shared_memory} { +Keyboard::Keyboard(Core::HID::HIDCore& hid_core_) : ControllerBase{hid_core_} { emulated_devices = hid_core.GetEmulatedDevices(); } @@ -23,6 +22,16 @@ void Keyboard::OnInit() {} void Keyboard::OnRelease() {} void Keyboard::OnUpdate(const Core::Timing::CoreTiming& core_timing) { + std::scoped_lock shared_lock{*shared_mutex}; + const u64 aruid = applet_resource->GetActiveAruid(); + auto* data = applet_resource->GetAruidData(aruid); + + if (data == nullptr || !data->flag.is_assigned) { + return; + } + + KeyboardSharedMemoryFormat& shared_memory = data->shared_memory_format->keyboard; + if (!IsControllerActivated()) { shared_memory.keyboard_lifo.buffer_count = 0; shared_memory.keyboard_lifo.buffer_tail = 0; |