summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgerman77 <juangerman-13@hotmail.com>2021-09-21 02:59:09 +0200
committerNarr the Reg <juangerman-13@hotmail.com>2021-11-25 03:30:23 +0100
commit456397ed39a6966e1a1e333090e778c0d3414858 (patch)
tree8c44903901c7e5f8975462b619badd81059c76ef
parentcore/emu_window: Remove touch input (diff)
downloadyuzu-456397ed39a6966e1a1e333090e778c0d3414858.tar
yuzu-456397ed39a6966e1a1e333090e778c0d3414858.tar.gz
yuzu-456397ed39a6966e1a1e333090e778c0d3414858.tar.bz2
yuzu-456397ed39a6966e1a1e333090e778c0d3414858.tar.lz
yuzu-456397ed39a6966e1a1e333090e778c0d3414858.tar.xz
yuzu-456397ed39a6966e1a1e333090e778c0d3414858.tar.zst
yuzu-456397ed39a6966e1a1e333090e778c0d3414858.zip
-rw-r--r--src/yuzu/debugger/controller.cpp32
-rw-r--r--src/yuzu/debugger/controller.h19
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 @@
#include <QLayout>
#include <QString>
#include "common/settings.h"
-#include "input_common/main.h"
+#include "core/core.h"
#include "yuzu/configuration/configure_input_player_widget.h"
#include "yuzu/debugger/controller.h"
-ControllerDialog::ControllerDialog(QWidget* parent, InputCommon::InputSubsystem* input_subsystem_)
- : QWidget(parent, Qt::Dialog), input_subsystem{input_subsystem_} {
+ControllerDialog::ControllerDialog(QWidget* parent) : QWidget(parent, Qt::Dialog) {
setObjectName(QStringLiteral("Controller"));
setWindowTitle(tr("Controller P1"));
resize(500, 350);
@@ -21,7 +20,8 @@ ControllerDialog::ControllerDialog(QWidget* parent, InputCommon::InputSubsystem*
Qt::WindowMaximizeButtonHint);
widget = new PlayerControlPreview(this);
- refreshConfiguration();
+ widget->SetController(Core::System::GetInstance().HIDCore().GetEmulatedController(
+ Core::HID::NpadIdType::Player1));
QLayout* layout = new QVBoxLayout(this);
layout->setContentsMargins(0, 0, 0, 0);
layout->addWidget(widget);
@@ -30,22 +30,10 @@ ControllerDialog::ControllerDialog(QWidget* parent, InputCommon::InputSubsystem*
// Configure focus so that widget is focusable and the dialog automatically forwards focus to
// it.
setFocusProxy(widget);
- widget->SetConnectedStatus(false);
widget->setFocusPolicy(Qt::StrongFocus);
widget->setFocus();
}
-void ControllerDialog::refreshConfiguration() {
- const auto& players = Settings::values.players.GetValue();
- constexpr std::size_t player = 0;
- widget->SetPlayerInputRaw(player, players[player].buttons, players[player].analogs);
- widget->SetControllerType(players[player].controller_type);
- ControllerCallback callback{[this](ControllerInput input) { InputController(input); }};
- widget->SetCallBack(callback);
- widget->repaint();
- widget->SetConnectedStatus(players[player].connected);
-}
-
QAction* ControllerDialog::toggleViewAction() {
if (toggle_view_action == nullptr) {
toggle_view_action = new QAction(tr("&Controller P1"), this);
@@ -61,7 +49,6 @@ void ControllerDialog::showEvent(QShowEvent* ev) {
if (toggle_view_action) {
toggle_view_action->setChecked(isVisible());
}
- refreshConfiguration();
QWidget::showEvent(ev);
}
@@ -69,16 +56,5 @@ void ControllerDialog::hideEvent(QHideEvent* ev) {
if (toggle_view_action) {
toggle_view_action->setChecked(isVisible());
}
- widget->SetConnectedStatus(false);
QWidget::hideEvent(ev);
}
-
-void ControllerDialog::InputController(ControllerInput input) {
- u32 buttons = 0;
- int index = 0;
- for (bool btn : input.button_values) {
- buttons |= (btn ? 1U : 0U) << index;
- index++;
- }
- //input_subsystem->GetTas()->RecordInput(buttons, input.axis_values);
-}
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 @@
#pragma once
-#include <QFileSystemWatcher>
#include <QWidget>
-#include "common/settings.h"
class QAction;
class QHideEvent;
@@ -17,35 +15,20 @@ namespace InputCommon {
class InputSubsystem;
}
-struct ControllerInput {
- std::array<std::pair<float, float>, Settings::NativeAnalog::NUM_STICKS_HID> axis_values{};
- std::array<bool, Settings::NativeButton::NumButtons> button_values{};
- bool changed{};
-};
-
-struct ControllerCallback {
- std::function<void(ControllerInput)> input;
-};
-
class ControllerDialog : public QWidget {
Q_OBJECT
public:
- explicit ControllerDialog(QWidget* parent = nullptr,
- InputCommon::InputSubsystem* input_subsystem_ = nullptr);
+ explicit ControllerDialog(QWidget* parent = nullptr);
/// Returns a QAction that can be used to toggle visibility of this dialog.
QAction* toggleViewAction();
- void refreshConfiguration();
protected:
void showEvent(QShowEvent* ev) override;
void hideEvent(QHideEvent* ev) override;
private:
- void InputController(ControllerInput input);
QAction* toggle_view_action = nullptr;
- QFileSystemWatcher* watcher = nullptr;
PlayerControlPreview* widget;
- InputCommon::InputSubsystem* input_subsystem;
};