diff options
| -rw-r--r-- | src/common/settings.h | 7 | ||||
| -rw-r--r-- | src/core/hle/service/apm/apm_interface.cpp | 2 | ||||
| -rw-r--r-- | src/core/hle/service/vi/vi.cpp | 3 | ||||
| -rw-r--r-- | src/input_common/tas/tas_input.cpp | 47 | ||||
| -rw-r--r-- | src/input_common/tas/tas_input.h | 59 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_input_player_widget.cpp | 3 | ||||
| -rw-r--r-- | src/yuzu/debugger/controller.cpp | 16 | ||||
| -rw-r--r-- | src/yuzu/debugger/controller.h | 3 | ||||
| -rw-r--r-- | src/yuzu/main.cpp | 21 | ||||
| -rw-r--r-- | src/yuzu/main.h | 1 |
10 files changed, 60 insertions, 102 deletions
diff --git a/src/common/settings.h b/src/common/settings.h index 7333a64dc..cf12c325c 100644 --- a/src/common/settings.h +++ b/src/common/settings.h | |||
| @@ -14,7 +14,6 @@ | |||
| 14 | #include <utility> | 14 | #include <utility> |
| 15 | #include <vector> | 15 | #include <vector> |
| 16 | 16 | ||
| 17 | #include <input_common/main.h> | ||
| 18 | #include "common/common_types.h" | 17 | #include "common/common_types.h" |
| 19 | #include "common/settings_input.h" | 18 | #include "common/settings_input.h" |
| 20 | 19 | ||
| @@ -515,9 +514,9 @@ struct Values { | |||
| 515 | 514 | ||
| 516 | BasicSetting<bool> pause_tas_on_load { false, "pause_tas_on_load" }; | 515 | BasicSetting<bool> pause_tas_on_load { false, "pause_tas_on_load" }; |
| 517 | BasicSetting<bool> tas_enable{ false, "tas_enable" }; | 516 | BasicSetting<bool> tas_enable{ false, "tas_enable" }; |
| 518 | BasicSetting<bool> tas_reset{ false, "tas_reset" }; | 517 | BasicSetting<bool> tas_loop{ false, "tas_loop" }; |
| 519 | BasicSetting<bool> tas_record{ false, "tas_record" }; | 518 | BasicSetting<bool> tas_swap_controllers{ false, "tas_swap_controllers" }; |
| 520 | BasicSetting<bool> is_cpu_boxted{ false, " BasicSetting<bool> is_cpu_boxted{ false, "cpuBoosted" }; | 519 | BasicSetting<bool> is_cpu_boosted{ false, "is_cpu_boosted" }; |
| 521 | " }; | 520 | " }; |
| 522 | 521 | ||
| 523 | BasicSetting<bool> mouse_panning{false, "mouse_panning"}; | 522 | BasicSetting<bool> mouse_panning{false, "mouse_panning"}; |
diff --git a/src/core/hle/service/apm/apm_interface.cpp b/src/core/hle/service/apm/apm_interface.cpp index 520ccfa88..e58bad083 100644 --- a/src/core/hle/service/apm/apm_interface.cpp +++ b/src/core/hle/service/apm/apm_interface.cpp | |||
| @@ -3,7 +3,6 @@ | |||
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include "common/logging/log.h" | 5 | #include "common/logging/log.h" |
| 6 | #include "common/settings.h" | ||
| 7 | #include "core/hle/ipc_helpers.h" | 6 | #include "core/hle/ipc_helpers.h" |
| 8 | #include "core/hle/service/apm/apm.h" | 7 | #include "core/hle/service/apm/apm.h" |
| 9 | #include "core/hle/service/apm/apm_controller.h" | 8 | #include "core/hle/service/apm/apm_controller.h" |
| @@ -121,7 +120,6 @@ void APM_Sys::SetCpuBoostMode(Kernel::HLERequestContext& ctx) { | |||
| 121 | 120 | ||
| 122 | LOG_DEBUG(Service_APM, "called, mode={:08X}", mode); | 121 | LOG_DEBUG(Service_APM, "called, mode={:08X}", mode); |
| 123 | 122 | ||
| 124 | Settings::values.is_cpu_boosted = (mode == CpuBoostMode::Full); | ||
| 125 | controller.SetFromCpuBoostMode(mode); | 123 | controller.SetFromCpuBoostMode(mode); |
| 126 | 124 | ||
| 127 | IPC::ResponseBuilder rb{ctx, 2}; | 125 | IPC::ResponseBuilder rb{ctx, 2}; |
diff --git a/src/core/hle/service/vi/vi.cpp b/src/core/hle/service/vi/vi.cpp index f4eac0bca..8e8fc40ca 100644 --- a/src/core/hle/service/vi/vi.cpp +++ b/src/core/hle/service/vi/vi.cpp | |||
| @@ -32,8 +32,6 @@ | |||
| 32 | #include "core/hle/service/vi/vi_s.h" | 32 | #include "core/hle/service/vi/vi_s.h" |
| 33 | #include "core/hle/service/vi/vi_u.h" | 33 | #include "core/hle/service/vi/vi_u.h" |
| 34 | 34 | ||
| 35 | #include "input_common/tas/tas_input.h" | ||
| 36 | |||
| 37 | namespace Service::VI { | 35 | namespace Service::VI { |
| 38 | 36 | ||
| 39 | constexpr ResultCode ERR_OPERATION_FAILED{ErrorModule::VI, 1}; | 37 | constexpr ResultCode ERR_OPERATION_FAILED{ErrorModule::VI, 1}; |
| @@ -597,7 +595,6 @@ private: | |||
| 597 | 595 | ||
| 598 | IGBPQueueBufferResponseParcel response{1280, 720}; | 596 | IGBPQueueBufferResponseParcel response{1280, 720}; |
| 599 | ctx.WriteBuffer(response.Serialize()); | 597 | ctx.WriteBuffer(response.Serialize()); |
| 600 | Settings::values.input_subsystem->GetTas()->UpdateThread(); | ||
| 601 | break; | 598 | break; |
| 602 | } | 599 | } |
| 603 | case TransactionId::Query: { | 600 | case TransactionId::Query: { |
diff --git a/src/input_common/tas/tas_input.cpp b/src/input_common/tas/tas_input.cpp index 6efa1234a..baeb18c22 100644 --- a/src/input_common/tas/tas_input.cpp +++ b/src/input_common/tas/tas_input.cpp | |||
| @@ -2,13 +2,8 @@ | |||
| 2 | // Licensed under GPLv2+ | 2 | // Licensed under GPLv2+ |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include <chrono> | ||
| 6 | #include <cstring> | 5 | #include <cstring> |
| 7 | #include <functional> | ||
| 8 | #include <random> | ||
| 9 | #include <regex> | 6 | #include <regex> |
| 10 | #include <thread> | ||
| 11 | #include <boost/asio.hpp> | ||
| 12 | 7 | ||
| 13 | #include "common/fs/file.h" | 8 | #include "common/fs/file.h" |
| 14 | #include "common/fs/fs_types.h" | 9 | #include "common/fs/fs_types.h" |
| @@ -43,27 +38,25 @@ constexpr std::array<std::pair<std::string_view, TasButton>, 20> text_to_tas_but | |||
| 43 | }; | 38 | }; |
| 44 | 39 | ||
| 45 | Tas::Tas() { | 40 | Tas::Tas() { |
| 41 | if (!Settings::values.tas_enable) { | ||
| 42 | return; | ||
| 43 | } | ||
| 46 | LoadTasFiles(); | 44 | LoadTasFiles(); |
| 47 | } | 45 | } |
| 48 | 46 | ||
| 49 | Tas::~Tas() { | 47 | Tas::~Tas() = default; |
| 50 | update_thread_running = false; | ||
| 51 | } | ||
| 52 | 48 | ||
| 53 | void Tas::RefreshTasFile() { | ||
| 54 | refresh_tas_fle = true; | ||
| 55 | } | ||
| 56 | void Tas::LoadTasFiles() { | 49 | void Tas::LoadTasFiles() { |
| 57 | script_length = 0; | 50 | script_length = 0; |
| 58 | for (size_t i = 0; i < PLAYER_NUMBER; i++) { | 51 | for (size_t i = 0; i < commands.size(); i++) { |
| 59 | LoadTasFile(i); | 52 | LoadTasFile(i); |
| 60 | if (commands[i].size() > script_length) { | 53 | if (commands[i].size() > script_length) { |
| 61 | script_length = commands[i].size(); | 54 | script_length = commands[i].size(); |
| 62 | } | 55 | } |
| 63 | } | 56 | } |
| 64 | } | 57 | } |
| 58 | |||
| 65 | void Tas::LoadTasFile(size_t player_index) { | 59 | void Tas::LoadTasFile(size_t player_index) { |
| 66 | LOG_DEBUG(Input, "LoadTasFile()"); | ||
| 67 | if (!commands[player_index].empty()) { | 60 | if (!commands[player_index].empty()) { |
| 68 | commands[player_index].clear(); | 61 | commands[player_index].clear(); |
| 69 | } | 62 | } |
| @@ -110,7 +103,6 @@ void Tas::LoadTasFile(size_t player_index) { | |||
| 110 | } | 103 | } |
| 111 | 104 | ||
| 112 | void Tas::WriteTasFile() { | 105 | void Tas::WriteTasFile() { |
| 113 | LOG_DEBUG(Input, "WriteTasFile()"); | ||
| 114 | std::string output_text; | 106 | std::string output_text; |
| 115 | for (size_t frame = 0; frame < record_commands.size(); frame++) { | 107 | for (size_t frame = 0; frame < record_commands.size(); frame++) { |
| 116 | if (!output_text.empty()) { | 108 | if (!output_text.empty()) { |
| @@ -131,13 +123,13 @@ void Tas::WriteTasFile() { | |||
| 131 | } | 123 | } |
| 132 | } | 124 | } |
| 133 | 125 | ||
| 134 | static std::pair<float, float> FlipY(std::pair<float, float> old) { | 126 | std::pair<float, float> Tas::FlipAxisY(std::pair<float, float> old) { |
| 135 | auto [x, y] = old; | 127 | auto [x, y] = old; |
| 136 | return {x, -y}; | 128 | return {x, -y}; |
| 137 | } | 129 | } |
| 138 | 130 | ||
| 139 | void Tas::RecordInput(u32 buttons, const std::array<std::pair<float, float>, 2>& axes) { | 131 | void Tas::RecordInput(u32 buttons, const std::array<std::pair<float, float>, 2>& axes) { |
| 140 | last_input = {buttons, FlipY(axes[0]), FlipY(axes[1])}; | 132 | last_input = {buttons, FlipAxisY(axes[0]), FlipAxisY(axes[1])}; |
| 141 | } | 133 | } |
| 142 | 134 | ||
| 143 | std::tuple<TasState, size_t, size_t> Tas::GetStatus() const { | 135 | std::tuple<TasState, size_t, size_t> Tas::GetStatus() const { |
| @@ -155,21 +147,21 @@ std::tuple<TasState, size_t, size_t> Tas::GetStatus() const { | |||
| 155 | return {state, current_command, script_length}; | 147 | return {state, current_command, script_length}; |
| 156 | } | 148 | } |
| 157 | 149 | ||
| 158 | static std::string DebugButtons(u32 buttons) { | 150 | std::string Tas::DebugButtons(u32 buttons) const { |
| 159 | return fmt::format("{{ {} }}", TasInput::Tas::ButtonsToString(buttons)); | 151 | return fmt::format("{{ {} }}", TasInput::Tas::ButtonsToString(buttons)); |
| 160 | } | 152 | } |
| 161 | 153 | ||
| 162 | static std::string DebugJoystick(float x, float y) { | 154 | std::string Tas::DebugJoystick(float x, float y) const { |
| 163 | return fmt::format("[ {} , {} ]", std::to_string(x), std::to_string(y)); | 155 | return fmt::format("[ {} , {} ]", std::to_string(x), std::to_string(y)); |
| 164 | } | 156 | } |
| 165 | 157 | ||
| 166 | static std::string DebugInput(const TasData& data) { | 158 | std::string Tas::DebugInput(const TasData& data) const { |
| 167 | return fmt::format("{{ {} , {} , {} }}", DebugButtons(data.buttons), | 159 | return fmt::format("{{ {} , {} , {} }}", DebugButtons(data.buttons), |
| 168 | DebugJoystick(data.axis[0], data.axis[1]), | 160 | DebugJoystick(data.axis[0], data.axis[1]), |
| 169 | DebugJoystick(data.axis[2], data.axis[3])); | 161 | DebugJoystick(data.axis[2], data.axis[3])); |
| 170 | } | 162 | } |
| 171 | 163 | ||
| 172 | static std::string DebugInputs(const std::array<TasData, PLAYER_NUMBER>& arr) { | 164 | std::string Tas::DebugInputs(const std::array<TasData, PLAYER_NUMBER>& arr) const { |
| 173 | std::string returns = "[ "; | 165 | std::string returns = "[ "; |
| 174 | for (size_t i = 0; i < arr.size(); i++) { | 166 | for (size_t i = 0; i < arr.size(); i++) { |
| 175 | returns += DebugInput(arr[i]); | 167 | returns += DebugInput(arr[i]); |
| @@ -180,8 +172,17 @@ static std::string DebugInputs(const std::array<TasData, PLAYER_NUMBER>& arr) { | |||
| 180 | return returns + "]"; | 172 | return returns + "]"; |
| 181 | } | 173 | } |
| 182 | 174 | ||
| 175 | std::string Tas::ButtonsToString(u32 button) const { | ||
| 176 | std::string returns; | ||
| 177 | for (auto [text_button, tas_button] : text_to_tas_button) { | ||
| 178 | if ((button & static_cast<u32>(tas_button)) != 0) | ||
| 179 | returns += fmt::format(", {}", text_button.substr(4)); | ||
| 180 | } | ||
| 181 | return returns.empty() ? "" : returns.substr(2); | ||
| 182 | } | ||
| 183 | |||
| 183 | void Tas::UpdateThread() { | 184 | void Tas::UpdateThread() { |
| 184 | if (!update_thread_running) { | 185 | if (!Settings::values.tas_enable) { |
| 185 | return; | 186 | return; |
| 186 | } | 187 | } |
| 187 | 188 | ||
| @@ -206,9 +207,9 @@ void Tas::UpdateThread() { | |||
| 206 | } | 207 | } |
| 207 | if (is_running) { | 208 | if (is_running) { |
| 208 | if (current_command < script_length) { | 209 | if (current_command < script_length) { |
| 209 | LOG_INFO(Input, "Playing TAS {}/{}", current_command, script_length); | 210 | LOG_DEBUG(Input, "Playing TAS {}/{}", current_command, script_length); |
| 210 | size_t frame = current_command++; | 211 | size_t frame = current_command++; |
| 211 | for (size_t i = 0; i < PLAYER_NUMBER; i++) { | 212 | for (size_t i = 0; i < commands.size(); i++) { |
| 212 | if (frame < commands[i].size()) { | 213 | if (frame < commands[i].size()) { |
| 213 | TASCommand command = commands[i][frame]; | 214 | TASCommand command = commands[i][frame]; |
| 214 | tas_data[i].buttons = command.buttons; | 215 | tas_data[i].buttons = command.buttons; |
diff --git a/src/input_common/tas/tas_input.h b/src/input_common/tas/tas_input.h index 49ef10ff9..e011e559e 100644 --- a/src/input_common/tas/tas_input.h +++ b/src/input_common/tas/tas_input.h | |||
| @@ -5,8 +5,6 @@ | |||
| 5 | #pragma once | 5 | #pragma once |
| 6 | 6 | ||
| 7 | #include <array> | 7 | #include <array> |
| 8 | #include <mutex> | ||
| 9 | #include <thread> | ||
| 10 | 8 | ||
| 11 | #include "common/common_types.h" | 9 | #include "common/common_types.h" |
| 12 | #include "core/frontend/input.h" | 10 | #include "core/frontend/input.h" |
| @@ -65,53 +63,6 @@ public: | |||
| 65 | Tas(); | 63 | Tas(); |
| 66 | ~Tas(); | 64 | ~Tas(); |
| 67 | 65 | ||
| 68 | static std::string ButtonsToString(u32 button) { | ||
| 69 | std::string returns; | ||
| 70 | if ((button & static_cast<u32>(TasInput::TasButton::BUTTON_A)) != 0) | ||
| 71 | returns += ", A"; | ||
| 72 | if ((button & static_cast<u32>(TasInput::TasButton::BUTTON_B)) != 0) | ||
| 73 | returns += ", B"; | ||
| 74 | if ((button & static_cast<u32>(TasInput::TasButton::BUTTON_X)) != 0) | ||
| 75 | returns += ", X"; | ||
| 76 | if ((button & static_cast<u32>(TasInput::TasButton::BUTTON_Y)) != 0) | ||
| 77 | returns += ", Y"; | ||
| 78 | if ((button & static_cast<u32>(TasInput::TasButton::STICK_L)) != 0) | ||
| 79 | returns += ", STICK_L"; | ||
| 80 | if ((button & static_cast<u32>(TasInput::TasButton::STICK_R)) != 0) | ||
| 81 | returns += ", STICK_R"; | ||
| 82 | if ((button & static_cast<u32>(TasInput::TasButton::TRIGGER_L)) != 0) | ||
| 83 | returns += ", TRIGGER_L"; | ||
| 84 | if ((button & static_cast<u32>(TasInput::TasButton::TRIGGER_R)) != 0) | ||
| 85 | returns += ", TRIGGER_R"; | ||
| 86 | if ((button & static_cast<u32>(TasInput::TasButton::TRIGGER_ZL)) != 0) | ||
| 87 | returns += ", TRIGGER_ZL"; | ||
| 88 | if ((button & static_cast<u32>(TasInput::TasButton::TRIGGER_ZR)) != 0) | ||
| 89 | returns += ", TRIGGER_ZR"; | ||
| 90 | if ((button & static_cast<u32>(TasInput::TasButton::BUTTON_PLUS)) != 0) | ||
| 91 | returns += ", PLUS"; | ||
| 92 | if ((button & static_cast<u32>(TasInput::TasButton::BUTTON_MINUS)) != 0) | ||
| 93 | returns += ", MINUS"; | ||
| 94 | if ((button & static_cast<u32>(TasInput::TasButton::BUTTON_LEFT)) != 0) | ||
| 95 | returns += ", LEFT"; | ||
| 96 | if ((button & static_cast<u32>(TasInput::TasButton::BUTTON_UP)) != 0) | ||
| 97 | returns += ", UP"; | ||
| 98 | if ((button & static_cast<u32>(TasInput::TasButton::BUTTON_RIGHT)) != 0) | ||
| 99 | returns += ", RIGHT"; | ||
| 100 | if ((button & static_cast<u32>(TasInput::TasButton::BUTTON_DOWN)) != 0) | ||
| 101 | returns += ", DOWN"; | ||
| 102 | if ((button & static_cast<u32>(TasInput::TasButton::BUTTON_SL)) != 0) | ||
| 103 | returns += ", SL"; | ||
| 104 | if ((button & static_cast<u32>(TasInput::TasButton::BUTTON_SR)) != 0) | ||
| 105 | returns += ", SR"; | ||
| 106 | if ((button & static_cast<u32>(TasInput::TasButton::BUTTON_HOME)) != 0) | ||
| 107 | returns += ", HOME"; | ||
| 108 | if ((button & static_cast<u32>(TasInput::TasButton::BUTTON_CAPTURE)) != 0) | ||
| 109 | returns += ", CAPTURE"; | ||
| 110 | return returns.empty() ? "" : returns.substr(2); | ||
| 111 | } | ||
| 112 | |||
| 113 | void RefreshTasFile(); | ||
| 114 | void LoadTasFiles(); | ||
| 115 | void RecordInput(u32 buttons, const std::array<std::pair<float, float>, 2>& axes); | 66 | void RecordInput(u32 buttons, const std::array<std::pair<float, float>, 2>& axes); |
| 116 | void UpdateThread(); | 67 | void UpdateThread(); |
| 117 | 68 | ||
| @@ -137,6 +88,7 @@ private: | |||
| 137 | TasAnalog l_axis{}; | 88 | TasAnalog l_axis{}; |
| 138 | TasAnalog r_axis{}; | 89 | TasAnalog r_axis{}; |
| 139 | }; | 90 | }; |
| 91 | void LoadTasFiles(); | ||
| 140 | void LoadTasFile(size_t player_index); | 92 | void LoadTasFile(size_t player_index); |
| 141 | void WriteTasFile(); | 93 | void WriteTasFile(); |
| 142 | TasAnalog ReadCommandAxis(const std::string& line) const; | 94 | TasAnalog ReadCommandAxis(const std::string& line) const; |
| @@ -144,9 +96,16 @@ private: | |||
| 144 | std::string WriteCommandButtons(u32 data) const; | 96 | std::string WriteCommandButtons(u32 data) const; |
| 145 | std::string WriteCommandAxis(TasAnalog data) const; | 97 | std::string WriteCommandAxis(TasAnalog data) const; |
| 146 | 98 | ||
| 99 | std::pair<float, float> FlipAxisY(std::pair<float, float> old); | ||
| 100 | |||
| 101 | std::string DebugButtons(u32 buttons) const; | ||
| 102 | std::string DebugJoystick(float x, float y) const; | ||
| 103 | std::string DebugInput(const TasData& data) const; | ||
| 104 | std::string DebugInputs(const std::array<TasData, PLAYER_NUMBER>& arr) const; | ||
| 105 | std::string ButtonsToString(u32 button) const; | ||
| 106 | |||
| 147 | size_t script_length{0}; | 107 | size_t script_length{0}; |
| 148 | std::array<TasData, PLAYER_NUMBER> tas_data; | 108 | std::array<TasData, PLAYER_NUMBER> tas_data; |
| 149 | bool update_thread_running{true}; | ||
| 150 | bool refresh_tas_fle{false}; | 109 | bool refresh_tas_fle{false}; |
| 151 | bool is_recording{false}; | 110 | bool is_recording{false}; |
| 152 | bool is_running{false}; | 111 | bool is_running{false}; |
diff --git a/src/yuzu/configuration/configure_input_player_widget.cpp b/src/yuzu/configuration/configure_input_player_widget.cpp index e4383676a..b905fc73d 100644 --- a/src/yuzu/configuration/configure_input_player_widget.cpp +++ b/src/yuzu/configuration/configure_input_player_widget.cpp | |||
| @@ -175,6 +175,9 @@ void PlayerControlPreview::ResetInputs() { | |||
| 175 | } | 175 | } |
| 176 | 176 | ||
| 177 | void PlayerControlPreview::UpdateInput() { | 177 | void PlayerControlPreview::UpdateInput() { |
| 178 | if (controller_callback.update != nullptr) { | ||
| 179 | controller_callback.update(std::move(true)); | ||
| 180 | } | ||
| 178 | if (!is_enabled && !mapping_active) { | 181 | if (!is_enabled && !mapping_active) { |
| 179 | return; | 182 | return; |
| 180 | } | 183 | } |
diff --git a/src/yuzu/debugger/controller.cpp b/src/yuzu/debugger/controller.cpp index 822d033d1..a745699bf 100644 --- a/src/yuzu/debugger/controller.cpp +++ b/src/yuzu/debugger/controller.cpp | |||
| @@ -41,7 +41,8 @@ void ControllerDialog::refreshConfiguration() { | |||
| 41 | constexpr std::size_t player = 0; | 41 | constexpr std::size_t player = 0; |
| 42 | widget->SetPlayerInputRaw(player, players[player].buttons, players[player].analogs); | 42 | widget->SetPlayerInputRaw(player, players[player].buttons, players[player].analogs); |
| 43 | widget->SetControllerType(players[player].controller_type); | 43 | widget->SetControllerType(players[player].controller_type); |
| 44 | ControllerCallback callback{[this](ControllerInput input) { InputController(input); }}; | 44 | ControllerCallback callback{[this](ControllerInput input) { InputController(input); }, |
| 45 | [this](bool update) { UpdateController(update); }}; | ||
| 45 | widget->SetCallBack(callback); | 46 | widget->SetCallBack(callback); |
| 46 | widget->repaint(); | 47 | widget->repaint(); |
| 47 | widget->SetConnectedStatus(players[player].connected); | 48 | widget->SetConnectedStatus(players[player].connected); |
| @@ -74,10 +75,6 @@ void ControllerDialog::hideEvent(QHideEvent* ev) { | |||
| 74 | QWidget::hideEvent(ev); | 75 | QWidget::hideEvent(ev); |
| 75 | } | 76 | } |
| 76 | 77 | ||
| 77 | void ControllerDialog::RefreshTasFile() { | ||
| 78 | input_subsystem->GetTas()->RefreshTasFile(); | ||
| 79 | } | ||
| 80 | |||
| 81 | void ControllerDialog::InputController(ControllerInput input) { | 78 | void ControllerDialog::InputController(ControllerInput input) { |
| 82 | u32 buttons = 0; | 79 | u32 buttons = 0; |
| 83 | int index = 0; | 80 | int index = 0; |
| @@ -86,4 +83,11 @@ void ControllerDialog::InputController(ControllerInput input) { | |||
| 86 | index++; | 83 | index++; |
| 87 | } | 84 | } |
| 88 | input_subsystem->GetTas()->RecordInput(buttons, input.axis_values); | 85 | input_subsystem->GetTas()->RecordInput(buttons, input.axis_values); |
| 89 | } \ No newline at end of file | 86 | } |
| 87 | |||
| 88 | void ControllerDialog::UpdateController(bool update) { | ||
| 89 | if (!update) { | ||
| 90 | return; | ||
| 91 | } | ||
| 92 | input_subsystem->GetTas()->UpdateThread(); | ||
| 93 | } | ||
diff --git a/src/yuzu/debugger/controller.h b/src/yuzu/debugger/controller.h index f2f6653f7..448d24b67 100644 --- a/src/yuzu/debugger/controller.h +++ b/src/yuzu/debugger/controller.h | |||
| @@ -25,6 +25,7 @@ struct ControllerInput { | |||
| 25 | 25 | ||
| 26 | struct ControllerCallback { | 26 | struct ControllerCallback { |
| 27 | std::function<void(ControllerInput)> input; | 27 | std::function<void(ControllerInput)> input; |
| 28 | std::function<void(bool)> update; | ||
| 28 | }; | 29 | }; |
| 29 | 30 | ||
| 30 | class ControllerDialog : public QWidget { | 31 | class ControllerDialog : public QWidget { |
| @@ -43,8 +44,8 @@ protected: | |||
| 43 | void hideEvent(QHideEvent* ev) override; | 44 | void hideEvent(QHideEvent* ev) override; |
| 44 | 45 | ||
| 45 | private: | 46 | private: |
| 46 | void RefreshTasFile(); | ||
| 47 | void InputController(ControllerInput input); | 47 | void InputController(ControllerInput input); |
| 48 | void UpdateController(bool update); | ||
| 48 | QAction* toggle_view_action = nullptr; | 49 | QAction* toggle_view_action = nullptr; |
| 49 | QFileSystemWatcher* watcher = nullptr; | 50 | QFileSystemWatcher* watcher = nullptr; |
| 50 | PlayerControlPreview* widget; | 51 | PlayerControlPreview* widget; |
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 820e31fa7..6c2835a2f 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp | |||
| @@ -196,7 +196,6 @@ GMainWindow::GMainWindow() | |||
| 196 | config{std::make_unique<Config>()}, vfs{std::make_shared<FileSys::RealVfsFilesystem>()}, | 196 | config{std::make_unique<Config>()}, vfs{std::make_shared<FileSys::RealVfsFilesystem>()}, |
| 197 | provider{std::make_unique<FileSys::ManualContentProvider>()} { | 197 | provider{std::make_unique<FileSys::ManualContentProvider>()} { |
| 198 | Common::Log::Initialize(); | 198 | Common::Log::Initialize(); |
| 199 | Settings::values.inputSubsystem = input_subsystem; | ||
| 200 | LoadTranslation(); | 199 | LoadTranslation(); |
| 201 | 200 | ||
| 202 | setAcceptDrops(true); | 201 | setAcceptDrops(true); |
| @@ -2903,16 +2902,17 @@ void GMainWindow::UpdateWindowTitle(std::string_view title_name, std::string_vie | |||
| 2903 | } | 2902 | } |
| 2904 | } | 2903 | } |
| 2905 | 2904 | ||
| 2906 | static std::string GetTasStateDescription(TasInput::TasState state) { | 2905 | QString GMainWindow::GetTasStateDescription() const { |
| 2907 | switch (state) { | 2906 | auto [tas_status, current_tas_frame, total_tas_frames] = input_subsystem->GetTas()->GetStatus(); |
| 2907 | switch (tas_status) { | ||
| 2908 | case TasInput::TasState::Running: | 2908 | case TasInput::TasState::Running: |
| 2909 | return "Running"; | 2909 | return tr("TAS state: Running %1/%2").arg(current_tas_frame).arg(total_tas_frames); |
| 2910 | case TasInput::TasState::Recording: | 2910 | case TasInput::TasState::Recording: |
| 2911 | return "Recording"; | 2911 | return tr("TAS state: Recording %1").arg(total_tas_frames); |
| 2912 | case TasInput::TasState::Stopped: | 2912 | case TasInput::TasState::Stopped: |
| 2913 | return "Stopped"; | 2913 | return tr("TAS state: Idle %1/%2").arg(current_tas_frame).arg(total_tas_frames); |
| 2914 | default: | 2914 | default: |
| 2915 | return "INVALID STATE"; | 2915 | return tr("INVALID TAS STATE"); |
| 2916 | } | 2916 | } |
| 2917 | } | 2917 | } |
| 2918 | 2918 | ||
| @@ -2923,12 +2923,7 @@ void GMainWindow::UpdateStatusBar() { | |||
| 2923 | } | 2923 | } |
| 2924 | 2924 | ||
| 2925 | if (Settings::values.tas_enable) { | 2925 | if (Settings::values.tas_enable) { |
| 2926 | auto [tas_status, current_tas_frame, total_tas_frames] = | 2926 | tas_label->setText(GetTasStateDescription()); |
| 2927 | input_subsystem->GetTas()->GetStatus(); | ||
| 2928 | tas_label->setText(tr("%1 TAS %2/%3") | ||
| 2929 | .arg(tr(GetTasStateDescription(tas_status).c_str())) | ||
| 2930 | .arg(current_tas_frame) | ||
| 2931 | .arg(total_tas_frames)); | ||
| 2932 | } else { | 2927 | } else { |
| 2933 | tas_label->clear(); | 2928 | tas_label->clear(); |
| 2934 | } | 2929 | } |
diff --git a/src/yuzu/main.h b/src/yuzu/main.h index 867a0003c..610b59ee5 100644 --- a/src/yuzu/main.h +++ b/src/yuzu/main.h | |||
| @@ -301,6 +301,7 @@ private: | |||
| 301 | void OpenURL(const QUrl& url); | 301 | void OpenURL(const QUrl& url); |
| 302 | void LoadTranslation(); | 302 | void LoadTranslation(); |
| 303 | void OpenPerGameConfiguration(u64 title_id, const std::string& file_name); | 303 | void OpenPerGameConfiguration(u64 title_id, const std::string& file_name); |
| 304 | QString GetTasStateDescription() const; | ||
| 304 | 305 | ||
| 305 | Ui::MainWindow ui; | 306 | Ui::MainWindow ui; |
| 306 | 307 | ||