summaryrefslogtreecommitdiffstats
path: root/src/core/hle/service/hid/controllers/mouse.cpp
diff options
context:
space:
mode:
authorNarr the Reg <juangerman-13@hotmail.com>2023-12-14 04:39:38 +0100
committerNarr the Reg <juangerman-13@hotmail.com>2023-12-14 06:24:28 +0100
commit64f68e96354df3afb9bb563c888793f98ecb5026 (patch)
tree82a1f3f51902e0a926bae4ae8a84ba1dcf2a145b /src/core/hle/service/hid/controllers/mouse.cpp
parentMerge pull request #12342 from FearlessTobi/fix-msvc (diff)
downloadyuzu-64f68e96354df3afb9bb563c888793f98ecb5026.tar
yuzu-64f68e96354df3afb9bb563c888793f98ecb5026.tar.gz
yuzu-64f68e96354df3afb9bb563c888793f98ecb5026.tar.bz2
yuzu-64f68e96354df3afb9bb563c888793f98ecb5026.tar.lz
yuzu-64f68e96354df3afb9bb563c888793f98ecb5026.tar.xz
yuzu-64f68e96354df3afb9bb563c888793f98ecb5026.tar.zst
yuzu-64f68e96354df3afb9bb563c888793f98ecb5026.zip
Diffstat (limited to 'src/core/hle/service/hid/controllers/mouse.cpp')
-rw-r--r--src/core/hle/service/hid/controllers/mouse.cpp17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/core/hle/service/hid/controllers/mouse.cpp b/src/core/hle/service/hid/controllers/mouse.cpp
index 6e5a04e34..cce6deb52 100644
--- a/src/core/hle/service/hid/controllers/mouse.cpp
+++ b/src/core/hle/service/hid/controllers/mouse.cpp
@@ -8,15 +8,12 @@
#include "core/hid/emulated_devices.h"
#include "core/hid/hid_core.h"
#include "core/hle/service/hid/controllers/mouse.h"
+#include "core/hle/service/hid/controllers/shared_memory_format.h"
namespace Service::HID {
-constexpr std::size_t SHARED_MEMORY_OFFSET = 0x3400;
-Mouse::Mouse(Core::HID::HIDCore& hid_core_, u8* raw_shared_memory_) : ControllerBase{hid_core_} {
- static_assert(SHARED_MEMORY_OFFSET + sizeof(MouseSharedMemory) < shared_memory_size,
- "MouseSharedMemory is bigger than the shared memory");
- shared_memory = std::construct_at(
- reinterpret_cast<MouseSharedMemory*>(raw_shared_memory_ + SHARED_MEMORY_OFFSET));
+Mouse::Mouse(Core::HID::HIDCore& hid_core_, MouseSharedMemoryFormat& mouse_shared_memory)
+ : ControllerBase{hid_core_}, shared_memory{mouse_shared_memory} {
emulated_devices = hid_core.GetEmulatedDevices();
}
@@ -27,14 +24,14 @@ void Mouse::OnRelease() {}
void Mouse::OnUpdate(const Core::Timing::CoreTiming& core_timing) {
if (!IsControllerActivated()) {
- shared_memory->mouse_lifo.buffer_count = 0;
- shared_memory->mouse_lifo.buffer_tail = 0;
+ shared_memory.mouse_lifo.buffer_count = 0;
+ shared_memory.mouse_lifo.buffer_tail = 0;
return;
}
next_state = {};
- const auto& last_entry = shared_memory->mouse_lifo.ReadCurrentEntry().state;
+ const auto& last_entry = shared_memory.mouse_lifo.ReadCurrentEntry().state;
next_state.sampling_number = last_entry.sampling_number + 1;
if (Settings::values.mouse_enabled) {
@@ -53,7 +50,7 @@ void Mouse::OnUpdate(const Core::Timing::CoreTiming& core_timing) {
next_state.button = mouse_button_state;
}
- shared_memory->mouse_lifo.WriteNextEntry(next_state);
+ shared_memory.mouse_lifo.WriteNextEntry(next_state);
}
} // namespace Service::HID