From ae410cb4be3389867800bbdff6ad9c0d0afef414 Mon Sep 17 00:00:00 2001 From: FlenarnTemp <68670981+FlenarnTemp@users.noreply.github.com> Date: Fri, 14 Jun 2024 07:45:58 +0200 Subject: [PATCH] feat: Misc. (#9) * feat: BSRandom. * feat: Inline function as it should be. * feat: More RE'ing, cheers GELUXRUM. * feat: AimModel RE. * feat: Update IDs. * feat: Missing import --- CommonLibF4/cmake/sourcelist.cmake | 1 + CommonLibF4/include/RE/Bethesda/Actor.h | 18 +++++++++ CommonLibF4/include/RE/Bethesda/BSExtraData.h | 38 ++++++++++++++++++- CommonLibF4/include/RE/Bethesda/BSRandom.h | 14 +++++++ CommonLibF4/include/RE/Fallout.h | 1 + .../include/RE/Scaleform/Kernel/SF_Memory.h | 4 +- 6 files changed, 72 insertions(+), 4 deletions(-) create mode 100644 CommonLibF4/include/RE/Bethesda/BSRandom.h diff --git a/CommonLibF4/cmake/sourcelist.cmake b/CommonLibF4/cmake/sourcelist.cmake index 4d1f3063..77c1ccfc 100644 --- a/CommonLibF4/cmake/sourcelist.cmake +++ b/CommonLibF4/cmake/sourcelist.cmake @@ -58,6 +58,7 @@ set(SOURCES include/RE/Bethesda/BSModelDB.h include/RE/Bethesda/BSPointerHandle.h include/RE/Bethesda/BSPreCulledObjects.h + include/RE/Bethesda/BSRandom.h include/RE/Bethesda/BSResource.h include/RE/Bethesda/BSResource/AsyncStream.h include/RE/Bethesda/BSResource/BSResourceEnums.h diff --git a/CommonLibF4/include/RE/Bethesda/Actor.h b/CommonLibF4/include/RE/Bethesda/Actor.h index e03e15c4..e678e448 100644 --- a/CommonLibF4/include/RE/Bethesda/Actor.h +++ b/CommonLibF4/include/RE/Bethesda/Actor.h @@ -6,6 +6,7 @@ #include "RE/Bethesda/BSLock.h" #include "RE/Bethesda/BSPointerHandle.h" #include "RE/Bethesda/BSSoundHandle.h" +#include "RE/Bethesda/BSSpring.h" #include "RE/Bethesda/BSTArray.h" #include "RE/Bethesda/BSTEvent.h" #include "RE/Bethesda/BSTSingleton.h" @@ -235,6 +236,23 @@ namespace RE }; static_assert(sizeof(SubGraphIdleRootData) == 0x18); + class __declspec(novtable) AimModel + { + public: + BGSAimModel::Data aimModelData; // 00 + BSSpring::SpringState recoilSpring; // 40 + BSSpring::SpringState recoilDiminishSpring; // 54 + NiPoint2 targetRecoilHead; // 68 + NiPoint2 currentRecoilHead; // 70 + NiPoint2 prevRecoilRad; // 78 + NiPoint2 preShotAimRad; // 80 + Actor* actor; // 88 + float fireConeSize; // 90 + float lastShotDeltaMs; // 94 + unsigned int continuousShots; // 98 + }; + static_assert(sizeof(AimModel) == 0xA0); + class __declspec(novtable) EquippedItemData : public NiRefObject // 00 { diff --git a/CommonLibF4/include/RE/Bethesda/BSExtraData.h b/CommonLibF4/include/RE/Bethesda/BSExtraData.h index e7c0127b..c10760b3 100644 --- a/CommonLibF4/include/RE/Bethesda/BSExtraData.h +++ b/CommonLibF4/include/RE/Bethesda/BSExtraData.h @@ -6,6 +6,7 @@ #include "RE/Bethesda/BSTArray.h" #include "RE/Bethesda/BSTSmartPointer.h" #include "RE/Bethesda/BSTTuple.h" +#include "RE/Bethesda/FormComponents.h" #include "RE/Bethesda/MemoryManager.h" #include "RE/NetImmerse/NiPoint.h" @@ -66,7 +67,7 @@ namespace RE kRangeDistOverride, kTimeLeft, kCharge, - kLight, + kLight, // ExtraLight kLock, // ExtraLock kTeleport, // ExtraTeleport kMapMarker, @@ -170,7 +171,7 @@ namespace RE kOutfitItem, kEditorLocation, kLeveledItemBase, - kLightData, + kLightData, // ExtraLightData kScene, kBadPosition, kHeadTrackingWeight, @@ -363,6 +364,39 @@ namespace RE }; static_assert(sizeof(ExtraHealth) == 0x20); + class __declspec(novtable) ExtraCharge : + public BSExtraData // 00 + { + public: + static constexpr auto RTTI{ RTTI::ExtraCharge }; + static constexpr auto VTABLE{ VTABLE::ExtraCharge }; + static constexpr auto TYPE{ EXTRA_DATA_TYPE::kCharge }; + + // members + float charge; // 18 + }; + static_assert(sizeof(ExtraCharge) == 0x20); + + struct __declspec(novtable) MapMarkerData : + public TESFullName // 00 + { + std::uint32_t flags; // 10 + }; + static_assert(sizeof(MapMarkerData) == 0x18); + + class __declspec(novtable) ExtraMapMarker : + public BSExtraData // 00 + { + public: + static constexpr auto RTTI{ RTTI::ExtraMapMarker }; + static constexpr auto VTABLE{ VTABLE::ExtraMapMarker }; + static constexpr auto TYPE{ EXTRA_DATA_TYPE::kMapMarker }; + + // members + MapMarkerData* mapMarkerData; // 18 + }; + static_assert(sizeof(ExtraMapMarker) == 0x20); + class __declspec(novtable) ExtraLock : public BSExtraData // 00 { diff --git a/CommonLibF4/include/RE/Bethesda/BSRandom.h b/CommonLibF4/include/RE/Bethesda/BSRandom.h new file mode 100644 index 00000000..8c7e1e6b --- /dev/null +++ b/CommonLibF4/include/RE/Bethesda/BSRandom.h @@ -0,0 +1,14 @@ +#pragma once + +namespace RE +{ + namespace BSRandom + { + inline std::uint32_t UnsignedInt(unsigned int aMin, unsigned int aMax) + { + using func_t = decltype(&BSRandom::UnsignedInt); + static REL::Relocation func{ REL::ID(2267950) }; + return (aMin, aMax); + } + } +} diff --git a/CommonLibF4/include/RE/Fallout.h b/CommonLibF4/include/RE/Fallout.h index 68fe0371..2cbac517 100644 --- a/CommonLibF4/include/RE/Fallout.h +++ b/CommonLibF4/include/RE/Fallout.h @@ -53,6 +53,7 @@ #include "RE/Bethesda/BSModelDB.h" #include "RE/Bethesda/BSPointerHandle.h" #include "RE/Bethesda/BSPreCulledObjects.h" +#include "RE/Bethesda/BSRandom.h" #include "RE/Bethesda/BSResource.h" #include "RE/Bethesda/BSResource/AsyncStream.h" #include "RE/Bethesda/BSResource/BSResourceEnums.h" diff --git a/CommonLibF4/include/RE/Scaleform/Kernel/SF_Memory.h b/CommonLibF4/include/RE/Scaleform/Kernel/SF_Memory.h index 9ae76f5e..887f614d 100644 --- a/CommonLibF4/include/RE/Scaleform/Kernel/SF_Memory.h +++ b/CommonLibF4/include/RE/Scaleform/Kernel/SF_Memory.h @@ -11,13 +11,13 @@ namespace RE::Scaleform public: static void SetGlobalHeap(MemoryHeap* a_heap) { - static REL::Relocation heap{ REL::ID(939898) }; + static REL::Relocation heap{ REL::ID(2707353) }; *heap = a_heap; } [[nodiscard]] static MemoryHeap* GetGlobalHeap() { - static REL::Relocation heap{ REL::ID(939898) }; + static REL::Relocation heap{ REL::ID(2707353) }; return *heap; }