diff options
| author | 2021-06-26 10:38:39 -0500 | |
|---|---|---|
| committer | 2021-09-18 23:22:42 +0200 | |
| commit | 9bb6580d89efb76534d9395bc052459d5f58e7c4 (patch) | |
| tree | aab812da6162e4f9ac305c80e245409d2781d8a2 /src/input_common/tas/tas_input.cpp | |
| parent | input_common/tas: Fallback to simple update (diff) | |
| download | yuzu-9bb6580d89efb76534d9395bc052459d5f58e7c4.tar.gz yuzu-9bb6580d89efb76534d9395bc052459d5f58e7c4.tar.xz yuzu-9bb6580d89efb76534d9395bc052459d5f58e7c4.zip | |
input_common/tas: overwrite file dialog
Diffstat (limited to 'src/input_common/tas/tas_input.cpp')
| -rw-r--r-- | src/input_common/tas/tas_input.cpp | 19 |
1 files changed, 3 insertions, 16 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 | ||
| 105 | void Tas::WriteTasFile() { | 105 | void 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 | ||
| 309 | void Tas::Record() { | 299 | bool 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 | ||
| 332 | InputCommon::ButtonMapping Tas::GetButtonMappingForDevice( | 319 | InputCommon::ButtonMapping Tas::GetButtonMappingForDevice( |