CommonLibSSE NG
MainMenu.h
Go to the documentation of this file.
1 #pragma once
2 
4 #include "RE/B/BSTEvent.h"
6 #include "RE/I/IMenu.h"
7 
8 namespace RE
9 {
10  class BSSaveDataEvent;
11  class BSSystemEvent;
12 
13  // menuDepth = 0
14  // flags = kPausesGame | kDisablePauseMenu | kRequiresUpdate | kUpdateUsesCursor | kApplicationMenu
15  // context = kMenuMode
16  class MainMenu :
17 #ifndef SKYRIM_CROSS_VR
18  public IMenu, // 00
19  public BSTEventSink<BSSystemEvent>, // 30
20  public BSTEventSink<BSSaveDataEvent>, // 38
21  public GFxFunctionHandler // 40
22 #else
23  public IMenu // 00
24 #endif
25  {
26  public:
27  inline static constexpr auto RTTI = RTTI_MainMenu;
28  constexpr static std::string_view MENU_NAME = "Main Menu";
29 
30  struct RUNTIME_DATA
31  {
32 #define RUNTIME_DATA_CONTENT \
33  BSScaleformExternalTexture gamerIconTexture; /* 00 */ \
34  std::uint32_t unk68; /* 18 */ \
35  std::uint8_t unk6C; /* 1C */ \
36  std::uint8_t unk6D; /* 1D */ \
37  std::uint8_t unk6E; /* 1E */ \
38  std::uint8_t pad6F; /* 1F */
39 
41  };
42  static_assert(sizeof(RUNTIME_DATA) == 0x20);
43 
44  ~MainMenu() override; // 00
45 
46  // override (IMenu)
47  void Accept(CallbackProcessor* a_processor) override; // 01
48  UI_MESSAGE_RESULTS ProcessMessage(UIMessage& a_message) override; // 04
49  void AdvanceMovie(float a_interval, std::uint32_t a_currentTime) override; // 05
50 
51 #ifndef SKYRIM_CROSS_VR
52  // override (BSTEventSink<BSSystemEvent>)
53  BSEventNotifyControl ProcessEvent(const BSSystemEvent* a_event, BSTEventSource<BSSystemEvent>* a_eventSource) override; // 01
54 
55  // override (BSTEventSink<BSSaveDataEvent>)
56  BSEventNotifyControl ProcessEvent(const BSSaveDataEvent* a_event, BSTEventSource<BSSaveDataEvent>* a_eventSource) override; // 01
57 
58  // override (GFxFunctionHandler)
59  void Call(Params& a_params) override; // 01
60 #endif
61 
63  {
64  return &REL::RelocateMember<BSTEventSink<BSSystemEvent>>(this, 0x30, 0x40);
65  }
66 
67  [[nodiscard]] const BSTEventSink<BSSystemEvent>* AsBSSystemEventSink() const noexcept
68  {
69  return const_cast<MainMenu*>(this)->AsBSSystemEventSink();
70  }
71 
73  {
74  return &REL::RelocateMember<BSTEventSink<BSSaveDataEvent>>(this, 0x38, 0x48);
75  }
76 
77  [[nodiscard]] const BSTEventSink<BSSaveDataEvent>* AsBSSaveDataEventSink() const noexcept
78  {
79  return const_cast<MainMenu*>(this)->AsBSSaveDataEventSink();
80  }
81 
82  [[nodiscard]] GFxFunctionHandler* AsGFxFunctionHandler() noexcept
83  {
84  return &REL::RelocateMember<GFxFunctionHandler>(this, 0x40, 0x50);
85  }
86 
87  [[nodiscard]] const GFxFunctionHandler* AsGFxFunctionHandler() const noexcept
88  {
89  return const_cast<MainMenu*>(this)->AsGFxFunctionHandler();
90  }
91 
92  [[nodiscard]] inline RUNTIME_DATA& GetRuntimeData() noexcept
93  {
94  return REL::RelocateMember<RUNTIME_DATA>(this, 0x50, 0x60);
95  }
96 
97  [[nodiscard]] inline const RUNTIME_DATA& GetRuntimeData() const noexcept
98  {
99  return REL::RelocateMember<RUNTIME_DATA>(this, 0x50, 0x60);
100  }
101 
102  // members
103 #ifndef SKYRIM_CROSS_VR
104  RUNTIME_DATA_CONTENT // 50, 60
105 #endif
106  };
107 #ifndef ENABLE_SKYRIM_VR
108  static_assert(sizeof(MainMenu) == 0x70);
109 #elif !defined(ENABLE_SKYRIM_AE) && !defined(ENABLE_SKYRIM_SE)
110  static_assert(sizeof(MainMenu) == 0x80);
111 #endif
112 }
113 #undef RUNTIME_DATA_CONTENT
#define RUNTIME_DATA_CONTENT
Definition: MainMenu.h:32
Definition: BSTEvent.h:143
Definition: BSTEvent.h:19
Definition: FxDelegateHandler.h:19
Definition: GFxFunctionHandler.h:12
Definition: IMenu.h:55
Definition: MainMenu.h:25
BSEventNotifyControl ProcessEvent(const BSSaveDataEvent *a_event, BSTEventSource< BSSaveDataEvent > *a_eventSource) override
const BSTEventSink< BSSaveDataEvent > * AsBSSaveDataEventSink() const noexcept
Definition: MainMenu.h:77
const GFxFunctionHandler * AsGFxFunctionHandler() const noexcept
Definition: MainMenu.h:87
static constexpr auto RTTI
Definition: MainMenu.h:27
const BSTEventSink< BSSystemEvent > * AsBSSystemEventSink() const noexcept
Definition: MainMenu.h:67
BSTEventSink< BSSystemEvent > * AsBSSystemEventSink() noexcept
Definition: MainMenu.h:62
void Accept(CallbackProcessor *a_processor) override
BSEventNotifyControl ProcessEvent(const BSSystemEvent *a_event, BSTEventSource< BSSystemEvent > *a_eventSource) override
GFxFunctionHandler * AsGFxFunctionHandler() noexcept
Definition: MainMenu.h:82
~MainMenu() override
BSTEventSink< BSSaveDataEvent > * AsBSSaveDataEventSink() noexcept
Definition: MainMenu.h:72
RUNTIME_DATA & GetRuntimeData() noexcept
Definition: MainMenu.h:92
void Call(Params &a_params) override
constexpr static std::string_view MENU_NAME
Definition: MainMenu.h:28
void AdvanceMovie(float a_interval, std::uint32_t a_currentTime) override
const RUNTIME_DATA & GetRuntimeData() const noexcept
Definition: MainMenu.h:97
UI_MESSAGE_RESULTS ProcessMessage(UIMessage &a_message) override
Definition: UIMessage.h:28
Definition: AbsorbEffect.h:6
UI_MESSAGE_RESULTS
Definition: IMenu.h:48
constexpr REL::VariantID RTTI_MainMenu(688873, 396727, 0x1f47148)
BSEventNotifyControl
Definition: BSTEvent.h:12
Definition: GFxFunctionHandler.h:17
Definition: MainMenu.h:31