CommonLibSSE (powerof3)
TLSData.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "RE/B/BSExtraData.h"
4 #include "RE/E/ExtraDataList.h"
5 #include "RE/E/ExtraDataTypes.h"
6 
7 namespace RE
8 {
9  struct TLSData
10  {
11  inline static constexpr uint32_t CACHED_EXTRA_DATA_SIZE = (static_cast<uint32_t>(ExtraDataType::kResourcesPreload) + 1);
12  std::uint8_t unk000[0x10]; // 000
13  std::uint32_t stateCounter; // 010 - on GetExtraData(), this gets checked against the GlobalStateCounter, which is incremented every time extra data is changed or removed; if they're not equal, then the following cached extra data is zeroed-out and recached
14  std::uint32_t pad014; // 014
16  BSExtraData* cachedExtraData[CACHED_EXTRA_DATA_SIZE]; // 020 - ExtraData types up to kResourcesPreload (0xB5) are cached
17  std::uint8_t unk5D0[0x30]; // 5D0
18  bool consoleMode; // 600
19  std::uint8_t unk601[0x167]; // 601
20  std::uint32_t taskFlag; // 768 -- unknown enum
21  // ... many others ...
22  };
23  static_assert(offsetof(TLSData, consoleMode) == 0x600);
24  static_assert(offsetof(TLSData, taskFlag) == 0x768);
25 
26  inline static TLSData* GetStaticTLSData()
27  {
29  auto tlsDataArray = reinterpret_cast<TLSData**>(__readgsqword(0x58));
30  return tlsDataArray[*tlsIndex];
31  }
32 }
Definition: Relocation.h:210
Definition: BSExtraData.h:9
Definition: ExtraDataList.h:49
constexpr REL::ID TlsIndex(static_cast< std::uint64_t >(528600))
Definition: AbsorbEffect.h:6
static TLSData * GetStaticTLSData()
Definition: TLSData.h:26
Definition: TLSData.h:10
std::uint32_t pad014
Definition: TLSData.h:14
ExtraDataList * cachedExtraDataList
Definition: TLSData.h:15
std::uint32_t stateCounter
Definition: TLSData.h:13
std::uint8_t unk601[0x167]
Definition: TLSData.h:19
std::uint32_t taskFlag
Definition: TLSData.h:20
static constexpr uint32_t CACHED_EXTRA_DATA_SIZE
Definition: TLSData.h:11
std::uint8_t unk5D0[0x30]
Definition: TLSData.h:17
std::uint8_t unk000[0x10]
Definition: TLSData.h:12
bool consoleMode
Definition: TLSData.h:18
BSExtraData * cachedExtraData[CACHED_EXTRA_DATA_SIZE]
Definition: TLSData.h:16