diff options
Diffstat (limited to 'src/input_common/drivers/tas_input.cpp')
| -rw-r--r-- | src/input_common/drivers/tas_input.cpp | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/src/input_common/drivers/tas_input.cpp b/src/input_common/drivers/tas_input.cpp index 7e7a1d58f..d2748b240 100644 --- a/src/input_common/drivers/tas_input.cpp +++ b/src/input_common/drivers/tas_input.cpp | |||
| @@ -141,7 +141,7 @@ void Tas::WriteTasFile(std::u8string file_name) { | |||
| 141 | } | 141 | } |
| 142 | } | 142 | } |
| 143 | 143 | ||
| 144 | void Tas::RecordInput(u32 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 = FlipAxisY(left_axis), |
| @@ -195,7 +195,7 @@ void Tas::UpdateThread() { | |||
| 195 | } | 195 | } |
| 196 | if (current_command < script_length) { | 196 | if (current_command < script_length) { |
| 197 | LOG_DEBUG(Input, "Playing TAS {}/{}", current_command, script_length); | 197 | LOG_DEBUG(Input, "Playing TAS {}/{}", current_command, script_length); |
| 198 | size_t frame = current_command++; | 198 | const size_t frame = current_command++; |
| 199 | for (size_t player_index = 0; player_index < commands.size(); player_index++) { | 199 | for (size_t player_index = 0; player_index < commands.size(); player_index++) { |
| 200 | TASCommand command{}; | 200 | TASCommand command{}; |
| 201 | if (frame < commands[player_index].size()) { | 201 | if (frame < commands[player_index].size()) { |
| @@ -207,8 +207,8 @@ void Tas::UpdateThread() { | |||
| 207 | .port = player_index, | 207 | .port = player_index, |
| 208 | .pad = 0, | 208 | .pad = 0, |
| 209 | }; | 209 | }; |
| 210 | for (std::size_t i = 0; i < sizeof(command.buttons); ++i) { | 210 | for (std::size_t i = 0; i < sizeof(command.buttons) * 8; ++i) { |
| 211 | const bool button_status = (command.buttons & (1U << i)) != 0; | 211 | const bool button_status = (command.buttons & (1LLU << i)) != 0; |
| 212 | const int button = static_cast<int>(i); | 212 | const int button = static_cast<int>(i); |
| 213 | SetButton(identifier, button, button_status); | 213 | SetButton(identifier, button, button_status); |
| 214 | } | 214 | } |
| @@ -244,14 +244,14 @@ TasAnalog Tas::ReadCommandAxis(const std::string& line) const { | |||
| 244 | return {x, y}; | 244 | return {x, y}; |
| 245 | } | 245 | } |
| 246 | 246 | ||
| 247 | u32 Tas::ReadCommandButtons(const std::string& data) const { | 247 | u64 Tas::ReadCommandButtons(const std::string& data) const { |
| 248 | std::stringstream button_text(data); | 248 | std::stringstream button_text(data); |
| 249 | std::string line; | 249 | std::string line; |
| 250 | u32 buttons = 0; | 250 | u64 buttons = 0; |
| 251 | while (std::getline(button_text, line, ';')) { | 251 | while (std::getline(button_text, line, ';')) { |
| 252 | for (auto [text, tas_button] : text_to_tas_button) { | 252 | for (auto [text, tas_button] : text_to_tas_button) { |
| 253 | if (text == line) { | 253 | if (text == line) { |
| 254 | buttons |= static_cast<u32>(tas_button); | 254 | buttons |= static_cast<u64>(tas_button); |
| 255 | break; | 255 | break; |
| 256 | } | 256 | } |
| 257 | } | 257 | } |
| @@ -259,13 +259,14 @@ u32 Tas::ReadCommandButtons(const std::string& data) const { | |||
| 259 | return buttons; | 259 | return buttons; |
| 260 | } | 260 | } |
| 261 | 261 | ||
| 262 | std::string Tas::WriteCommandButtons(u32 buttons) const { | 262 | std::string Tas::WriteCommandButtons(u64 buttons) const { |
| 263 | std::string returns = ""; | 263 | std::string returns = ""; |
| 264 | for (auto [text_button, tas_button] : text_to_tas_button) { | 264 | for (auto [text_button, tas_button] : text_to_tas_button) { |
| 265 | if ((buttons & static_cast<u32>(tas_button)) != 0) | 265 | if ((buttons & static_cast<u64>(tas_button)) != 0) { |
| 266 | returns += fmt::format("{};", text_button.substr(4)); | 266 | returns += fmt::format("{};", text_button); |
| 267 | } | ||
| 267 | } | 268 | } |
| 268 | return returns.empty() ? "NONE" : returns.substr(2); | 269 | return returns.empty() ? "NONE" : returns; |
| 269 | } | 270 | } |
| 270 | 271 | ||
| 271 | std::string Tas::WriteCommandAxis(TasAnalog analog) const { | 272 | std::string Tas::WriteCommandAxis(TasAnalog analog) const { |