diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/input_common/drivers/tas_input.cpp | 10 | ||||
| -rw-r--r-- | src/input_common/drivers/tas_input.h | 48 |
2 files changed, 30 insertions, 28 deletions
diff --git a/src/input_common/drivers/tas_input.cpp b/src/input_common/drivers/tas_input.cpp index 1a38616b4..19d8ccae3 100644 --- a/src/input_common/drivers/tas_input.cpp +++ b/src/input_common/drivers/tas_input.cpp | |||
| @@ -238,13 +238,13 @@ TasAnalog Tas::ReadCommandAxis(const std::string& line) const { | |||
| 238 | return {x, y}; | 238 | return {x, y}; |
| 239 | } | 239 | } |
| 240 | 240 | ||
| 241 | u64 Tas::ReadCommandButtons(const std::string& data) const { | 241 | u64 Tas::ReadCommandButtons(const std::string& line) const { |
| 242 | std::stringstream button_text(data); | 242 | std::stringstream button_text(line); |
| 243 | std::string line; | 243 | std::string button_line; |
| 244 | u64 buttons = 0; | 244 | u64 buttons = 0; |
| 245 | while (std::getline(button_text, line, ';')) { | 245 | while (std::getline(button_text, button_line, ';')) { |
| 246 | for (auto [text, tas_button] : text_to_tas_button) { | 246 | for (auto [text, tas_button] : text_to_tas_button) { |
| 247 | if (text == line) { | 247 | if (text == button_line) { |
| 248 | buttons |= static_cast<u64>(tas_button); | 248 | buttons |= static_cast<u64>(tas_button); |
| 249 | break; | 249 | break; |
| 250 | } | 250 | } |
diff --git a/src/input_common/drivers/tas_input.h b/src/input_common/drivers/tas_input.h index c44c39da9..7c2c4a21b 100644 --- a/src/input_common/drivers/tas_input.h +++ b/src/input_common/drivers/tas_input.h | |||
| @@ -88,39 +88,39 @@ public: | |||
| 88 | 88 | ||
| 89 | /** | 89 | /** |
| 90 | * Changes the input status that will be stored in each frame | 90 | * Changes the input status that will be stored in each frame |
| 91 | * @param buttons: bitfield with the status of the buttons | 91 | * @param buttons Bitfield with the status of the buttons |
| 92 | * @param left_axis: value of the left axis | 92 | * @param left_axis Value of the left axis |
| 93 | * @param right_axis: value of the right axis | 93 | * @param right_axis Value of the right axis |
| 94 | */ | 94 | */ |
| 95 | void RecordInput(u64 buttons, TasAnalog left_axis, TasAnalog right_axis); | 95 | void RecordInput(u64 buttons, TasAnalog left_axis, TasAnalog right_axis); |
| 96 | 96 | ||
| 97 | // Main loop that records or executes input | 97 | // Main loop that records or executes input |
| 98 | void UpdateThread(); | 98 | void UpdateThread(); |
| 99 | 99 | ||
| 100 | // Sets the flag to start or stop the TAS command excecution and swaps controllers profiles | 100 | // Sets the flag to start or stop the TAS command execution and swaps controllers profiles |
| 101 | void StartStop(); | 101 | void StartStop(); |
| 102 | 102 | ||
| 103 | // Stop the TAS and reverts any controller profile | 103 | // Stop the TAS and reverts any controller profile |
| 104 | void Stop(); | 104 | void Stop(); |
| 105 | 105 | ||
| 106 | // Sets the flag to reload the file and start from the begining in the next update | 106 | // Sets the flag to reload the file and start from the beginning in the next update |
| 107 | void Reset(); | 107 | void Reset(); |
| 108 | 108 | ||
| 109 | /** | 109 | /** |
| 110 | * Sets the flag to enable or disable recording of inputs | 110 | * Sets the flag to enable or disable recording of inputs |
| 111 | * @return Returns true if the current recording status is enabled | 111 | * @returns true if the current recording status is enabled |
| 112 | */ | 112 | */ |
| 113 | bool Record(); | 113 | bool Record(); |
| 114 | 114 | ||
| 115 | /** | 115 | /** |
| 116 | * Saves contents of record_commands on a file | 116 | * Saves contents of record_commands on a file |
| 117 | * @param overwrite_file: Indicates if player 1 should be overwritten | 117 | * @param overwrite_file Indicates if player 1 should be overwritten |
| 118 | */ | 118 | */ |
| 119 | void SaveRecording(bool overwrite_file); | 119 | void SaveRecording(bool overwrite_file); |
| 120 | 120 | ||
| 121 | /** | 121 | /** |
| 122 | * Returns the current status values of TAS playback/recording | 122 | * Returns the current status values of TAS playback/recording |
| 123 | * @return Tuple of | 123 | * @returns A Tuple of |
| 124 | * TasState indicating the current state out of Running ; | 124 | * TasState indicating the current state out of Running ; |
| 125 | * Current playback progress ; | 125 | * Current playback progress ; |
| 126 | * Total length of script file currently loaded or being recorded | 126 | * Total length of script file currently loaded or being recorded |
| @@ -139,29 +139,31 @@ private: | |||
| 139 | /// Loads TAS files from all players | 139 | /// Loads TAS files from all players |
| 140 | void LoadTasFiles(); | 140 | void LoadTasFiles(); |
| 141 | 141 | ||
| 142 | /** Loads TAS file from the specified player | 142 | /** |
| 143 | * @param player_index: player number to save the script | 143 | * Loads TAS file from the specified player |
| 144 | * @param file_index: script number of the file | 144 | * @param player_index Player number to save the script |
| 145 | * @param file_index Script number of the file | ||
| 145 | */ | 146 | */ |
| 146 | void LoadTasFile(size_t player_index, size_t file_index); | 147 | void LoadTasFile(size_t player_index, size_t file_index); |
| 147 | 148 | ||
| 148 | /** Writes a TAS file from the recorded commands | 149 | /** |
| 149 | * @param file_name: name of the file to be written | 150 | * Writes a TAS file from the recorded commands |
| 151 | * @param file_name Name of the file to be written | ||
| 150 | */ | 152 | */ |
| 151 | void WriteTasFile(std::u8string file_name); | 153 | void WriteTasFile(std::u8string file_name); |
| 152 | 154 | ||
| 153 | /** | 155 | /** |
| 154 | * 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 |
| 155 | * @param line: string containing axis values with the following format "x;y" | 157 | * @param line String containing axis values with the following format "x;y" |
| 156 | * @return Returns a TAS analog object with axis values with range from -1.0 to 1.0 | 158 | * @returns A TAS analog object with axis values with range from -1.0 to 1.0 |
| 157 | */ | 159 | */ |
| 158 | TasAnalog ReadCommandAxis(const std::string& line) const; | 160 | TasAnalog ReadCommandAxis(const std::string& line) const; |
| 159 | 161 | ||
| 160 | /** | 162 | /** |
| 161 | * Parses a string containing the button values. Each button is represented by it's text format | 163 | * Parses a string containing the button values. Each button is represented by it's text format |
| 162 | * specified in text_to_tas_button array | 164 | * specified in text_to_tas_button array |
| 163 | * @param line: string containing button name with the following format "a;b;c;d..." | 165 | * @param line string containing button name with the following format "a;b;c;d..." |
| 164 | * @return Returns a u64 with each bit representing the status of a button | 166 | * @returns A u64 with each bit representing the status of a button |
| 165 | */ | 167 | */ |
| 166 | u64 ReadCommandButtons(const std::string& line) const; | 168 | u64 ReadCommandButtons(const std::string& line) const; |
| 167 | 169 | ||
| @@ -172,17 +174,17 @@ private: | |||
| 172 | 174 | ||
| 173 | /** | 175 | /** |
| 174 | * Converts an u64 containing the button status into the text equivalent | 176 | * Converts an u64 containing the button status into the text equivalent |
| 175 | * @param buttons: bitfield with the status of the buttons | 177 | * @param buttons Bitfield with the status of the buttons |
| 176 | * @return Returns a string with the name of the buttons to be written to the file | 178 | * @returns A string with the name of the buttons to be written to the file |
| 177 | */ | 179 | */ |
| 178 | std::string WriteCommandButtons(u64 buttons) const; | 180 | std::string WriteCommandButtons(u64 buttons) const; |
| 179 | 181 | ||
| 180 | /** | 182 | /** |
| 181 | * Converts an TAS analog object containing the axis status into the text equivalent | 183 | * Converts an TAS analog object containing the axis status into the text equivalent |
| 182 | * @param data: value of the axis | 184 | * @param analog Value of the axis |
| 183 | * @return A string with the value of the axis to be written to the file | 185 | * @returns A string with the value of the axis to be written to the file |
| 184 | */ | 186 | */ |
| 185 | std::string WriteCommandAxis(TasAnalog data) const; | 187 | std::string WriteCommandAxis(TasAnalog analog) const; |
| 186 | 188 | ||
| 187 | /// Sets an axis for a particular pad to the given value. | 189 | /// Sets an axis for a particular pad to the given value. |
| 188 | void SetTasAxis(const PadIdentifier& identifier, TasAxis axis, f32 value); | 190 | void SetTasAxis(const PadIdentifier& identifier, TasAxis axis, f32 value); |