Support for SDL Joysticks

This enables use of non-controller peripherals,
such as DirectInput steering wheels or flight sticks
This commit is contained in:
Silent
2020-11-15 14:56:52 +01:00
parent 99ec667b20
commit 2880b71b48
14 changed files with 570 additions and 73 deletions

View File

@ -2,6 +2,8 @@
#include "frontend-common/controller_interface.h"
#include <QtCore/QObject>
#include <memory>
#include <vector>
// NOTE: Those Monitor classes must be copyable to meet the requirements of std::function, but at the same time we want
// copies to be opaque to the caling code and share context. Therefore, all mutable context of the monitor (if required)
@ -29,8 +31,25 @@ public:
ControllerInterface::Hook::CallbackResult operator()(const ControllerInterface::Hook& ei) const;
private:
bool ProcessAxisInput(const ControllerInterface::Hook& ei, std::optional<bool>& half_axis_positive,
std::optional<bool>& inverted) const;
bool AnalyzeInputHistory(std::optional<bool>& half_axis_positive, std::optional<bool>& inverted) const;
struct Context
{
struct History
{
int controller_index;
int axis_number;
float value;
};
std::vector<History> m_inputs_history;
};
QObject* m_parent;
Controller::AxisType m_axis_type;
std::shared_ptr<Context> m_context = std::make_shared<Context>();
};
class InputRumbleBindingMonitor