summaryrefslogtreecommitdiff
path: root/src/yuzu/debugger/controller.h
diff options
context:
space:
mode:
authorMonsterDruide1 <5958456@gmail.com>2021-06-18 16:15:42 +0200
committerMonsterDruide1 <5958456@gmail.com>2021-09-18 23:22:00 +0200
commitb42c3ce21db249d5e3bc04b4f73202e757da317c (patch)
treec5ccf9e311d2a675b0e2afff3d85ed4654047b5e /src/yuzu/debugger/controller.h
parent35f46fc079d9534df7850eca3ce29e89e04d8914 (diff)
input_common/tas: Base playback & recording system
The base playback system supports up to 8 controllers (specified by `PLAYER_NUMBER` in `tas_input.h`), which all change their inputs simulataneously when `TAS::UpdateThread` is called. The recording system uses the controller debugger to read the state of the first controller and forwards that data to the TASing system for recording. Currently, this process sadly is not frame-perfect and pixel-accurate. Co-authored-by: Naii-the-Baf <sfabian200@gmail.com> Co-authored-by: Narr-the-Reg <juangerman-13@hotmail.com>
Diffstat (limited to 'src/yuzu/debugger/controller.h')
-rw-r--r--src/yuzu/debugger/controller.h24
1 files changed, 23 insertions, 1 deletions
diff --git a/src/yuzu/debugger/controller.h b/src/yuzu/debugger/controller.h
index c54750070..659923e1b 100644
--- a/src/yuzu/debugger/controller.h
+++ b/src/yuzu/debugger/controller.h
@@ -4,18 +4,36 @@
#pragma once
+#include <QFileSystemWatcher>
#include <QWidget>
+#include "common/settings.h"
class QAction;
class QHideEvent;
class QShowEvent;
class PlayerControlPreview;
+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;
+ std::function<void()> update;
+};
+
class ControllerDialog : public QWidget {
Q_OBJECT
public:
- explicit ControllerDialog(QWidget* parent = nullptr);
+ explicit ControllerDialog(QWidget* parent = nullptr,
+ InputCommon::InputSubsystem* input_subsystem_ = nullptr);
/// Returns a QAction that can be used to toggle visibility of this dialog.
QAction* toggleViewAction();
@@ -26,6 +44,10 @@ protected:
void hideEvent(QHideEvent* ev) override;
private:
+ void RefreshTasFile();
+ void InputController(ControllerInput input);
QAction* toggle_view_action = nullptr;
+ QFileSystemWatcher* watcher = nullptr;
PlayerControlPreview* widget;
+ InputCommon::InputSubsystem* input_subsystem;
};