CommonLibSSE (Parapets fork)
Loading...
Searching...
No Matches
ControlMap.h
Go to the documentation of this file.
1#pragma once
2
5#include "RE/B/BSTArray.h"
6#include "RE/B/BSTEvent.h"
7#include "RE/B/BSTSingleton.h"
8#include "RE/I/InputDevices.h"
10#include "RE/U/UserEvents.h"
11
12namespace RE
13{
14 class UserEventEnabled;
15
16 class ControlMap :
17 public BSTSingletonSDM<ControlMap>, // 00
18 public BSTEventSource<UserEventEnabled> // 08
19 {
20 public:
23
24 enum : std::uint32_t
25 {
26 kInvalid = static_cast<std::uint8_t>(-1)
27 };
28
30 {
31 public:
32 // members
34 std::uint16_t inputKey; // 08
35 std::uint16_t modifier; // 08
36 std::int8_t indexInContext; // 0C
37 bool remappable; // 0D
38 bool linked; // 0E
40 std::uint32_t pad14; // 14
41 };
42 static_assert(sizeof(UserEventMapping) == 0x18);
43
45 {
46 public:
47 // members
48 BSTArray<UserEventMapping> deviceMappings[INPUT_DEVICES::kTotal]; // 00
49 };
50 static_assert(sizeof(InputContext) == 0x60);
51
53 {
54 public:
55 // members
60 std::uint32_t pad14; // 14
62 };
63 static_assert(sizeof(LinkedMapping) == 0x20);
64
66
67 std::int8_t AllowTextInput(bool a_allow);
68 constexpr bool AreControlsEnabled(UEFlag a_flags) const noexcept { return enabledControls.all(a_flags); }
69 std::uint32_t GetMappedKey(std::string_view a_eventID, INPUT_DEVICE a_device, InputContextID a_context = InputContextID::kGameplay) const;
70 std::string_view GetUserEventName(std::uint32_t a_buttonID, INPUT_DEVICE a_device, InputContextID a_context = InputContextID::kGameplay) const;
71 constexpr bool IsActivateControlsEnabled() const noexcept { return enabledControls.all(UEFlag::kActivate); }
72 constexpr bool IsConsoleControlsEnabled() const noexcept { return enabledControls.all(UEFlag::kConsole); }
73 constexpr bool IsFightingControlsEnabled() const noexcept { return enabledControls.all(UEFlag::kFighting); }
74 constexpr bool IsLookingControlsEnabled() const noexcept { return enabledControls.all(UEFlag::kLooking); }
75 constexpr bool IsMenuControlsEnabled() const noexcept { return enabledControls.all(UEFlag::kMenu); }
76 constexpr bool IsMainFourControlsEnabled() const noexcept { return enabledControls.all(UEFlag::kMainFour); }
77 constexpr bool IsMovementControlsEnabled() const noexcept { return enabledControls.all(UEFlag::kMovement); }
78 constexpr bool IsPOVSwitchControlsEnabled() const noexcept { return enabledControls.all(UEFlag::kPOVSwitch); }
79 constexpr bool IsSneakingControlsEnabled() const noexcept { return enabledControls.all(UEFlag::kSneaking); }
80 constexpr bool IsVATSControlsEnabled() const noexcept { return enabledControls.all(UEFlag::kVATS); }
81 constexpr bool IsWheelZoomControlsEnabled() const noexcept { return enabledControls.all(UEFlag::kWheelZoom); }
82 void ToggleControls(UEFlag a_flags, bool a_enable);
83
84 // members
85 InputContext* controlMap[InputContextID::kTotal]; // 060
90 std::int8_t textEntryCount; // 120
93 std::uint8_t pad123; // 123
95 };
96 static_assert(sizeof(ControlMap) == 0x128);
97}
Definition: BSTArray.h:377
Definition: BSTEvent.h:28
Definition: ControlMap.h:19
std::uint8_t pad123
Definition: ControlMap.h:93
constexpr bool IsFightingControlsEnabled() const noexcept
Definition: ControlMap.h:73
constexpr bool AreControlsEnabled(UEFlag a_flags) const noexcept
Definition: ControlMap.h:68
void ToggleControls(UEFlag a_flags, bool a_enable)
std::int8_t textEntryCount
Definition: ControlMap.h:90
std::int8_t AllowTextInput(bool a_allow)
constexpr bool IsSneakingControlsEnabled() const noexcept
Definition: ControlMap.h:79
constexpr bool IsConsoleControlsEnabled() const noexcept
Definition: ControlMap.h:72
bool ignoreActivateDisabledEvents
Definition: ControlMap.h:92
constexpr bool IsMovementControlsEnabled() const noexcept
Definition: ControlMap.h:77
stl::enumeration< PC_GAMEPAD_TYPE, std::uint32_t > gamePadMapType
Definition: ControlMap.h:94
constexpr bool IsMainFourControlsEnabled() const noexcept
Definition: ControlMap.h:76
std::string_view GetUserEventName(std::uint32_t a_buttonID, INPUT_DEVICE a_device, InputContextID a_context=InputContextID::kGameplay) const
std::uint32_t GetMappedKey(std::string_view a_eventID, INPUT_DEVICE a_device, InputContextID a_context=InputContextID::kGameplay) const
constexpr bool IsPOVSwitchControlsEnabled() const noexcept
Definition: ControlMap.h:78
constexpr bool IsActivateControlsEnabled() const noexcept
Definition: ControlMap.h:71
InputContext * controlMap[InputContextID::kTotal]
Definition: ControlMap.h:85
stl::enumeration< UEFlag, std::uint32_t > enabledControls
Definition: ControlMap.h:88
constexpr bool IsMenuControlsEnabled() const noexcept
Definition: ControlMap.h:75
constexpr bool IsLookingControlsEnabled() const noexcept
Definition: ControlMap.h:74
constexpr bool IsWheelZoomControlsEnabled() const noexcept
Definition: ControlMap.h:81
bool ignoreKeyboardMouse
Definition: ControlMap.h:91
constexpr bool IsVATSControlsEnabled() const noexcept
Definition: ControlMap.h:80
@ kInvalid
Definition: ControlMap.h:26
BSTArray< LinkedMapping > linkedMappings
Definition: ControlMap.h:86
BSTArray< InputContextID > contextPriorityStack
Definition: ControlMap.h:87
stl::enumeration< UEFlag, std::uint32_t > unk11C
Definition: ControlMap.h:89
static ControlMap * GetSingleton()
INPUT_CONTEXT_IDS::INPUT_CONTEXT_ID INPUT_CONTEXT_ID
Definition: UserEvents.h:38
USER_EVENT_FLAG
Definition: UserEvents.h:41
Definition: PCH.h:216
constexpr bool all(Args... a_args) const noexcept
Definition: PCH.h:288
Definition: AbsorbEffect.h:6
Definition: BSTSingleton.h:50
Definition: ControlMap.h:45
BSTArray< UserEventMapping > deviceMappings[INPUT_DEVICES::kTotal]
Definition: ControlMap.h:48
Definition: ControlMap.h:53
std::uint32_t pad14
Definition: ControlMap.h:60
BSFixedString linkFromName
Definition: ControlMap.h:61
InputContextID linkedMappingContext
Definition: ControlMap.h:57
INPUT_DEVICE device
Definition: ControlMap.h:58
BSFixedString linkedMappingName
Definition: ControlMap.h:56
InputContextID linkFromContext
Definition: ControlMap.h:59
Definition: ControlMap.h:30
stl::enumeration< UEFlag, std::uint32_t > userEventGroupFlag
Definition: ControlMap.h:39
std::int8_t indexInContext
Definition: ControlMap.h:36
BSFixedString eventID
Definition: ControlMap.h:33
std::uint16_t modifier
Definition: ControlMap.h:35
std::uint16_t inputKey
Definition: ControlMap.h:34
bool linked
Definition: ControlMap.h:38
bool remappable
Definition: ControlMap.h:37
std::uint32_t pad14
Definition: ControlMap.h:40
INPUT_DEVICE
Definition: InputDevices.h:8
INPUT_CONTEXT_ID
Definition: UserEvents.h:14