summaryrefslogtreecommitdiff
path: root/src/hid_core/resource_manager.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/hid_core/resource_manager.h')
-rw-r--r--src/hid_core/resource_manager.h89
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
13namespace Core::HID { 13namespace Core::HID {
14struct FirmwareVersion;
14struct VibrationDeviceHandle; 15struct VibrationDeviceHandle;
15struct VibrationValue; 16struct VibrationValue;
16struct VibrationDeviceInfo; 17struct VibrationDeviceInfo;
@@ -21,8 +22,9 @@ struct EventType;
21} 22}
22 23
23namespace Kernel { 24namespace Kernel {
25class KEvent;
24class KSharedMemory; 26class KSharedMemory;
25} 27} // namespace Kernel
26 28
27namespace Service::HID { 29namespace Service::HID {
28class AppletResource; 30class AppletResource;
@@ -33,6 +35,7 @@ class DebugMouse;
33class DebugPad; 35class DebugPad;
34class Digitizer; 36class Digitizer;
35class Gesture; 37class Gesture;
38class HidFirmwareSettings;
36class HomeButton; 39class HomeButton;
37class Keyboard; 40class Keyboard;
38class Mouse; 41class Mouse;
@@ -42,6 +45,8 @@ class SevenSixAxis;
42class SixAxis; 45class SixAxis;
43class SleepButton; 46class SleepButton;
44class TouchScreen; 47class TouchScreen;
48class TouchDriver;
49class TouchResource;
45class UniquePad; 50class UniquePad;
46class NpadVibrationBase; 51class NpadVibrationBase;
47class NpadN64VibrationDevice; 52class NpadN64VibrationDevice;
@@ -52,7 +57,7 @@ struct HandheldConfig;
52class ResourceManager { 57class ResourceManager {
53 58
54public: 59public:
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
110private: 117private:
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:
162private: 179private:
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