CommonLibSSE NG
BSInputDeviceManager.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "RE/B/BSFixedString.h"
4 #include "RE/B/BSTEvent.h"
5 #include "RE/B/BSTSingleton.h"
6 #include "RE/I/InputDevices.h"
7 
8 namespace RE
9 {
10  class BSIInputDevice;
11  class BSInputDevice;
12  class BSPCGamepadDeviceDelegate;
13  class BSPCGamepadDeviceHandler;
14  class BSTrackedControllerDevice;
15  class BSWin32KeyboardDevice;
16  class BSWin32MouseDevice;
17  class BSWin32VirtualKeyboardDevice;
18  class InputEvent;
19  struct BSRemoteGamepadEvent;
20 
22  public BSTEventSource<InputEvent*>, // 00
23  public BSTSingletonSDM<BSInputDeviceManager> // 58
24  {
25  public:
26  struct RUNTIME_DATA
27  {
28 #define RUNTIME_DATA_CONTENT \
29  bool queuedGamepadEnableValue{ false }; /* 00 */ \
30  bool valueQueued{ false }; /* 01 */ \
31  bool pollingEnabled{ false }; /* 02 */ \
32  std::uint8_t pad03; /* 03 */ \
33  std::uint32_t pad04; /* 04 */ \
34  BSTEventSource<BSRemoteGamepadEvent> remoteGamepadEventSource; /* 08 */ \
35  std::uint8_t unk60; /* 60 */ \
36  std::uint8_t unk61; /* 61 */ \
37  std::uint16_t unk62; /* 62 */ \
38  std::uint32_t unk64; /* 64 */ \
39  std::uint64_t unk68; /* 68 */
40 
42  };
43  static_assert(sizeof(RUNTIME_DATA) == 0x70);
44 
46 
54  [[nodiscard]] bool IsGamepadConnected();
55  [[nodiscard]] bool IsGamepadEnabled();
56  [[nodiscard]] bool IsMouseBackground();
57  bool GetDeviceKeyMapping(INPUT_DEVICE a_device, std::uint32_t a_key, BSFixedString& a_mapping);
58  bool GetDeviceMappedKeycode(INPUT_DEVICE a_device, std::uint32_t a_key, std::uint32_t& a_outKeyCode);
64  void PollInputDevices(float a_secsSinceLastFrame);
65 
66  [[nodiscard]] inline RUNTIME_DATA& GetRuntimeData() noexcept
67  {
68  return REL::RelocateMember<RUNTIME_DATA>(this, 0x80, 0x98);
69  }
70 
71  [[nodiscard]] inline const RUNTIME_DATA& GetRuntimeData() const noexcept
72  {
73  return REL::RelocateMember<RUNTIME_DATA>(this, 0x80, 0x98);
74  }
75 
76  // members
77  std::uint8_t pad59; // 59
78  std::uint16_t pad5A; // 5A
79  std::uint32_t pad5C; // 5C
81 #ifndef SKYRIM_CROSS_VR
82 # if !defined(ENABLE_SKYRIM_AE) && !defined(ENABLE_SKYRIM_SE)
86 # elif !defined(ENABLE_SKYRIM_VR)
88 # endif
89 #endif
90  };
91 #ifndef ENABLE_SKYRIM_VR
92  static_assert(sizeof(BSInputDeviceManager) == 0xF0);
93 #elif !defined(ENABLE_SKYRIM_AE) && !defined(ENABLE_SKYRIM_SE)
94  static_assert(sizeof(BSInputDeviceManager) == 0x108);
95 #else
96  static_assert(sizeof(BSInputDeviceManager) == 0x80);
97 #endif
98 }
99 #undef RUNTIME_DATA_CONTENT
#define RUNTIME_DATA_CONTENT
Definition: BSInputDeviceManager.h:28
Definition: BSIInputDevice.h:9
Definition: BSInputDeviceManager.h:24
BSIInputDevice * devices[4]
Definition: BSInputDeviceManager.h:80
std::uint32_t pad5C
Definition: BSInputDeviceManager.h:79
bool GetDeviceMappedKeycode(INPUT_DEVICE a_device, std::uint32_t a_key, std::uint32_t &a_outKeyCode)
void PollInputDevices(float a_secsSinceLastFrame)
BSTrackedControllerDevice * GetVRControllerLeft()
BSTrackedControllerDevice * vrDevices[2]
Definition: BSInputDeviceManager.h:84
RUNTIME_DATA & GetRuntimeData() noexcept
Definition: BSInputDeviceManager.h:66
BSWin32VirtualKeyboardDevice * GetVirtualKeyboard()
BSTrackedControllerDevice * unkDevice
Definition: BSInputDeviceManager.h:83
BSPCGamepadDeviceDelegate * GetGamepad()
static BSInputDeviceManager * GetSingleton()
const RUNTIME_DATA & GetRuntimeData() const noexcept
Definition: BSInputDeviceManager.h:71
BSWin32MouseDevice * GetMouse()
bool GetDeviceKeyMapping(INPUT_DEVICE a_device, std::uint32_t a_key, BSFixedString &a_mapping)
BSTrackedControllerDevice * GetVRControllerRight()
BSPCGamepadDeviceHandler * GetGamepadHandler()
BSWin32KeyboardDevice * GetKeyboard()
std::uint16_t pad5A
Definition: BSInputDeviceManager.h:78
std::uint8_t pad59
Definition: BSInputDeviceManager.h:77
Definition: BSPCGamepadDeviceDelegate.h:10
Definition: BSPCGamepadDeviceHandler.h:10
Definition: BSTEvent.h:19
Definition: BSTrackedControllerDevice.h:9
Definition: BSWin32KeyboardDevice.h:10
Definition: BSWin32MouseDevice.h:11
Definition: BSWin32VirtualKeyboardDevice.h:8
Definition: AbsorbEffect.h:6
Definition: BSInputDeviceManager.h:27
Definition: BSTSingleton.h:50
INPUT_DEVICE
Definition: InputDevices.h:8