From 575183d6dcd8da9b10ee41e47be4b7d4f8631783 Mon Sep 17 00:00:00 2001 From: Narr the Reg Date: Tue, 16 Jan 2024 12:17:18 -0600 Subject: service: hid: Fully implement touch resource --- src/hid_core/resource_manager.h | 89 ++++++++++++++++++++++++----------------- 1 file changed, 53 insertions(+), 36 deletions(-) (limited to 'src/hid_core/resource_manager.h') diff --git a/src/hid_core/resource_manager.h b/src/hid_core/resource_manager.h index 128e00125..0bfe09511 100644 --- a/src/hid_core/resource_manager.h +++ b/src/hid_core/resource_manager.h @@ -11,6 +11,7 @@ class System; } namespace Core::HID { +struct FirmwareVersion; struct VibrationDeviceHandle; struct VibrationValue; struct VibrationDeviceInfo; @@ -21,8 +22,9 @@ struct EventType; } namespace Kernel { +class KEvent; class KSharedMemory; -} +} // namespace Kernel namespace Service::HID { class AppletResource; @@ -33,6 +35,7 @@ class DebugMouse; class DebugPad; class Digitizer; class Gesture; +class HidFirmwareSettings; class HomeButton; class Keyboard; class Mouse; @@ -42,6 +45,8 @@ class SevenSixAxis; class SixAxis; class SleepButton; class TouchScreen; +class TouchDriver; +class TouchResource; class UniquePad; class NpadVibrationBase; class NpadN64VibrationDevice; @@ -52,7 +57,7 @@ struct HandheldConfig; class ResourceManager { public: - explicit ResourceManager(Core::System& system_); + explicit ResourceManager(Core::System& system_, std::shared_ptr settings); ~ResourceManager(); void Initialize(); @@ -102,6 +107,8 @@ public: Result SendVibrationValue(u64 aruid, const Core::HID::VibrationDeviceHandle& handle, const Core::HID::VibrationValue& value); + Result GetTouchScreenFirmwareVersion(Core::HID::FirmwareVersion& firmware) const; + void UpdateControllers(std::chrono::nanoseconds ns_late); void UpdateNpad(std::chrono::nanoseconds ns_late); void UpdateMouseKeyboard(std::chrono::nanoseconds ns_late); @@ -109,6 +116,7 @@ public: private: Result CreateAppletResourceImpl(u64 aruid); + void InitializeHandheldConfig(); void InitializeHidCommonSampler(); void InitializeTouchScreenSampler(); void InitializeConsoleSixAxisSampler(); @@ -117,37 +125,46 @@ private: bool is_initialized{false}; mutable std::recursive_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; - std::shared_ptr debug_pad = nullptr; - std::shared_ptr digitizer = nullptr; - std::shared_ptr gesture = nullptr; - std::shared_ptr home_button = nullptr; - std::shared_ptr keyboard = nullptr; - std::shared_ptr mouse = nullptr; - std::shared_ptr npad = nullptr; - std::shared_ptr palma = nullptr; - std::shared_ptr seven_six_axis = nullptr; - std::shared_ptr six_axis = nullptr; - std::shared_ptr sleep_button = nullptr; - std::shared_ptr touch_screen = nullptr; - std::shared_ptr unique_pad = nullptr; - - std::shared_ptr handheld_config = nullptr; + std::shared_ptr applet_resource{nullptr}; + + mutable std::mutex input_mutex; + Kernel::KEvent* input_event{nullptr}; + + std::shared_ptr handheld_config{nullptr}; + std::shared_ptr firmware_settings{nullptr}; + + std::shared_ptr capture_button{nullptr}; + std::shared_ptr console_six_axis{nullptr}; + std::shared_ptr debug_mouse{nullptr}; + std::shared_ptr debug_pad{nullptr}; + std::shared_ptr digitizer{nullptr}; + std::shared_ptr home_button{nullptr}; + std::shared_ptr keyboard{nullptr}; + std::shared_ptr mouse{nullptr}; + std::shared_ptr npad{nullptr}; + std::shared_ptr palma{nullptr}; + std::shared_ptr seven_six_axis{nullptr}; + std::shared_ptr six_axis{nullptr}; + std::shared_ptr sleep_button{nullptr}; + std::shared_ptr unique_pad{nullptr}; // TODO: Create these resources - // std::shared_ptr audio_control = nullptr; - // std::shared_ptr button_config = nullptr; - // std::shared_ptr config = nullptr; - // std::shared_ptr connection = nullptr; - // std::shared_ptr custom_config = nullptr; - // std::shared_ptr digitizer = nullptr; - // std::shared_ptr hdls = nullptr; - // std::shared_ptr play_report = nullptr; - // std::shared_ptr rail = nullptr; + // std::shared_ptr audio_control{nullptr}; + // std::shared_ptr button_config{nullptr}; + // std::shared_ptr config{nullptr}; + // std::shared_ptr connection{nullptr}; + // std::shared_ptr custom_config{nullptr}; + // std::shared_ptr digitizer{nullptr}; + // std::shared_ptr hdls{nullptr}; + // std::shared_ptr play_report{nullptr}; + // std::shared_ptr rail{nullptr}; + + // Touch Resources + std::shared_ptr gesture{nullptr}; + std::shared_ptr touch_screen{nullptr}; + std::shared_ptr touch_resource{nullptr}; + std::shared_ptr touch_driver{nullptr}; + std::shared_ptr touch_update_event{nullptr}; Core::System& system; KernelHelpers::ServiceContext service_context; @@ -162,12 +179,12 @@ public: private: void GetSharedMemoryHandle(HLERequestContext& ctx); - std::shared_ptr npad_update_event; - std::shared_ptr default_update_event; - std::shared_ptr mouse_keyboard_update_event; - std::shared_ptr motion_update_event; + std::shared_ptr npad_update_event{nullptr}; + std::shared_ptr default_update_event{nullptr}; + std::shared_ptr mouse_keyboard_update_event{nullptr}; + std::shared_ptr motion_update_event{nullptr}; - u64 aruid; + u64 aruid{}; std::shared_ptr resource_manager; }; -- cgit v1.2.3