early-access version 2201

This commit is contained in:
pineappleEA
2021-11-15 02:13:48 +01:00
parent ecea1de808
commit e7e23d3a10
88 changed files with 4284 additions and 4864 deletions
+22 -16
View File
@@ -4,9 +4,7 @@
#pragma once
#include <QFileSystemWatcher>
#include <QWidget>
#include "common/settings.h"
class QAction;
class QHideEvent;
@@ -17,35 +15,43 @@ 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;
};
namespace Core::HID {
class HIDCore;
class EmulatedController;
enum class ControllerTriggerType;
} // namespace Core::HID
class ControllerDialog : public QWidget {
Q_OBJECT
public:
explicit ControllerDialog(QWidget* parent = nullptr,
InputCommon::InputSubsystem* input_subsystem_ = nullptr);
explicit ControllerDialog(Core::HID::HIDCore& hid_core_,
std::shared_ptr<InputCommon::InputSubsystem> input_subsystem_,
QWidget* parent = nullptr);
/// Returns a QAction that can be used to toggle visibility of this dialog.
QAction* toggleViewAction();
/// Reloads the widget to apply any changes in the configuration
void refreshConfiguration();
/// Disables events from the emulated controller
void UnloadController();
protected:
void showEvent(QShowEvent* ev) override;
void hideEvent(QHideEvent* ev) override;
private:
void InputController(ControllerInput input);
/// Redirects input from the widget to the TAS driver
void ControllerUpdate(Core::HID::ControllerTriggerType type);
int callback_key;
bool is_controller_set{};
Core::HID::EmulatedController* controller;
QAction* toggle_view_action = nullptr;
QFileSystemWatcher* watcher = nullptr;
PlayerControlPreview* widget;
InputCommon::InputSubsystem* input_subsystem;
Core::HID::HIDCore& hid_core;
std::shared_ptr<InputCommon::InputSubsystem> input_subsystem;
};