| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
#pragma once |
| 10 |
|
| 11 |
#include <windows.h> |
| 12 |
#include <XInput.h> |
| 13 |
|
| 14 |
#include "InputCommon/ControllerInterface/ControllerInterface.h" |
| 15 |
|
| 16 |
#ifndef XINPUT_DEVSUBTYPE_FLIGHT_STICK |
| 17 |
#error You are building this module against the wrong version of DirectX. You probably need to remove DXSDK_DIR from your include path and/or _WIN32_WINNT is wrong. |
| 18 |
#endif |
| 19 |
|
| 20 |
namespace ciface::XInput |
| 21 |
{ |
| 22 |
void Init(); |
| 23 |
void PopulateDevices(); |
| 24 |
void DeInit(); |
| 25 |
|
| 26 |
class Device final : public Core::Device |
| 27 |
{ |
| 28 |
public: |
| 29 |
Device(const XINPUT_CAPABILITIES& capabilities, u8 index); |
| 30 |
|
| 31 |
std::string GetName() const override; |
| 32 |
std::string GetSource() const override; |
| 33 |
std::optional<int> GetPreferredId() const override; |
| 34 |
int GetSortPriority() const override { return -2; } |
| 35 |
|
| 36 |
Core::DeviceRemoval UpdateInput() override; |
| 37 |
|
| 38 |
void UpdateMotors(); |
| 39 |
|
| 40 |
private: |
| 41 |
XINPUT_STATE m_state_in{}; |
| 42 |
XINPUT_VIBRATION m_state_out{}; |
| 43 |
ControlState m_battery_level{}; |
| 44 |
const BYTE m_subtype; |
| 45 |
const u8 m_index; |
| 46 |
}; |
| 47 |
} |