summaryrefslogtreecommitdiff
path: root/include/egg/core/eggSystem.h
diff options
context:
space:
mode:
authorrobojumper <robojumper@gmail.com>2026-04-09 08:14:45 +0200
committerGitHub <noreply@github.com>2026-04-09 08:14:45 +0200
commit124935c073861c40f412e1bc0bfb880f5ded7693 (patch)
tree10a0d14b20b56477055997c92449c448a9f97b97 /include/egg/core/eggSystem.h
parentf9fb1b59fca13953041d747da203ec37c38f6bc3 (diff)
parent5083d2031c263e392165fe440fe175d67ef86bd1 (diff)
Merge pull request #305 from bgsamm/d_main
Matches for d_main, d_sys, & mpls
Diffstat (limited to 'include/egg/core/eggSystem.h')
-rw-r--r--include/egg/core/eggSystem.h77
1 files changed, 68 insertions, 9 deletions
diff --git a/include/egg/core/eggSystem.h b/include/egg/core/eggSystem.h
index 919c84da..634b7578 100644
--- a/include/egg/core/eggSystem.h
+++ b/include/egg/core/eggSystem.h
@@ -2,30 +2,37 @@
#define EGG_SYSTEM_H
#include "common.h"
-#include "egg/core/eggHeap.h"
-
+#include "egg/core/eggVideo.h"
namespace EGG {
class Display;
-class XfbManager;
+class Heap;
+class PerformanceView;
+class SceneManager;
+class SimpleAudioMgr;
+class Thread;
class Video;
+class XfbManager;
class ConfigurationData {
public:
+ inline ConfigurationData() : mSystemHeapSize(0x89000) {}
+
// vtable at 0x0
/* vt 0x08 */ virtual Video *getVideo() = 0;
/* vt 0x0C */ virtual Heap *getSystemHeap() = 0;
/* vt 0x10 */ virtual Display *getDisplay() = 0;
/* vt 0x14 */ virtual XfbManager *getXfbMgr() = 0;
- /* vt 0x18 */ virtual void getPerfView() = 0;
- /* vt 0x1C */ virtual void getScnMgr() = 0;
- /* vt 0x20 */ virtual void getAudioMgr() = 0;
+ /* vt 0x18 */ virtual PerformanceView *getPerfView() = 0;
+ /* vt 0x1C */ virtual SceneManager *getSceneMgr() = 0;
+ /* vt 0x20 */ virtual SimpleAudioMgr *getAudioMgr() = 0;
/* vt 0x24 */ virtual void onBeginFrame();
/* vt 0x28 */ virtual void onEndFrame();
/* vt 0x2C */ virtual void initRenderMode();
/* vt 0x30 */ virtual void initMemory();
/* vt 0x34 */ virtual void run();
+ /* vt 0x38 */ virtual void initialize() = 0;
public:
/* 0x04 */ u32 mRoot1HeapStart;
@@ -41,12 +48,11 @@ public:
/* 0x2C */ u32 field_0x2C;
/* 0x30 */ u32 mSystemHeapStart;
/* 0x34 */ u32 mSystemHeapSize;
- /* 0x38 */ u32 mGraphicsFifoSize;
- /* 0x3C */ u32 field_0x3C;
};
class BaseSystem {
public:
static ConfigurationData *mConfigData;
+
static XfbManager *getXfbMgr() {
return mConfigData->getXfbMgr();
}
@@ -59,7 +65,60 @@ public:
};
template <class TVideo, class TDisplay, class TXfbManager, class TAudioManager, class TSceneManager, class TPerfView>
-class TSystem : ConfigurationData {};
+class TSystem : public ConfigurationData {
+public:
+ inline TSystem() : mGraphicsFifoSize(0x80000), mRenderMode() {}
+
+ void onBeginFrame() override {}
+ void onEndFrame() override {}
+
+ void initRenderMode() override {}
+ void initialize() override {}
+
+ Video *getVideo() override {
+ return static_cast<Video *>(mVideo);
+ }
+
+ Heap *getSystemHeap() override {
+ return static_cast<Heap *>(mSystemHeap);
+ }
+
+ Display *getDisplay() override {
+ return static_cast<Display *>(mDisplay);
+ }
+
+ XfbManager *getXfbMgr() override {
+ return static_cast<XfbManager *>(mXfbMgr);
+ }
+
+ PerformanceView *getPerfView() override {
+ return static_cast<PerformanceView *>(mPerfView);
+ }
+
+ SceneManager *getSceneMgr() override {
+ return static_cast<SceneManager *>(mSceneMgr);
+ }
+
+ SimpleAudioMgr *getAudioMgr() override {
+ return static_cast<SimpleAudioMgr *>(mAudioMgr);
+ }
+
+ // Trick to fix weak function order in d_sys.cpp
+ // https://github.com/zeldaret/ss/pull/305#issuecomment-4201728492
+ void doInitialize() {
+ initialize();
+ }
+
+public:
+ /* 0x38 */ u32 mGraphicsFifoSize;
+ /* 0x3C */ GXRenderModeObj *mRenderMode;
+ /* 0x40 */ TAudioManager *mAudioMgr;
+ /* 0x44 */ TVideo *mVideo;
+ /* 0x48 */ TXfbManager *mXfbMgr;
+ /* 0x4c */ TDisplay *mDisplay;
+ /* 0x50 */ TPerfView *mPerfView;
+ /* 0x54 */ TSceneManager *mSceneMgr;
+};
} // namespace EGG