CommonLibSSE NG
MapMenu.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "RE/B/BSSoundHandle.h"
4 #include "RE/B/BSTArray.h"
5 #include "RE/B/BSTEvent.h"
6 #include "RE/B/BSTSmartPointer.h"
7 #include "RE/G/GFxValue.h"
9 #include "RE/I/IMenu.h"
10 #include "RE/L/LocalMapMenu.h"
11 #include "RE/M/MapCamera.h"
12 #include "RE/W/WorldSpaceMenu.h"
13 
14 namespace RE
15 {
16  class BSAudioManager;
17  class MapLookHandler;
18  class MapMoveHandler;
19  class MapZoomHandler;
20  class MenuOpenCloseEvent;
21  class TESWorldSpace;
22 
23  // menuDepth = 3
24  // flags = kPausesGame | kUsesCursor | kRendersOffscreenTargets | kCustomRendering
25  // context = kMap
26  class MapMenu :
27 #if !defined(ENABLE_SKYRIM_AE) && !defined(ENABLE_SKYRIM_SE)
28  public WorldSpaceMenu, // 00000
29  public BSTEventSink<MenuOpenCloseEvent>, // 00058
30  public IMapCameraCallbacks // 00060
31 #elif !defined(ENABLE_SKYRIM_VR)
32  public IMenu, // 00000
33  public BSTEventSink<MenuOpenCloseEvent>, // 00030
34  public IMapCameraCallbacks // 00038
35 #else
36  public IMenu
37 #endif
38  {
39  public:
40  inline static constexpr auto RTTI = RTTI_MapMenu;
41  constexpr static std::string_view MENU_NAME = "MapMenu";
42 
44  {
46  std::uint32_t unk08;
47  std::uint32_t unk0C;
49  std::uint32_t unk18;
50  std::uint32_t unk1C;
51  std::uint32_t unk20;
52  std::uint32_t unk24;
53  std::uint32_t unk28;
54  std::uint32_t unk2C;
55  std::uint32_t unk30;
56  std::uint32_t unk34;
57  };
58  static_assert(sizeof(Unk30470Entry) == 0x38);
59 
61  {
62  std::uint32_t unk00;
63  std::uint32_t unk04;
64  std::uint32_t unk08;
65  std::uint32_t unk0C;
66  const char* label;
67  std::uint32_t unk18;
68  std::uint32_t unk1C;
69  std::uint32_t unk20;
70  std::uint32_t unk24;
71  std::uint32_t unk28;
72  std::uint32_t unk2C;
73  std::uint32_t unk30;
74  std::uint32_t unk34;
75  std::uint32_t unk38;
76  std::uint32_t unk3C;
77  std::uint32_t unk40;
78  std::uint32_t unk44;
79  };
80  static_assert(sizeof(Unk30488Entry) == 0x48);
81 
82  struct RUNTIME_DATA
83  {
84 #define RUNTIME_DATA_CONTENT \
85  BSTSmartPointer<MapMoveHandler> moveHandler; /* 00 */ \
86  BSTSmartPointer<MapLookHandler> lookHandler; /* 08 */ \
87  BSTSmartPointer<MapZoomHandler> zoomHandler; /* 10 */ \
88  ObjectRefHandle mapMarker; /* 18 */ \
89  LocalMapMenu localMapMenu; /* 20 */
90 
92  };
93 #ifndef ENABLE_SKYRIM_VR
94  static_assert(sizeof(RUNTIME_DATA) == 0x30420);
95 #elif !defined(ENABLE_SKYRIM_AE) && !defined(ENABLE_SKYRIM_SE)
96  static_assert(sizeof(RUNTIME_DATA) == 0x304A0);
97 #endif
98 
100  {
101 #define RUNTIME_DATA2_CONTENT \
102  RefHandle unk30460; /* 000 */ \
103  NiPoint3 playerMarkerPosition; /* 004 */ \
104  BSTArray<Unk30470Entry*> unk30470; /* 010 */ \
105  BSTArray<Unk30488Entry*> unk30488; /* 028 */ \
106  MapCamera camera; /* 040 */ \
107  std::uint64_t unk30530; /* 0D0 */ \
108  TESWorldSpace* worldSpace; /* 0D8 */ \
109  GFxValue unk30540; /* 0E0 */ \
110  std::uint64_t unk30558; /* 0F8 */ \
111  std::uint64_t unk30560; /* 100 */ \
112  std::uint64_t unk30568; /* 108 */ \
113  std::uint32_t unk30570; /* 110 */ \
114  BSSoundHandle unk30574; /* 114 */ \
115  std::uint64_t unk30580; /* 120 */ \
116  std::uint64_t unk30588; /* 128 */ \
117  std::uint64_t unk30590; /* 130 */
119  };
120  static_assert(sizeof(RUNTIME_DATA2) == 0x138);
121 
122  ~MapMenu() override; // 00
123 
124  // override (IMenu)
125  void Accept(CallbackProcessor* a_processor) override; // 01
126  UI_MESSAGE_RESULTS ProcessMessage(UIMessage& a_message) override; // 04
127  void AdvanceMovie(float a_interval, std::uint32_t a_currentTime) override; // 05
128  void RefreshPlatform() override; // 08
129 
130  // override (BSTEventSink<MenuOpenCloseEvent>)
131 #ifndef SKYRIM_CROSS_VR
133 #endif
134 
135  void PlaceMarker()
136  {
137  using func_t = decltype(&MapMenu::PlaceMarker);
138  REL::Relocation<func_t> func{ RELOCATION_ID(52226, 53113) };
139  return func(this);
140  }
141 
142  [[nodiscard]] WorldSpaceMenu* AsWorldSpaceMenu() noexcept
143  {
145  return nullptr;
146  }
147  return &REL::RelocateMember<WorldSpaceMenu>(this, 0, 0);
148  }
149 
150  [[nodiscard]] const WorldSpaceMenu* AsWorldSpaceMenu() const noexcept
151  {
152  return const_cast<MapMenu*>(this)->AsWorldSpaceMenu();
153  }
154 
156  {
157  return &REL::RelocateMember<BSTEventSink<MenuOpenCloseEvent>>(this, 0x30, 0x58);
158  }
159 
160  [[nodiscard]] const BSTEventSink<MenuOpenCloseEvent>* AsMenuOpenCloseEventSink() const noexcept
161  {
162  return const_cast<MapMenu*>(this)->AsMenuOpenCloseEventSink();
163  }
164 
165  [[nodiscard]] IMapCameraCallbacks* AsIMapCameraCallbacks() noexcept
166  {
167  return &REL::RelocateMember<IMapCameraCallbacks>(this, 0x38, 0x60);
168  }
169 
170  [[nodiscard]] const IMapCameraCallbacks* AsIMapCameraCallbacks() const noexcept
171  {
172  return const_cast<MapMenu*>(this)->AsIMapCameraCallbacks();
173  }
174 
175  [[nodiscard]] inline RUNTIME_DATA& GetRuntimeData() noexcept
176  {
177  return REL::RelocateMember<RUNTIME_DATA>(this, 0x40, 0x68);
178  }
179 
180  [[nodiscard]] inline const RUNTIME_DATA& GetRuntimeData() const noexcept
181  {
182  return REL::RelocateMember<RUNTIME_DATA>(this, 0x40, 0x68);
183  }
184 
185  [[nodiscard]] inline RUNTIME_DATA2& GetRuntimeData2() noexcept
186  {
187  return REL::RelocateMember<RUNTIME_DATA2>(this, 0x30460, 0x30508);
188  }
189 
190  [[nodiscard]] inline const RUNTIME_DATA2& GetRuntimeData2() const noexcept
191  {
192  return REL::RelocateMember<RUNTIME_DATA2>(this, 0x30460, 0x30508);
193  }
194 
195  // members
196 #ifndef SKYRIM_CROSS_VR
197  RUNTIME_DATA_CONTENT // 40, 68
198  RUNTIME_DATA2_CONTENT // 30460, 30508
199 #endif
200  };
201 
202 #ifndef ENABLE_SKYRIM_VR
203  static_assert(sizeof(MapMenu) == 0x30598);
204 #endif
205 }
206 
207 #undef RUNTIME_DATA_CONTENT
208 #undef RUNTIME_DATA2_CONTENT
#define SKYRIM_REL_CONSTEXPR
Definition: Common.h:47
#define RUNTIME_DATA_CONTENT
Definition: MapMenu.h:84
#define RUNTIME_DATA2_CONTENT
Definition: MapMenu.h:101
#define RELOCATION_ID(a_se, a_ae)
Definition: PCH.h:724
static SKYRIM_REL_VR bool IsVR() noexcept
Definition: Module.h:254
Definition: Relocation.h:204
Definition: BSTEvent.h:143
Definition: FxDelegateHandler.h:19
Definition: IMenu.h:55
Definition: MapMenu.h:38
~MapMenu() override
BSTEventSink< MenuOpenCloseEvent > * AsMenuOpenCloseEventSink() noexcept
Definition: MapMenu.h:155
const WorldSpaceMenu * AsWorldSpaceMenu() const noexcept
Definition: MapMenu.h:150
void Accept(CallbackProcessor *a_processor) override
const BSTEventSink< MenuOpenCloseEvent > * AsMenuOpenCloseEventSink() const noexcept
Definition: MapMenu.h:160
constexpr static std::string_view MENU_NAME
Definition: MapMenu.h:41
IMapCameraCallbacks * AsIMapCameraCallbacks() noexcept
Definition: MapMenu.h:165
UI_MESSAGE_RESULTS ProcessMessage(UIMessage &a_message) override
RUNTIME_DATA & GetRuntimeData() noexcept
Definition: MapMenu.h:175
const IMapCameraCallbacks * AsIMapCameraCallbacks() const noexcept
Definition: MapMenu.h:170
const RUNTIME_DATA & GetRuntimeData() const noexcept
Definition: MapMenu.h:180
void AdvanceMovie(float a_interval, std::uint32_t a_currentTime) override
static constexpr auto RTTI
Definition: MapMenu.h:40
BSEventNotifyControl ProcessEvent(const MenuOpenCloseEvent *a_event, BSTEventSource< MenuOpenCloseEvent > *a_eventSource) override
const RUNTIME_DATA2 & GetRuntimeData2() const noexcept
Definition: MapMenu.h:190
void PlaceMarker()
Definition: MapMenu.h:135
WorldSpaceMenu * AsWorldSpaceMenu() noexcept
Definition: MapMenu.h:142
RUNTIME_DATA2 & GetRuntimeData2() noexcept
Definition: MapMenu.h:185
void RefreshPlatform() override
Definition: MenuOpenCloseEvent.h:8
Definition: TESForm.h:36
Definition: TESFullName.h:9
Definition: UIMessage.h:28
Definition: WorldSpaceMenu.h:19
Definition: AbsorbEffect.h:6
constexpr REL::VariantID RTTI_MapMenu(688986, 396841, 0x1f490d0)
UI_MESSAGE_RESULTS
Definition: IMenu.h:48
BSEventNotifyControl
Definition: BSTEvent.h:12
Definition: IMapCameraCallbacks.h:6
Definition: MapMenu.h:100
Definition: MapMenu.h:83
Definition: MapMenu.h:44
std::uint32_t unk0C
Definition: MapMenu.h:47
std::uint32_t unk1C
Definition: MapMenu.h:50
TESForm * unk10
Definition: MapMenu.h:48
std::uint32_t unk20
Definition: MapMenu.h:51
std::uint32_t unk30
Definition: MapMenu.h:55
std::uint32_t unk2C
Definition: MapMenu.h:54
TESFullName * unk00
Definition: MapMenu.h:45
std::uint32_t unk18
Definition: MapMenu.h:49
std::uint32_t unk34
Definition: MapMenu.h:56
std::uint32_t unk28
Definition: MapMenu.h:53
std::uint32_t unk08
Definition: MapMenu.h:46
std::uint32_t unk24
Definition: MapMenu.h:52
Definition: MapMenu.h:61
std::uint32_t unk00
Definition: MapMenu.h:62
std::uint32_t unk30
Definition: MapMenu.h:73
std::uint32_t unk08
Definition: MapMenu.h:64
const char * label
Definition: MapMenu.h:66
std::uint32_t unk0C
Definition: MapMenu.h:65
std::uint32_t unk40
Definition: MapMenu.h:77
std::uint32_t unk28
Definition: MapMenu.h:71
std::uint32_t unk24
Definition: MapMenu.h:70
std::uint32_t unk04
Definition: MapMenu.h:63
std::uint32_t unk34
Definition: MapMenu.h:74
std::uint32_t unk3C
Definition: MapMenu.h:76
std::uint32_t unk44
Definition: MapMenu.h:78
std::uint32_t unk18
Definition: MapMenu.h:67
std::uint32_t unk2C
Definition: MapMenu.h:72
std::uint32_t unk20
Definition: MapMenu.h:69
std::uint32_t unk1C
Definition: MapMenu.h:68
std::uint32_t unk38
Definition: MapMenu.h:75