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