diff options
Diffstat (limited to 'src/core/hid/input_converter.h')
| -rw-r--r-- | src/core/hid/input_converter.h | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/src/core/hid/input_converter.h b/src/core/hid/input_converter.h new file mode 100644 index 000000000..3cc32e26a --- /dev/null +++ b/src/core/hid/input_converter.h | |||
| @@ -0,0 +1,77 @@ | |||
| 1 | // Copyright 2021 yuzu Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included | ||
| 4 | |||
| 5 | #pragma once | ||
| 6 | |||
| 7 | namespace Input { | ||
| 8 | struct CallbackStatus; | ||
| 9 | }; | ||
| 10 | |||
| 11 | namespace Core::HID { | ||
| 12 | |||
| 13 | /** | ||
| 14 | * Converts raw input data into a valid battery status. | ||
| 15 | * | ||
| 16 | * @param Supported callbacks: Analog, Battery, Trigger. | ||
| 17 | * @return A valid BatteryStatus object. | ||
| 18 | */ | ||
| 19 | Input::BatteryStatus TransformToBattery(const Input::CallbackStatus& callback); | ||
| 20 | |||
| 21 | /** | ||
| 22 | * Converts raw input data into a valid button status. Applies invert properties to the output. | ||
| 23 | * | ||
| 24 | * @param Supported callbacks: Analog, Button, Trigger. | ||
| 25 | * @return A valid TouchStatus object. | ||
| 26 | */ | ||
| 27 | Input::ButtonStatus TransformToButton(const Input::CallbackStatus& callback); | ||
| 28 | |||
| 29 | /** | ||
| 30 | * Converts raw input data into a valid motion status. | ||
| 31 | * | ||
| 32 | * @param Supported callbacks: Motion. | ||
| 33 | * @return A valid TouchStatus object. | ||
| 34 | */ | ||
| 35 | Input::MotionStatus TransformToMotion(const Input::CallbackStatus& callback); | ||
| 36 | |||
| 37 | /** | ||
| 38 | * Converts raw input data into a valid stick status. Applies offset, deadzone, range and invert | ||
| 39 | * properties to the output. | ||
| 40 | * | ||
| 41 | * @param Supported callbacks: Stick. | ||
| 42 | * @return A valid StickStatus object. | ||
| 43 | */ | ||
| 44 | Input::StickStatus TransformToStick(const Input::CallbackStatus& callback); | ||
| 45 | |||
| 46 | /** | ||
| 47 | * Converts raw input data into a valid touch status. | ||
| 48 | * | ||
| 49 | * @param Supported callbacks: Touch. | ||
| 50 | * @return A valid TouchStatus object. | ||
| 51 | */ | ||
| 52 | Input::TouchStatus TransformToTouch(const Input::CallbackStatus& callback); | ||
| 53 | |||
| 54 | /** | ||
| 55 | * Converts raw input data into a valid trigger status. Applies offset, deadzone, range and | ||
| 56 | * invert properties to the output. Button status uses the threshold property if necessary. | ||
| 57 | * | ||
| 58 | * @param Supported callbacks: Analog, Button, Trigger. | ||
| 59 | * @return A valid TriggerStatus object. | ||
| 60 | */ | ||
| 61 | Input::TriggerStatus TransformToTrigger(const Input::CallbackStatus& callback); | ||
| 62 | |||
| 63 | /** | ||
| 64 | * Converts raw analog data into a valid analog value | ||
| 65 | * @param An analog object containing raw data and properties, bool that determines if the value | ||
| 66 | * needs to be clamped between -1.0f and 1.0f. | ||
| 67 | */ | ||
| 68 | void SanitizeAnalog(Input::AnalogStatus& analog, bool clamp_value); | ||
| 69 | |||
| 70 | /** | ||
| 71 | * Converts raw stick data into a valid stick value | ||
| 72 | * @param Two analog objects containing raw data and properties, bool that determines if the value | ||
| 73 | * needs to be clamped into the unit circle. | ||
| 74 | */ | ||
| 75 | void SanitizeStick(Input::AnalogStatus& analog_x, Input::AnalogStatus& analog_y, bool clamp_value); | ||
| 76 | |||
| 77 | } // namespace Core::HID | ||