Debian Codegraph @

Source/Core/InputCommon/ControllerInterface/DInput/DInputJoystick.h

raw symbols SCIP
1 // Copyright 2010 Dolphin Emulator Project
2 // SPDX-License-Identifier: GPL-2.0-or-later
3
4 #pragma once
5
6 #include "InputCommon/ControllerInterface/CoreDevice.h"
7 #include "InputCommon/ControllerInterface/ForceFeedback/ForceFeedbackDevice.h"
8
9 namespace ciface::DInput
10 {
11 void InitJoystick(IDirectInput8* const idi8, HWND hwnd);
12
13 class Joystick : public ForceFeedback::ForceFeedbackDevice
14 {
15 private:
16 class Button : public Input
17 {
18 public:
19 Button(u8 index, const BYTE& button) : m_button(button), m_index(index) {}
20 std::string GetName() const override;
21 ControlState GetState() const override;
22
23 private:
24 const BYTE& m_button;
25 const u8 m_index;
26 };
27
28 class Axis : public Input
29 {
30 public:
31 Axis(u8 index, const LONG& axis, LONG base, LONG range)
32 : m_axis(axis), m_base(base), m_range(range), m_index(index)
33 {
34 }
35 std::string GetName() const override;
36 ControlState GetState() const override;
37
38 private:
39 const LONG& m_axis;
40 const LONG m_base, m_range;
41 const u8 m_index;
42 };
43
44 class Hat : public Input
45 {
46 public:
47 Hat(u8 index, const DWORD& hat, u8 direction)
48 : m_hat(hat), m_direction(direction), m_index(index)
49 {
50 }
51 std::string GetName() const override;
52 ControlState GetState() const override;
53
54 private:
55 const DWORD& m_hat;
56 const u8 m_index, m_direction;
57 };
58
59 public:
60 Core::DeviceRemoval UpdateInput() override;
61
62 Joystick(const LPDIRECTINPUTDEVICE8 device);
63 ~Joystick() override;
64
65 std::string GetName() const override;
66 std::string GetSource() const override;
67 int GetSortPriority() const override { return -3; }
68
69 bool IsValid() const final;
70
71 private:
72 const LPDIRECTINPUTDEVICE8 m_device;
73
74 DIJOYSTATE m_state_in{};
75
76 bool m_buffered;
77 };
78 } // namespace ciface::DInput