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 2ea3b7d59..571eacf9f 100644
--- a/src/yuzu/main.cpp
+++ b/src/yuzu/main.cpp
@@ -3730,15 +3730,36 @@ void GMainWindow::UpdateWindowTitle(std::string_view title_name, std::string_vie
3730 } 3730 }
3731} 3731}
3732 3732
3733std::string GMainWindow::CreateTASFramesString(
3734 std::array<size_t, InputCommon::TasInput::PLAYER_NUMBER> frames) const {
3735 std::string string = "";
3736 size_t maxPlayerIndex = 0;
3737 for (size_t i = 0; i < frames.size(); i++) {
3738 if (frames[i] != 0) {
3739 if (maxPlayerIndex != 0)
3740 string += ", ";
3741 while (maxPlayerIndex++ != i)
3742 string += "0, ";
3743 string += std::to_string(frames[i]);
3744 }
3745 }
3746 return string;
3747}
3748
3733QString GMainWindow::GetTasStateDescription() const { 3749QString GMainWindow::GetTasStateDescription() const {
3734 auto [tas_status, current_tas_frame, total_tas_frames] = input_subsystem->GetTas()->GetStatus(); 3750 auto [tas_status, current_tas_frame, total_tas_frames] = input_subsystem->GetTas()->GetStatus();
3751 std::string tas_frames_string = CreateTASFramesString(total_tas_frames);
3735 switch (tas_status) { 3752 switch (tas_status) {
3736 case InputCommon::TasInput::TasState::Running: 3753 case InputCommon::TasInput::TasState::Running:
3737 return tr("TAS state: Running %1/%2").arg(current_tas_frame).arg(total_tas_frames); 3754 return tr("TAS state: Running %1/%2")
3755 .arg(current_tas_frame)
3756 .arg(QString::fromStdString(tas_frames_string));
3738 case InputCommon::TasInput::TasState::Recording: 3757 case InputCommon::TasInput::TasState::Recording:
3739 return tr("TAS state: Recording %1").arg(total_tas_frames); 3758 return tr("TAS state: Recording %1").arg(total_tas_frames[0]);
3740 case InputCommon::TasInput::TasState::Stopped: 3759 case InputCommon::TasInput::TasState::Stopped:
3741 return tr("TAS state: Idle %1/%2").arg(current_tas_frame).arg(total_tas_frames); 3760 return tr("TAS state: Idle %1/%2")
3761 .arg(current_tas_frame)
3762 .arg(QString::fromStdString(tas_frames_string));
3742 default: 3763 default:
3743 return tr("TAS State: Invalid"); 3764 return tr("TAS State: Invalid");
3744 } 3765 }
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);