diff options
| author | 2021-10-24 20:27:00 -0500 | |
|---|---|---|
| committer | 2021-11-24 20:30:25 -0600 | |
| commit | f01dac3bf934657059b77bae3630201110f83e3d (patch) | |
| tree | 0a451f6b23c9eed1af33fa9d3fedd67261a12c90 | |
| parent | settings: Fix mouse and keyboard mappings (diff) | |
| download | yuzu-f01dac3bf934657059b77bae3630201110f83e3d.tar.gz yuzu-f01dac3bf934657059b77bae3630201110f83e3d.tar.xz yuzu-f01dac3bf934657059b77bae3630201110f83e3d.zip | |
service/hid: Fix memory allocated incorrectly
5 files changed, 7 insertions, 7 deletions
diff --git a/src/core/hle/service/hid/controllers/debug_pad.cpp b/src/core/hle/service/hid/controllers/debug_pad.cpp index b2b4edf51..5b1946f13 100644 --- a/src/core/hle/service/hid/controllers/debug_pad.cpp +++ b/src/core/hle/service/hid/controllers/debug_pad.cpp | |||
| @@ -12,7 +12,7 @@ | |||
| 12 | #include "core/hle/service/hid/controllers/debug_pad.h" | 12 | #include "core/hle/service/hid/controllers/debug_pad.h" |
| 13 | 13 | ||
| 14 | namespace Service::HID { | 14 | namespace Service::HID { |
| 15 | 15 | constexpr std::size_t SHARED_MEMORY_OFFSET = 0x00000; | |
| 16 | constexpr s32 HID_JOYSTICK_MAX = 0x7fff; | 16 | constexpr s32 HID_JOYSTICK_MAX = 0x7fff; |
| 17 | [[maybe_unused]] constexpr s32 HID_JOYSTICK_MIN = -0x7fff; | 17 | [[maybe_unused]] constexpr s32 HID_JOYSTICK_MIN = -0x7fff; |
| 18 | enum class JoystickId : std::size_t { Joystick_Left, Joystick_Right }; | 18 | enum class JoystickId : std::size_t { Joystick_Left, Joystick_Right }; |
| @@ -32,7 +32,7 @@ void Controller_DebugPad::OnUpdate(const Core::Timing::CoreTiming& core_timing, | |||
| 32 | if (!IsControllerActivated()) { | 32 | if (!IsControllerActivated()) { |
| 33 | debug_pad_lifo.entry_count = 0; | 33 | debug_pad_lifo.entry_count = 0; |
| 34 | debug_pad_lifo.last_entry_index = 0; | 34 | debug_pad_lifo.last_entry_index = 0; |
| 35 | std::memcpy(data, &debug_pad_lifo, sizeof(debug_pad_lifo)); | 35 | std::memcpy(data + SHARED_MEMORY_OFFSET, &debug_pad_lifo, sizeof(debug_pad_lifo)); |
| 36 | return; | 36 | return; |
| 37 | } | 37 | } |
| 38 | 38 | ||
| @@ -51,7 +51,7 @@ void Controller_DebugPad::OnUpdate(const Core::Timing::CoreTiming& core_timing, | |||
| 51 | } | 51 | } |
| 52 | 52 | ||
| 53 | debug_pad_lifo.WriteNextEntry(next_state); | 53 | debug_pad_lifo.WriteNextEntry(next_state); |
| 54 | std::memcpy(data, &debug_pad_lifo, sizeof(debug_pad_lifo)); | 54 | std::memcpy(data + SHARED_MEMORY_OFFSET, &debug_pad_lifo, sizeof(debug_pad_lifo)); |
| 55 | } | 55 | } |
| 56 | 56 | ||
| 57 | } // namespace Service::HID | 57 | } // namespace Service::HID |
diff --git a/src/core/hle/service/hid/controllers/gesture.cpp b/src/core/hle/service/hid/controllers/gesture.cpp index 7a7bc68a2..47760b4f8 100644 --- a/src/core/hle/service/hid/controllers/gesture.cpp +++ b/src/core/hle/service/hid/controllers/gesture.cpp | |||
| @@ -43,7 +43,7 @@ void Controller_Gesture::OnUpdate(const Core::Timing::CoreTiming& core_timing, u | |||
| 43 | if (!IsControllerActivated()) { | 43 | if (!IsControllerActivated()) { |
| 44 | gesture_lifo.entry_count = 0; | 44 | gesture_lifo.entry_count = 0; |
| 45 | gesture_lifo.last_entry_index = 0; | 45 | gesture_lifo.last_entry_index = 0; |
| 46 | std::memcpy(data, &gesture_lifo, sizeof(gesture_lifo)); | 46 | std::memcpy(data + SHARED_MEMORY_OFFSET, &gesture_lifo, sizeof(gesture_lifo)); |
| 47 | return; | 47 | return; |
| 48 | } | 48 | } |
| 49 | 49 | ||
diff --git a/src/core/hle/service/hid/controllers/keyboard.cpp b/src/core/hle/service/hid/controllers/keyboard.cpp index db0f56b92..632679a17 100644 --- a/src/core/hle/service/hid/controllers/keyboard.cpp +++ b/src/core/hle/service/hid/controllers/keyboard.cpp | |||
| @@ -29,7 +29,7 @@ void Controller_Keyboard::OnUpdate(const Core::Timing::CoreTiming& core_timing, | |||
| 29 | if (!IsControllerActivated()) { | 29 | if (!IsControllerActivated()) { |
| 30 | keyboard_lifo.entry_count = 0; | 30 | keyboard_lifo.entry_count = 0; |
| 31 | keyboard_lifo.last_entry_index = 0; | 31 | keyboard_lifo.last_entry_index = 0; |
| 32 | std::memcpy(data, &keyboard_lifo, sizeof(keyboard_lifo)); | 32 | std::memcpy(data + SHARED_MEMORY_OFFSET, &keyboard_lifo, sizeof(keyboard_lifo)); |
| 33 | return; | 33 | return; |
| 34 | } | 34 | } |
| 35 | 35 | ||
diff --git a/src/core/hle/service/hid/controllers/mouse.cpp b/src/core/hle/service/hid/controllers/mouse.cpp index 2f607bfe9..6d3bd0a2b 100644 --- a/src/core/hle/service/hid/controllers/mouse.cpp +++ b/src/core/hle/service/hid/controllers/mouse.cpp | |||
| @@ -29,7 +29,7 @@ void Controller_Mouse::OnUpdate(const Core::Timing::CoreTiming& core_timing, u8* | |||
| 29 | if (!IsControllerActivated()) { | 29 | if (!IsControllerActivated()) { |
| 30 | mouse_lifo.entry_count = 0; | 30 | mouse_lifo.entry_count = 0; |
| 31 | mouse_lifo.last_entry_index = 0; | 31 | mouse_lifo.last_entry_index = 0; |
| 32 | std::memcpy(data, &mouse_lifo, sizeof(mouse_lifo)); | 32 | std::memcpy(data + SHARED_MEMORY_OFFSET, &mouse_lifo, sizeof(mouse_lifo)); |
| 33 | return; | 33 | return; |
| 34 | } | 34 | } |
| 35 | 35 | ||
diff --git a/src/core/hle/service/hid/controllers/xpad.cpp b/src/core/hle/service/hid/controllers/xpad.cpp index 29a412ff9..aa9f044f1 100644 --- a/src/core/hle/service/hid/controllers/xpad.cpp +++ b/src/core/hle/service/hid/controllers/xpad.cpp | |||
| @@ -22,7 +22,7 @@ void Controller_XPad::OnUpdate(const Core::Timing::CoreTiming& core_timing, u8* | |||
| 22 | if (!IsControllerActivated()) { | 22 | if (!IsControllerActivated()) { |
| 23 | basic_xpad_lifo.entry_count = 0; | 23 | basic_xpad_lifo.entry_count = 0; |
| 24 | basic_xpad_lifo.last_entry_index = 0; | 24 | basic_xpad_lifo.last_entry_index = 0; |
| 25 | std::memcpy(data, &basic_xpad_lifo, sizeof(basic_xpad_lifo)); | 25 | std::memcpy(data + SHARED_MEMORY_OFFSET, &basic_xpad_lifo, sizeof(basic_xpad_lifo)); |
| 26 | return; | 26 | return; |
| 27 | } | 27 | } |
| 28 | 28 | ||