Skip to content

Commit 296a3bb

Browse files
authored
Merge pull request #24 from qudix/dev
feat: misc
2 parents d8b201e + 1ee55e4 commit 296a3bb

4 files changed

Lines changed: 43 additions & 23 deletions

File tree

CommonLibF4/include/RE/Bethesda/IMenu.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ namespace RE
400400
bool menuCanBeVisible{ true }; // 61
401401
bool hasQuadsForCumstomRenderer{ false }; // 62
402402
bool hasDoneFirstAdvanceMovie{ false }; // 63
403-
REX::EnumSet<UI_DEPTH_PRIORITY, std::uint8_t> depthPriority{ UI_DEPTH_PRIORITY::kStandard }; // 64
403+
UI_DEPTH_PRIORITY depthPriority{ UI_DEPTH_PRIORITY::kStandard }; // 64
404404
REX::EnumSet<UserEvents::INPUT_CONTEXT_ID, std::int32_t> inputContext{ UserEvents::INPUT_CONTEXT_ID::kNone }; // 68
405405
};
406406
static_assert(sizeof(IMenu) == 0x70);

CommonLibF4/include/RE/Bethesda/PlayerControls.h

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ namespace RE
2222
struct AutoMoveHandler;
2323
struct GrabRotationHandler;
2424
struct JumpHandler;
25-
struct LookHandler;
2625
struct MeleeThrowHandler;
2726
struct MovementHandler;
2827
struct ReadyWeaponHandler;
@@ -138,6 +137,22 @@ namespace RE
138137
};
139138
static_assert(sizeof(HeldStateHandler) == 0x28);
140139

140+
class LookHandler :
141+
public PlayerInputHandler
142+
{
143+
public:
144+
static constexpr auto RTTI{ RTTI::LookHandler };
145+
static constexpr auto VTABLE{ VTABLE::LookHandler };
146+
147+
explicit constexpr LookHandler(PlayerControlsData& a_data) noexcept :
148+
PlayerInputHandler(a_data)
149+
{}
150+
151+
// members
152+
float thumbstickMaxedSec{ 0.0f }; // 20
153+
};
154+
static_assert(sizeof(LookHandler) == 0x28);
155+
141156
class __declspec(novtable) PlayerControls :
142157
BSInputEventReceiver, // 000
143158
BSTEventSink<MenuOpenCloseEvent>, // 010
@@ -154,7 +169,7 @@ namespace RE
154169

155170
static PlayerControls* GetSingleton()
156171
{
157-
static REL::Relocation<PlayerControls**> singleton{ REL::ID(544871) };
172+
static REL::Relocation<PlayerControls**> singleton{ REL::ID(2692013) };
158173
return *singleton;
159174
}
160175

CommonLibF4/include/REL/IDDB.h

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -24,26 +24,7 @@ namespace REL
2424
return singleton;
2525
}
2626

27-
[[nodiscard]] std::size_t id2offset(std::uint64_t a_id) const
28-
{
29-
if (_id2offset.empty()) {
30-
stl::report_and_fail("data is empty"sv);
31-
}
32-
33-
const mapping_t elem{ a_id, 0 };
34-
const auto it = std::lower_bound(
35-
_id2offset.begin(),
36-
_id2offset.end(),
37-
elem,
38-
[](auto&& a_lhs, auto&& a_rhs) {
39-
return a_lhs.id < a_rhs.id;
40-
});
41-
if (it == _id2offset.end()) {
42-
stl::report_and_fail("id not found"sv);
43-
}
44-
45-
return static_cast<std::size_t>(it->offset);
46-
}
27+
[[nodiscard]] std::size_t id2offset(std::uint64_t a_id) const;
4728

4829
protected:
4930
friend class Offset2ID;

CommonLibF4/src/REL/IDDB.cpp

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#include "REL/IDDB.h"
2+
#include "REL/Module.h"
23
#include "REL/Version.h"
34

45
#include "REX/W32/BCRYPT.h"
@@ -105,4 +106,27 @@ namespace REL
105106
*reinterpret_cast<const std::uint64_t*>(_mmap.data())
106107
};
107108
}
109+
110+
std::size_t IDDB::id2offset(std::uint64_t a_id) const
111+
{
112+
if (_id2offset.empty()) {
113+
stl::report_and_fail("data is empty"sv);
114+
}
115+
116+
const mapping_t elem{ a_id, 0 };
117+
const auto it = std::lower_bound(
118+
_id2offset.begin(),
119+
_id2offset.end(),
120+
elem,
121+
[](auto&& a_lhs, auto&& a_rhs) {
122+
return a_lhs.id < a_rhs.id;
123+
});
124+
if (it == _id2offset.end()) {
125+
const auto version = Module::get().version();
126+
const auto str = std::format("id {} not found!\ngame version: {}"sv, a_id, version.string());
127+
stl::report_and_fail(str);
128+
}
129+
130+
return static_cast<std::size_t>(it->offset);
131+
}
108132
}

0 commit comments

Comments
 (0)