aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorliamwhite <[email protected]>2024-01-01 15:02:13 -0500
committerGitHub <[email protected]>2024-01-01 15:02:13 -0500
commit59d81ae614a42588dbd7eaf4b7e029ab168886c9 (patch)
treea5d636853c0871b700ebccf1c5d4fc6726046a31
parentc3c676b7d69c35c37462fb0edd04d714e9a1f4e3 (diff)
parent865abfc37c5b3e8945d833bd44db428ad720bd58 (diff)
downloadyuzu-android-59d81ae614a42588dbd7eaf4b7e029ab168886c9.tar.gz
yuzu-android-59d81ae614a42588dbd7eaf4b7e029ab168886c9.zip
Merge pull request #12536 from german77/npad_interface
service: hid: Use applet resource to get latest shared memory handle
-rw-r--r--src/core/CMakeLists.txt16
-rw-r--r--src/core/hle/service/hid/controllers/applet_resource.cpp18
-rw-r--r--src/core/hle/service/hid/controllers/applet_resource.h94
-rw-r--r--src/core/hle/service/hid/controllers/capture_button.cpp38
-rw-r--r--src/core/hle/service/hid/controllers/capture_button.h (renamed from src/core/hle/service/hid/controllers/stubbed.h)8
-rw-r--r--src/core/hle/service/hid/controllers/console_six_axis.cpp15
-rw-r--r--src/core/hle/service/hid/controllers/console_six_axis.h6
-rw-r--r--src/core/hle/service/hid/controllers/controller_base.cpp5
-rw-r--r--src/core/hle/service/hid/controllers/controller_base.h8
-rw-r--r--src/core/hle/service/hid/controllers/debug_mouse.cpp63
-rw-r--r--src/core/hle/service/hid/controllers/debug_mouse.h34
-rw-r--r--src/core/hle/service/hid/controllers/debug_pad.cpp16
-rw-r--r--src/core/hle/service/hid/controllers/debug_pad.h6
-rw-r--r--src/core/hle/service/hid/controllers/digitizer.cpp38
-rw-r--r--src/core/hle/service/hid/controllers/digitizer.h27
-rw-r--r--src/core/hle/service/hid/controllers/gesture.cpp41
-rw-r--r--src/core/hle/service/hid/controllers/gesture.h5
-rw-r--r--src/core/hle/service/hid/controllers/home_button.cpp38
-rw-r--r--src/core/hle/service/hid/controllers/home_button.h27
-rw-r--r--src/core/hle/service/hid/controllers/keyboard.cpp16
-rw-r--r--src/core/hle/service/hid/controllers/keyboard.h6
-rw-r--r--src/core/hle/service/hid/controllers/mouse.cpp15
-rw-r--r--src/core/hle/service/hid/controllers/mouse.h5
-rw-r--r--src/core/hle/service/hid/controllers/npad.cpp51
-rw-r--r--src/core/hle/service/hid/controllers/npad.h11
-rw-r--r--src/core/hle/service/hid/controllers/shared_memory_holder.cpp3
-rw-r--r--src/core/hle/service/hid/controllers/six_axis.cpp24
-rw-r--r--src/core/hle/service/hid/controllers/sleep_button.cpp38
-rw-r--r--src/core/hle/service/hid/controllers/sleep_button.h27
-rw-r--r--src/core/hle/service/hid/controllers/stubbed.cpp31
-rw-r--r--src/core/hle/service/hid/controllers/touchscreen.cpp17
-rw-r--r--src/core/hle/service/hid/controllers/touchscreen.h4
-rw-r--r--src/core/hle/service/hid/controllers/types/shared_memory_format.h (renamed from src/core/hle/service/hid/controllers/shared_memory_format.h)0
-rw-r--r--src/core/hle/service/hid/controllers/unique_pad.cpp38
-rw-r--r--src/core/hle/service/hid/controllers/unique_pad.h27
-rw-r--r--src/core/hle/service/hid/resource_manager.cpp107
-rw-r--r--src/core/hle/service/hid/resource_manager.h18
37 files changed, 711 insertions, 230 deletions
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt
index 367d01dc7..dfba79267 100644
--- a/src/core/CMakeLists.txt
+++ b/src/core/CMakeLists.txt
@@ -553,17 +553,26 @@ add_library(core STATIC
hle/service/hid/controllers/types/keyboard_types.h
hle/service/hid/controllers/types/mouse_types.h
hle/service/hid/controllers/types/npad_types.h
+ hle/service/hid/controllers/types/shared_memory_format.h
hle/service/hid/controllers/types/touch_types.h
hle/service/hid/controllers/applet_resource.cpp
hle/service/hid/controllers/applet_resource.h
+ hle/service/hid/controllers/capture_button.cpp
+ hle/service/hid/controllers/capture_button.h
hle/service/hid/controllers/console_six_axis.cpp
hle/service/hid/controllers/console_six_axis.h
hle/service/hid/controllers/controller_base.cpp
hle/service/hid/controllers/controller_base.h
+ hle/service/hid/controllers/debug_mouse.cpp
+ hle/service/hid/controllers/debug_mouse.h
hle/service/hid/controllers/debug_pad.cpp
hle/service/hid/controllers/debug_pad.h
+ hle/service/hid/controllers/digitizer.cpp
+ hle/service/hid/controllers/digitizer.h
hle/service/hid/controllers/gesture.cpp
hle/service/hid/controllers/gesture.h
+ hle/service/hid/controllers/home_button.cpp
+ hle/service/hid/controllers/home_button.h
hle/service/hid/controllers/keyboard.cpp
hle/service/hid/controllers/keyboard.h
hle/service/hid/controllers/mouse.cpp
@@ -574,15 +583,16 @@ add_library(core STATIC
hle/service/hid/controllers/palma.h
hle/service/hid/controllers/seven_six_axis.cpp
hle/service/hid/controllers/seven_six_axis.h
- hle/service/hid/controllers/shared_memory_format.h
hle/service/hid/controllers/shared_memory_holder.cpp
hle/service/hid/controllers/shared_memory_holder.h
hle/service/hid/controllers/six_axis.cpp
hle/service/hid/controllers/six_axis.h
- hle/service/hid/controllers/stubbed.cpp
- hle/service/hid/controllers/stubbed.h
+ hle/service/hid/controllers/sleep_button.cpp
+ hle/service/hid/controllers/sleep_button.h
hle/service/hid/controllers/touchscreen.cpp
hle/service/hid/controllers/touchscreen.h
+ hle/service/hid/controllers/unique_pad.cpp
+ hle/service/hid/controllers/unique_pad.h
hle/service/hid/hidbus/hidbus_base.cpp
hle/service/hid/hidbus/hidbus_base.h
hle/service/hid/hidbus/ringcon.cpp
diff --git a/src/core/hle/service/hid/controllers/applet_resource.cpp b/src/core/hle/service/hid/controllers/applet_resource.cpp
index c8e74c764..b4ff663c2 100644
--- a/src/core/hle/service/hid/controllers/applet_resource.cpp
+++ b/src/core/hle/service/hid/controllers/applet_resource.cpp
@@ -4,7 +4,7 @@
#include "core/core.h"
#include "core/hle/kernel/k_shared_memory.h"
#include "core/hle/service/hid/controllers/applet_resource.h"
-#include "core/hle/service/hid/controllers/shared_memory_format.h"
+#include "core/hle/service/hid/controllers/types/shared_memory_format.h"
#include "core/hle/service/hid/errors.h"
namespace Service::HID {
@@ -164,6 +164,22 @@ Result AppletResource::GetSharedMemoryFormat(SharedMemoryFormat** out_shared_mem
return ResultSuccess;
}
+AruidData* AppletResource::GetAruidData(u64 aruid) {
+ const u64 aruid_index = GetIndexFromAruid(aruid);
+ if (aruid_index == AruidIndexMax) {
+ return nullptr;
+ }
+ return &data[aruid_index];
+}
+
+AruidData* AppletResource::GetAruidDataByIndex(std::size_t aruid_index) {
+ return &data[aruid_index];
+}
+
+bool AppletResource::IsVibrationAruidActive(u64 aruid) const {
+ return aruid == 0 || aruid == active_vibration_aruid;
+}
+
u64 AppletResource::GetIndexFromAruid(u64 aruid) {
for (std::size_t i = 0; i < AruidIndexMax; i++) {
if (registration_list.flag[i] == RegistrationStatus::Initialized &&
diff --git a/src/core/hle/service/hid/controllers/applet_resource.h b/src/core/hle/service/hid/controllers/applet_resource.h
index e7991f93a..52cc4cf42 100644
--- a/src/core/hle/service/hid/controllers/applet_resource.h
+++ b/src/core/hle/service/hid/controllers/applet_resource.h
@@ -4,6 +4,7 @@
#pragma once
#include <array>
+#include <mutex>
#include "common/bit_field.h"
#include "common/common_types.h"
@@ -20,6 +21,59 @@ class KSharedMemory;
namespace Service::HID {
struct SharedMemoryFormat;
+class AppletResource;
+class NPadResource;
+
+static constexpr std::size_t AruidIndexMax = 0x20;
+
+enum class RegistrationStatus : u32 {
+ None,
+ Initialized,
+ PendingDelete,
+};
+
+struct DataStatusFlag {
+ union {
+ u32 raw{};
+
+ BitField<0, 1, u32> is_initialized;
+ BitField<1, 1, u32> is_assigned;
+ BitField<16, 1, u32> enable_pad_input;
+ BitField<17, 1, u32> enable_six_axis_sensor;
+ BitField<18, 1, u32> bit_18;
+ BitField<19, 1, u32> is_palma_connectable;
+ BitField<20, 1, u32> enable_palma_boost_mode;
+ BitField<21, 1, u32> enable_touchscreen;
+ };
+};
+
+struct AruidRegisterList {
+ std::array<RegistrationStatus, AruidIndexMax> flag{};
+ std::array<u64, AruidIndexMax> aruid{};
+};
+static_assert(sizeof(AruidRegisterList) == 0x180, "AruidRegisterList is an invalid size");
+
+struct AruidData {
+ DataStatusFlag flag{};
+ u64 aruid{};
+ SharedMemoryFormat* shared_memory_format{nullptr};
+};
+
+struct HandheldConfig {
+ bool is_handheld_hid_enabled;
+ bool is_force_handheld;
+ bool is_joycon_rail_enabled;
+ bool is_force_handheld_style_vibration;
+};
+static_assert(sizeof(HandheldConfig) == 0x4, "HandheldConfig is an invalid size");
+
+struct AppletResourceHolder {
+ std::shared_ptr<AppletResource> applet_resource{nullptr};
+ std::recursive_mutex* shared_mutex{nullptr};
+ NPadResource* shared_npad_resource{nullptr};
+ std::shared_ptr<HandheldConfig> handheld_config{nullptr};
+ long* handle_1;
+};
class AppletResource {
public:
@@ -36,6 +90,10 @@ public:
u64 GetActiveAruid();
Result GetSharedMemoryHandle(Kernel::KSharedMemory** out_handle, u64 aruid);
Result GetSharedMemoryFormat(SharedMemoryFormat** out_shared_memory_format, u64 aruid);
+ AruidData* GetAruidData(u64 aruid);
+ AruidData* GetAruidDataByIndex(std::size_t aruid_index);
+
+ bool IsVibrationAruidActive(u64 aruid) const;
u64 GetIndexFromAruid(u64 aruid);
@@ -52,46 +110,12 @@ public:
Result UnregisterCoreAppletResource();
private:
- static constexpr std::size_t AruidIndexMax = 0x20;
-
- enum RegistrationStatus : u32 {
- None,
- Initialized,
- PendingDelete,
- };
-
- struct DataStatusFlag {
- union {
- u32 raw{};
-
- BitField<0, 1, u32> is_initialized;
- BitField<1, 1, u32> is_assigned;
- BitField<16, 1, u32> enable_pad_input;
- BitField<17, 1, u32> enable_six_axis_sensor;
- BitField<18, 1, u32> bit_18;
- BitField<19, 1, u32> is_palma_connectable;
- BitField<20, 1, u32> enable_palma_boost_mode;
- BitField<21, 1, u32> enable_touchscreen;
- };
- };
-
- struct AruidRegisterList {
- std::array<RegistrationStatus, AruidIndexMax> flag{};
- std::array<u64, AruidIndexMax> aruid{};
- };
- static_assert(sizeof(AruidRegisterList) == 0x180, "AruidRegisterList is an invalid size");
-
- struct AruidData {
- DataStatusFlag flag{};
- u64 aruid{};
- SharedMemoryFormat* shared_memory_format{nullptr};
- };
-
u64 active_aruid{};
AruidRegisterList registration_list{};
std::array<AruidData, AruidIndexMax> data{};
std::array<SharedMemoryHolder, AruidIndexMax> shared_memory_holder{};
s32 ref_counter{};
+ u64 active_vibration_aruid;
Core::System& system;
};
diff --git a/src/core/hle/service/hid/controllers/capture_button.cpp b/src/core/hle/service/hid/controllers/capture_button.cpp
new file mode 100644
index 000000000..8b486fcb5
--- /dev/null
+++ b/src/core/hle/service/hid/controllers/capture_button.cpp
@@ -0,0 +1,38 @@
+// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#include "core/core_timing.h"
+#include "core/hle/service/hid/controllers/applet_resource.h"
+#include "core/hle/service/hid/controllers/capture_button.h"
+#include "core/hle/service/hid/controllers/types/shared_memory_format.h"
+
+namespace Service::HID {
+
+CaptureButton::CaptureButton(Core::HID::HIDCore& hid_core_) : ControllerBase{hid_core_} {}
+
+CaptureButton::~CaptureButton() = default;
+
+void CaptureButton::OnInit() {}
+
+void CaptureButton::OnRelease() {}
+
+void CaptureButton::OnUpdate(const Core::Timing::CoreTiming& core_timing) {
+ if (!smart_update) {
+ return;
+ }
+
+ const u64 aruid = applet_resource->GetActiveAruid();
+ auto* data = applet_resource->GetAruidData(aruid);
+
+ if (data == nullptr) {
+ return;
+ }
+
+ auto& header = data->shared_memory_format->capture_button.header;
+ header.timestamp = core_timing.GetGlobalTimeNs().count();
+ header.total_entry_count = 17;
+ header.entry_count = 0;
+ header.last_entry_index = 0;
+}
+
+} // namespace Service::HID
diff --git a/src/core/hle/service/hid/controllers/stubbed.h b/src/core/hle/service/hid/controllers/capture_button.h
index d2052fb17..dcc4715c5 100644
--- a/src/core/hle/service/hid/controllers/stubbed.h
+++ b/src/core/hle/service/hid/controllers/capture_button.h
@@ -6,12 +6,11 @@
#include "core/hle/service/hid/controllers/controller_base.h"
namespace Service::HID {
-struct CommonHeader;
-class Controller_Stubbed final : public ControllerBase {
+class CaptureButton final : public ControllerBase {
public:
- explicit Controller_Stubbed(Core::HID::HIDCore& hid_core_, CommonHeader& ring_lifo_header);
- ~Controller_Stubbed() override;
+ explicit CaptureButton(Core::HID::HIDCore& hid_core_);
+ ~CaptureButton() override;
// Called when the controller is initialized
void OnInit() override;
@@ -23,7 +22,6 @@ public:
void OnUpdate(const Core::Timing::CoreTiming& core_timing) override;
private:
- CommonHeader& header;
bool smart_update{};
};
} // namespace Service::HID
diff --git a/src/core/hle/service/hid/controllers/console_six_axis.cpp b/src/core/hle/service/hid/controllers/console_six_axis.cpp
index 3961d2b5f..8eba2c292 100644
--- a/src/core/hle/service/hid/controllers/console_six_axis.cpp
+++ b/src/core/hle/service/hid/controllers/console_six_axis.cpp
@@ -5,13 +5,11 @@
#include "core/hid/emulated_console.h"
#include "core/hid/hid_core.h"
#include "core/hle/service/hid/controllers/console_six_axis.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 {
-ConsoleSixAxis::ConsoleSixAxis(Core::HID::HIDCore& hid_core_,
- ConsoleSixAxisSensorSharedMemoryFormat& console_shared_memory)
- : ControllerBase{hid_core_}, shared_memory{console_shared_memory} {
+ConsoleSixAxis::ConsoleSixAxis(Core::HID::HIDCore& hid_core_) : ControllerBase{hid_core_} {
console = hid_core.GetEmulatedConsole();
}
@@ -22,6 +20,15 @@ void ConsoleSixAxis::OnInit() {}
void ConsoleSixAxis::OnRelease() {}
void ConsoleSixAxis::OnUpdate(const Core::Timing::CoreTiming& core_timing) {
+ const u64 aruid = applet_resource->GetActiveAruid();
+ auto* data = applet_resource->GetAruidData(aruid);
+
+ if (data == nullptr) {
+ return;
+ }
+
+ ConsoleSixAxisSensorSharedMemoryFormat& shared_memory = data->shared_memory_format->console;
+
if (!IsControllerActivated()) {
return;
}
diff --git a/src/core/hle/service/hid/controllers/console_six_axis.h b/src/core/hle/service/hid/controllers/console_six_axis.h
index 3d1c9ce23..e3351f83c 100644
--- a/src/core/hle/service/hid/controllers/console_six_axis.h
+++ b/src/core/hle/service/hid/controllers/console_six_axis.h
@@ -10,12 +10,9 @@ class EmulatedConsole;
} // namespace Core::HID
namespace Service::HID {
-struct ConsoleSixAxisSensorSharedMemoryFormat;
-
class ConsoleSixAxis final : public ControllerBase {
public:
- explicit ConsoleSixAxis(Core::HID::HIDCore& hid_core_,
- ConsoleSixAxisSensorSharedMemoryFormat& console_shared_memory);
+ explicit ConsoleSixAxis(Core::HID::HIDCore& hid_core_);
~ConsoleSixAxis() override;
// Called when the controller is initialized
@@ -28,7 +25,6 @@ public:
void OnUpdate(const Core::Timing::CoreTiming& core_timing) override;
private:
- ConsoleSixAxisSensorSharedMemoryFormat& shared_memory;
Core::HID::EmulatedConsole* console = nullptr;
};
} // namespace Service::HID
diff --git a/src/core/hle/service/hid/controllers/controller_base.cpp b/src/core/hle/service/hid/controllers/controller_base.cpp
index 0bcd87062..2083ccfad 100644
--- a/src/core/hle/service/hid/controllers/controller_base.cpp
+++ b/src/core/hle/service/hid/controllers/controller_base.cpp
@@ -31,4 +31,9 @@ void ControllerBase::DeactivateController() {
bool ControllerBase::IsControllerActivated() const {
return is_activated;
}
+
+void ControllerBase::SetAppletResource(std::shared_ptr<AppletResource> resource) {
+ applet_resource = resource;
+}
+
} // namespace Service::HID
diff --git a/src/core/hle/service/hid/controllers/controller_base.h b/src/core/hle/service/hid/controllers/controller_base.h
index 4326c7821..759ae0053 100644
--- a/src/core/hle/service/hid/controllers/controller_base.h
+++ b/src/core/hle/service/hid/controllers/controller_base.h
@@ -3,8 +3,11 @@
#pragma once
+#include <memory>
+
#include "common/common_types.h"
#include "core/hle/result.h"
+#include "core/hle/service/hid/controllers/applet_resource.h"
namespace Core::Timing {
class CoreTiming;
@@ -12,7 +15,7 @@ class CoreTiming;
namespace Core::HID {
class HIDCore;
-}
+} // namespace Core::HID
namespace Service::HID {
class ControllerBase {
@@ -39,8 +42,11 @@ public:
bool IsControllerActivated() const;
+ void SetAppletResource(std::shared_ptr<AppletResource> resource);
+
protected:
bool is_activated{false};
+ std::shared_ptr<AppletResource> applet_resource{nullptr};
Core::HID::HIDCore& hid_core;
};
diff --git a/src/core/hle/service/hid/controllers/debug_mouse.cpp b/src/core/hle/service/hid/controllers/debug_mouse.cpp
new file mode 100644
index 000000000..f2f1a27f8
--- /dev/null
+++ b/src/core/hle/service/hid/controllers/debug_mouse.cpp
@@ -0,0 +1,63 @@
+// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#include "core/core_timing.h"
+#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/debug_mouse.h"
+#include "core/hle/service/hid/controllers/types/shared_memory_format.h"
+
+namespace Service::HID {
+
+DebugMouse::DebugMouse(Core::HID::HIDCore& hid_core_) : ControllerBase{hid_core_} {
+ emulated_devices = hid_core.GetEmulatedDevices();
+}
+
+DebugMouse::~DebugMouse() = default;
+
+void DebugMouse::OnInit() {}
+void DebugMouse::OnRelease() {}
+
+void DebugMouse::OnUpdate(const Core::Timing::CoreTiming& core_timing) {
+ const u64 aruid = applet_resource->GetActiveAruid();
+ auto* data = applet_resource->GetAruidData(aruid);
+
+ if (data == nullptr) {
+ return;
+ }
+
+ MouseSharedMemoryFormat& shared_memory = data->shared_memory_format->debug_mouse;
+
+ if (!IsControllerActivated()) {
+ 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;
+ next_state.sampling_number = last_entry.sampling_number + 1;
+
+ if (Settings::values.mouse_enabled) {
+ const auto& mouse_button_state = emulated_devices->GetMouseButtons();
+ const auto& mouse_position_state = emulated_devices->GetMousePosition();
+ const auto& mouse_wheel_state = emulated_devices->GetMouseWheel();
+ next_state.attribute.is_connected.Assign(1);
+ next_state.x = static_cast<s32>(mouse_position_state.x * Layout::ScreenUndocked::Width);
+ next_state.y = static_cast<s32>(mouse_position_state.y * Layout::ScreenUndocked::Height);
+ next_state.delta_x = next_state.x - last_entry.x;
+ next_state.delta_y = next_state.y - last_entry.y;
+ next_state.delta_wheel_x = mouse_wheel_state.x - last_mouse_wheel_state.x;
+ next_state.delta_wheel_y = mouse_wheel_state.y - last_mouse_wheel_state.y;
+
+ last_mouse_wheel_state = mouse_wheel_state;
+ next_state.button = mouse_button_state;
+ }
+
+ shared_memory.mouse_lifo.WriteNextEntry(next_state);
+}
+
+} // namespace Service::HID
diff --git a/src/core/hle/service/hid/controllers/debug_mouse.h b/src/core/hle/service/hid/controllers/debug_mouse.h
new file mode 100644
index 000000000..ec939fa9f
--- /dev/null
+++ b/src/core/hle/service/hid/controllers/debug_mouse.h
@@ -0,0 +1,34 @@
+// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
+
+#include "core/hle/service/hid/controllers/controller_base.h"
+
+namespace Core::HID {
+class EmulatedDevices;
+struct MouseState;
+struct AnalogStickState;
+} // namespace Core::HID
+
+namespace Service::HID {
+class DebugMouse final : public ControllerBase {
+public:
+ explicit DebugMouse(Core::HID::HIDCore& hid_core_);
+ ~DebugMouse() override;
+
+ // Called when the controller is initialized
+ void OnInit() override;
+
+ // When the controller is released
+ void OnRelease() override;
+
+ // When the controller is requesting an update for the shared memory
+ void OnUpdate(const Core::Timing::CoreTiming& core_timing) override;
+
+private:
+ Core::HID::MouseState next_state{};
+ Core::HID::AnalogStickState last_mouse_wheel_state{};
+ Core::HID::EmulatedDevices* emulated_devices = nullptr;
+};
+} // namespace Service::HID
diff --git a/src/core/hle/service/hid/controllers/debug_pad.cpp b/src/core/hle/service/hid/controllers/debug_pad.cpp
index 7d2370b4f..1811cf620 100644
--- a/src/core/hle/service/hid/controllers/debug_pad.cpp
+++ b/src/core/hle/service/hid/controllers/debug_pad.cpp
@@ -6,14 +6,13 @@
#include "core/hid/emulated_controller.h"
#include "core/hid/hid_core.h"
#include "core/hid/hid_types.h"
+#include "core/hle/service/hid/controllers/applet_resource.h"
#include "core/hle/service/hid/controllers/debug_pad.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 {
-DebugPad::DebugPad(Core::HID::HIDCore& hid_core_,
- DebugPadSharedMemoryFormat& debug_pad_shared_memory)
- : ControllerBase{hid_core_}, shared_memory{debug_pad_shared_memory} {
+DebugPad::DebugPad(Core::HID::HIDCore& hid_core_) : ControllerBase{hid_core_} {
controller = hid_core.GetEmulatedController(Core::HID::NpadIdType::Other);
}
@@ -24,6 +23,15 @@ void DebugPad::OnInit() {}
void DebugPad::OnRelease() {}
void DebugPad::OnUpdate(const Core::Timing::CoreTiming& core_timing) {
+ const u64 aruid = applet_resource->GetActiveAruid();
+ auto* data = applet_resource->GetAruidData(aruid);
+
+ if (data == nullptr) {
+ return;
+ }
+
+ DebugPadSharedMemoryFormat& shared_memory = data->shared_memory_format->debug_pad;
+
if (!IsControllerActivated()) {
shared_memory.debug_pad_lifo.buffer_count = 0;
shared_memory.debug_pad_lifo.buffer_tail = 0;
diff --git a/src/core/hle/service/hid/controllers/debug_pad.h b/src/core/hle/service/hid/controllers/debug_pad.h
index 8ab29eca8..dd00b2402 100644
--- a/src/core/hle/service/hid/controllers/debug_pad.h
+++ b/src/core/hle/service/hid/controllers/debug_pad.h
@@ -15,12 +15,9 @@ class CoreTiming;
}
namespace Service::HID {
-struct DebugPadSharedMemoryFormat;
-
class DebugPad final : public ControllerBase {
public:
- explicit DebugPad(Core::HID::HIDCore& hid_core_,
- DebugPadSharedMemoryFormat& debug_pad_shared_memory);
+ explicit DebugPad(Core::HID::HIDCore& hid_core_);
~DebugPad() override;
// Called when the controller is initialized
@@ -34,7 +31,6 @@ public:
private:
DebugPadState next_state{};
- DebugPadSharedMemoryFormat& shared_memory;
Core::HID::EmulatedController* controller = nullptr;
};
} // namespace Service::HID
diff --git a/src/core/hle/service/hid/controllers/digitizer.cpp b/src/core/hle/service/hid/controllers/digitizer.cpp
new file mode 100644
index 000000000..c01580fd6
--- /dev/null
+++ b/src/core/hle/service/hid/controllers/digitizer.cpp
@@ -0,0 +1,38 @@
+// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#include "core/core_timing.h"
+#include "core/hle/service/hid/controllers/applet_resource.h"
+#include "core/hle/service/hid/controllers/digitizer.h"
+#include "core/hle/service/hid/controllers/types/shared_memory_format.h"
+
+namespace Service::HID {
+
+Digitizer::Digitizer(Core::HID::HIDCore& hid_core_) : ControllerBase{hid_core_} {}
+
+Digitizer::~Digitizer() = default;
+
+void Digitizer::OnInit() {}
+
+void Digitizer::OnRelease() {}
+
+void Digitizer::OnUpdate(const Core::Timing::CoreTiming& core_timing) {
+ if (!smart_update) {
+ return;
+ }
+
+ const u64 aruid = applet_resource->GetActiveAruid();
+ auto* data = applet_resource->GetAruidData(aruid);
+
+ if (data == nullptr) {
+ return;
+ }
+
+ auto& header = data->shared_memory_format->digitizer.header;
+ header.timestamp = core_timing.GetGlobalTimeNs().count();
+ header.total_entry_count = 17;
+ header.entry_count = 0;
+ header.last_entry_index = 0;
+}
+
+} // namespace Service::HID
diff --git a/src/core/hle/service/hid/controllers/digitizer.h b/src/core/hle/service/hid/controllers/digitizer.h
new file mode 100644
index 000000000..d81f814c3
--- /dev/null
+++ b/src/core/hle/service/hid/controllers/digitizer.h
@@ -0,0 +1,27 @@
+// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
+
+#include "core/hle/service/hid/controllers/controller_base.h"
+
+namespace Service::HID {
+
+class Digitizer final : public ControllerBase {
+public:
+ explicit Digitizer(Core::HID::HIDCore& hid_core_);
+ ~Digitizer() override;
+
+ // Called when the controller is initialized
+ void OnInit() override;
+
+ // When the controller is released
+ void OnRelease() override;
+
+ // When the controller is requesting an update for the shared memory
+ void OnUpdate(const Core::Timing::CoreTiming& core_timing) override;
+
+private:
+ bool smart_update{};
+};
+} // namespace Service::HID
diff --git a/src/core/hle/service/hid/controllers/gesture.cpp b/src/core/hle/service/hid/controllers/gesture.cpp
index f658005f6..6e686fe65 100644
--- a/src/core/hle/service/hid/controllers/gesture.cpp
+++ b/src/core/hle/service/hid/controllers/gesture.cpp
@@ -6,8 +6,9 @@
#include "core/frontend/emu_window.h"
#include "core/hid/emulated_console.h"
#include "core/hid/hid_core.h"
+#include "core/hle/service/hid/controllers/applet_resource.h"
#include "core/hle/service/hid/controllers/gesture.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 {
// HW is around 700, value is set to 400 to make it easier to trigger with mouse
@@ -21,24 +22,40 @@ constexpr f32 Square(s32 num) {
return static_cast<f32>(num * num);
}
-Gesture::Gesture(Core::HID::HIDCore& hid_core_, GestureSharedMemoryFormat& gesture_shared_memory)
- : ControllerBase(hid_core_), shared_memory{gesture_shared_memory} {
+Gesture::Gesture(Core::HID::HIDCore& hid_core_) : ControllerBase(hid_core_) {
console = hid_core.GetEmulatedConsole();
}
Gesture::~Gesture() = default;
void Gesture::OnInit() {
- shared_memory.gesture_lifo.buffer_count = 0;
- shared_memory.gesture_lifo.buffer_tail = 0;
+ const u64 aruid = applet_resource->GetActiveAruid();
+ auto* data = applet_resource->GetAruidData(aruid);
+
+ if (data == nullptr) {
+ return;
+ }
+
+ shared_memory = &data->shared_memory_format->gesture;
+ shared_memory->gesture_lifo.buffer_count = 0;
+ shared_memory->gesture_lifo.buffer_tail = 0;
force_update = true;
}
void Gesture::OnRelease() {}
void Gesture::OnUpdate(const Core::Timing::CoreTiming& core_timing) {
+ const u64 aruid = applet_resource->GetActiveAruid();
+ auto* data = applet_resource->GetAruidData(aruid);
+
+ if (data == nullptr) {
+ return;
+ }
+
+ shared_memory = &data->shared_memory_format->gesture;
+
if (!IsControllerActivated()) {
- shared_memory.gesture_lifo.buffer_count = 0;
- shared_memory.gesture_lifo.buffer_tail = 0;
+ shared_memory->gesture_lifo.buffer_count = 0;
+ shared_memory->gesture_lifo.buffer_tail = 0;
return;
}
@@ -46,7 +63,7 @@ void Gesture::OnUpdate(const Core::Timing::CoreTiming& core_timing) {
GestureProperties gesture = GetGestureProperties();
f32 time_difference =
- static_cast<f32>(shared_memory.gesture_lifo.timestamp - last_update_timestamp) /
+ static_cast<f32>(shared_memory->gesture_lifo.timestamp - last_update_timestamp) /
(1000 * 1000 * 1000);
// Only update if necessary
@@ -54,7 +71,7 @@ void Gesture::OnUpdate(const Core::Timing::CoreTiming& core_timing) {
return;
}
- last_update_timestamp = shared_memory.gesture_lifo.timestamp;
+ last_update_timestamp = shared_memory->gesture_lifo.timestamp;
UpdateGestureSharedMemory(gesture, time_difference);
}
@@ -97,7 +114,7 @@ void Gesture::UpdateGestureSharedMemory(GestureProperties& gesture, f32 time_dif
GestureType type = GestureType::Idle;
GestureAttribute attributes{};
- const auto& last_entry = shared_memory.gesture_lifo.ReadCurrentEntry().state;
+ const auto& last_entry = shared_memory->gesture_lifo.ReadCurrentEntry().state;
// Reset next state to default
next_state.sampling_number = last_entry.sampling_number + 1;
@@ -127,7 +144,7 @@ void Gesture::UpdateGestureSharedMemory(GestureProperties& gesture, f32 time_dif
next_state.points = gesture.points;
last_gesture = gesture;
- shared_memory.gesture_lifo.WriteNextEntry(next_state);
+ shared_memory->gesture_lifo.WriteNextEntry(next_state);
}
void Gesture::NewGesture(GestureProperties& gesture, GestureType& type,
@@ -300,7 +317,7 @@ void Gesture::SetSwipeEvent(GestureProperties& gesture, GestureProperties& last_
}
const GestureState& Gesture::GetLastGestureEntry() const {
- return shared_memory.gesture_lifo.ReadCurrentEntry().state;
+ return shared_memory->gesture_lifo.ReadCurrentEntry().state;
}
GestureProperties Gesture::GetGestureProperties() {
diff --git a/src/core/hle/service/hid/controllers/gesture.h b/src/core/hle/service/hid/controllers/gesture.h
index 41fdfcd03..78da1552a 100644
--- a/src/core/hle/service/hid/controllers/gesture.h
+++ b/src/core/hle/service/hid/controllers/gesture.h
@@ -18,8 +18,7 @@ struct GestureSharedMemoryFormat;
class Gesture final : public ControllerBase {
public:
- explicit Gesture(Core::HID::HIDCore& hid_core_,
- GestureSharedMemoryFormat& gesture_shared_memory);
+ explicit Gesture(Core::HID::HIDCore& hid_core_);
~Gesture() override;
// Called when the controller is initialized
@@ -74,7 +73,7 @@ private:
GestureProperties GetGestureProperties();
GestureState next_state{};
- GestureSharedMemoryFormat& shared_memory;
+ GestureSharedMemoryFormat* shared_memory;
Core::HID::EmulatedConsole* console = nullptr;
std::array<Core::HID::TouchFinger, MAX_POINTS> fingers{};
diff --git a/src/core/hle/service/hid/controllers/home_button.cpp b/src/core/hle/service/hid/controllers/home_button.cpp
new file mode 100644
index 000000000..71dd9bc08
--- /dev/null
+++ b/src/core/hle/service/hid/controllers/home_button.cpp
@@ -0,0 +1,38 @@
+// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#include "core/core_timing.h"
+#include "core/hle/service/hid/controllers/applet_resource.h"
+#include "core/hle/service/hid/controllers/home_button.h"
+#include "core/hle/service/hid/controllers/types/shared_memory_format.h"
+
+namespace Service::HID {
+
+HomeButton::HomeButton(Core::HID::HIDCore& hid_core_) : ControllerBase{hid_core_} {}
+
+HomeButton::~HomeButton() = default;
+
+void HomeButton::OnInit() {}
+
+void HomeButton::OnRelease() {}
+
+void HomeButton::OnUpdate(const Core::Timing::CoreTiming& core_timing) {
+ if (!smart_update) {
+ return;
+ }
+
+ const u64 aruid = applet_resource->GetActiveAruid();
+ auto* data = applet_resource->GetAruidData(aruid);
+
+ if (data == nullptr) {
+ return;
+ }
+
+ auto& header = data->shared_memory_format->home_button.header;
+ header.timestamp = core_timing.GetGlobalTimeNs().count();
+ header.total_entry_count = 17;
+ header.entry_count = 0;
+ header.last_entry_index = 0;
+}
+
+} // namespace Service::HID
diff --git a/src/core/hle/service/hid/controllers/home_button.h b/src/core/hle/service/hid/controllers/home_button.h
new file mode 100644
index 000000000..e91c2aa5d
--- /dev/null
+++ b/src/core/hle/service/hid/controllers/home_button.h
@@ -0,0 +1,27 @@
+// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
+
+#include "core/hle/service/hid/controllers/controller_base.h"
+
+namespace Service::HID {
+
+class HomeButton final : public ControllerBase {
+public:
+ explicit HomeButton(Core::HID::HIDCore& hid_core_);
+ ~HomeButton() override;
+
+ // Called when the controller is initialized
+ void OnInit() override;
+
+ // When the controller is released
+ void OnRelease() override;
+
+ // When the controller is requesting an update for the shared memory
+ void OnUpdate(const Core::Timing::CoreTiming& core_timing) override;
+
+private:
+ bool smart_update{};
+};
+} // namespace Service::HID
diff --git a/src/core/hle/service/hid/controllers/keyboard.cpp b/src/core/hle/service/hid/controllers/keyboard.cpp
index 871e5036a..c72b3e5ce 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,15 @@ void Keyboard::OnInit() {}
void Keyboard::OnRelease() {}
void Keyboard::OnUpdate(const Core::Timing::CoreTiming& core_timing) {
+ const u64 aruid = applet_resource->GetActiveAruid();
+ auto* data = applet_resource->GetAruidData(aruid);
+
+ if (data == nullptr) {
+ 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;
diff --git a/src/core/hle/service/hid/controllers/keyboard.h b/src/core/hle/service/hid/controllers/keyboard.h
index 4d72171b9..e8ca326c6 100644
--- a/src/core/hle/service/hid/controllers/keyboard.h
+++ b/src/core/hle/service/hid/controllers/keyboard.h
@@ -7,12 +7,9 @@
#include "core/hle/service/hid/controllers/types/keyboard_types.h"
namespace Service::HID {
-struct KeyboardSharedMemoryFormat;
-
class Keyboard final : public ControllerBase {
public:
- explicit Keyboard(Core::HID::HIDCore& hid_core_,
- KeyboardSharedMemoryFormat& keyboard_shared_memory);
+ explicit Keyboard(Core::HID::HIDCore& hid_core_);
~Keyboard() override;
// Called when the controller is initialized
@@ -26,7 +23,6 @@ public:
private:
KeyboardState next_state{};
- KeyboardSharedMemoryFormat& shared_memory;
Core::HID::EmulatedDevices* emulated_devices = nullptr;
};
} // namespace Service::HID
diff --git a/src/core/hle/service/hid/controllers/mouse.cpp b/src/core/hle/service/hid/controllers/mouse.cpp
index de5b2c804..58deafbc5 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,15 @@ void Mouse::OnInit() {}
void Mouse::OnRelease() {}
void Mouse::OnUpdate(const Core::Timing::CoreTiming& core_timing) {
+ const u64 aruid = applet_resource->GetActiveAruid();
+ auto* data = applet_resource->GetAruidData(aruid);
+
+ if (data == nullptr) {
+ 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;
diff --git a/src/core/hle/service/hid/controllers/mouse.h b/src/core/hle/service/hid/controllers/mouse.h
index 363f316a5..cefad956c 100644
--- a/src/core/hle/service/hid/controllers/mouse.h
+++ b/src/core/hle/service/hid/controllers/mouse.h
@@ -12,11 +12,9 @@ struct AnalogStickState;
} // namespace Core::HID
namespace Service::HID {
-struct MouseSharedMemoryFormat;
-
class Mouse final : public ControllerBase {
public:
- explicit Mouse(Core::HID::HIDCore& hid_core_, MouseSharedMemoryFormat& mouse_shared_memory);
+ explicit Mouse(Core::HID::HIDCore& hid_core_);
~Mouse() override;
// Called when the controller is initialized
@@ -31,7 +29,6 @@ public:
private:
Core::HID::MouseState next_state{};
Core::HID::AnalogStickState last_mouse_wheel_state{};
- MouseSharedMemoryFormat& shared_memory;
Core::HID::EmulatedDevices* emulated_devices = nullptr;
};
} // namespace Service::HID
diff --git a/src/core/hle/service/hid/controllers/npad.cpp b/src/core/hle/service/hid/controllers/npad.cpp
index 53a737cf5..c7aa606bc 100644
--- a/src/core/hle/service/hid/controllers/npad.cpp
+++ b/src/core/hle/service/hid/controllers/npad.cpp
@@ -16,8 +16,9 @@
#include "core/hid/hid_core.h"
#include "core/hle/kernel/k_event.h"
#include "core/hle/kernel/k_readable_event.h"
+#include "core/hle/service/hid/controllers/applet_resource.h"
#include "core/hle/service/hid/controllers/npad.h"
-#include "core/hle/service/hid/controllers/shared_memory_format.h"
+#include "core/hle/service/hid/controllers/types/shared_memory_format.h"
#include "core/hle/service/hid/errors.h"
#include "core/hle/service/hid/hid_util.h"
#include "core/hle/service/kernel_helpers.h"
@@ -30,12 +31,10 @@ constexpr std::array<Core::HID::NpadIdType, 10> npad_id_list{
Core::HID::NpadIdType::Handheld,
};
-NPad::NPad(Core::HID::HIDCore& hid_core_, NpadSharedMemoryFormat& npad_shared_memory_format,
- KernelHelpers::ServiceContext& service_context_)
+NPad::NPad(Core::HID::HIDCore& hid_core_, KernelHelpers::ServiceContext& service_context_)
: ControllerBase{hid_core_}, service_context{service_context_} {
for (std::size_t i = 0; i < controller_data.size(); ++i) {
auto& controller = controller_data[i];
- controller.shared_memory = &npad_shared_memory_format.npad_entry[i].internal_state;
controller.device = hid_core.GetEmulatedControllerByIndex(i);
controller.vibration[Core::HID::EmulatedDeviceIndex::LeftIndex].latest_vibration_value =
Core::HID::DEFAULT_VIBRATION_VALUE;
@@ -297,12 +296,20 @@ void NPad::InitNewlyAddedController(Core::HID::NpadIdType npad_id) {
}
void NPad::OnInit() {
+ const u64 aruid = applet_resource->GetActiveAruid();
+ auto* data = applet_resource->GetAruidData(aruid);
+
+ if (data == nullptr) {
+ return;
+ }
+
if (!IsControllerActivated()) {
return;
}
for (std::size_t i = 0; i < controller_data.size(); ++i) {
auto& controller = controller_data[i];
+ controller.shared_memory = &data->shared_memory_format->npad.npad_entry[i].internal_state;
controller.styleset_changed_event =
service_context.CreateEvent(fmt::format("npad:NpadStyleSetChanged_{}", i));
}
@@ -355,7 +362,9 @@ void NPad::OnRelease() {
is_controller_initialized = false;
for (std::size_t i = 0; i < controller_data.size(); ++i) {
auto& controller = controller_data[i];
- service_context.CloseEvent(controller.styleset_changed_event);
+ if (controller.styleset_changed_event) {
+ service_context.CloseEvent(controller.styleset_changed_event);
+ }
for (std::size_t device_idx = 0; device_idx < controller.vibration.size(); ++device_idx) {
VibrateControllerAtIndex(controller.device->GetNpadIdType(), device_idx, {});
}
@@ -432,12 +441,20 @@ void NPad::RequestPadStateUpdate(Core::HID::NpadIdType npad_id) {
}
void NPad::OnUpdate(const Core::Timing::CoreTiming& core_timing) {
+ const u64 aruid = applet_resource->GetActiveAruid();
+ auto* data = applet_resource->GetAruidData(aruid);
+
+ if (data == nullptr) {
+ return;
+ }
+
if (!IsControllerActivated()) {
return;
}
for (std::size_t i = 0; i < controller_data.size(); ++i) {
auto& controller = controller_data[i];
+ controller.shared_memory = &data->shared_memory_format->npad.npad_entry[i].internal_state;
auto* npad = controller.shared_memory;
const auto& controller_type = controller.device->GetNpadStyleIndex();
@@ -976,30 +993,6 @@ Result NPad::ResetIsSixAxisSensorDeviceNewlyAssigned(
return ResultSuccess;
}
-NpadSixAxisSensorLifo& NPad::GetSixAxisFullkeyLifo(Core::HID::NpadIdType npad_id) {
- return GetControllerFromNpadIdType(npad_id).shared_memory->sixaxis_fullkey_lifo;
-}
-
-NpadSixAxisSensorLifo& NPad::GetSixAxisHandheldLifo(Core::HID::NpadIdType npad_id) {
- return GetControllerFromNpadIdType(npad_id).shared_memory->sixaxis_handheld_lifo;
-}
-
-NpadSixAxisSensorLifo& NPad::GetSixAxisDualLeftLifo(Core::HID::NpadIdType npad_id) {
- return GetControllerFromNpadIdType(npad_id).shared_memory->sixaxis_dual_left_lifo;
-}
-
-NpadSixAxisSensorLifo& NPad::GetSixAxisDualRightLifo(Core::HID::NpadIdType npad_id) {
- return GetControllerFromNpadIdType(npad_id).shared_memory->sixaxis_dual_right_lifo;
-}
-
-NpadSixAxisSensorLifo& NPad::GetSixAxisLeftLifo(Core::HID::NpadIdType npad_id) {
- return GetControllerFromNpadIdType(npad_id).shared_memory->sixaxis_left_lifo;
-}
-
-NpadSixAxisSensorLifo& NPad::GetSixAxisRightLifo(Core::HID::NpadIdType npad_id) {
- return GetControllerFromNpadIdType(npad_id).shared_memory->sixaxis_right_lifo;
-}
-
Result NPad::MergeSingleJoyAsDualJoy(Core::HID::NpadIdType npad_id_1,
Core::HID::NpadIdType npad_id_2) {
if (!IsNpadIdValid(npad_id_1) || !IsNpadIdValid(npad_id_2)) {
diff --git a/src/core/hle/service/hid/controllers/npad.h b/src/core/hle/service/hid/controllers/npad.h
index 4e2412356..80cfcb2bb 100644
--- a/src/core/hle/service/hid/controllers/npad.h
+++ b/src/core/hle/service/hid/controllers/npad.h
@@ -30,14 +30,14 @@ class ServiceContext;
union Result;
namespace Service::HID {
+class AppletResource;
struct NpadInternalState;
struct NpadSixAxisSensorLifo;
struct NpadSharedMemoryFormat;
class NPad final : public ControllerBase {
public:
- explicit NPad(Core::HID::HIDCore& hid_core_, NpadSharedMemoryFormat& npad_shared_memory_format,
- KernelHelpers::ServiceContext& service_context_);
+ explicit NPad(Core::HID::HIDCore& hid_core_, KernelHelpers::ServiceContext& service_context_);
~NPad() override;
// Called when the controller is initialized
@@ -106,13 +106,6 @@ public:
Result ResetIsSixAxisSensorDeviceNewlyAssigned(
const Core::HID::SixAxisSensorHandle& sixaxis_handle);
- NpadSixAxisSensorLifo& GetSixAxisFullkeyLifo(Core::HID::NpadIdType npad_id);
- NpadSixAxisSensorLifo& GetSixAxisHandheldLifo(Core::HID::NpadIdType npad_id);
- NpadSixAxisSensorLifo& GetSixAxisDualLeftLifo(Core::HID::NpadIdType npad_id);
- NpadSixAxisSensorLifo& GetSixAxisDualRightLifo(Core::HID::NpadIdType npad_id);
- NpadSixAxisSensorLifo& GetSixAxisLeftLifo(Core::HID::NpadIdType npad_id);
- NpadSixAxisSensorLifo& GetSixAxisRightLifo(Core::HID::NpadIdType npad_id);
-
Result GetLedPattern(Core::HID::NpadIdType npad_id, Core::HID::LedPattern& pattern) const;
Result IsUnintendedHomeButtonInputProtectionEnabled(Core::HID::NpadIdType npad_id,
bool& is_enabled) const;
diff --git a/src/core/hle/service/hid/controllers/shared_memory_holder.cpp b/src/core/hle/service/hid/controllers/shared_memory_holder.cpp
index 51581188e..0bc5169c6 100644
--- a/src/core/hle/service/hid/controllers/shared_memory_holder.cpp
+++ b/src/core/hle/service/hid/controllers/shared_memory_holder.cpp
@@ -3,8 +3,9 @@
#include "core/core.h"
#include "core/hle/kernel/k_shared_memory.h"
-#include "core/hle/service/hid/controllers/shared_memory_format.h"
+#include "core/hle/service/hid/controllers/applet_resource.h"
#include "core/hle/service/hid/controllers/shared_memory_holder.h"
+#include "core/hle/service/hid/controllers/types/shared_memory_format.h"
#include "core/hle/service/hid/errors.h"
namespace Service::HID {
diff --git a/src/core/hle/service/hid/controllers/six_axis.cpp b/src/core/hle/service/hid/controllers/six_axis.cpp
index 36b72f9ea..a5a67dea6 100644
--- a/src/core/hle/service/hid/controllers/six_axis.cpp
+++ b/src/core/hle/service/hid/controllers/six_axis.cpp
@@ -6,8 +6,8 @@
#include "core/hid/emulated_controller.h"
#include "core/hid/hid_core.h"
#include "core/hle/service/hid/controllers/npad.h"
-#include "core/hle/service/hid/controllers/shared_memory_format.h"
#include "core/hle/service/hid/controllers/six_axis.h"
+#include "core/hle/service/hid/controllers/types/shared_memory_format.h"
#include "core/hle/service/hid/errors.h"
#include "core/hle/service/hid/hid_util.h"
@@ -27,14 +27,20 @@ void SixAxis::OnInit() {}
void SixAxis::OnRelease() {}
void SixAxis::OnUpdate(const Core::Timing::CoreTiming& core_timing) {
+ const u64 aruid = applet_resource->GetActiveAruid();
+ auto* data = applet_resource->GetAruidData(aruid);
+
+ if (data == nullptr) {
+ return;
+ }
+
if (!IsControllerActivated()) {
return;
}
for (std::size_t i = 0; i < controller_data.size(); ++i) {
+ NpadSharedMemoryEntry& shared_memory = data->shared_memory_format->npad.npad_entry[i];
auto& controller = controller_data[i];
-
- const auto npad_id = IndexToNpadIdType(i);
const auto& controller_type = controller.device->GetNpadStyleIndex();
if (controller_type == Core::HID::NpadStyleIndex::None ||
@@ -50,12 +56,12 @@ void SixAxis::OnUpdate(const Core::Timing::CoreTiming& core_timing) {
auto& sixaxis_left_lifo_state = controller.sixaxis_left_lifo_state;
auto& sixaxis_right_lifo_state = controller.sixaxis_right_lifo_state;
- auto& sixaxis_fullkey_lifo = npad->GetSixAxisFullkeyLifo(npad_id);
- auto& sixaxis_handheld_lifo = npad->GetSixAxisHandheldLifo(npad_id);
- auto& sixaxis_dual_left_lifo = npad->GetSixAxisDualLeftLifo(npad_id);
- auto& sixaxis_dual_right_lifo = npad->GetSixAxisDualRightLifo(npad_id);
- auto& sixaxis_left_lifo = npad->GetSixAxisLeftLifo(npad_id);
- auto& sixaxis_right_lifo = npad->GetSixAxisRightLifo(npad_id);
+ auto& sixaxis_fullkey_lifo = shared_memory.internal_state.sixaxis_fullkey_lifo;
+ auto& sixaxis_handheld_lifo = shared_memory.internal_state.sixaxis_handheld_lifo;
+ auto& sixaxis_dual_left_lifo = shared_memory.internal_state.sixaxis_dual_left_lifo;
+ auto& sixaxis_dual_right_lifo = shared_memory.internal_state.sixaxis_dual_right_lifo;
+ auto& sixaxis_left_lifo = shared_memory.internal_state.sixaxis_left_lifo;
+ auto& sixaxis_right_lifo = shared_memory.internal_state.sixaxis_right_lifo;
// Clear previous state
sixaxis_fullkey_state = {};
diff --git a/src/core/hle/service/hid/controllers/sleep_button.cpp b/src/core/hle/service/hid/controllers/sleep_button.cpp
new file mode 100644
index 000000000..978dc4c1f
--- /dev/null
+++ b/src/core/hle/service/hid/controllers/sleep_button.cpp
@@ -0,0 +1,38 @@
+// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#include "core/core_timing.h"
+#include "core/hle/service/hid/controllers/applet_resource.h"
+#include "core/hle/service/hid/controllers/sleep_button.h"
+#include "core/hle/service/hid/controllers/types/shared_memory_format.h"
+
+namespace Service::HID {
+
+SleepButton::SleepButton(Core::HID::HIDCore& hid_core_) : ControllerBase{hid_core_} {}
+
+SleepButton::~SleepButton() = default;
+
+void SleepButton::OnInit() {}
+
+void SleepButton::OnRelease() {}
+
+void SleepButton::OnUpdate(const Core::Timing::CoreTiming& core_timing) {
+ if (!smart_update) {
+ return;
+ }
+
+ const u64 aruid = applet_resource->GetActiveAruid();
+ auto* data = applet_resource->GetAruidData(aruid);
+
+ if (data == nullptr) {
+ return;
+ }
+
+ auto& header = data->shared_memory_format->capture_button.header;
+ header.timestamp = core_timing.GetGlobalTimeNs().count();
+ header.total_entry_count = 17;
+ header.entry_count = 0;
+ header.last_entry_index = 0;
+}
+
+} // namespace Service::HID
diff --git a/src/core/hle/service/hid/controllers/sleep_button.h b/src/core/hle/service/hid/controllers/sleep_button.h
new file mode 100644
index 000000000..59964bf63
--- /dev/null
+++ b/src/core/hle/service/hid/controllers/sleep_button.h
@@ -0,0 +1,27 @@
+// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
+
+#include "core/hle/service/hid/controllers/controller_base.h"
+
+namespace Service::HID {
+
+class SleepButton final : public ControllerBase {
+public:
+ explicit SleepButton(Core::HID::HIDCore& hid_core_);
+ ~SleepButton() override;
+
+ // Called when the controller is initialized
+ void OnInit() override;
+
+ // When the controller is released
+ void OnRelease() override;
+
+ // When the controller is requesting an update for the shared memory
+ void OnUpdate(const Core::Timing::CoreTiming& core_timing) override;
+
+private:
+ bool smart_update{};
+};
+} // namespace Service::HID
diff --git a/src/core/hle/service/hid/controllers/stubbed.cpp b/src/core/hle/service/hid/controllers/stubbed.cpp
deleted file mode 100644
index e2a5f5d79..000000000
--- a/src/core/hle/service/hid/controllers/stubbed.cpp
+++ /dev/null
@@ -1,31 +0,0 @@
-// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
-// SPDX-License-Identifier: GPL-2.0-or-later
-
-#include "core/core_timing.h"
-#include "core/hle/service/hid/controllers/shared_memory_format.h"
-#include "core/hle/service/hid/controllers/stubbed.h"
-
-namespace Service::HID {
-
-Controller_Stubbed::Controller_Stubbed(Core::HID::HIDCore& hid_core_,
- CommonHeader& ring_lifo_header)
- : ControllerBase{hid_core_}, header{ring_lifo_header} {}
-
-Controller_Stubbed::~Controller_Stubbed() = default;
-
-void Controller_Stubbed::OnInit() {}
-
-void Controller_Stubbed::OnRelease() {}
-
-void Controller_Stubbed::OnUpdate(const Core::Timing::CoreTiming& core_timing) {
- if (!smart_update) {
- return;
- }
-
- header.timestamp = core_timing.GetGlobalTimeNs().count();
- header.total_entry_count = 17;
- header.entry_count = 0;
- header.last_entry_index = 0;
-}
-
-} // namespace Service::HID
diff --git a/src/core/hle/service/hid/controllers/touchscreen.cpp b/src/core/hle/service/hid/controllers/touchscreen.cpp
index 469750006..291dc707e 100644
--- a/src/core/hle/service/hid/controllers/touchscreen.cpp
+++ b/src/core/hle/service/hid/controllers/touchscreen.cpp
@@ -8,15 +8,14 @@
#include "core/frontend/emu_window.h"
#include "core/hid/emulated_console.h"
#include "core/hid/hid_core.h"
-#include "core/hle/service/hid/controllers/shared_memory_format.h"
+#include "core/hle/service/hid/controllers/applet_resource.h"
#include "core/hle/service/hid/controllers/touchscreen.h"
+#include "core/hle/service/hid/controllers/types/shared_memory_format.h"
namespace Service::HID {
-TouchScreen::TouchScreen(Core::HID::HIDCore& hid_core_,
- TouchScreenSharedMemoryFormat& touch_shared_memory)
- : ControllerBase{hid_core_}, shared_memory{touch_shared_memory},
- touchscreen_width(Layout::ScreenUndocked::Width),
+TouchScreen::TouchScreen(Core::HID::HIDCore& hid_core_)
+ : ControllerBase{hid_core_}, touchscreen_width(Layout::ScreenUndocked::Width),
touchscreen_height(Layout::ScreenUndocked::Height) {
console = hid_core.GetEmulatedConsole();
}
@@ -28,6 +27,14 @@ void TouchScreen::OnInit() {}
void TouchScreen::OnRelease() {}
void TouchScreen::OnUpdate(const Core::Timing::CoreTiming& core_timing) {
+ const u64 aruid = applet_resource->GetActiveAruid();
+ auto* data = applet_resource->GetAruidData(aruid);
+
+ if (data == nullptr) {
+ return;
+ }
+
+ TouchScreenSharedMemoryFormat& shared_memory = data->shared_memory_format->touch_screen;
shared_memory.touch_screen_lifo.timestamp = core_timing.GetGlobalTimeNs().count();
if (!IsControllerActivated()) {
diff --git a/src/core/hle/service/hid/controllers/touchscreen.h b/src/core/hle/service/hid/controllers/touchscreen.h
index 5b6305bfc..945d359be 100644
--- a/src/core/hle/service/hid/controllers/touchscreen.h
+++ b/src/core/hle/service/hid/controllers/touchscreen.h
@@ -18,8 +18,7 @@ struct TouchScreenSharedMemoryFormat;
class TouchScreen final : public ControllerBase {
public:
- explicit TouchScreen(Core::HID::HIDCore& hid_core_,
- TouchScreenSharedMemoryFormat& touch_shared_memory);
+ explicit TouchScreen(Core::HID::HIDCore& hid_core_);
~TouchScreen() override;
// Called when the controller is initialized
@@ -35,7 +34,6 @@ public:
private:
TouchScreenState next_state{};
- TouchScreenSharedMemoryFormat& shared_memory;
Core::HID::EmulatedConsole* console = nullptr;
std::array<Core::HID::TouchFinger, MAX_FINGERS> fingers{};
diff --git a/src/core/hle/service/hid/controllers/shared_memory_format.h b/src/core/hle/service/hid/controllers/types/shared_memory_format.h
index 2986c113e..2986c113e 100644
--- a/src/core/hle/service/hid/controllers/shared_memory_format.h
+++ b/src/core/hle/service/hid/controllers/types/shared_memory_format.h
diff --git a/src/core/hle/service/hid/controllers/unique_pad.cpp b/src/core/hle/service/hid/controllers/unique_pad.cpp
new file mode 100644
index 000000000..8230501a5
--- /dev/null
+++ b/src/core/hle/service/hid/controllers/unique_pad.cpp
@@ -0,0 +1,38 @@
+// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#include "core/core_timing.h"
+#include "core/hle/service/hid/controllers/applet_resource.h"
+#include "core/hle/service/hid/controllers/types/shared_memory_format.h"
+#include "core/hle/service/hid/controllers/unique_pad.h"
+
+namespace Service::HID {
+
+UniquePad::UniquePad(Core::HID::HIDCore& hid_core_) : ControllerBase{hid_core_} {}
+
+UniquePad::~UniquePad() = default;
+
+void UniquePad::OnInit() {}
+
+void UniquePad::OnRelease() {}
+
+void UniquePad::OnUpdate(const Core::Timing::CoreTiming& core_timing) {
+ if (!smart_update) {
+ return;
+ }
+
+ const u64 aruid = applet_resource->GetActiveAruid();
+ auto* data = applet_resource->GetAruidData(aruid);
+
+ if (data == nullptr) {
+ return;
+ }
+
+ auto& header = data->shared_memory_format->capture_button.header;
+ header.timestamp = core_timing.GetGlobalTimeNs().count();
+ header.total_entry_count = 17;
+ header.entry_count = 0;
+ header.last_entry_index = 0;
+}
+
+} // namespace Service::HID
diff --git a/src/core/hle/service/hid/controllers/unique_pad.h b/src/core/hle/service/hid/controllers/unique_pad.h
new file mode 100644
index 000000000..966368264
--- /dev/null
+++ b/src/core/hle/service/hid/controllers/unique_pad.h
@@ -0,0 +1,27 @@
+// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
+
+#include "core/hle/service/hid/controllers/controller_base.h"
+
+namespace Service::HID {
+
+class UniquePad final : public ControllerBase {
+public:
+ explicit UniquePad(Core::HID::HIDCore& hid_core_);
+ ~UniquePad() override;
+
+ // Called when the controller is initialized
+ void OnInit() override;
+
+ // When the controller is released
+ void OnRelease() override;
+
+ // When the controller is requesting an update for the shared memory
+ void OnUpdate(const Core::Timing::CoreTiming& core_timing) override;
+
+private:
+ bool smart_update{};
+};
+} // namespace Service::HID
diff --git a/src/core/hle/service/hid/resource_manager.cpp b/src/core/hle/service/hid/resource_manager.cpp
index afc61f70d..84b4be3ed 100644
--- a/src/core/hle/service/hid/resource_manager.cpp
+++ b/src/core/hle/service/hid/resource_manager.cpp
@@ -10,18 +10,23 @@
#include "core/hle/service/ipc_helpers.h"
#include "core/hle/service/hid/controllers/applet_resource.h"
+#include "core/hle/service/hid/controllers/capture_button.h"
#include "core/hle/service/hid/controllers/console_six_axis.h"
+#include "core/hle/service/hid/controllers/debug_mouse.h"
#include "core/hle/service/hid/controllers/debug_pad.h"
+#include "core/hle/service/hid/controllers/digitizer.h"
#include "core/hle/service/hid/controllers/gesture.h"
+#include "core/hle/service/hid/controllers/home_button.h"
#include "core/hle/service/hid/controllers/keyboard.h"
#include "core/hle/service/hid/controllers/mouse.h"
#include "core/hle/service/hid/controllers/npad.h"
#include "core/hle/service/hid/controllers/palma.h"
#include "core/hle/service/hid/controllers/seven_six_axis.h"
-#include "core/hle/service/hid/controllers/shared_memory_format.h"
#include "core/hle/service/hid/controllers/six_axis.h"
-#include "core/hle/service/hid/controllers/stubbed.h"
+#include "core/hle/service/hid/controllers/sleep_button.h"
#include "core/hle/service/hid/controllers/touchscreen.h"
+#include "core/hle/service/hid/controllers/types/shared_memory_format.h"
+#include "core/hle/service/hid/controllers/unique_pad.h"
namespace Service::HID {
@@ -46,42 +51,13 @@ void ResourceManager::Initialize() {
}
system.HIDCore().ReloadInputDevices();
- is_initialized = true;
-}
-
-void ResourceManager::InitializeController(u64 aruid) {
- SharedMemoryFormat* shared_memory = nullptr;
- const auto result = applet_resource->GetSharedMemoryFormat(&shared_memory, aruid);
- if (result.IsError()) {
- return;
- }
-
- debug_pad = std::make_shared<DebugPad>(system.HIDCore(), shared_memory->debug_pad);
- mouse = std::make_shared<Mouse>(system.HIDCore(), shared_memory->mouse);
- debug_mouse = std::make_shared<DebugMouse>(system.HIDCore(), shared_memory->debug_mouse);
- keyboard = std::make_shared<Keyboard>(system.HIDCore(), shared_memory->keyboard);
- unique_pad = std::make_shared<UniquePad>(system.HIDCore(), shared_memory->unique_pad.header);
- npad = std::make_shared<NPad>(system.HIDCore(), shared_memory->npad, service_context);
- gesture = std::make_shared<Gesture>(system.HIDCore(), shared_memory->gesture);
- touch_screen = std::make_shared<TouchScreen>(system.HIDCore(), shared_memory->touch_screen);
- palma = std::make_shared<Palma>(system.HIDCore(), service_context);
+ InitializeHidCommonSampler();
+ InitializeTouchScreenSampler();
+ InitializeConsoleSixAxisSampler();
+ InitializeAHidSampler();
- home_button = std::make_shared<HomeButton>(system.HIDCore(), shared_memory->home_button.header);
- sleep_button =
- std::make_shared<SleepButton>(system.HIDCore(), shared_memory->sleep_button.header);
- capture_button =
- std::make_shared<CaptureButton>(system.HIDCore(), shared_memory->capture_button.header);
- digitizer = std::make_shared<Digitizer>(system.HIDCore(), shared_memory->digitizer.header);
-
- six_axis = std::make_shared<SixAxis>(system.HIDCore(), npad);
- console_six_axis = std::make_shared<ConsoleSixAxis>(system.HIDCore(), shared_memory->console);
- seven_six_axis = std::make_shared<SevenSixAxis>(system);
-
- // Homebrew doesn't try to activate some controllers, so we activate them by default
- npad->Activate();
- six_axis->Activate();
- touch_screen->Activate();
+ is_initialized = true;
}
std::shared_ptr<AppletResource> ResourceManager::GetAppletResource() const {
@@ -165,16 +141,65 @@ Result ResourceManager::CreateAppletResource(u64 aruid) {
if (result.IsError()) {
return result;
}
+
+ // Homebrew doesn't try to activate some controllers, so we activate them by default
+ npad->Activate();
+ six_axis->Activate();
+ touch_screen->Activate();
+
return GetNpad()->Activate(aruid);
}
Result ResourceManager::CreateAppletResourceImpl(u64 aruid) {
std::scoped_lock lock{shared_mutex};
- const auto result = applet_resource->CreateAppletResource(aruid);
- if (result.IsSuccess()) {
- InitializeController(aruid);
- }
- return result;
+ return applet_resource->CreateAppletResource(aruid);
+}
+
+void ResourceManager::InitializeHidCommonSampler() {
+ debug_pad = std::make_shared<DebugPad>(system.HIDCore());
+ mouse = std::make_shared<Mouse>(system.HIDCore());
+ debug_mouse = std::make_shared<DebugMouse>(system.HIDCore());
+ keyboard = std::make_shared<Keyboard>(system.HIDCore());
+ unique_pad = std::make_shared<UniquePad>(system.HIDCore());
+ npad = std::make_shared<NPad>(system.HIDCore(), service_context);
+ gesture = std::make_shared<Gesture>(system.HIDCore());
+ home_button = std::make_shared<HomeButton>(system.HIDCore());
+ sleep_button = std::make_shared<SleepButton>(system.HIDCore());
+ capture_button = std::make_shared<CaptureButton>(system.HIDCore());
+ digitizer = std::make_shared<Digitizer>(system.HIDCore());
+
+ palma = std::make_shared<Palma>(system.HIDCore(), service_context);
+ six_axis = std::make_shared<SixAxis>(system.HIDCore(), npad);
+
+ debug_pad->SetAppletResource(applet_resource);
+ digitizer->SetAppletResource(applet_resource);
+ keyboard->SetAppletResource(applet_resource);
+ npad->SetAppletResource(applet_resource);
+ six_axis->SetAppletResource(applet_resource);
+ mouse->SetAppletResource(applet_resource);
+ debug_mouse->SetAppletResource(applet_resource);
+ home_button->SetAppletResource(applet_resource);
+ sleep_button->SetAppletResource(applet_resource);
+ capture_button->SetAppletResource(applet_resource);
+}
+
+void ResourceManager::InitializeTouchScreenSampler() {
+ gesture = std::make_shared<Gesture>(system.HIDCore());
+ touch_screen = std::make_shared<TouchScreen>(system.HIDCore());
+
+ touch_screen->SetAppletResource(applet_resource);
+ gesture->SetAppletResource(applet_resource);
+}
+
+void ResourceManager::InitializeConsoleSixAxisSampler() {
+ console_six_axis = std::make_shared<ConsoleSixAxis>(system.HIDCore());
+ seven_six_axis = std::make_shared<SevenSixAxis>(system);
+
+ console_six_axis->SetAppletResource(applet_resource);
+}
+
+void ResourceManager::InitializeAHidSampler() {
+ // TODO
}
Result ResourceManager::RegisterCoreAppletResource() {
diff --git a/src/core/hle/service/hid/resource_manager.h b/src/core/hle/service/hid/resource_manager.h
index 5a6596099..70d9b6550 100644
--- a/src/core/hle/service/hid/resource_manager.h
+++ b/src/core/hle/service/hid/resource_manager.h
@@ -20,24 +20,23 @@ class KSharedMemory;
namespace Service::HID {
class AppletResource;
+class CaptureButton;
class Controller_Stubbed;
class ConsoleSixAxis;
+class DebugMouse;
class DebugPad;
+class Digitizer;
class Gesture;
+class HomeButton;
class Keyboard;
class Mouse;
class NPad;
class Palma;
class SevenSixAxis;
class SixAxis;
+class SleepButton;
class TouchScreen;
-
-using CaptureButton = Controller_Stubbed;
-using DebugMouse = Mouse;
-using Digitizer = Controller_Stubbed;
-using HomeButton = Controller_Stubbed;
-using SleepButton = Controller_Stubbed;
-using UniquePad = Controller_Stubbed;
+class UniquePad;
class ResourceManager {
@@ -46,7 +45,6 @@ public:
~ResourceManager();
void Initialize();
- void InitializeController(u64 aruid);
std::shared_ptr<AppletResource> GetAppletResource() const;
std::shared_ptr<CaptureButton> GetCaptureButton() const;
@@ -88,6 +86,10 @@ public:
private:
Result CreateAppletResourceImpl(u64 aruid);
+ void InitializeHidCommonSampler();
+ void InitializeTouchScreenSampler();
+ void InitializeConsoleSixAxisSampler();
+ void InitializeAHidSampler();
bool is_initialized{false};