summaryrefslogtreecommitdiff
path: root/src/core/hid/emulated_controller.h
diff options
context:
space:
mode:
authorGravatar Lioncash2021-12-13 21:09:28 -0500
committerGravatar Lioncash2021-12-13 21:22:02 -0500
commite05d2a70b24e550d67fcdd24aae7094ad41745f8 (patch)
treeaf5116d02b99366344c261df03cae992b2e96ae5 /src/core/hid/emulated_controller.h
parentcommon/input: Remove unnecessary returns (diff)
downloadyuzu-e05d2a70b24e550d67fcdd24aae7094ad41745f8.tar.gz
yuzu-e05d2a70b24e550d67fcdd24aae7094ad41745f8.tar.xz
yuzu-e05d2a70b24e550d67fcdd24aae7094ad41745f8.zip
common/input: Avoid numerous large copies of CallbackStatus
CallbackStatus instances aren't the cheapest things to copy around (relative to everything else), given that they're currently 520 bytes in size and are currently copied numerous times when callbacks are invoked. Instead, we can pass the status by const reference to avoid all the copying.
Diffstat (limited to 'src/core/hid/emulated_controller.h')
-rw-r--r--src/core/hid/emulated_controller.h13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/core/hid/emulated_controller.h b/src/core/hid/emulated_controller.h
index 425b3e7c4..e42aafebc 100644
--- a/src/core/hid/emulated_controller.h
+++ b/src/core/hid/emulated_controller.h
@@ -328,35 +328,38 @@ private:
328 * @param callback A CallbackStatus containing the button status 328 * @param callback A CallbackStatus containing the button status
329 * @param index Button ID of the to be updated 329 * @param index Button ID of the to be updated
330 */ 330 */
331 void SetButton(Common::Input::CallbackStatus callback, std::size_t index, Common::UUID uuid); 331 void SetButton(const Common::Input::CallbackStatus& callback, std::size_t index,
332 Common::UUID uuid);
332 333
333 /** 334 /**
334 * Updates the analog stick status of the controller 335 * Updates the analog stick status of the controller
335 * @param callback A CallbackStatus containing the analog stick status 336 * @param callback A CallbackStatus containing the analog stick status
336 * @param index stick ID of the to be updated 337 * @param index stick ID of the to be updated
337 */ 338 */
338 void SetStick(Common::Input::CallbackStatus callback, std::size_t index, Common::UUID uuid); 339 void SetStick(const Common::Input::CallbackStatus& callback, std::size_t index,
340 Common::UUID uuid);
339 341
340 /** 342 /**
341 * Updates the trigger status of the controller 343 * Updates the trigger status of the controller
342 * @param callback A CallbackStatus containing the trigger status 344 * @param callback A CallbackStatus containing the trigger status
343 * @param index trigger ID of the to be updated 345 * @param index trigger ID of the to be updated
344 */ 346 */
345 void SetTrigger(Common::Input::CallbackStatus callback, std::size_t index, Common::UUID uuid); 347 void SetTrigger(const Common::Input::CallbackStatus& callback, std::size_t index,
348 Common::UUID uuid);
346 349
347 /** 350 /**
348 * Updates the motion status of the controller 351 * Updates the motion status of the controller
349 * @param callback A CallbackStatus containing gyro and accelerometer data 352 * @param callback A CallbackStatus containing gyro and accelerometer data
350 * @param index motion ID of the to be updated 353 * @param index motion ID of the to be updated
351 */ 354 */
352 void SetMotion(Common::Input::CallbackStatus callback, std::size_t index); 355 void SetMotion(const Common::Input::CallbackStatus& callback, std::size_t index);
353 356
354 /** 357 /**
355 * Updates the battery status of the controller 358 * Updates the battery status of the controller
356 * @param callback A CallbackStatus containing the battery status 359 * @param callback A CallbackStatus containing the battery status
357 * @param index Button ID of the to be updated 360 * @param index Button ID of the to be updated
358 */ 361 */
359 void SetBattery(Common::Input::CallbackStatus callback, std::size_t index); 362 void SetBattery(const Common::Input::CallbackStatus& callback, std::size_t index);
360 363
361 /** 364 /**
362 * Triggers a callback that something has changed on the controller status 365 * Triggers a callback that something has changed on the controller status