summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2021-12-13 16:54:05 +0100
committerLioncash <mathew1800@gmail.com>2021-12-13 16:54:43 +0100
commit6be730bdcdf875655973b1a39576e6933fd93eab (patch)
treee1a9882a78ba837dd7e9bdd08e77e4259c581955
parenttas_input: Remove unused std::smatch variable (diff)
downloadyuzu-6be730bdcdf875655973b1a39576e6933fd93eab.tar
yuzu-6be730bdcdf875655973b1a39576e6933fd93eab.tar.gz
yuzu-6be730bdcdf875655973b1a39576e6933fd93eab.tar.bz2
yuzu-6be730bdcdf875655973b1a39576e6933fd93eab.tar.lz
yuzu-6be730bdcdf875655973b1a39576e6933fd93eab.tar.xz
yuzu-6be730bdcdf875655973b1a39576e6933fd93eab.tar.zst
yuzu-6be730bdcdf875655973b1a39576e6933fd93eab.zip
-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) {
LOG_INFO(Input, "TAS file loaded! {} frames", frame_no);
}
-void Tas::WriteTasFile(std::u8string file_name) {
+void Tas::WriteTasFile(std::u8string_view file_name) {
std::string output_text;
for (size_t frame = 0; frame < record_commands.size(); frame++) {
const TASCommand& line = record_commands[frame];
output_text += fmt::format("{} {} {} {}\n", frame, WriteCommandButtons(line.buttons),
WriteCommandAxis(line.l_axis), WriteCommandAxis(line.r_axis));
}
- const auto bytes_written = Common::FS::WriteStringToFile(
- Common::FS::GetYuzuPath(Common::FS::YuzuPath::TASDir) / file_name,
- Common::FS::FileType::TextFile, output_text);
+
+ const auto tas_file_name = Common::FS::GetYuzuPath(Common::FS::YuzuPath::TASDir) / file_name;
+ const auto bytes_written =
+ Common::FS::WriteStringToFile(tas_file_name, Common::FS::FileType::TextFile, output_text);
if (bytes_written == output_text.size()) {
LOG_INFO(Input, "TAS file written to file!");
} else {
@@ -252,7 +253,7 @@ u64 Tas::ReadCommandButtons(const std::string& line) const {
}
std::string Tas::WriteCommandButtons(u64 buttons) const {
- std::string returns = "";
+ std::string returns;
for (auto [text_button, tas_button] : text_to_tas_button) {
if ((buttons & static_cast<u64>(tas_button)) != 0) {
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:
* Writes a TAS file from the recorded commands
* @param file_name Name of the file to be written
*/
- void WriteTasFile(std::u8string file_name);
+ void WriteTasFile(std::u8string_view file_name);
/**
* Parses a string containing the axis values. X and Y have a range from -32767 to 32767