diff options
| author | 2021-09-20 19:59:09 -0500 | |
|---|---|---|
| committer | 2021-11-24 20:30:23 -0600 | |
| commit | 456397ed39a6966e1a1e333090e778c0d3414858 (patch) | |
| tree | 8c44903901c7e5f8975462b619badd81059c76ef /src | |
| parent | core/emu_window: Remove touch input (diff) | |
| download | yuzu-456397ed39a6966e1a1e333090e778c0d3414858.tar.gz yuzu-456397ed39a6966e1a1e333090e778c0d3414858.tar.xz yuzu-456397ed39a6966e1a1e333090e778c0d3414858.zip | |
debugger/controller: Remove TAS
Diffstat (limited to 'src')
| -rw-r--r-- | src/yuzu/debugger/controller.cpp | 32 | ||||
| -rw-r--r-- | src/yuzu/debugger/controller.h | 19 |
2 files changed, 5 insertions, 46 deletions
diff --git a/src/yuzu/debugger/controller.cpp b/src/yuzu/debugger/controller.cpp index 0e190a3d5..d8e41f8b6 100644 --- a/src/yuzu/debugger/controller.cpp +++ b/src/yuzu/debugger/controller.cpp | |||
| @@ -6,12 +6,11 @@ | |||
| 6 | #include <QLayout> | 6 | #include <QLayout> |
| 7 | #include <QString> | 7 | #include <QString> |
| 8 | #include "common/settings.h" | 8 | #include "common/settings.h" |
| 9 | #include "input_common/main.h" | 9 | #include "core/core.h" |
| 10 | #include "yuzu/configuration/configure_input_player_widget.h" | 10 | #include "yuzu/configuration/configure_input_player_widget.h" |
| 11 | #include "yuzu/debugger/controller.h" | 11 | #include "yuzu/debugger/controller.h" |
| 12 | 12 | ||
| 13 | ControllerDialog::ControllerDialog(QWidget* parent, InputCommon::InputSubsystem* input_subsystem_) | 13 | ControllerDialog::ControllerDialog(QWidget* parent) : QWidget(parent, Qt::Dialog) { |
| 14 | : QWidget(parent, Qt::Dialog), input_subsystem{input_subsystem_} { | ||
| 15 | setObjectName(QStringLiteral("Controller")); | 14 | setObjectName(QStringLiteral("Controller")); |
| 16 | setWindowTitle(tr("Controller P1")); | 15 | setWindowTitle(tr("Controller P1")); |
| 17 | resize(500, 350); | 16 | resize(500, 350); |
| @@ -21,7 +20,8 @@ ControllerDialog::ControllerDialog(QWidget* parent, InputCommon::InputSubsystem* | |||
| 21 | Qt::WindowMaximizeButtonHint); | 20 | Qt::WindowMaximizeButtonHint); |
| 22 | 21 | ||
| 23 | widget = new PlayerControlPreview(this); | 22 | widget = new PlayerControlPreview(this); |
| 24 | refreshConfiguration(); | 23 | widget->SetController(Core::System::GetInstance().HIDCore().GetEmulatedController( |
| 24 | Core::HID::NpadIdType::Player1)); | ||
| 25 | QLayout* layout = new QVBoxLayout(this); | 25 | QLayout* layout = new QVBoxLayout(this); |
| 26 | layout->setContentsMargins(0, 0, 0, 0); | 26 | layout->setContentsMargins(0, 0, 0, 0); |
| 27 | layout->addWidget(widget); | 27 | layout->addWidget(widget); |
| @@ -30,22 +30,10 @@ ControllerDialog::ControllerDialog(QWidget* parent, InputCommon::InputSubsystem* | |||
| 30 | // Configure focus so that widget is focusable and the dialog automatically forwards focus to | 30 | // Configure focus so that widget is focusable and the dialog automatically forwards focus to |
| 31 | // it. | 31 | // it. |
| 32 | setFocusProxy(widget); | 32 | setFocusProxy(widget); |
| 33 | widget->SetConnectedStatus(false); | ||
| 34 | widget->setFocusPolicy(Qt::StrongFocus); | 33 | widget->setFocusPolicy(Qt::StrongFocus); |
| 35 | widget->setFocus(); | 34 | widget->setFocus(); |
| 36 | } | 35 | } |
| 37 | 36 | ||
| 38 | void ControllerDialog::refreshConfiguration() { | ||
| 39 | const auto& players = Settings::values.players.GetValue(); | ||
| 40 | constexpr std::size_t player = 0; | ||
| 41 | widget->SetPlayerInputRaw(player, players[player].buttons, players[player].analogs); | ||
| 42 | widget->SetControllerType(players[player].controller_type); | ||
| 43 | ControllerCallback callback{[this](ControllerInput input) { InputController(input); }}; | ||
| 44 | widget->SetCallBack(callback); | ||
| 45 | widget->repaint(); | ||
| 46 | widget->SetConnectedStatus(players[player].connected); | ||
| 47 | } | ||
| 48 | |||
| 49 | QAction* ControllerDialog::toggleViewAction() { | 37 | QAction* ControllerDialog::toggleViewAction() { |
| 50 | if (toggle_view_action == nullptr) { | 38 | if (toggle_view_action == nullptr) { |
| 51 | toggle_view_action = new QAction(tr("&Controller P1"), this); | 39 | toggle_view_action = new QAction(tr("&Controller P1"), this); |
| @@ -61,7 +49,6 @@ void ControllerDialog::showEvent(QShowEvent* ev) { | |||
| 61 | if (toggle_view_action) { | 49 | if (toggle_view_action) { |
| 62 | toggle_view_action->setChecked(isVisible()); | 50 | toggle_view_action->setChecked(isVisible()); |
| 63 | } | 51 | } |
| 64 | refreshConfiguration(); | ||
| 65 | QWidget::showEvent(ev); | 52 | QWidget::showEvent(ev); |
| 66 | } | 53 | } |
| 67 | 54 | ||
| @@ -69,16 +56,5 @@ void ControllerDialog::hideEvent(QHideEvent* ev) { | |||
| 69 | if (toggle_view_action) { | 56 | if (toggle_view_action) { |
| 70 | toggle_view_action->setChecked(isVisible()); | 57 | toggle_view_action->setChecked(isVisible()); |
| 71 | } | 58 | } |
| 72 | widget->SetConnectedStatus(false); | ||
| 73 | QWidget::hideEvent(ev); | 59 | QWidget::hideEvent(ev); |
| 74 | } | 60 | } |
| 75 | |||
| 76 | void ControllerDialog::InputController(ControllerInput input) { | ||
| 77 | u32 buttons = 0; | ||
| 78 | int index = 0; | ||
| 79 | for (bool btn : input.button_values) { | ||
| 80 | buttons |= (btn ? 1U : 0U) << index; | ||
| 81 | index++; | ||
| 82 | } | ||
| 83 | //input_subsystem->GetTas()->RecordInput(buttons, input.axis_values); | ||
| 84 | } | ||
diff --git a/src/yuzu/debugger/controller.h b/src/yuzu/debugger/controller.h index 7742db58b..697489cbb 100644 --- a/src/yuzu/debugger/controller.h +++ b/src/yuzu/debugger/controller.h | |||
| @@ -4,9 +4,7 @@ | |||
| 4 | 4 | ||
| 5 | #pragma once | 5 | #pragma once |
| 6 | 6 | ||
| 7 | #include <QFileSystemWatcher> | ||
| 8 | #include <QWidget> | 7 | #include <QWidget> |
| 9 | #include "common/settings.h" | ||
| 10 | 8 | ||
| 11 | class QAction; | 9 | class QAction; |
| 12 | class QHideEvent; | 10 | class QHideEvent; |
| @@ -17,35 +15,20 @@ namespace InputCommon { | |||
| 17 | class InputSubsystem; | 15 | class InputSubsystem; |
| 18 | } | 16 | } |
| 19 | 17 | ||
| 20 | struct ControllerInput { | ||
| 21 | std::array<std::pair<float, float>, Settings::NativeAnalog::NUM_STICKS_HID> axis_values{}; | ||
| 22 | std::array<bool, Settings::NativeButton::NumButtons> button_values{}; | ||
| 23 | bool changed{}; | ||
| 24 | }; | ||
| 25 | |||
| 26 | struct ControllerCallback { | ||
| 27 | std::function<void(ControllerInput)> input; | ||
| 28 | }; | ||
| 29 | |||
| 30 | class ControllerDialog : public QWidget { | 18 | class ControllerDialog : public QWidget { |
| 31 | Q_OBJECT | 19 | Q_OBJECT |
| 32 | 20 | ||
| 33 | public: | 21 | public: |
| 34 | explicit ControllerDialog(QWidget* parent = nullptr, | 22 | explicit ControllerDialog(QWidget* parent = nullptr); |
| 35 | InputCommon::InputSubsystem* input_subsystem_ = nullptr); | ||
| 36 | 23 | ||
| 37 | /// Returns a QAction that can be used to toggle visibility of this dialog. | 24 | /// Returns a QAction that can be used to toggle visibility of this dialog. |
| 38 | QAction* toggleViewAction(); | 25 | QAction* toggleViewAction(); |
| 39 | void refreshConfiguration(); | ||
| 40 | 26 | ||
| 41 | protected: | 27 | protected: |
| 42 | void showEvent(QShowEvent* ev) override; | 28 | void showEvent(QShowEvent* ev) override; |
| 43 | void hideEvent(QHideEvent* ev) override; | 29 | void hideEvent(QHideEvent* ev) override; |
| 44 | 30 | ||
| 45 | private: | 31 | private: |
| 46 | void InputController(ControllerInput input); | ||
| 47 | QAction* toggle_view_action = nullptr; | 32 | QAction* toggle_view_action = nullptr; |
| 48 | QFileSystemWatcher* watcher = nullptr; | ||
| 49 | PlayerControlPreview* widget; | 33 | PlayerControlPreview* widget; |
| 50 | InputCommon::InputSubsystem* input_subsystem; | ||
| 51 | }; | 34 | }; |