diff options
Diffstat (limited to 'src/core/hid/emulated_controller.h')
| -rw-r--r-- | src/core/hid/emulated_controller.h | 58 |
1 files changed, 30 insertions, 28 deletions
diff --git a/src/core/hid/emulated_controller.h b/src/core/hid/emulated_controller.h index 2c5d51bc8..5887e3e38 100644 --- a/src/core/hid/emulated_controller.h +++ b/src/core/hid/emulated_controller.h | |||
| @@ -132,8 +132,8 @@ struct ControllerUpdateCallback { | |||
| 132 | class EmulatedController { | 132 | class EmulatedController { |
| 133 | public: | 133 | public: |
| 134 | /** | 134 | /** |
| 135 | * Contains all input data related to this controller. Like buttons, joysticks, motion. | 135 | * Contains all input data (buttons, joysticks, vibration, and motion) within this controller. |
| 136 | * @param Npad id type for this specific controller | 136 | * @param npad_id_type npad id type for this specific controller |
| 137 | */ | 137 | */ |
| 138 | explicit EmulatedController(NpadIdType npad_id_type_); | 138 | explicit EmulatedController(NpadIdType npad_id_type_); |
| 139 | ~EmulatedController(); | 139 | ~EmulatedController(); |
| @@ -155,7 +155,7 @@ public: | |||
| 155 | 155 | ||
| 156 | /** | 156 | /** |
| 157 | * Gets the NpadStyleIndex for this controller | 157 | * Gets the NpadStyleIndex for this controller |
| 158 | * @param If true tmp_npad_type will be returned | 158 | * @param get_temporary_value If true tmp_npad_type will be returned |
| 159 | * @return NpadStyleIndex set on the controller | 159 | * @return NpadStyleIndex set on the controller |
| 160 | */ | 160 | */ |
| 161 | NpadStyleIndex GetNpadStyleIndex(bool get_temporary_value = false) const; | 161 | NpadStyleIndex GetNpadStyleIndex(bool get_temporary_value = false) const; |
| @@ -168,7 +168,7 @@ public: | |||
| 168 | 168 | ||
| 169 | /** | 169 | /** |
| 170 | * Is the emulated connected | 170 | * Is the emulated connected |
| 171 | * @param If true tmp_is_connected will be returned | 171 | * @param get_temporary_value If true tmp_is_connected will be returned |
| 172 | * @return true if the controller has the connected status | 172 | * @return true if the controller has the connected status |
| 173 | */ | 173 | */ |
| 174 | bool IsConnected(bool get_temporary_value = false) const; | 174 | bool IsConnected(bool get_temporary_value = false) const; |
| @@ -179,14 +179,16 @@ public: | |||
| 179 | /// Removes all callbacks created from input devices | 179 | /// Removes all callbacks created from input devices |
| 180 | void UnloadInput(); | 180 | void UnloadInput(); |
| 181 | 181 | ||
| 182 | /// Sets the emulated console into configuring mode. Locking all HID service events from being | 182 | /** |
| 183 | /// moddified | 183 | * Sets the emulated controller into configuring mode |
| 184 | * This prevents the modification of the HID state of the emulated controller by input commands | ||
| 185 | */ | ||
| 184 | void EnableConfiguration(); | 186 | void EnableConfiguration(); |
| 185 | 187 | ||
| 186 | /// Returns the emulated console to the normal behaivour | 188 | /// Returns the emulated controller into normal mode, allowing the modification of the HID state |
| 187 | void DisableConfiguration(); | 189 | void DisableConfiguration(); |
| 188 | 190 | ||
| 189 | /// Returns true if the emulated device is on configuring mode | 191 | /// Returns true if the emulated controller is in configuring mode |
| 190 | bool IsConfiguring() const; | 192 | bool IsConfiguring() const; |
| 191 | 193 | ||
| 192 | /// Reload all input devices | 194 | /// Reload all input devices |
| @@ -215,19 +217,19 @@ public: | |||
| 215 | 217 | ||
| 216 | /** | 218 | /** |
| 217 | * Updates the current mapped button device | 219 | * Updates the current mapped button device |
| 218 | * @param ParamPackage with controller data to be mapped | 220 | * @param param ParamPackage with controller data to be mapped |
| 219 | */ | 221 | */ |
| 220 | void SetButtonParam(std::size_t index, Common::ParamPackage param); | 222 | void SetButtonParam(std::size_t index, Common::ParamPackage param); |
| 221 | 223 | ||
| 222 | /** | 224 | /** |
| 223 | * Updates the current mapped stick device | 225 | * Updates the current mapped stick device |
| 224 | * @param ParamPackage with controller data to be mapped | 226 | * @param param ParamPackage with controller data to be mapped |
| 225 | */ | 227 | */ |
| 226 | void SetStickParam(std::size_t index, Common::ParamPackage param); | 228 | void SetStickParam(std::size_t index, Common::ParamPackage param); |
| 227 | 229 | ||
| 228 | /** | 230 | /** |
| 229 | * Updates the current mapped motion device | 231 | * Updates the current mapped motion device |
| 230 | * @param ParamPackage with controller data to be mapped | 232 | * @param param ParamPackage with controller data to be mapped |
| 231 | */ | 233 | */ |
| 232 | void SetMotionParam(std::size_t index, Common::ParamPackage param); | 234 | void SetMotionParam(std::size_t index, Common::ParamPackage param); |
| 233 | 235 | ||
| @@ -270,13 +272,13 @@ public: | |||
| 270 | /// Returns the latest battery status from the controller | 272 | /// Returns the latest battery status from the controller |
| 271 | BatteryLevelState GetBattery() const; | 273 | BatteryLevelState GetBattery() const; |
| 272 | 274 | ||
| 273 | /* | 275 | /** |
| 274 | * Sends a specific vibration to the output device | 276 | * Sends a specific vibration to the output device |
| 275 | * @return returns true if vibration had no errors | 277 | * @return returns true if vibration had no errors |
| 276 | */ | 278 | */ |
| 277 | bool SetVibration(std::size_t device_index, VibrationValue vibration); | 279 | bool SetVibration(std::size_t device_index, VibrationValue vibration); |
| 278 | 280 | ||
| 279 | /* | 281 | /** |
| 280 | * Sends a small vibration to the output device | 282 | * Sends a small vibration to the output device |
| 281 | * @return returns true if SetVibration was successfull | 283 | * @return returns true if SetVibration was successfull |
| 282 | */ | 284 | */ |
| @@ -290,14 +292,14 @@ public: | |||
| 290 | 292 | ||
| 291 | /** | 293 | /** |
| 292 | * Adds a callback to the list of events | 294 | * Adds a callback to the list of events |
| 293 | * @param ConsoleUpdateCallback that will be triggered | 295 | * @param update_callback A ConsoleUpdateCallback that will be triggered |
| 294 | * @return an unique key corresponding to the callback index in the list | 296 | * @return an unique key corresponding to the callback index in the list |
| 295 | */ | 297 | */ |
| 296 | int SetCallback(ControllerUpdateCallback update_callback); | 298 | int SetCallback(ControllerUpdateCallback update_callback); |
| 297 | 299 | ||
| 298 | /** | 300 | /** |
| 299 | * Removes a callback from the list stopping any future events to this object | 301 | * Removes a callback from the list stopping any future events to this object |
| 300 | * @param Key corresponding to the callback index in the list | 302 | * @param key Key corresponding to the callback index in the list |
| 301 | */ | 303 | */ |
| 302 | void DeleteCallback(int key); | 304 | void DeleteCallback(int key); |
| 303 | 305 | ||
| @@ -310,43 +312,43 @@ private: | |||
| 310 | 312 | ||
| 311 | /** | 313 | /** |
| 312 | * Updates the button status of the controller | 314 | * Updates the button status of the controller |
| 313 | * @param callback: A CallbackStatus containing the button status | 315 | * @param callback A CallbackStatus containing the button status |
| 314 | * @param index: Button ID of the to be updated | 316 | * @param index Button ID of the to be updated |
| 315 | */ | 317 | */ |
| 316 | void SetButton(Common::Input::CallbackStatus callback, std::size_t index, Common::UUID uuid); | 318 | void SetButton(Common::Input::CallbackStatus callback, std::size_t index, Common::UUID uuid); |
| 317 | 319 | ||
| 318 | /** | 320 | /** |
| 319 | * Updates the analog stick status of the controller | 321 | * Updates the analog stick status of the controller |
| 320 | * @param callback: A CallbackStatus containing the analog stick status | 322 | * @param callback A CallbackStatus containing the analog stick status |
| 321 | * @param index: stick ID of the to be updated | 323 | * @param index stick ID of the to be updated |
| 322 | */ | 324 | */ |
| 323 | void SetStick(Common::Input::CallbackStatus callback, std::size_t index, Common::UUID uuid); | 325 | void SetStick(Common::Input::CallbackStatus callback, std::size_t index, Common::UUID uuid); |
| 324 | 326 | ||
| 325 | /** | 327 | /** |
| 326 | * Updates the trigger status of the controller | 328 | * Updates the trigger status of the controller |
| 327 | * @param callback: A CallbackStatus containing the trigger status | 329 | * @param callback A CallbackStatus containing the trigger status |
| 328 | * @param index: trigger ID of the to be updated | 330 | * @param index trigger ID of the to be updated |
| 329 | */ | 331 | */ |
| 330 | void SetTrigger(Common::Input::CallbackStatus callback, std::size_t index, Common::UUID uuid); | 332 | void SetTrigger(Common::Input::CallbackStatus callback, std::size_t index, Common::UUID uuid); |
| 331 | 333 | ||
| 332 | /** | 334 | /** |
| 333 | * Updates the motion status of the controller | 335 | * Updates the motion status of the controller |
| 334 | * @param callback: A CallbackStatus containing gyro and accelerometer data | 336 | * @param callback A CallbackStatus containing gyro and accelerometer data |
| 335 | * @param index: motion ID of the to be updated | 337 | * @param index motion ID of the to be updated |
| 336 | */ | 338 | */ |
| 337 | void SetMotion(Common::Input::CallbackStatus callback, std::size_t index); | 339 | void SetMotion(Common::Input::CallbackStatus callback, std::size_t index); |
| 338 | 340 | ||
| 339 | /** | 341 | /** |
| 340 | * Updates the battery status of the controller | 342 | * Updates the battery status of the controller |
| 341 | * @param callback: A CallbackStatus containing the battery status | 343 | * @param callback A CallbackStatus containing the battery status |
| 342 | * @param index: Button ID of the to be updated | 344 | * @param index Button ID of the to be updated |
| 343 | */ | 345 | */ |
| 344 | void SetBattery(Common::Input::CallbackStatus callback, std::size_t index); | 346 | void SetBattery(Common::Input::CallbackStatus callback, std::size_t index); |
| 345 | 347 | ||
| 346 | /** | 348 | /** |
| 347 | * Triggers a callback that something has changed on the controller status | 349 | * Triggers a callback that something has changed on the controller status |
| 348 | * @param type: Input type of the event to trigger | 350 | * @param type Input type of the event to trigger |
| 349 | * @param is_service_update: indicates if this event should be sended to only services | 351 | * @param is_service_update indicates if this event should only be sent to HID services |
| 350 | */ | 352 | */ |
| 351 | void TriggerOnChange(ControllerTriggerType type, bool is_service_update); | 353 | void TriggerOnChange(ControllerTriggerType type, bool is_service_update); |
| 352 | 354 | ||
| @@ -357,7 +359,7 @@ private: | |||
| 357 | f32 motion_sensitivity{0.01f}; | 359 | f32 motion_sensitivity{0.01f}; |
| 358 | bool force_update_motion{false}; | 360 | bool force_update_motion{false}; |
| 359 | 361 | ||
| 360 | // Temporary values to avoid doing changes while the controller is on configuration mode | 362 | // Temporary values to avoid doing changes while the controller is in configuring mode |
| 361 | NpadStyleIndex tmp_npad_type{NpadStyleIndex::None}; | 363 | NpadStyleIndex tmp_npad_type{NpadStyleIndex::None}; |
| 362 | bool tmp_is_connected{false}; | 364 | bool tmp_is_connected{false}; |
| 363 | 365 | ||