Debian Codegraph @

Source/Core/InputCommon/ControllerInterface/XInput/XInput.h

raw symbols SCIP
1 // Copyright 2010 Dolphin Emulator Project
2 // SPDX-License-Identifier: GPL-2.0-or-later
3
4 // XInput suffers a similar issue as XAudio2. Since Win8, it is part of the OS.
5 // However, unlike XAudio2 they have not made the API incompatible - so we just
6 // compile against the latest version and fall back to dynamically loading the
7 // old DLL.
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 } // namespace ciface::XInput