summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/input_common/drivers/tas_input.cpp12
-rw-r--r--src/input_common/drivers/tas_input.h2
-rw-r--r--src/yuzu/main.cpp27
-rw-r--r--src/yuzu/main.h4
4 files changed, 38 insertions, 7 deletions
diff --git a/src/input_common/drivers/tas_input.cpp b/src/input_common/drivers/tas_input.cpp
index f3ade90da..f3cb14c56 100644
--- a/src/input_common/drivers/tas_input.cpp
+++ b/src/input_common/drivers/tas_input.cpp
@@ -156,10 +156,12 @@ void Tas::RecordInput(u64 buttons, TasAnalog left_axis, TasAnalog right_axis) {
156 }; 156 };
157} 157}
158 158
159std::tuple<TasState, size_t, size_t> Tas::GetStatus() const { 159std::tuple<TasState, size_t, std::array<size_t, PLAYER_NUMBER>> Tas::GetStatus() const {
160 TasState state; 160 TasState state;
161 std::array<size_t, PLAYER_NUMBER> lengths{0};
161 if (is_recording) { 162 if (is_recording) {
162 return {TasState::Recording, 0, record_commands.size()}; 163 lengths[0] = record_commands.size();
164 return {TasState::Recording, record_commands.size(), lengths};
163 } 165 }
164 166
165 if (is_running) { 167 if (is_running) {
@@ -168,7 +170,11 @@ std::tuple<TasState, size_t, size_t> Tas::GetStatus() const {
168 state = TasState::Stopped; 170 state = TasState::Stopped;
169 } 171 }
170 172
171 return {state, current_command, script_length}; 173 for (size_t i = 0; i < PLAYER_NUMBER; i++) {
174 lengths[i] = commands[i].size();
175 }
176
177 return {state, current_command, lengths};
172} 178}
173 179
174void Tas::UpdateThread() { 180void Tas::UpdateThread() {
diff --git a/src/input_common/drivers/tas_input.h b/src/input_common/drivers/tas_input.h
index 38a27a230..5be66d142 100644
--- a/src/input_common/drivers/tas_input.h
+++ b/src/input_common/drivers/tas_input.h
@@ -124,7 +124,7 @@ public:
124 * Current playback progress ; 124 * Current playback progress ;
125 * Total length of script file currently loaded or being recorded 125 * Total length of script file currently loaded or being recorded
126 */ 126 */
127 std::tuple<TasState, size_t, size_t> GetStatus() const; 127 std::tuple<TasState, size_t, std::array<size_t, PLAYER_NUMBER>> GetStatus() const;
128 128
129private: 129private:
130 enum class TasAxis : u8; 130 enum class TasAxis : u8;
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp
index c55f81c2f..4f1d5e79e 100644
--- a/src/yuzu/main.cpp
+++ b/src/yuzu/main.cpp
@@ -3726,15 +3726,36 @@ void GMainWindow::UpdateWindowTitle(std::string_view title_name, std::string_vie
3726 } 3726 }
3727} 3727}
3728 3728
3729std::string GMainWindow::CreateTASFramesString(
3730 std::array<size_t, InputCommon::TasInput::PLAYER_NUMBER> frames) const {
3731 std::string string = "";
3732 size_t maxPlayerIndex = 0;
3733 for (size_t i = 0; i < frames.size(); i++) {
3734 if (frames[i] != 0) {
3735 if (maxPlayerIndex != 0)
3736 string += ", ";
3737 while (maxPlayerIndex++ != i)
3738 string += "0, ";
3739 string += std::to_string(frames[i]);
3740 }
3741 }
3742 return string;
3743}
3744
3729QString GMainWindow::GetTasStateDescription() const { 3745QString GMainWindow::GetTasStateDescription() const {
3730 auto [tas_status, current_tas_frame, total_tas_frames] = input_subsystem->GetTas()->GetStatus(); 3746 auto [tas_status, current_tas_frame, total_tas_frames] = input_subsystem->GetTas()->GetStatus();
3747 std::string tas_frames_string = CreateTASFramesString(total_tas_frames);
3731 switch (tas_status) { 3748 switch (tas_status) {
3732 case InputCommon::TasInput::TasState::Running: 3749 case InputCommon::TasInput::TasState::Running:
3733 return tr("TAS state: Running %1/%2").arg(current_tas_frame).arg(total_tas_frames); 3750 return tr("TAS state: Running %1/%2")
3751 .arg(current_tas_frame)
3752 .arg(QString::fromStdString(tas_frames_string));
3734 case InputCommon::TasInput::TasState::Recording: 3753 case InputCommon::TasInput::TasState::Recording:
3735 return tr("TAS state: Recording %1").arg(total_tas_frames); 3754 return tr("TAS state: Recording %1").arg(total_tas_frames[0]);
3736 case InputCommon::TasInput::TasState::Stopped: 3755 case InputCommon::TasInput::TasState::Stopped:
3737 return tr("TAS state: Idle %1/%2").arg(current_tas_frame).arg(total_tas_frames); 3756 return tr("TAS state: Idle %1/%2")
3757 .arg(current_tas_frame)
3758 .arg(QString::fromStdString(tas_frames_string));
3738 default: 3759 default:
3739 return tr("TAS State: Invalid"); 3760 return tr("TAS State: Invalid");
3740 } 3761 }
diff --git a/src/yuzu/main.h b/src/yuzu/main.h
index f25ce65a8..0f61abc7a 100644
--- a/src/yuzu/main.h
+++ b/src/yuzu/main.h
@@ -12,6 +12,7 @@
12 12
13#include "common/announce_multiplayer_room.h" 13#include "common/announce_multiplayer_room.h"
14#include "common/common_types.h" 14#include "common/common_types.h"
15#include "input_common/drivers/tas_input.h"
15#include "yuzu/compatibility_list.h" 16#include "yuzu/compatibility_list.h"
16#include "yuzu/hotkeys.h" 17#include "yuzu/hotkeys.h"
17 18
@@ -266,6 +267,9 @@ private:
266 void changeEvent(QEvent* event) override; 267 void changeEvent(QEvent* event) override;
267 void closeEvent(QCloseEvent* event) override; 268 void closeEvent(QCloseEvent* event) override;
268 269
270 std::string CreateTASFramesString(
271 std::array<size_t, InputCommon::TasInput::PLAYER_NUMBER> frames) const;
272
269#ifdef __unix__ 273#ifdef __unix__
270 void SetupSigInterrupts(); 274 void SetupSigInterrupts();
271 static void HandleSigInterrupt(int); 275 static void HandleSigInterrupt(int);