summaryrefslogtreecommitdiff
path: root/src/input_common
diff options
context:
space:
mode:
Diffstat (limited to 'src/input_common')
-rw-r--r--src/input_common/tas/tas_input.cpp19
-rw-r--r--src/input_common/tas/tas_input.h6
2 files changed, 6 insertions, 19 deletions
diff --git a/src/input_common/tas/tas_input.cpp b/src/input_common/tas/tas_input.cpp
index baeb18c22..eb3327520 100644
--- a/src/input_common/tas/tas_input.cpp
+++ b/src/input_common/tas/tas_input.cpp
@@ -102,7 +102,7 @@ void Tas::LoadTasFile(size_t player_index) {
102 LOG_INFO(Input, "TAS file loaded! {} frames", frame_no); 102 LOG_INFO(Input, "TAS file loaded! {} frames", frame_no);
103} 103}
104 104
105void Tas::WriteTasFile() { 105void Tas::WriteTasFile(std::string file_name) {
106 std::string output_text; 106 std::string output_text;
107 for (size_t frame = 0; frame < record_commands.size(); frame++) { 107 for (size_t frame = 0; frame < record_commands.size(); frame++) {
108 if (!output_text.empty()) { 108 if (!output_text.empty()) {
@@ -113,7 +113,7 @@ void Tas::WriteTasFile() {
113 WriteCommandAxis(line.l_axis) + " " + WriteCommandAxis(line.r_axis); 113 WriteCommandAxis(line.l_axis) + " " + WriteCommandAxis(line.r_axis);
114 } 114 }
115 const size_t bytes_written = Common::FS::WriteStringToFile( 115 const size_t bytes_written = Common::FS::WriteStringToFile(
116 Common::FS::GetYuzuPathString(Common::FS::YuzuPath::TASDir) + "record.txt", 116 Common::FS::GetYuzuPathString(Common::FS::YuzuPath::TASDir) + file_name,
117 Common::FS::FileType::TextFile, output_text); 117 Common::FS::FileType::TextFile, output_text);
118 if (bytes_written == output_text.size()) { 118 if (bytes_written == output_text.size()) {
119 LOG_INFO(Input, "TAS file written to file!"); 119 LOG_INFO(Input, "TAS file written to file!");
@@ -189,18 +189,8 @@ void Tas::UpdateThread() {
189 if (is_recording) { 189 if (is_recording) {
190 record_commands.push_back(last_input); 190 record_commands.push_back(last_input);
191 } 191 }
192 if (!is_recording && !record_commands.empty()) {
193 WriteTasFile();
194 needs_reset = true;
195 refresh_tas_fle = true;
196 record_commands.clear();
197 }
198 if (needs_reset) { 192 if (needs_reset) {
199 current_command = 0; 193 current_command = 0;
200 if (refresh_tas_fle) {
201 LoadTasFiles();
202 refresh_tas_fle = false;
203 }
204 needs_reset = false; 194 needs_reset = false;
205 LoadTasFiles(); 195 LoadTasFiles();
206 LOG_DEBUG(Input, "tas_reset done"); 196 LOG_DEBUG(Input, "tas_reset done");
@@ -306,10 +296,8 @@ void Tas::Reset() {
306 needs_reset = true; 296 needs_reset = true;
307} 297}
308 298
309void Tas::Record() { 299bool Tas::Record() {
310 is_recording = !is_recording; 300 is_recording = !is_recording;
311<<<<<<< HEAD
312=======
313 return is_recording; 301 return is_recording;
314} 302}
315 303
@@ -326,7 +314,6 @@ void Tas::SaveRecording(bool overwrite_file) {
326 } 314 }
327 needs_reset = true; 315 needs_reset = true;
328 record_commands.clear(); 316 record_commands.clear();
329>>>>>>> 773d268db (config: disable pause on load)
330} 317}
331 318
332InputCommon::ButtonMapping Tas::GetButtonMappingForDevice( 319InputCommon::ButtonMapping Tas::GetButtonMappingForDevice(
diff --git a/src/input_common/tas/tas_input.h b/src/input_common/tas/tas_input.h
index e011e559e..e0462e858 100644
--- a/src/input_common/tas/tas_input.h
+++ b/src/input_common/tas/tas_input.h
@@ -68,7 +68,8 @@ public:
68 68
69 void StartStop(); 69 void StartStop();
70 void Reset(); 70 void Reset();
71 void Record(); 71 bool Record();
72 void SaveRecording(bool overwrite_file);
72 73
73 /** 74 /**
74 * Returns the current status values of TAS playback/recording 75 * Returns the current status values of TAS playback/recording
@@ -90,7 +91,7 @@ private:
90 }; 91 };
91 void LoadTasFiles(); 92 void LoadTasFiles();
92 void LoadTasFile(size_t player_index); 93 void LoadTasFile(size_t player_index);
93 void WriteTasFile(); 94 void WriteTasFile(std::string file_name);
94 TasAnalog ReadCommandAxis(const std::string& line) const; 95 TasAnalog ReadCommandAxis(const std::string& line) const;
95 u32 ReadCommandButtons(const std::string& line) const; 96 u32 ReadCommandButtons(const std::string& line) const;
96 std::string WriteCommandButtons(u32 data) const; 97 std::string WriteCommandButtons(u32 data) const;
@@ -106,7 +107,6 @@ private:
106 107
107 size_t script_length{0}; 108 size_t script_length{0};
108 std::array<TasData, PLAYER_NUMBER> tas_data; 109 std::array<TasData, PLAYER_NUMBER> tas_data;
109 bool refresh_tas_fle{false};
110 bool is_recording{false}; 110 bool is_recording{false};
111 bool is_running{false}; 111 bool is_running{false};
112 bool needs_reset{false}; 112 bool needs_reset{false};