CommonLibSSE (Parapets fork)
GameSettingCollection.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "RE/S/Setting.h"
5 
6 namespace RE
7 {
9  {
10  public:
11  inline static constexpr auto RTTI = RTTI_GameSettingCollection;
12 
13  ~GameSettingCollection() override; // 00
14 
15  // override (SettingCollectionMap<Setting>)
16  bool WriteSetting(Setting* a_setting) override; // 03 - { return false; }
17  bool ReadSetting(Setting* a_setting) override; // 04
18  bool OpenHandle(bool a_create) override; // 05 - { return handle != 0; }
19  bool CloseHandle() override; // 06 - { handle = 0; return true; }
20 
21  // add
22  virtual void Unk_0A(void); // 0A
23 
25 
26  Setting* GetSetting(const char* a_name);
27  };
28  static_assert(sizeof(GameSettingCollection) == 0x140);
29 
30  namespace literals
31  {
32  template <stl::nttp::zstring S>
33  inline auto operator""_gs()
34  {
35  static RE::Setting* setting = nullptr;
36  if (!setting) {
37  if (auto collection = GameSettingCollection::GetSingleton()) {
38  setting = collection->GetSetting(S.data());
39  }
40  }
41 
42  if constexpr (S.front() == 'b') {
43  return setting ? std::optional(setting->data.b) : std::nullopt;
44  } else if constexpr (S.front() == 'f') {
45  return setting ? std::optional(setting->data.f) : std::nullopt;
46  } else if constexpr (S.front() == 'i') {
47  return setting ? std::optional(setting->data.i) : std::nullopt;
48  } else if constexpr (S.front() == 'r') {
49  return setting ? std::optional(setting->data.r) : std::nullopt;
50  } else if constexpr (S.front() == 's') {
51  return setting ? std::optional(setting->data.s) : std::nullopt;
52  } else if constexpr (S.front() == 'u') {
53  return setting ? std::optional(setting->data.u) : std::nullopt;
54  }
55  }
56  }
57 }
Definition: GameSettingCollection.h:9
bool WriteSetting(Setting *a_setting) override
~GameSettingCollection() override
static GameSettingCollection * GetSingleton()
bool CloseHandle() override
Setting * GetSetting(const char *a_name)
bool ReadSetting(Setting *a_setting) override
static constexpr auto RTTI
Definition: GameSettingCollection.h:11
virtual void Unk_0A(void)
bool OpenHandle(bool a_create) override
Definition: SettingCollectionMap.h:11
Definition: Setting.h:8
Data data
Definition: Setting.h:51
Definition: AbsorbEffect.h:6
constexpr REL::ID RTTI_GameSettingCollection
Definition: Offsets_RTTI.h:4861
std::uint32_t u
Definition: Setting.h:30
float f
Definition: Setting.h:26
std::int32_t i
Definition: Setting.h:27
char * s
Definition: Setting.h:29
Color r
Definition: Setting.h:28
bool b
Definition: Setting.h:25