From e445ef9d607d04dab185be55b1395007a40c3b81 Mon Sep 17 00:00:00 2001 From: Narr the Reg Date: Tue, 5 Dec 2023 18:39:18 -0600 Subject: service: hid: Introduce proper AppletResource emulation --- src/core/hle/service/hid/resource_manager.h | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'src/core/hle/service/hid/resource_manager.h') diff --git a/src/core/hle/service/hid/resource_manager.h b/src/core/hle/service/hid/resource_manager.h index 2b6a9b5e6..a78e2b729 100644 --- a/src/core/hle/service/hid/resource_manager.h +++ b/src/core/hle/service/hid/resource_manager.h @@ -6,11 +6,20 @@ #include "core/hle/service/kernel_helpers.h" #include "core/hle/service/service.h" +namespace Core { +class System; +} + namespace Core::Timing { struct EventType; } +namespace Kernel { +class KSharedMemory; +} + namespace Service::HID { +class AppletResource; class Controller_Stubbed; class ConsoleSixAxis; class DebugPad; @@ -38,6 +47,7 @@ public: void Initialize(); + std::shared_ptr GetAppletResource() const; std::shared_ptr GetCaptureButton() const; std::shared_ptr GetConsoleSixAxis() const; std::shared_ptr GetDebugMouse() const; @@ -54,6 +64,18 @@ public: std::shared_ptr GetTouchScreen() const; std::shared_ptr GetUniquePad() const; + Result CreateAppletResource(u64 aruid); + + Result RegisterAppletResourceUserId(u64 aruid, bool bool_value); + void UnregisterAppletResourceUserId(u64 aruid); + + Result GetSharedMemoryHandle(Kernel::KSharedMemory** out_handle, u64 aruid); + + void EnableInput(u64 aruid, bool is_enabled); + void EnableSixAxisSensor(u64 aruid, bool is_enabled); + void EnablePadInput(u64 aruid, bool is_enabled); + void EnableTouchScreen(u64 aruid, bool is_enabled); + void UpdateControllers(std::uintptr_t user_data, std::chrono::nanoseconds ns_late); void UpdateNpad(std::uintptr_t user_data, std::chrono::nanoseconds ns_late); void UpdateMouseKeyboard(std::uintptr_t user_data, std::chrono::nanoseconds ns_late); @@ -62,6 +84,9 @@ public: private: bool is_initialized{false}; + mutable std::mutex shared_mutex; + std::shared_ptr applet_resource = nullptr; + std::shared_ptr capture_button = nullptr; std::shared_ptr console_six_axis = nullptr; std::shared_ptr debug_mouse = nullptr; @@ -106,6 +131,8 @@ private: std::shared_ptr default_update_event; std::shared_ptr mouse_keyboard_update_event; std::shared_ptr motion_update_event; + + std::shared_ptr resource_manager; }; } // namespace Service::HID -- cgit v1.2.3