summaryrefslogtreecommitdiff
path: root/src/input_common/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'src/input_common/drivers')
-rw-r--r--src/input_common/drivers/tas_input.cpp11
-rw-r--r--src/input_common/drivers/tas_input.h2
2 files changed, 7 insertions, 6 deletions
diff --git a/src/input_common/drivers/tas_input.cpp b/src/input_common/drivers/tas_input.cpp
index 0a504c484..3fdd3649b 100644
--- a/src/input_common/drivers/tas_input.cpp
+++ b/src/input_common/drivers/tas_input.cpp
@@ -121,16 +121,17 @@ void Tas::LoadTasFile(size_t player_index, size_t file_index) {
121 LOG_INFO(Input, "TAS file loaded! {} frames", frame_no); 121 LOG_INFO(Input, "TAS file loaded! {} frames", frame_no);
122} 122}
123 123
124void Tas::WriteTasFile(std::u8string file_name) { 124void Tas::WriteTasFile(std::u8string_view file_name) {
125 std::string output_text; 125 std::string output_text;
126 for (size_t frame = 0; frame < record_commands.size(); frame++) { 126 for (size_t frame = 0; frame < record_commands.size(); frame++) {
127 const TASCommand& line = record_commands[frame]; 127 const TASCommand& line = record_commands[frame];
128 output_text += fmt::format("{} {} {} {}\n", frame, WriteCommandButtons(line.buttons), 128 output_text += fmt::format("{} {} {} {}\n", frame, WriteCommandButtons(line.buttons),
129 WriteCommandAxis(line.l_axis), WriteCommandAxis(line.r_axis)); 129 WriteCommandAxis(line.l_axis), WriteCommandAxis(line.r_axis));
130 } 130 }
131 const auto bytes_written = Common::FS::WriteStringToFile( 131
132 Common::FS::GetYuzuPath(Common::FS::YuzuPath::TASDir) / file_name, 132 const auto tas_file_name = Common::FS::GetYuzuPath(Common::FS::YuzuPath::TASDir) / file_name;
133 Common::FS::FileType::TextFile, output_text); 133 const auto bytes_written =
134 Common::FS::WriteStringToFile(tas_file_name, Common::FS::FileType::TextFile, output_text);
134 if (bytes_written == output_text.size()) { 135 if (bytes_written == output_text.size()) {
135 LOG_INFO(Input, "TAS file written to file!"); 136 LOG_INFO(Input, "TAS file written to file!");
136 } else { 137 } else {
@@ -252,7 +253,7 @@ u64 Tas::ReadCommandButtons(const std::string& line) const {
252} 253}
253 254
254std::string Tas::WriteCommandButtons(u64 buttons) const { 255std::string Tas::WriteCommandButtons(u64 buttons) const {
255 std::string returns = ""; 256 std::string returns;
256 for (auto [text_button, tas_button] : text_to_tas_button) { 257 for (auto [text_button, tas_button] : text_to_tas_button) {
257 if ((buttons & static_cast<u64>(tas_button)) != 0) { 258 if ((buttons & static_cast<u64>(tas_button)) != 0) {
258 returns += fmt::format("{};", text_button); 259 returns += fmt::format("{};", text_button);
diff --git a/src/input_common/drivers/tas_input.h b/src/input_common/drivers/tas_input.h
index 7c2c4a21b..68970dcec 100644
--- a/src/input_common/drivers/tas_input.h
+++ b/src/input_common/drivers/tas_input.h
@@ -150,7 +150,7 @@ private:
150 * Writes a TAS file from the recorded commands 150 * Writes a TAS file from the recorded commands
151 * @param file_name Name of the file to be written 151 * @param file_name Name of the file to be written
152 */ 152 */
153 void WriteTasFile(std::u8string file_name); 153 void WriteTasFile(std::u8string_view file_name);
154 154
155 /** 155 /**
156 * Parses a string containing the axis values. X and Y have a range from -32767 to 32767 156 * Parses a string containing the axis values. X and Y have a range from -32767 to 32767