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
44
45 std::uint32_t LoadScripts();
46 TESForm* LookupForm(FormID a_rawFormID, std::string_view a_modName);
47 template <class T>
48 T* LookupForm(FormID a_rawFormID, std::string_view a_modName);
49 FormID LookupFormID(FormID a_rawFormID, std::string_view a_modName);
50
51 const TESFile* LookupModByName(std::string_view a_modName);
52 std::optional<std::uint8_t> GetModIndex(std::string_view a_modName);
53
54 const TESFile* LookupLoadedModByName(std::string_view a_modName);
55 const TESFile* LookupLoadedModByIndex(std::uint8_t a_index);
56 std::optional<std::uint8_t> GetLoadedModIndex(std::string_view a_modName);
57
58 const TESFile* LookupLoadedLightModByName(std::string_view a_modName);
59 const TESFile* LookupLoadedLightModByIndex(std::uint16_t a_index);
60 std::optional<std::uint16_t> GetLoadedLightModIndex(std::string_view a_modName);
61
62 bool IsGeneratedID(FormID a_formID);
63
65 template <class T>
67
68 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);
69
70 // members
71 std::uint8_t pad001; // 001
72 std::uint16_t pad002; // 002
73 std::uint32_t pad004; // 004
75 BSTArray<TESForm*> formArrays[std::to_underlying(FormType::Max)]; // 010
80 FormID nextID; // D50
81 std::uint32_t padD54; // D54
85 bool masterSave; // DA0
86 bool blockSave; // DA1
87 bool saveLoadGame; // DA2
88 bool autoSaving; // DA3
89 bool exportingPlugin; // DA4
90 bool clearingData; // DA5
91 bool hasDesiredFiles; // DA6
92 bool checkingModels; // DA7
93 bool loadingFiles; // DA8
94 bool dontRemoveIDs; // DA9
95 std::uint8_t unkDAA; // DAA
96 std::uint8_t padDAB; // DAB
97 std::uint32_t padDAC; // DAC
100 };
101 static_assert(sizeof(TESDataHandler) == 0xDC0);
102
103 template <class T>
104 T* TESDataHandler::LookupForm(FormID a_rawFormID, std::string_view a_modName)
105 {
106 auto form = LookupForm(a_rawFormID, a_modName);
107 if (!form) {
108 return 0;
109 }
110
111 return form->Is(T::FORMTYPE) ? static_cast<T*>(form) : 0;
112 }
113
114 template <class T>
116 {
117 return reinterpret_cast<BSTArray<T*>&>(GetFormArray(T::FORMTYPE));
118 }
119}
Definition BSTList.h:10
Definition BSTArray.h:378
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:81
TESRegionDataManager * regionDataManager
Definition TESDataHandler.h:98
BSTArray< TESForm * > formArrays[std::to_underlying(FormType::Max)]
Definition TESDataHandler.h:75
std::uint32_t pad004
Definition TESDataHandler.h:73
std::uint8_t unkDAA
Definition TESDataHandler.h:95
FormID nextID
Definition TESDataHandler.h:80
BSSimpleList< TESFile * > files
Definition TESDataHandler.h:83
bool clearingData
Definition TESDataHandler.h:90
TESForm * LookupForm(FormID a_rawFormID, std::string_view a_modName)
static TESDataHandler * GetSingleton()
std::optional< std::uint8_t > GetModIndex(std::string_view a_modName)
bool AddFormToDataHandler(TESForm *a_form)
const TESFile * LookupLoadedModByName(std::string_view a_modName)
const TESFile * LookupModByName(std::string_view a_modName)
bool loadingFiles
Definition TESDataHandler.h:93
InventoryChanges * merchantInventory
Definition TESDataHandler.h:99
bool checkingModels
Definition TESDataHandler.h:92
const TESFile * LookupLoadedModByIndex(std::uint8_t a_index)
NiTList< TESForm * > badForms
Definition TESDataHandler.h:79
TESObjectList * objectList
Definition TESDataHandler.h:74
BSTArray< T * > & GetFormArray()
Definition TESDataHandler.h:115
const TESFile * LookupLoadedLightModByIndex(std::uint16_t a_index)
bool blockSave
Definition TESDataHandler.h:86
std::uint8_t pad001
Definition TESDataHandler.h:71
std::optional< std::uint16_t > GetLoadedLightModIndex(std::string_view a_modName)
bool masterSave
Definition TESDataHandler.h:85
bool exportingPlugin
Definition TESDataHandler.h:89
std::uint32_t LoadScripts()
bool dontRemoveIDs
Definition TESDataHandler.h:94
NiTPrimitiveArray< TESObjectCELL * > interiorCells
Definition TESDataHandler.h:77
BSTArray< TESForm * > & GetFormArray(FormType a_formType)
std::optional< std::uint8_t > GetLoadedModIndex(std::string_view a_modName)
TESRegionList * regionList
Definition TESDataHandler.h:76
bool hasDesiredFiles
Definition TESDataHandler.h:91
NiTPrimitiveArray< BGSAddonNode * > addonNodes
Definition TESDataHandler.h:78
TESFile * activeFile
Definition TESDataHandler.h:82
const TESFile * LookupLoadedLightModByName(std::string_view a_modName)
std::uint32_t padDAC
Definition TESDataHandler.h:97
TESFileCollection compiledFileCollection
Definition TESDataHandler.h:84
bool saveLoadGame
Definition TESDataHandler.h:87
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:88
std::uint16_t pad002
Definition TESDataHandler.h:72
FormID LookupFormID(FormID a_rawFormID, std::string_view a_modName)
bool IsGeneratedID(FormID a_formID)
std::uint8_t padDAB
Definition TESDataHandler.h:96
Definition TESFile.h:17
Definition TESForm.h:36
Definition TESObjectCELL.h:115
Definition TESObjectREFR.h:114
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
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