summaryrefslogtreecommitdiffstats
path: root/src/input_common/drivers
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2021-12-13 16:41:30 +0100
committerLioncash <mathew1800@gmail.com>2021-12-13 16:41:32 +0100
commitc126b0718ca4ffff463c4462ca38f61019df4acf (patch)
tree5c1d3f7839643b3e43efab520c683bb5a9ea4815 /src/input_common/drivers
parentMerge pull request #7574 from v1993/patch-1 (diff)
downloadyuzu-c126b0718ca4ffff463c4462ca38f61019df4acf.tar
yuzu-c126b0718ca4ffff463c4462ca38f61019df4acf.tar.gz
yuzu-c126b0718ca4ffff463c4462ca38f61019df4acf.tar.bz2
yuzu-c126b0718ca4ffff463c4462ca38f61019df4acf.tar.lz
yuzu-c126b0718ca4ffff463c4462ca38f61019df4acf.tar.xz
yuzu-c126b0718ca4ffff463c4462ca38f61019df4acf.tar.zst
yuzu-c126b0718ca4ffff463c4462ca38f61019df4acf.zip
Diffstat (limited to 'src/input_common/drivers')
-rw-r--r--src/input_common/drivers/tas_input.cpp14
-rw-r--r--src/input_common/drivers/tas_input.h5
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 @@
namespace InputCommon::TasInput {
-enum TasAxes : u8 {
+enum class Tas::TasAxis : u8 {
StickX,
StickY,
SubstickX,
@@ -205,10 +205,10 @@ void Tas::UpdateThread() {
const int button = static_cast<int>(i);
SetButton(identifier, button, button_status);
}
- SetAxis(identifier, TasAxes::StickX, command.l_axis.x);
- SetAxis(identifier, TasAxes::StickY, command.l_axis.y);
- SetAxis(identifier, TasAxes::SubstickX, command.r_axis.x);
- SetAxis(identifier, TasAxes::SubstickY, command.r_axis.y);
+ SetTasAxis(identifier, TasAxis::StickX, command.l_axis.x);
+ SetTasAxis(identifier, TasAxis::StickY, command.l_axis.y);
+ SetTasAxis(identifier, TasAxis::SubstickX, command.r_axis.x);
+ SetTasAxis(identifier, TasAxis::SubstickY, command.r_axis.y);
}
} else {
is_running = Settings::values.tas_loop.GetValue();
@@ -267,6 +267,10 @@ std::string Tas::WriteCommandAxis(TasAnalog analog) const {
return fmt::format("{};{}", analog.x * 32767, analog.y * 32767);
}
+void Tas::SetTasAxis(const PadIdentifier& identifier, TasAxis axis, f32 value) {
+ SetAxis(identifier, static_cast<int>(axis), value);
+}
+
void Tas::StartStop() {
if (!Settings::values.tas_enable) {
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:
std::tuple<TasState, size_t, size_t> GetStatus() const;
private:
+ enum class TasAxis : u8;
+
struct TASCommand {
u64 buttons{};
TasAnalog l_axis{};
@@ -182,6 +184,9 @@ private:
*/
std::string WriteCommandAxis(TasAnalog data) const;
+ /// Sets an axis for a particular pad to the given value.
+ void SetTasAxis(const PadIdentifier& identifier, TasAxis axis, f32 value);
+
size_t script_length{0};
bool is_recording{false};
bool is_running{false};