summaryrefslogtreecommitdiff
path: root/src/input_common/tas/tas_input.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/input_common/tas/tas_input.h')
-rw-r--r--src/input_common/tas/tas_input.h26
1 files changed, 20 insertions, 6 deletions
diff --git a/src/input_common/tas/tas_input.h b/src/input_common/tas/tas_input.h
index 8ee70bcaf..49ef10ff9 100644
--- a/src/input_common/tas/tas_input.h
+++ b/src/input_common/tas/tas_input.h
@@ -14,14 +14,14 @@
14 14
15namespace TasInput { 15namespace TasInput {
16 16
17constexpr int PLAYER_NUMBER = 8; 17constexpr size_t PLAYER_NUMBER = 8;
18 18
19using TasAnalog = std::pair<float, float>; 19using TasAnalog = std::pair<float, float>;
20 20
21enum class TasState { 21enum class TasState {
22 RUNNING, 22 Running,
23 RECORDING, 23 Recording,
24 STOPPED, 24 Stopped,
25}; 25};
26 26
27enum class TasButton : u32 { 27enum class TasButton : u32 {
@@ -114,8 +114,19 @@ public:
114 void LoadTasFiles(); 114 void LoadTasFiles();
115 void RecordInput(u32 buttons, const std::array<std::pair<float, float>, 2>& axes); 115 void RecordInput(u32 buttons, const std::array<std::pair<float, float>, 2>& axes);
116 void UpdateThread(); 116 void UpdateThread();
117 std::tuple<TasState, size_t, size_t> GetStatus();
118 117
118 void StartStop();
119 void Reset();
120 void Record();
121
122 /**
123 * Returns the current status values of TAS playback/recording
124 * @return Tuple of
125 * TasState indicating the current state out of Running, Recording or Stopped ;
126 * Current playback progress or amount of frames (so far) for Recording ;
127 * Total length of script file currently loaded or amount of frames (so far) for Recording
128 */
129 std::tuple<TasState, size_t, size_t> GetStatus() const;
119 InputCommon::ButtonMapping GetButtonMappingForDevice(const Common::ParamPackage& params) const; 130 InputCommon::ButtonMapping GetButtonMappingForDevice(const Common::ParamPackage& params) const;
120 InputCommon::AnalogMapping GetAnalogMappingForDevice(const Common::ParamPackage& params) const; 131 InputCommon::AnalogMapping GetAnalogMappingForDevice(const Common::ParamPackage& params) const;
121 [[nodiscard]] const TasData& GetTasState(std::size_t pad) const; 132 [[nodiscard]] const TasData& GetTasState(std::size_t pad) const;
@@ -137,9 +148,12 @@ private:
137 std::array<TasData, PLAYER_NUMBER> tas_data; 148 std::array<TasData, PLAYER_NUMBER> tas_data;
138 bool update_thread_running{true}; 149 bool update_thread_running{true};
139 bool refresh_tas_fle{false}; 150 bool refresh_tas_fle{false};
151 bool is_recording{false};
152 bool is_running{false};
153 bool needs_reset{false};
140 std::array<std::vector<TASCommand>, PLAYER_NUMBER> commands{}; 154 std::array<std::vector<TASCommand>, PLAYER_NUMBER> commands{};
141 std::vector<TASCommand> record_commands{}; 155 std::vector<TASCommand> record_commands{};
142 std::size_t current_command{0}; 156 size_t current_command{0};
143 TASCommand last_input{}; // only used for recording 157 TASCommand last_input{}; // only used for recording
144}; 158};
145} // namespace TasInput 159} // namespace TasInput