diff options
Diffstat (limited to 'src/input_common/drivers/tas_input.cpp')
| -rw-r--r-- | src/input_common/drivers/tas_input.cpp | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/src/input_common/drivers/tas_input.cpp b/src/input_common/drivers/tas_input.cpp index d2748b240..bb9c236ea 100644 --- a/src/input_common/drivers/tas_input.cpp +++ b/src/input_common/drivers/tas_input.cpp | |||
| @@ -71,21 +71,21 @@ Tas::~Tas() { | |||
| 71 | void Tas::LoadTasFiles() { | 71 | void Tas::LoadTasFiles() { |
| 72 | script_length = 0; | 72 | script_length = 0; |
| 73 | for (size_t i = 0; i < commands.size(); i++) { | 73 | for (size_t i = 0; i < commands.size(); i++) { |
| 74 | LoadTasFile(i); | 74 | LoadTasFile(i, 0); |
| 75 | if (commands[i].size() > script_length) { | 75 | if (commands[i].size() > script_length) { |
| 76 | script_length = commands[i].size(); | 76 | script_length = commands[i].size(); |
| 77 | } | 77 | } |
| 78 | } | 78 | } |
| 79 | } | 79 | } |
| 80 | 80 | ||
| 81 | void Tas::LoadTasFile(size_t player_index) { | 81 | void Tas::LoadTasFile(size_t player_index, size_t file_index) { |
| 82 | if (!commands[player_index].empty()) { | 82 | if (!commands[player_index].empty()) { |
| 83 | commands[player_index].clear(); | 83 | commands[player_index].clear(); |
| 84 | } | 84 | } |
| 85 | std::string file = | 85 | std::string file = Common::FS::ReadStringFromFile( |
| 86 | Common::FS::ReadStringFromFile(Common::FS::GetYuzuPath(Common::FS::YuzuPath::TASDir) / | 86 | Common::FS::GetYuzuPath(Common::FS::YuzuPath::TASDir) / |
| 87 | fmt::format("script0-{}.txt", player_index + 1), | 87 | fmt::format("script{}-{}.txt", file_index, player_index + 1), |
| 88 | Common::FS::FileType::BinaryFile); | 88 | Common::FS::FileType::BinaryFile); |
| 89 | std::stringstream command_line(file); | 89 | std::stringstream command_line(file); |
| 90 | std::string line; | 90 | std::string line; |
| 91 | int frame_no = 0; | 91 | int frame_no = 0; |
| @@ -144,15 +144,8 @@ void Tas::WriteTasFile(std::u8string file_name) { | |||
| 144 | void Tas::RecordInput(u64 buttons, TasAnalog left_axis, TasAnalog right_axis) { | 144 | void Tas::RecordInput(u64 buttons, TasAnalog left_axis, TasAnalog right_axis) { |
| 145 | last_input = { | 145 | last_input = { |
| 146 | .buttons = buttons, | 146 | .buttons = buttons, |
| 147 | .l_axis = FlipAxisY(left_axis), | 147 | .l_axis = left_axis, |
| 148 | .r_axis = FlipAxisY(right_axis), | 148 | .r_axis = right_axis, |
| 149 | }; | ||
| 150 | } | ||
| 151 | |||
| 152 | TasAnalog Tas::FlipAxisY(TasAnalog old) { | ||
| 153 | return { | ||
| 154 | .x = old.x, | ||
| 155 | .y = -old.y, | ||
| 156 | }; | 149 | }; |
| 157 | } | 150 | } |
| 158 | 151 | ||
| @@ -219,6 +212,7 @@ void Tas::UpdateThread() { | |||
| 219 | } | 212 | } |
| 220 | } else { | 213 | } else { |
| 221 | is_running = Settings::values.tas_loop.GetValue(); | 214 | is_running = Settings::values.tas_loop.GetValue(); |
| 215 | LoadTasFiles(); | ||
| 222 | current_command = 0; | 216 | current_command = 0; |
| 223 | ClearInput(); | 217 | ClearInput(); |
| 224 | } | 218 | } |