From 7556f74cd4a143b1481ba669a4a9994852e4e35c Mon Sep 17 00:00:00 2001 From: FlenarnTemp <68670981+FlenarnTemp@users.noreply.github.com> Date: Thu, 16 May 2024 19:17:32 +0200 Subject: [PATCH] feat: Misc RE'ing. (#6) * fix(BSExtraData.h) - constructor for ExtraHealth was incorrect. * feat(PipboyDataGroup & PipboyValue) * fix(PipboyDataGroup) - use REX::W32 instead of WinAPI. * feat: Few more functions and whatnot. --- CommonLibF4/cmake/sourcelist.cmake | 2 + .../RE/Bethesda/BGSStoryManagerTreeForm.h | 6 +- CommonLibF4/include/RE/Bethesda/BSExtraData.h | 9 ++- .../include/RE/Bethesda/PipboyDataGroup.h | 27 ++++++++ CommonLibF4/include/RE/Bethesda/PipboyValue.h | 61 +++++++++++++++++++ CommonLibF4/include/RE/Bethesda/TESForms.h | 14 +++++ CommonLibF4/include/RE/Fallout.h | 2 + 7 files changed, 116 insertions(+), 5 deletions(-) create mode 100644 CommonLibF4/include/RE/Bethesda/PipboyDataGroup.h create mode 100644 CommonLibF4/include/RE/Bethesda/PipboyValue.h diff --git a/CommonLibF4/cmake/sourcelist.cmake b/CommonLibF4/cmake/sourcelist.cmake index 03d4edbc..0ba59e38 100644 --- a/CommonLibF4/cmake/sourcelist.cmake +++ b/CommonLibF4/cmake/sourcelist.cmake @@ -191,8 +191,10 @@ set(SOURCES include/RE/Bethesda/Movement.h include/RE/Bethesda/NavMesh.h include/RE/Bethesda/NavMeshInfoMap.h + include/RE/Bethesda/PipboyDataGroup.h include/RE/Bethesda/PipboyInventoryUtils.h include/RE/Bethesda/PipboyManager.h + include/RE/Bethesda/PipboyValue.h include/RE/Bethesda/PlayerCharacter.h include/RE/Bethesda/PlayerControls.h include/RE/Bethesda/PowerArmor.h diff --git a/CommonLibF4/include/RE/Bethesda/BGSStoryManagerTreeForm.h b/CommonLibF4/include/RE/Bethesda/BGSStoryManagerTreeForm.h index ab84ae25..4750cdbf 100644 --- a/CommonLibF4/include/RE/Bethesda/BGSStoryManagerTreeForm.h +++ b/CommonLibF4/include/RE/Bethesda/BGSStoryManagerTreeForm.h @@ -82,11 +82,11 @@ namespace RE class BGSQuestInstanceText { public: - void ParseString(BSStringT& inOutText, const TESQuest* quest, std::uint32_t instanceID) + static void ParseString(BSStringT* inOutText, const TESQuest* quest, std::uint32_t instanceID) { using func_t = decltype(&BGSQuestInstanceText::ParseString); - REL::Relocation func{ REL::ID(141681) }; // Update - return func(this, inOutText, quest, instanceID); + REL::Relocation func{ REL::ID(2206630) }; + return func(inOutText, quest, instanceID); } struct StringData diff --git a/CommonLibF4/include/RE/Bethesda/BSExtraData.h b/CommonLibF4/include/RE/Bethesda/BSExtraData.h index 0c2ec5d5..e0866aae 100644 --- a/CommonLibF4/include/RE/Bethesda/BSExtraData.h +++ b/CommonLibF4/include/RE/Bethesda/BSExtraData.h @@ -350,8 +350,12 @@ namespace RE static constexpr auto VTABLE{ VTABLE::ExtraHealth }; static constexpr auto TYPE{ EXTRA_DATA_TYPE::kHealth }; - ExtraHealth(); - ExtraHealth(float health); + ExtraHealth(float health) : + BSExtraData(TYPE), + health(health) + { + stl::emplace_vtable(this); + } // members float health; // 18 @@ -899,6 +903,7 @@ namespace RE { using func_t = decltype(&ExtraDataList::GetHealthPerc); REL::Relocation func{ REL::ID(2190226) }; + return func(this); } void SetHealthPerc(float a_healthPerc) diff --git a/CommonLibF4/include/RE/Bethesda/PipboyDataGroup.h b/CommonLibF4/include/RE/Bethesda/PipboyDataGroup.h new file mode 100644 index 00000000..1cc8de87 --- /dev/null +++ b/CommonLibF4/include/RE/Bethesda/PipboyDataGroup.h @@ -0,0 +1,27 @@ +#pragma once + +#include "RE/Bethesda/BSTEvent.h" +#include "RE/Bethesda/IMenu.h" +#include "RE/Bethesda/PipboyValue.h" + +namespace RE +{ + class PipboyDataGroup + : BSTEventSource + { + public: + static constexpr auto RTTI{ RTTI::PipboyDataGroup }; + static constexpr auto VTABLE{ VTABLE::PipboyDataGroup }; + + virtual ~PipboyDataGroup(); + + virtual void Populate(bool); + virtual void DoClearData(); + virtual void DoClearSink(); + + REX::W32::CRITICAL_SECTION PipboyDataMutex; + void* rThrottleManager; // PipboyThrottleManager + PipboyValue* rootValue; + }; + static_assert(sizeof(PipboyDataGroup) == 0x98); +} diff --git a/CommonLibF4/include/RE/Bethesda/PipboyValue.h b/CommonLibF4/include/RE/Bethesda/PipboyValue.h new file mode 100644 index 00000000..58935d41 --- /dev/null +++ b/CommonLibF4/include/RE/Bethesda/PipboyValue.h @@ -0,0 +1,61 @@ +#pragma once + +#include "RE/Bethesda/BSFixedString.h" +#include "RE/Bethesda/BSTArray.h" +#include "RE/Bethesda/BSTHashMap.h" + +namespace RE +{ + class PipboyObject; + + class __declspec(novtable) PipboyValue + { + public: + static constexpr auto RTTI{ RTTI::PipboyValue }; + static constexpr auto VTABLE{ VTABLE::PipboyValue }; + + enum SERIALIZATION_DATA_TYPE : std::uint8_t + { + SDT_BOOL = 0x0, + SDT_INT_8 = 0x1, + SDT_UINT_8 = 0x2, + SDT_INT_32 = 0x3, + SDT_UINT_32 = 0x4, + SDT_FLOAT = 0x5, + SDT_STRING = 0x6, + SDT_ARRAY = 0x7, + SDT_OBJECT = 0x8, + }; + + virtual ~PipboyValue(); + + virtual void CleanDirtyToGame(); + virtual void Serialize(void* a_args1); + virtual void SerializeChanged(void* a_args1); + virtual SERIALIZATION_DATA_TYPE GetType(); + + // members + std::uint32_t id; // 08 + bool isDirtyGame; // 0C + bool isDirtyToCompanion; // 0D + PipboyValue* parentValue; // 10 + }; + static_assert(sizeof(PipboyValue) == 0x18); + + class __declspec(novtable) PipboyObject : + PipboyValue + { + public: + static constexpr auto RTTI{ RTTI::PipboyObject }; + static constexpr auto VTABLE{ VTABLE::PipboyObject }; + + virtual ~PipboyObject(); + + //members + BSTHashMap memberMap; + BSTSet addedMemberIDs; + BSTArray removedMemberIDs; + bool newlyCreated; + }; + static_assert(sizeof(PipboyObject) == 0x98); +} diff --git a/CommonLibF4/include/RE/Bethesda/TESForms.h b/CommonLibF4/include/RE/Bethesda/TESForms.h index a6104c00..8f00edaf 100644 --- a/CommonLibF4/include/RE/Bethesda/TESForms.h +++ b/CommonLibF4/include/RE/Bethesda/TESForms.h @@ -1770,6 +1770,20 @@ namespace RE return func(this); } + CHARISMA_CHALLENGE_DIFFICULTY GetSpeechChallengeLevel() + { + using func_t = decltype(&TESTopicInfo::GetSpeechChallengeLevel); + REL::Relocation func{ REL::ID(2208441) }; + return func(this); + } + + CHARISMA_CHALLENGE_SUCCESS GetSuccessLevel() + { + using func_t = decltype(&TESTopicInfo::GetSuccessLevel); + REL::Relocation func{ REL::ID(2208444) }; + return func(this); + } + // members TESTopic* parentTopic; // 20 TESGlobal* resetGlobal; // 28 diff --git a/CommonLibF4/include/RE/Fallout.h b/CommonLibF4/include/RE/Fallout.h index 4cea9ea9..311670f3 100644 --- a/CommonLibF4/include/RE/Fallout.h +++ b/CommonLibF4/include/RE/Fallout.h @@ -187,8 +187,10 @@ #include "RE/Bethesda/Movement.h" #include "RE/Bethesda/NavMesh.h" #include "RE/Bethesda/NavMeshInfoMap.h" +#include "RE/Bethesda/PipboyDataGroup.h" #include "RE/Bethesda/PipboyInventoryUtils.h" #include "RE/Bethesda/PipboyManager.h" +#include "RE/Bethesda/PipboyValue.h" #include "RE/Bethesda/PlayerCharacter.h" #include "RE/Bethesda/PlayerControls.h" #include "RE/Bethesda/PowerArmor.h"