diff options
Diffstat (limited to 'src/core/hle/service/hid/controllers/mouse.cpp')
-rw-r--r-- | src/core/hle/service/hid/controllers/mouse.cpp | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/core/hle/service/hid/controllers/mouse.cpp b/src/core/hle/service/hid/controllers/mouse.cpp index de5b2c804..3a8d1751b 100644 --- a/src/core/hle/service/hid/controllers/mouse.cpp +++ b/src/core/hle/service/hid/controllers/mouse.cpp @@ -5,13 +5,13 @@ #include "core/frontend/emu_window.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/mouse.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 { -Mouse::Mouse(Core::HID::HIDCore& hid_core_, MouseSharedMemoryFormat& mouse_shared_memory) - : ControllerBase{hid_core_}, shared_memory{mouse_shared_memory} { +Mouse::Mouse(Core::HID::HIDCore& hid_core_) : ControllerBase{hid_core_} { emulated_devices = hid_core.GetEmulatedDevices(); } @@ -21,6 +21,16 @@ void Mouse::OnInit() {} void Mouse::OnRelease() {} void Mouse::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; + } + + MouseSharedMemoryFormat& shared_memory = data->shared_memory_format->mouse; + if (!IsControllerActivated()) { shared_memory.mouse_lifo.buffer_count = 0; shared_memory.mouse_lifo.buffer_tail = 0; |