Skip to content

Commit

Permalink
feat: Misc RE'ing. (#6)
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
FlenarnTemp authored May 16, 2024
1 parent 25dac70 commit 7556f74
Show file tree
Hide file tree
Showing 7 changed files with 116 additions and 5 deletions.
2 changes: 2 additions & 0 deletions CommonLibF4/cmake/sourcelist.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions CommonLibF4/include/RE/Bethesda/BGSStoryManagerTreeForm.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,11 @@ namespace RE
class BGSQuestInstanceText
{
public:
void ParseString(BSStringT<char>& inOutText, const TESQuest* quest, std::uint32_t instanceID)
static void ParseString(BSStringT<char>* inOutText, const TESQuest* quest, std::uint32_t instanceID)
{
using func_t = decltype(&BGSQuestInstanceText::ParseString);
REL::Relocation<func_t> func{ REL::ID(141681) }; // Update
return func(this, inOutText, quest, instanceID);
REL::Relocation<func_t> func{ REL::ID(2206630) };
return func(inOutText, quest, instanceID);
}

struct StringData
Expand Down
9 changes: 7 additions & 2 deletions CommonLibF4/include/RE/Bethesda/BSExtraData.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -899,6 +903,7 @@ namespace RE
{
using func_t = decltype(&ExtraDataList::GetHealthPerc);
REL::Relocation<func_t> func{ REL::ID(2190226) };
return func(this);
}

void SetHealthPerc(float a_healthPerc)
Expand Down
27 changes: 27 additions & 0 deletions CommonLibF4/include/RE/Bethesda/PipboyDataGroup.h
Original file line number Diff line number Diff line change
@@ -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<PipboyValueChangedEvent>
{
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);
}
61 changes: 61 additions & 0 deletions CommonLibF4/include/RE/Bethesda/PipboyValue.h
Original file line number Diff line number Diff line change
@@ -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<BSFixedString, PipboyValue*> memberMap;
BSTSet<std::uint32_t> addedMemberIDs;
BSTArray<std::uint32_t> removedMemberIDs;
bool newlyCreated;
};
static_assert(sizeof(PipboyObject) == 0x98);
}
14 changes: 14 additions & 0 deletions CommonLibF4/include/RE/Bethesda/TESForms.h
Original file line number Diff line number Diff line change
Expand Up @@ -1770,6 +1770,20 @@ namespace RE
return func(this);
}

CHARISMA_CHALLENGE_DIFFICULTY GetSpeechChallengeLevel()
{
using func_t = decltype(&TESTopicInfo::GetSpeechChallengeLevel);
REL::Relocation<func_t> func{ REL::ID(2208441) };
return func(this);
}

CHARISMA_CHALLENGE_SUCCESS GetSuccessLevel()
{
using func_t = decltype(&TESTopicInfo::GetSuccessLevel);
REL::Relocation<func_t> func{ REL::ID(2208444) };
return func(this);
}

// members
TESTopic* parentTopic; // 20
TESGlobal* resetGlobal; // 28
Expand Down
2 changes: 2 additions & 0 deletions CommonLibF4/include/RE/Fallout.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 7556f74

Please sign in to comment.