CommonLibSSE (powerof3)
BGSSaveLoadManager.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "RE/B/BSAtomic.h"
4 #include "RE/B/BSFixedString.h"
5 #include "RE/B/BSTArray.h"
6 #include "RE/B/BSTEvent.h"
7 #include "RE/B/BSTHashMap.h"
8 #include "RE/B/BSTMessageQueue.h"
9 #include "RE/B/BSTSmartPointer.h"
10 #include "RE/B/BSThread.h"
11 #include "RE/R/RaceSexMenuEvent.h"
12 #include "RE/R/Request.h"
13 
14 namespace RE
15 {
16  class BSSaveDataEvent;
17  class BSSystemEvent;
18  struct BGSSaveLoadManagerEvent;
19 
21  {
22  public:
23  enum class SaveType
24  {
25  kAutosave = 0x0,
26  kSave = 0x1,
27  kQuicksave = 0x2,
28  kCustom = 0x3
29  };
30 
32 
33  // members
40  std::int32_t saveVersion; // 30
41  std::uint32_t saveNumber; // 34
42  std::uint32_t characterLevel; // 38
43  float currentExperience; // 3C
44  float requiredExperience; // 40
45  std::uint32_t screenshotWidth; // 44
46  std::uint32_t screenshotHeight; // 48
47  std::uint32_t unk4C; // 4C
50  std::int32_t unk60; // 60
51  bool loaded; // 64
52  bool unk65; // 65
53  bool unk66; // 66
54  std::uint8_t unk67; // 67
55  std::uint8_t unk68; // 68
56  bool modded; // 69
57  std::uint16_t pad6A; // 6A
58  std::uint32_t characterID; // 6C
60  std::uint32_t pad74; // 74
61  };
62  static_assert(sizeof(BGSSaveLoadFileEntry) == 0x78);
63 
65  public BSTEventSink<BSSaveDataEvent>, // 000
66  public BSTEventSink<RaceSexMenuEvent::NameChangedEvent>, // 008
67  public BSTEventSource<BGSSaveLoadManagerEvent>, // 018
68  public BSTEventSink<BSSystemEvent> // 010
69  {
70  public:
71  inline static constexpr auto RTTI = RTTI_BGSSaveLoadManager;
72  inline static constexpr auto VTABLE = VTABLE_BGSSaveLoadManager;
73 
74  class Thread : public BSThread
75  {
76  public:
77  inline static constexpr auto RTTI = RTTI_BGSSaveLoadManager__Thread;
78  inline static constexpr auto VTABLE = VTABLE_BGSSaveLoadManager__Thread;
79 
80  ~Thread() override; // 00
81 
82  void Unk_01(void) override; // 01
83  void Unk_02(void) override; // 02
84 
85  // members
86  bool isRunnning; // 50
87  bool isBusy; // 51
88  std::uint16_t pad52; // 52
89  std::uint32_t pad54; // 54
92  };
93  static_assert(sizeof(Thread) == 0xC0);
94 
95  struct SaveEntry
96  {
97  std::uint32_t characterID; // 00
98  std::uint32_t isModded; // 04
99  std::uint32_t manualSaveCount; // 08
100  std::uint32_t autoSaveCount; // 0C
103  };
104  static_assert(sizeof(SaveEntry) == 0x48);
105 
106  ~BGSSaveLoadManager() override; // 00
107 
108  // override (BSTEventSink<BSSaveDataEvent>)
109  BSEventNotifyControl ProcessEvent(const BSSaveDataEvent* a_event, BSTEventSource<BSSaveDataEvent>* a_eventSource) override; // 01
110 
111  // override (BSTEventSink<RaceSexMenuEvent::NameChangedEvent>)
113 
114  // override (BSTEventSink<BSSystemEvent>)
115  BSEventNotifyControl ProcessEvent(const BSSystemEvent* a_event, BSTEventSource<BSSystemEvent>* a_eventSource) override; // 01
116 
118 
120  void Save(const char* a_fileName);
121  void Load(const char* a_fileName);
122  void Load(const char* a_fileName, bool a_checkForMods);
125 
126  // members
128  std::uint64_t unk0A0; // 0A0
129  std::uint32_t unk0A8; // 0A8
130  std::uint32_t unk0AC; // 0AC
131  std::uint32_t unk0B0; // 0B0
132  std::uint32_t unk0B4; // 0B4
133  std::uint64_t unk0B8; // 0B8
134  std::uint64_t unk0C0; // 0C0
135  std::uint64_t unk0C8; // 0C8
136  std::uint32_t currentCharacterID; // 0D0
137  std::uint32_t currentCharacterModded; // 0D4
138  std::uint32_t displayCharacterID; // 0D8
139  std::uint32_t displayCharacterModded; // 0DC
140  std::uint32_t unk0E0; // 0E0
141  std::uint32_t unk0E4; // 0E4
143 
145  std::uint8_t unk118; // 118
146  std::uint8_t pad119; // 119
147  std::uint16_t pad11A; // 11A
148  std::uint32_t saveCount; // 11C
149  std::uint8_t unk120; // 120
150  std::uint8_t pad121; // 121
151  std::uint16_t pad122; // 122
152  std::uint32_t pad124; // 124
153  std::uint64_t tickCount; // 128
154  std::uint8_t unk130; // 130
155  std::uint8_t pad131; // 131
156  std::uint16_t pad132; // 132
157  std::uint32_t pad134; // 134
158  const char lastFileFullName[0x104]; // 138
159  std::uint32_t pad23C; // 23C
161  std::uint16_t lastFileNameLength; // 248
162  std::uint16_t maxFileNameLength; // 24A
163  std::uint32_t unk24C; // 24C
164  std::int32_t unk250; // 250
165  std::uint32_t pad254; // 254
166  std::uint64_t unk258; // 258
167  std::uint16_t unk260; // 260
168  std::uint16_t unk262; // 262
169  std::uint32_t unk264; // 264
170  std::uint64_t unk268; // 268
171  std::uint32_t unk270; // 270
172  std::uint32_t unk274; // 274
173  std::uint64_t unk278; // 278
174  std::uint64_t unk280; // 280
175  std::uint32_t unk288; // 288
176  std::uint32_t unk28C; // 28C
177  std::uint64_t unk290; // 290
178  std::uint64_t unk298; // 298
179  std::uint32_t unk2A0; // 2A0
180  std::uint32_t unk2A4; // 2A4
181  std::uint64_t unk2A8; // 2A8
182 #ifdef SKYRIM_SUPPORT_AE
183  std::uint16_t unk2B0; // 2B0
184  std::uint16_t unk2B2; // 2B2
185  std::uint64_t unk2B8; // 2B8
186  BSTArray<void*> unk2C0; // 2C0
187  BSTArray<void*> unk2D8; // 2D8
188  std::uint8_t unk2F0; // 2F0
189 #endif
190  Thread thread; // 2B0
191 
193 
194  protected:
195  bool Save_Impl(std::int32_t a_deviceID, std::uint32_t a_outputStats, const char* a_fileName);
196  bool Load_Impl(const char* a_fileName, std::int32_t a_deviceID, std::uint32_t a_outputStats, bool a_checkForMods);
197  };
198 #ifdef SKYRIM_SUPPORT_AE
199  static_assert(sizeof(BGSSaveLoadManager) == 0x418);
200 #else
201  static_assert(sizeof(BGSSaveLoadManager) == 0x3D0);
202 #endif
203 }
Definition: BGSSaveLoadManager.h:21
std::uint32_t pad74
Definition: BGSSaveLoadManager.h:60
BSFixedString playTime
Definition: BGSSaveLoadManager.h:38
std::uint32_t characterID
Definition: BGSSaveLoadManager.h:58
bool unk65
Definition: BGSSaveLoadManager.h:52
bool unk66
Definition: BGSSaveLoadManager.h:53
BSFixedString fileName
Definition: BGSSaveLoadManager.h:34
std::int32_t saveVersion
Definition: BGSSaveLoadManager.h:40
bool loaded
Definition: BGSSaveLoadManager.h:51
std::uint32_t characterLevel
Definition: BGSSaveLoadManager.h:42
std::uint32_t screenshotHeight
Definition: BGSSaveLoadManager.h:46
std::uint16_t pad6A
Definition: BGSSaveLoadManager.h:57
std::int32_t unk60
Definition: BGSSaveLoadManager.h:50
BSFixedString characterName
Definition: BGSSaveLoadManager.h:35
std::uint32_t saveNumber
Definition: BGSSaveLoadManager.h:41
std::uint32_t screenshotWidth
Definition: BGSSaveLoadManager.h:45
float currentExperience
Definition: BGSSaveLoadManager.h:43
REX::EnumSet< SaveType, std::uint32_t > saveType
Definition: BGSSaveLoadManager.h:59
BSFixedString currentLocation
Definition: BGSSaveLoadManager.h:37
std::uint8_t unk68
Definition: BGSSaveLoadManager.h:55
SaveType
Definition: BGSSaveLoadManager.h:24
BSFixedString characterRace
Definition: BGSSaveLoadManager.h:39
REX::W32::FILETIME fileTime
Definition: BGSSaveLoadManager.h:48
std::uint32_t unk4C
Definition: BGSSaveLoadManager.h:47
REX::W32::FILETIME saveTime
Definition: BGSSaveLoadManager.h:49
BSFixedString characterTitle
Definition: BGSSaveLoadManager.h:36
std::uint8_t unk67
Definition: BGSSaveLoadManager.h:54
float requiredExperience
Definition: BGSSaveLoadManager.h:44
bool modded
Definition: BGSSaveLoadManager.h:56
Definition: BGSSaveLoadManager.h:75
void Unk_02(void) override
bool isBusy
Definition: BGSSaveLoadManager.h:87
static constexpr auto VTABLE
Definition: BGSSaveLoadManager.h:78
std::uint32_t pad54
Definition: BGSSaveLoadManager.h:89
void Unk_01(void) override
static constexpr auto RTTI
Definition: BGSSaveLoadManager.h:77
BSTCommonStaticMessageQueue< BSTSmartPointer< bgs::saveload::Request >, 8 > asyncSaveLoadOperationQueue
Definition: BGSSaveLoadManager.h:91
std::uint16_t pad52
Definition: BGSSaveLoadManager.h:88
BSEventFlag haveTask
Definition: BGSSaveLoadManager.h:90
bool isRunnning
Definition: BGSSaveLoadManager.h:86
Definition: BGSSaveLoadManager.h:69
std::uint32_t displayCharacterModded
Definition: BGSSaveLoadManager.h:139
std::int32_t unk250
Definition: BGSSaveLoadManager.h:164
BSTCommonStaticMessageQueue< BSTSmartPointer< bgs::saveload::Request >, 8 > unk370
Definition: BGSSaveLoadManager.h:192
static BGSSaveLoadManager * GetSingleton()
std::uint8_t pad119
Definition: BGSSaveLoadManager.h:146
std::uint32_t unk24C
Definition: BGSSaveLoadManager.h:163
std::uint32_t unk2A4
Definition: BGSSaveLoadManager.h:180
std::uint16_t pad122
Definition: BGSSaveLoadManager.h:151
static constexpr auto RTTI
Definition: BGSSaveLoadManager.h:71
std::uint64_t unk278
Definition: BGSSaveLoadManager.h:173
BSTArray< SaveEntry > loadedEntries
Definition: BGSSaveLoadManager.h:142
std::uint32_t currentCharacterID
Definition: BGSSaveLoadManager.h:136
std::uint8_t unk118
Definition: BGSSaveLoadManager.h:145
std::uint32_t unk2A0
Definition: BGSSaveLoadManager.h:179
std::uint32_t unk0B0
Definition: BGSSaveLoadManager.h:131
std::uint32_t unk0E4
Definition: BGSSaveLoadManager.h:141
std::uint32_t pad23C
Definition: BGSSaveLoadManager.h:159
BSEventNotifyControl ProcessEvent(const BSSaveDataEvent *a_event, BSTEventSource< BSSaveDataEvent > *a_eventSource) override
std::uint16_t pad132
Definition: BGSSaveLoadManager.h:156
void Save(const char *a_fileName)
std::uint16_t lastFileNameLength
Definition: BGSSaveLoadManager.h:161
Thread thread
Definition: BGSSaveLoadManager.h:190
BSEventNotifyControl ProcessEvent(const RaceSexMenuEvent::NameChangedEvent *a_event, BSTEventSource< RaceSexMenuEvent::NameChangedEvent > *a_eventSource) override
static constexpr auto VTABLE
Definition: BGSSaveLoadManager.h:72
std::uint16_t maxFileNameLength
Definition: BGSSaveLoadManager.h:162
std::uint32_t unk270
Definition: BGSSaveLoadManager.h:171
std::uint64_t unk258
Definition: BGSSaveLoadManager.h:166
std::uint16_t unk262
Definition: BGSSaveLoadManager.h:168
std::uint16_t pad11A
Definition: BGSSaveLoadManager.h:147
std::uint32_t unk0B4
Definition: BGSSaveLoadManager.h:132
BSEventNotifyControl ProcessEvent(const BSSystemEvent *a_event, BSTEventSource< BSSystemEvent > *a_eventSource) override
BSFixedString lastFileName
Definition: BGSSaveLoadManager.h:160
std::uint8_t pad131
Definition: BGSSaveLoadManager.h:155
bool Load_Impl(const char *a_fileName, std::int32_t a_deviceID, std::uint32_t a_outputStats, bool a_checkForMods)
std::uint64_t unk0A0
Definition: BGSSaveLoadManager.h:128
std::uint64_t unk2A8
Definition: BGSSaveLoadManager.h:181
std::uint32_t pad134
Definition: BGSSaveLoadManager.h:157
std::uint64_t unk280
Definition: BGSSaveLoadManager.h:174
std::uint32_t saveCount
Definition: BGSSaveLoadManager.h:148
std::uint64_t tickCount
Definition: BGSSaveLoadManager.h:153
std::uint64_t unk290
Definition: BGSSaveLoadManager.h:177
std::uint32_t unk274
Definition: BGSSaveLoadManager.h:172
void Load(const char *a_fileName, bool a_checkForMods)
std::uint32_t unk288
Definition: BGSSaveLoadManager.h:175
std::uint8_t unk130
Definition: BGSSaveLoadManager.h:154
std::uint64_t unk0C8
Definition: BGSSaveLoadManager.h:135
std::uint32_t unk0AC
Definition: BGSSaveLoadManager.h:130
std::uint16_t unk260
Definition: BGSSaveLoadManager.h:167
std::uint32_t unk0E0
Definition: BGSSaveLoadManager.h:140
std::uint32_t pad254
Definition: BGSSaveLoadManager.h:165
std::uint32_t displayCharacterID
Definition: BGSSaveLoadManager.h:138
std::uint64_t unk0B8
Definition: BGSSaveLoadManager.h:133
void Load(const char *a_fileName)
std::uint32_t pad124
Definition: BGSSaveLoadManager.h:152
std::uint8_t unk120
Definition: BGSSaveLoadManager.h:149
BSTHashMap< std::uint64_t, BSFixedString > characterIDNameMap
Definition: BGSSaveLoadManager.h:127
std::uint32_t currentCharacterModded
Definition: BGSSaveLoadManager.h:137
std::uint64_t unk268
Definition: BGSSaveLoadManager.h:170
~BGSSaveLoadManager() override
std::uint64_t unk298
Definition: BGSSaveLoadManager.h:178
std::uint32_t unk0A8
Definition: BGSSaveLoadManager.h:129
std::uint32_t unk28C
Definition: BGSSaveLoadManager.h:176
BSTArray< BGSSaveLoadFileEntry * > saveGameList
Definition: BGSSaveLoadManager.h:144
std::uint32_t unk264
Definition: BGSSaveLoadManager.h:169
std::uint8_t pad121
Definition: BGSSaveLoadManager.h:150
const char lastFileFullName[0x104]
Definition: BGSSaveLoadManager.h:158
std::uint64_t unk0C0
Definition: BGSSaveLoadManager.h:134
bool Save_Impl(std::int32_t a_deviceID, std::uint32_t a_outputStats, const char *a_fileName)
Definition: BSAtomic.h:57
Definition: BSTArray.h:378
Definition: BSTMessageQueue.h:81
Definition: BSTEvent.h:143
Definition: BSTEvent.h:19
Definition: BSTHashMap.h:21
Definition: BSThread.h:8
Definition: AbsorbEffect.h:6
constexpr std::array< REL::ID, 3 > VTABLE_BGSSaveLoadManager
Definition: Offsets_VTABLE.h:8849
constexpr REL::ID RTTI_BGSSaveLoadManager(static_cast< std::uint64_t >(686602))
constexpr REL::ID RTTI_BGSSaveLoadManager__Thread(static_cast< std::uint64_t >(686610))
BSEventNotifyControl
Definition: BSTEvent.h:12
constexpr std::array< REL::ID, 1 > VTABLE_BGSSaveLoadManager__Thread
Definition: Offsets_VTABLE.h:8850
Definition: BASE.h:41
Definition: BGSSaveLoadManager.h:96
BSTHashMap< std::uint32_t, BSFixedString > autoSaves
Definition: BGSSaveLoadManager.h:101
BSFixedString lastQuicksave
Definition: BGSSaveLoadManager.h:102
std::uint32_t isModded
Definition: BGSSaveLoadManager.h:98
std::uint32_t characterID
Definition: BGSSaveLoadManager.h:97
std::uint32_t manualSaveCount
Definition: BGSSaveLoadManager.h:99
std::uint32_t autoSaveCount
Definition: BGSSaveLoadManager.h:100
Definition: RaceSexMenuEvent.h:9