diff options
author | Lioncash <mathew1800@gmail.com> | 2021-12-13 16:49:06 +0100 |
---|---|---|
committer | Lioncash <mathew1800@gmail.com> | 2021-12-13 16:49:11 +0100 |
commit | d52ad96ce348656b2ea7de8b8a85badfa86d2860 (patch) | |
tree | 1d054ac61a893b2b16e977b3b792b7b320d9407f | |
parent | tas_input: Make TasAxes enum an enum class (diff) | |
download | yuzu-d52ad96ce348656b2ea7de8b8a85badfa86d2860.tar yuzu-d52ad96ce348656b2ea7de8b8a85badfa86d2860.tar.gz yuzu-d52ad96ce348656b2ea7de8b8a85badfa86d2860.tar.bz2 yuzu-d52ad96ce348656b2ea7de8b8a85badfa86d2860.tar.lz yuzu-d52ad96ce348656b2ea7de8b8a85badfa86d2860.tar.xz yuzu-d52ad96ce348656b2ea7de8b8a85badfa86d2860.tar.zst yuzu-d52ad96ce348656b2ea7de8b8a85badfa86d2860.zip |
-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 { return {x, y}; } -u64 Tas::ReadCommandButtons(const std::string& data) const { - std::stringstream button_text(data); - std::string line; +u64 Tas::ReadCommandButtons(const std::string& line) const { + std::stringstream button_text(line); + std::string button_line; u64 buttons = 0; - while (std::getline(button_text, line, ';')) { + while (std::getline(button_text, button_line, ';')) { for (auto [text, tas_button] : text_to_tas_button) { - if (text == line) { + if (text == button_line) { buttons |= static_cast<u64>(tas_button); break; } 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: /** * Changes the input status that will be stored in each frame - * @param buttons: bitfield with the status of the buttons - * @param left_axis: value of the left axis - * @param right_axis: value of the right axis + * @param buttons Bitfield with the status of the buttons + * @param left_axis Value of the left axis + * @param right_axis Value of the right axis */ void RecordInput(u64 buttons, TasAnalog left_axis, TasAnalog right_axis); // Main loop that records or executes input void UpdateThread(); - // Sets the flag to start or stop the TAS command excecution and swaps controllers profiles + // Sets the flag to start or stop the TAS command execution and swaps controllers profiles void StartStop(); - // Stop the TAS and reverts any controller profile + // Stop the TAS and reverts any controller profile void Stop(); - // Sets the flag to reload the file and start from the begining in the next update + // Sets the flag to reload the file and start from the beginning in the next update void Reset(); /** * Sets the flag to enable or disable recording of inputs - * @return Returns true if the current recording status is enabled + * @returns true if the current recording status is enabled */ bool Record(); /** * Saves contents of record_commands on a file - * @param overwrite_file: Indicates if player 1 should be overwritten + * @param overwrite_file Indicates if player 1 should be overwritten */ void SaveRecording(bool overwrite_file); /** * Returns the current status values of TAS playback/recording - * @return Tuple of + * @returns A Tuple of * TasState indicating the current state out of Running ; * Current playback progress ; * Total length of script file currently loaded or being recorded @@ -139,29 +139,31 @@ private: /// Loads TAS files from all players void LoadTasFiles(); - /** Loads TAS file from the specified player - * @param player_index: player number to save the script - * @param file_index: script number of the file + /** + * Loads TAS file from the specified player + * @param player_index Player number to save the script + * @param file_index Script number of the file */ void LoadTasFile(size_t player_index, size_t file_index); - /** Writes a TAS file from the recorded commands - * @param file_name: name of the file to be written + /** + * Writes a TAS file from the recorded commands + * @param file_name Name of the file to be written */ void WriteTasFile(std::u8string file_name); /** * Parses a string containing the axis values. X and Y have a range from -32767 to 32767 - * @param line: string containing axis values with the following format "x;y" - * @return Returns a TAS analog object with axis values with range from -1.0 to 1.0 + * @param line String containing axis values with the following format "x;y" + * @returns A TAS analog object with axis values with range from -1.0 to 1.0 */ TasAnalog ReadCommandAxis(const std::string& line) const; /** * Parses a string containing the button values. Each button is represented by it's text format * specified in text_to_tas_button array - * @param line: string containing button name with the following format "a;b;c;d..." - * @return Returns a u64 with each bit representing the status of a button + * @param line string containing button name with the following format "a;b;c;d..." + * @returns A u64 with each bit representing the status of a button */ u64 ReadCommandButtons(const std::string& line) const; @@ -172,17 +174,17 @@ private: /** * Converts an u64 containing the button status into the text equivalent - * @param buttons: bitfield with the status of the buttons - * @return Returns a string with the name of the buttons to be written to the file + * @param buttons Bitfield with the status of the buttons + * @returns A string with the name of the buttons to be written to the file */ std::string WriteCommandButtons(u64 buttons) const; /** * Converts an TAS analog object containing the axis status into the text equivalent - * @param data: value of the axis - * @return A string with the value of the axis to be written to the file + * @param analog Value of the axis + * @returns A string with the value of the axis to be written to the file */ - std::string WriteCommandAxis(TasAnalog data) const; + std::string WriteCommandAxis(TasAnalog analog) const; /// Sets an axis for a particular pad to the given value. void SetTasAxis(const PadIdentifier& identifier, TasAxis axis, f32 value); |