diff options
| -rw-r--r-- | src/input_common/drivers/tas_input.cpp | 14 | ||||
| -rw-r--r-- | src/input_common/drivers/tas_input.h | 5 |
2 files changed, 14 insertions, 5 deletions
diff --git a/src/input_common/drivers/tas_input.cpp b/src/input_common/drivers/tas_input.cpp index 0e01fb0d9..1a38616b4 100644 --- a/src/input_common/drivers/tas_input.cpp +++ b/src/input_common/drivers/tas_input.cpp | |||
| @@ -15,7 +15,7 @@ | |||
| 15 | 15 | ||
| 16 | namespace InputCommon::TasInput { | 16 | namespace InputCommon::TasInput { |
| 17 | 17 | ||
| 18 | enum TasAxes : u8 { | 18 | enum class Tas::TasAxis : u8 { |
| 19 | StickX, | 19 | StickX, |
| 20 | StickY, | 20 | StickY, |
| 21 | SubstickX, | 21 | SubstickX, |
| @@ -205,10 +205,10 @@ void Tas::UpdateThread() { | |||
| 205 | const int button = static_cast<int>(i); | 205 | const int button = static_cast<int>(i); |
| 206 | SetButton(identifier, button, button_status); | 206 | SetButton(identifier, button, button_status); |
| 207 | } | 207 | } |
| 208 | SetAxis(identifier, TasAxes::StickX, command.l_axis.x); | 208 | SetTasAxis(identifier, TasAxis::StickX, command.l_axis.x); |
| 209 | SetAxis(identifier, TasAxes::StickY, command.l_axis.y); | 209 | SetTasAxis(identifier, TasAxis::StickY, command.l_axis.y); |
| 210 | SetAxis(identifier, TasAxes::SubstickX, command.r_axis.x); | 210 | SetTasAxis(identifier, TasAxis::SubstickX, command.r_axis.x); |
| 211 | SetAxis(identifier, TasAxes::SubstickY, command.r_axis.y); | 211 | SetTasAxis(identifier, TasAxis::SubstickY, command.r_axis.y); |
| 212 | } | 212 | } |
| 213 | } else { | 213 | } else { |
| 214 | is_running = Settings::values.tas_loop.GetValue(); | 214 | is_running = Settings::values.tas_loop.GetValue(); |
| @@ -267,6 +267,10 @@ std::string Tas::WriteCommandAxis(TasAnalog analog) const { | |||
| 267 | return fmt::format("{};{}", analog.x * 32767, analog.y * 32767); | 267 | return fmt::format("{};{}", analog.x * 32767, analog.y * 32767); |
| 268 | } | 268 | } |
| 269 | 269 | ||
| 270 | void Tas::SetTasAxis(const PadIdentifier& identifier, TasAxis axis, f32 value) { | ||
| 271 | SetAxis(identifier, static_cast<int>(axis), value); | ||
| 272 | } | ||
| 273 | |||
| 270 | void Tas::StartStop() { | 274 | void Tas::StartStop() { |
| 271 | if (!Settings::values.tas_enable) { | 275 | if (!Settings::values.tas_enable) { |
| 272 | return; | 276 | return; |
diff --git a/src/input_common/drivers/tas_input.h b/src/input_common/drivers/tas_input.h index c95a130fc..c44c39da9 100644 --- a/src/input_common/drivers/tas_input.h +++ b/src/input_common/drivers/tas_input.h | |||
| @@ -128,6 +128,8 @@ public: | |||
| 128 | std::tuple<TasState, size_t, size_t> GetStatus() const; | 128 | std::tuple<TasState, size_t, size_t> GetStatus() const; |
| 129 | 129 | ||
| 130 | private: | 130 | private: |
| 131 | enum class TasAxis : u8; | ||
| 132 | |||
| 131 | struct TASCommand { | 133 | struct TASCommand { |
| 132 | u64 buttons{}; | 134 | u64 buttons{}; |
| 133 | TasAnalog l_axis{}; | 135 | TasAnalog l_axis{}; |
| @@ -182,6 +184,9 @@ private: | |||
| 182 | */ | 184 | */ |
| 183 | std::string WriteCommandAxis(TasAnalog data) const; | 185 | std::string WriteCommandAxis(TasAnalog data) const; |
| 184 | 186 | ||
| 187 | /// Sets an axis for a particular pad to the given value. | ||
| 188 | void SetTasAxis(const PadIdentifier& identifier, TasAxis axis, f32 value); | ||
| 189 | |||
| 185 | size_t script_length{0}; | 190 | size_t script_length{0}; |
| 186 | bool is_recording{false}; | 191 | bool is_recording{false}; |
| 187 | bool is_running{false}; | 192 | bool is_running{false}; |