aboutsummaryrefslogtreecommitdiff
path: root/src/hid_core
diff options
context:
space:
mode:
authorunknown <sahyno1996@gmail.com>2025-10-12 17:03:14 +0200
committercrueter <crueter@eden-emu.dev>2025-10-12 17:03:14 +0200
commita3ef2cc1838a007a2f424e88212aa6f1eb93eab3 (patch)
tree6ab37fe23b6d30a33a352deb631866720d012ecb /src/hid_core
parent1e1b8ad33face3f3409aec50818d2b4fda8e6a0d (diff)
[audio_core/hid] Audio REV12+15 support + HID fixes (#2719)
This fixes newer updates / games. Implements partial audio rev15, rev13, rev12 and HID issues on SDK20+ games. Credits to LotP (Ryubing) and Zephyron (Citron) for their research and implementation. Co-authored-by: Zephyron <zephyron@citron-emu.org> Co-authored-by: Shinmegumi <shinmegumi@eden-emu.dev> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/2719 Reviewed-by: MaranBr <maranbr@eden-emu.dev> Reviewed-by: CamilleLaVey <camillelavey99@gmail.com> Co-authored-by: unknown <sahyno1996@gmail.com> Co-committed-by: unknown <sahyno1996@gmail.com>
Diffstat (limited to 'src/hid_core')
-rw-r--r--src/hid_core/resources/npad/npad_types.h14
-rw-r--r--src/hid_core/resources/ring_lifo.h6
-rw-r--r--src/hid_core/resources/shared_memory_format.h13
3 files changed, 29 insertions, 4 deletions
diff --git a/src/hid_core/resources/npad/npad_types.h b/src/hid_core/resources/npad/npad_types.h
index 92700d69a6..68b803c3d3 100644
--- a/src/hid_core/resources/npad/npad_types.h
+++ b/src/hid_core/resources/npad/npad_types.h
@@ -1,3 +1,6 @@
+// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
+// SPDX-License-Identifier: GPL-3.0-or-later
+
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
@@ -159,6 +162,17 @@ struct NpadGcTriggerState {
};
static_assert(sizeof(NpadGcTriggerState) == 0x10, "NpadGcTriggerState is an invalid size");
+// This is nn::hid::NpadCondition (global controller condition structure)
+struct NpadCondition {
+ u32 _00{};
+ u32 is_initialized{1};
+ u32 hold_type{static_cast<u32>(NpadJoyHoldType::Horizontal)};
+ u32 is_valid{1};
+};
+static_assert(sizeof(NpadCondition) == 0x10, "NpadCondition is an invalid size");
+
+
+
// This is nn::hid::NpadSystemProperties
struct NPadSystemProperties {
union {
diff --git a/src/hid_core/resources/ring_lifo.h b/src/hid_core/resources/ring_lifo.h
index 0816784e08..55ba2f0e61 100644
--- a/src/hid_core/resources/ring_lifo.h
+++ b/src/hid_core/resources/ring_lifo.h
@@ -1,3 +1,6 @@
+// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
+// SPDX-License-Identifier: GPL-3.0-or-later
+
// SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
@@ -44,8 +47,7 @@ struct Lifo {
buffer_count++;
}
buffer_tail = GetNextEntryIndex();
- const auto& previous_entry = ReadPreviousEntry();
- entries[buffer_tail].sampling_number = previous_entry.sampling_number + 1;
+ entries[buffer_tail].sampling_number = new_state.sampling_number << 1;
entries[buffer_tail].state = new_state;
}
};
diff --git a/src/hid_core/resources/shared_memory_format.h b/src/hid_core/resources/shared_memory_format.h
index 49755c8dc3..b9deeec302 100644
--- a/src/hid_core/resources/shared_memory_format.h
+++ b/src/hid_core/resources/shared_memory_format.h
@@ -1,3 +1,6 @@
+// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
+// SPDX-License-Identifier: GPL-3.0-or-later
+
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
@@ -201,7 +204,9 @@ static_assert(sizeof(ConsoleSixAxisSensorSharedMemoryFormat) == 0x20,
// This is nn::hid::detail::SharedMemoryFormat
struct SharedMemoryFormat {
- void Initialize() {}
+ void Initialize() {
+ npad_condition = NpadCondition{};
+ }
DebugPadSharedMemoryFormat debug_pad;
TouchScreenSharedMemoryFormat touch_screen;
@@ -218,7 +223,9 @@ struct SharedMemoryFormat {
ConsoleSixAxisSensorSharedMemoryFormat console;
INSERT_PADDING_BYTES(0x19E0);
MouseSharedMemoryFormat debug_mouse;
- INSERT_PADDING_BYTES(0x2000);
+ INSERT_PADDING_BYTES(0x200);
+ NpadCondition npad_condition;
+ INSERT_PADDING_BYTES(0x1DF0);
};
static_assert(offsetof(SharedMemoryFormat, debug_pad) == 0x0, "debug_pad has wrong offset");
static_assert(offsetof(SharedMemoryFormat, touch_screen) == 0x400, "touch_screen has wrong offset");
@@ -236,6 +243,8 @@ static_assert(offsetof(SharedMemoryFormat, npad) == 0x9A00, "npad has wrong offs
static_assert(offsetof(SharedMemoryFormat, gesture) == 0x3BA00, "gesture has wrong offset");
static_assert(offsetof(SharedMemoryFormat, console) == 0x3C200, "console has wrong offset");
static_assert(offsetof(SharedMemoryFormat, debug_mouse) == 0x3DC00, "debug_mouse has wrong offset");
+static_assert(offsetof(SharedMemoryFormat, npad_condition) == 0x3E200,
+ "npad_condition has wrong offset");
static_assert(sizeof(SharedMemoryFormat) == 0x40000, "SharedMemoryFormat is an invalid size");
} // namespace Service::HID