summaryrefslogtreecommitdiffstats
path: root/src/input_common/drivers
diff options
context:
space:
mode:
authorgerman77 <juangerman-13@hotmail.com>2021-11-03 05:50:30 +0100
committerNarr the Reg <juangerman-13@hotmail.com>2021-11-25 03:30:27 +0100
commit157e0b85fdd805e02d234dccf1ce578e3159adee (patch)
tree3916ae9628d53df0cfff3667ecbfb4dbd94f8e0b /src/input_common/drivers
parentcore/hid: Fully emulate motion from button (diff)
downloadyuzu-157e0b85fdd805e02d234dccf1ce578e3159adee.tar
yuzu-157e0b85fdd805e02d234dccf1ce578e3159adee.tar.gz
yuzu-157e0b85fdd805e02d234dccf1ce578e3159adee.tar.bz2
yuzu-157e0b85fdd805e02d234dccf1ce578e3159adee.tar.lz
yuzu-157e0b85fdd805e02d234dccf1ce578e3159adee.tar.xz
yuzu-157e0b85fdd805e02d234dccf1ce578e3159adee.tar.zst
yuzu-157e0b85fdd805e02d234dccf1ce578e3159adee.zip
Diffstat (limited to 'src/input_common/drivers')
-rw-r--r--src/input_common/drivers/tas_input.cpp24
-rw-r--r--src/input_common/drivers/tas_input.h11
2 files changed, 12 insertions, 23 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() {
void Tas::LoadTasFiles() {
script_length = 0;
for (size_t i = 0; i < commands.size(); i++) {
- LoadTasFile(i);
+ LoadTasFile(i, 0);
if (commands[i].size() > script_length) {
script_length = commands[i].size();
}
}
}
-void Tas::LoadTasFile(size_t player_index) {
+void Tas::LoadTasFile(size_t player_index, size_t file_index) {
if (!commands[player_index].empty()) {
commands[player_index].clear();
}
- std::string file =
- Common::FS::ReadStringFromFile(Common::FS::GetYuzuPath(Common::FS::YuzuPath::TASDir) /
- fmt::format("script0-{}.txt", player_index + 1),
- Common::FS::FileType::BinaryFile);
+ std::string file = Common::FS::ReadStringFromFile(
+ Common::FS::GetYuzuPath(Common::FS::YuzuPath::TASDir) /
+ fmt::format("script{}-{}.txt", file_index, player_index + 1),
+ Common::FS::FileType::BinaryFile);
std::stringstream command_line(file);
std::string line;
int frame_no = 0;
@@ -144,15 +144,8 @@ void Tas::WriteTasFile(std::u8string file_name) {
void Tas::RecordInput(u64 buttons, TasAnalog left_axis, TasAnalog right_axis) {
last_input = {
.buttons = buttons,
- .l_axis = FlipAxisY(left_axis),
- .r_axis = FlipAxisY(right_axis),
- };
-}
-
-TasAnalog Tas::FlipAxisY(TasAnalog old) {
- return {
- .x = old.x,
- .y = -old.y,
+ .l_axis = left_axis,
+ .r_axis = right_axis,
};
}
@@ -219,6 +212,7 @@ void Tas::UpdateThread() {
}
} else {
is_running = Settings::values.tas_loop.GetValue();
+ LoadTasFiles();
current_command = 0;
ClearInput();
}
diff --git a/src/input_common/drivers/tas_input.h b/src/input_common/drivers/tas_input.h
index 82dc9d616..bfb37a638 100644
--- a/src/input_common/drivers/tas_input.h
+++ b/src/input_common/drivers/tas_input.h
@@ -138,21 +138,16 @@ private:
void LoadTasFiles();
/** Loads TAS file from the specified player
- * @param player_index: player number where data is going to be stored
+ * @param player_index: player number to save the script
+ * @param file_index: script number of the file
*/
- void LoadTasFile(size_t player_index);
+ 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
*/
void WriteTasFile(std::u8string file_name);
- /** Inverts the Y axis polarity
- * @param old: value of the axis
- * @return new value of the axis
- */
- TasAnalog FlipAxisY(TasAnalog old);
-
/**
* 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"