diff options
Diffstat (limited to 'src/hid_core/resource_manager.h')
| -rw-r--r-- | src/hid_core/resource_manager.h | 89 |
1 files changed, 53 insertions, 36 deletions
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; | |||
| 11 | } | 11 | } |
| 12 | 12 | ||
| 13 | namespace Core::HID { | 13 | namespace Core::HID { |
| 14 | struct FirmwareVersion; | ||
| 14 | struct VibrationDeviceHandle; | 15 | struct VibrationDeviceHandle; |
| 15 | struct VibrationValue; | 16 | struct VibrationValue; |
| 16 | struct VibrationDeviceInfo; | 17 | struct VibrationDeviceInfo; |
| @@ -21,8 +22,9 @@ struct EventType; | |||
| 21 | } | 22 | } |
| 22 | 23 | ||
| 23 | namespace Kernel { | 24 | namespace Kernel { |
| 25 | class KEvent; | ||
| 24 | class KSharedMemory; | 26 | class KSharedMemory; |
| 25 | } | 27 | } // namespace Kernel |
| 26 | 28 | ||
| 27 | namespace Service::HID { | 29 | namespace Service::HID { |
| 28 | class AppletResource; | 30 | class AppletResource; |
| @@ -33,6 +35,7 @@ class DebugMouse; | |||
| 33 | class DebugPad; | 35 | class DebugPad; |
| 34 | class Digitizer; | 36 | class Digitizer; |
| 35 | class Gesture; | 37 | class Gesture; |
| 38 | class HidFirmwareSettings; | ||
| 36 | class HomeButton; | 39 | class HomeButton; |
| 37 | class Keyboard; | 40 | class Keyboard; |
| 38 | class Mouse; | 41 | class Mouse; |
| @@ -42,6 +45,8 @@ class SevenSixAxis; | |||
| 42 | class SixAxis; | 45 | class SixAxis; |
| 43 | class SleepButton; | 46 | class SleepButton; |
| 44 | class TouchScreen; | 47 | class TouchScreen; |
| 48 | class TouchDriver; | ||
| 49 | class TouchResource; | ||
| 45 | class UniquePad; | 50 | class UniquePad; |
| 46 | class NpadVibrationBase; | 51 | class NpadVibrationBase; |
| 47 | class NpadN64VibrationDevice; | 52 | class NpadN64VibrationDevice; |
| @@ -52,7 +57,7 @@ struct HandheldConfig; | |||
| 52 | class ResourceManager { | 57 | class ResourceManager { |
| 53 | 58 | ||
| 54 | public: | 59 | public: |
| 55 | explicit ResourceManager(Core::System& system_); | 60 | explicit ResourceManager(Core::System& system_, std::shared_ptr<HidFirmwareSettings> settings); |
| 56 | ~ResourceManager(); | 61 | ~ResourceManager(); |
| 57 | 62 | ||
| 58 | void Initialize(); | 63 | void Initialize(); |
| @@ -102,6 +107,8 @@ public: | |||
| 102 | Result SendVibrationValue(u64 aruid, const Core::HID::VibrationDeviceHandle& handle, | 107 | Result SendVibrationValue(u64 aruid, const Core::HID::VibrationDeviceHandle& handle, |
| 103 | const Core::HID::VibrationValue& value); | 108 | const Core::HID::VibrationValue& value); |
| 104 | 109 | ||
| 110 | Result GetTouchScreenFirmwareVersion(Core::HID::FirmwareVersion& firmware) const; | ||
| 111 | |||
| 105 | void UpdateControllers(std::chrono::nanoseconds ns_late); | 112 | void UpdateControllers(std::chrono::nanoseconds ns_late); |
| 106 | void UpdateNpad(std::chrono::nanoseconds ns_late); | 113 | void UpdateNpad(std::chrono::nanoseconds ns_late); |
| 107 | void UpdateMouseKeyboard(std::chrono::nanoseconds ns_late); | 114 | void UpdateMouseKeyboard(std::chrono::nanoseconds ns_late); |
| @@ -109,6 +116,7 @@ public: | |||
| 109 | 116 | ||
| 110 | private: | 117 | private: |
| 111 | Result CreateAppletResourceImpl(u64 aruid); | 118 | Result CreateAppletResourceImpl(u64 aruid); |
| 119 | void InitializeHandheldConfig(); | ||
| 112 | void InitializeHidCommonSampler(); | 120 | void InitializeHidCommonSampler(); |
| 113 | void InitializeTouchScreenSampler(); | 121 | void InitializeTouchScreenSampler(); |
| 114 | void InitializeConsoleSixAxisSampler(); | 122 | void InitializeConsoleSixAxisSampler(); |
| @@ -117,37 +125,46 @@ private: | |||
| 117 | bool is_initialized{false}; | 125 | bool is_initialized{false}; |
| 118 | 126 | ||
| 119 | mutable std::recursive_mutex shared_mutex; | 127 | mutable std::recursive_mutex shared_mutex; |
| 120 | std::shared_ptr<AppletResource> applet_resource = nullptr; | 128 | std::shared_ptr<AppletResource> applet_resource{nullptr}; |
| 121 | 129 | ||
| 122 | std::shared_ptr<CaptureButton> capture_button = nullptr; | 130 | mutable std::mutex input_mutex; |
| 123 | std::shared_ptr<ConsoleSixAxis> console_six_axis = nullptr; | 131 | Kernel::KEvent* input_event{nullptr}; |
| 124 | std::shared_ptr<DebugMouse> debug_mouse = nullptr; | 132 | |
| 125 | std::shared_ptr<DebugPad> debug_pad = nullptr; | 133 | std::shared_ptr<HandheldConfig> handheld_config{nullptr}; |
| 126 | std::shared_ptr<Digitizer> digitizer = nullptr; | 134 | std::shared_ptr<HidFirmwareSettings> firmware_settings{nullptr}; |
| 127 | std::shared_ptr<Gesture> gesture = nullptr; | 135 | |
| 128 | std::shared_ptr<HomeButton> home_button = nullptr; | 136 | std::shared_ptr<CaptureButton> capture_button{nullptr}; |
| 129 | std::shared_ptr<Keyboard> keyboard = nullptr; | 137 | std::shared_ptr<ConsoleSixAxis> console_six_axis{nullptr}; |
| 130 | std::shared_ptr<Mouse> mouse = nullptr; | 138 | std::shared_ptr<DebugMouse> debug_mouse{nullptr}; |
| 131 | std::shared_ptr<NPad> npad = nullptr; | 139 | std::shared_ptr<DebugPad> debug_pad{nullptr}; |
| 132 | std::shared_ptr<Palma> palma = nullptr; | 140 | std::shared_ptr<Digitizer> digitizer{nullptr}; |
| 133 | std::shared_ptr<SevenSixAxis> seven_six_axis = nullptr; | 141 | std::shared_ptr<HomeButton> home_button{nullptr}; |
| 134 | std::shared_ptr<SixAxis> six_axis = nullptr; | 142 | std::shared_ptr<Keyboard> keyboard{nullptr}; |
| 135 | std::shared_ptr<SleepButton> sleep_button = nullptr; | 143 | std::shared_ptr<Mouse> mouse{nullptr}; |
| 136 | std::shared_ptr<TouchScreen> touch_screen = nullptr; | 144 | std::shared_ptr<NPad> npad{nullptr}; |
| 137 | std::shared_ptr<UniquePad> unique_pad = nullptr; | 145 | std::shared_ptr<Palma> palma{nullptr}; |
| 138 | 146 | std::shared_ptr<SevenSixAxis> seven_six_axis{nullptr}; | |
| 139 | std::shared_ptr<HandheldConfig> handheld_config = nullptr; | 147 | std::shared_ptr<SixAxis> six_axis{nullptr}; |
| 148 | std::shared_ptr<SleepButton> sleep_button{nullptr}; | ||
| 149 | std::shared_ptr<UniquePad> unique_pad{nullptr}; | ||
| 140 | 150 | ||
| 141 | // TODO: Create these resources | 151 | // TODO: Create these resources |
| 142 | // std::shared_ptr<AudioControl> audio_control = nullptr; | 152 | // std::shared_ptr<AudioControl> audio_control{nullptr}; |
| 143 | // std::shared_ptr<ButtonConfig> button_config = nullptr; | 153 | // std::shared_ptr<ButtonConfig> button_config{nullptr}; |
| 144 | // std::shared_ptr<Config> config = nullptr; | 154 | // std::shared_ptr<Config> config{nullptr}; |
| 145 | // std::shared_ptr<Connection> connection = nullptr; | 155 | // std::shared_ptr<Connection> connection{nullptr}; |
| 146 | // std::shared_ptr<CustomConfig> custom_config = nullptr; | 156 | // std::shared_ptr<CustomConfig> custom_config{nullptr}; |
| 147 | // std::shared_ptr<Digitizer> digitizer = nullptr; | 157 | // std::shared_ptr<Digitizer> digitizer{nullptr}; |
| 148 | // std::shared_ptr<Hdls> hdls = nullptr; | 158 | // std::shared_ptr<Hdls> hdls{nullptr}; |
| 149 | // std::shared_ptr<PlayReport> play_report = nullptr; | 159 | // std::shared_ptr<PlayReport> play_report{nullptr}; |
| 150 | // std::shared_ptr<Rail> rail = nullptr; | 160 | // std::shared_ptr<Rail> rail{nullptr}; |
| 161 | |||
| 162 | // Touch Resources | ||
| 163 | std::shared_ptr<Gesture> gesture{nullptr}; | ||
| 164 | std::shared_ptr<TouchScreen> touch_screen{nullptr}; | ||
| 165 | std::shared_ptr<TouchResource> touch_resource{nullptr}; | ||
| 166 | std::shared_ptr<TouchDriver> touch_driver{nullptr}; | ||
| 167 | std::shared_ptr<Core::Timing::EventType> touch_update_event{nullptr}; | ||
| 151 | 168 | ||
| 152 | Core::System& system; | 169 | Core::System& system; |
| 153 | KernelHelpers::ServiceContext service_context; | 170 | KernelHelpers::ServiceContext service_context; |
| @@ -162,12 +179,12 @@ public: | |||
| 162 | private: | 179 | private: |
| 163 | void GetSharedMemoryHandle(HLERequestContext& ctx); | 180 | void GetSharedMemoryHandle(HLERequestContext& ctx); |
| 164 | 181 | ||
| 165 | std::shared_ptr<Core::Timing::EventType> npad_update_event; | 182 | std::shared_ptr<Core::Timing::EventType> npad_update_event{nullptr}; |
| 166 | std::shared_ptr<Core::Timing::EventType> default_update_event; | 183 | std::shared_ptr<Core::Timing::EventType> default_update_event{nullptr}; |
| 167 | std::shared_ptr<Core::Timing::EventType> mouse_keyboard_update_event; | 184 | std::shared_ptr<Core::Timing::EventType> mouse_keyboard_update_event{nullptr}; |
| 168 | std::shared_ptr<Core::Timing::EventType> motion_update_event; | 185 | std::shared_ptr<Core::Timing::EventType> motion_update_event{nullptr}; |
| 169 | 186 | ||
| 170 | u64 aruid; | 187 | u64 aruid{}; |
| 171 | std::shared_ptr<ResourceManager> resource_manager; | 188 | std::shared_ptr<ResourceManager> resource_manager; |
| 172 | }; | 189 | }; |
| 173 | 190 | ||