CommonLibSSE (powerof3)
Loading...
Searching...
No Matches
TESDataHandler.h
Go to the documentation of this file.
1#pragma once
2
4#include "RE/B/BSTArray.h"
5#include "RE/B/BSTList.h"
6#include "RE/B/BSTSingleton.h"
7#include "RE/F/FormTypes.h"
8#include "RE/N/NiTArray.h"
9#include "RE/N/NiTList.h"
10#include "RE/T/TESForm.h"
11
12namespace RE
13{
14 class BGSPrimitive;
15 class InventoryChanges;
16 class NiPoint3;
17 class TESFile;
18 class TESRegionDataManager;
19 class TESRegionList;
20
22 {
23 public:
24 // members
25 std::uint8_t pad0; // 0
26 };
27 static_assert(sizeof(TESObjectList) == 0x1);
28
30 {
31 public:
32 // members
35 };
36 static_assert(sizeof(TESFileCollection) == 0x30);
37
38 class TESDataHandler : public BSTSingletonSDM<TESDataHandler>
39 {
40 public:
42
43 std::uint32_t LoadScripts();
44 TESForm* LookupForm(FormID a_rawFormID, std::string_view a_modName);
45 template <class T>
46 T* LookupForm(FormID a_rawFormID, std::string_view a_modName);
47 FormID LookupFormID(FormID a_rawFormID, std::string_view a_modName);
48
49 const TESFile* LookupModByName(std::string_view a_modName);
50 std::optional<std::uint8_t> GetModIndex(std::string_view a_modName);
51
52 const TESFile* LookupLoadedModByName(std::string_view a_modName);
53 const TESFile* LookupLoadedModByIndex(std::uint8_t a_index);
54 std::optional<std::uint8_t> GetLoadedModIndex(std::string_view a_modName);
55
56 const TESFile* LookupLoadedLightModByName(std::string_view a_modName);
57 const TESFile* LookupLoadedLightModByIndex(std::uint16_t a_index);
58 std::optional<std::uint16_t> GetLoadedLightModIndex(std::string_view a_modName);
59
60 bool IsGeneratedID(FormID a_formID);
61
63 template <class T>
65
66 ObjectRefHandle CreateReferenceAtLocation(TESBoundObject* a_base, const NiPoint3& a_location, const NiPoint3& a_rotation, TESObjectCELL* a_targetCell, TESWorldSpace* a_selfWorldSpace, TESObjectREFR* a_alreadyCreatedRef, BGSPrimitive* a_primitive, const ObjectRefHandle& a_linkedRoomRefHandle, bool a_forcePersist, bool a_arg11);
67
68 // members
69 std::uint8_t pad001; // 001
70 std::uint16_t pad002; // 002
71 std::uint32_t pad004; // 004
78 FormID nextID; // D50
79 std::uint32_t padD54; // D54
83 bool masterSave; // DA0
84 bool blockSave; // DA1
85 bool saveLoadGame; // DA2
86 bool autoSaving; // DA3
87 bool exportingPlugin; // DA4
88 bool clearingData; // DA5
89 bool hasDesiredFiles; // DA6
90 bool checkingModels; // DA7
91 bool loadingFiles; // DA8
92 bool dontRemoveIDs; // DA9
93 std::uint8_t unkDAA; // DAA
94 std::uint8_t padDAB; // DAB
95 std::uint32_t padDAC; // DAC
98 };
99 static_assert(sizeof(TESDataHandler) == 0xDC0);
100
101 template <class T>
102 T* TESDataHandler::LookupForm(FormID a_rawFormID, std::string_view a_modName)
103 {
104 auto form = LookupForm(a_rawFormID, a_modName);
105 if (!form) {
106 return 0;
107 }
108
109 return form->Is(T::FORMTYPE) ? static_cast<T*>(form) : 0;
110 }
111
112 template <class T>
114 {
115 return reinterpret_cast<BSTArray<T*>&>(GetFormArray(T::FORMTYPE));
116 }
117}
Definition: BSTList.h:10
Definition: BSTArray.h:377
Definition: InventoryChanges.h:15
Definition: NiPoint3.h:6
Definition: NiTList.h:10
Definition: NiTArray.h:136
Definition: TESBoundObject.h:24
Definition: TESDataHandler.h:39
std::uint32_t padD54
Definition: TESDataHandler.h:79
TESRegionDataManager * regionDataManager
Definition: TESDataHandler.h:96
std::uint32_t pad004
Definition: TESDataHandler.h:71
std::uint8_t unkDAA
Definition: TESDataHandler.h:93
FormID nextID
Definition: TESDataHandler.h:78
BSSimpleList< TESFile * > files
Definition: TESDataHandler.h:81
bool clearingData
Definition: TESDataHandler.h:88
TESForm * LookupForm(FormID a_rawFormID, std::string_view a_modName)
static TESDataHandler * GetSingleton()
std::optional< std::uint8_t > GetModIndex(std::string_view a_modName)
const TESFile * LookupLoadedModByName(std::string_view a_modName)
const TESFile * LookupModByName(std::string_view a_modName)
bool loadingFiles
Definition: TESDataHandler.h:91
InventoryChanges * merchantInventory
Definition: TESDataHandler.h:97
bool checkingModels
Definition: TESDataHandler.h:90
const TESFile * LookupLoadedModByIndex(std::uint8_t a_index)
NiTList< TESForm * > badForms
Definition: TESDataHandler.h:77
TESObjectList * objectList
Definition: TESDataHandler.h:72
BSTArray< T * > & GetFormArray()
Definition: TESDataHandler.h:113
const TESFile * LookupLoadedLightModByIndex(std::uint16_t a_index)
bool blockSave
Definition: TESDataHandler.h:84
std::uint8_t pad001
Definition: TESDataHandler.h:69
std::optional< std::uint16_t > GetLoadedLightModIndex(std::string_view a_modName)
bool masterSave
Definition: TESDataHandler.h:83
bool exportingPlugin
Definition: TESDataHandler.h:87
std::uint32_t LoadScripts()
bool dontRemoveIDs
Definition: TESDataHandler.h:92
NiTPrimitiveArray< TESObjectCELL * > interiorCells
Definition: TESDataHandler.h:75
BSTArray< TESForm * > & GetFormArray(FormType a_formType)
std::optional< std::uint8_t > GetLoadedModIndex(std::string_view a_modName)
TESRegionList * regionList
Definition: TESDataHandler.h:74
bool hasDesiredFiles
Definition: TESDataHandler.h:89
NiTPrimitiveArray< BGSAddonNode * > addonNodes
Definition: TESDataHandler.h:76
TESFile * activeFile
Definition: TESDataHandler.h:80
const TESFile * LookupLoadedLightModByName(std::string_view a_modName)
std::uint32_t padDAC
Definition: TESDataHandler.h:95
TESFileCollection compiledFileCollection
Definition: TESDataHandler.h:82
bool saveLoadGame
Definition: TESDataHandler.h:85
ObjectRefHandle CreateReferenceAtLocation(TESBoundObject *a_base, const NiPoint3 &a_location, const NiPoint3 &a_rotation, TESObjectCELL *a_targetCell, TESWorldSpace *a_selfWorldSpace, TESObjectREFR *a_alreadyCreatedRef, BGSPrimitive *a_primitive, const ObjectRefHandle &a_linkedRoomRefHandle, bool a_forcePersist, bool a_arg11)
bool autoSaving
Definition: TESDataHandler.h:86
std::uint16_t pad002
Definition: TESDataHandler.h:70
FormID LookupFormID(FormID a_rawFormID, std::string_view a_modName)
bool IsGeneratedID(FormID a_formID)
BSTArray< TESForm * > formArrays[stl::to_underlying(FormType::Max)]
Definition: TESDataHandler.h:73
std::uint8_t padDAB
Definition: TESDataHandler.h:94
Definition: TESFile.h:15
Definition: TESForm.h:35
Definition: TESObjectCELL.h:115
Definition: TESObjectREFR.h:110
Definition: TESRegionDataManager.h:18
Definition: TESRegionList.h:10
Definition: TESWorldSpace.h:118
Definition: AbsorbEffect.h:6
FormType
Definition: FormTypes.h:139
std::uint32_t FormID
Definition: BSCoreTypes.h:5
constexpr auto to_underlying(Enum a_val) noexcept
Definition: PCH.h:642
Definition: BSTSingleton.h:50
Definition: TESDataHandler.h:30
BSTArray< TESFile * > smallFiles
Definition: TESDataHandler.h:34
BSTArray< TESFile * > files
Definition: TESDataHandler.h:33
Definition: TESDataHandler.h:22
std::uint8_t pad0
Definition: TESDataHandler.h:25