diff --git a/config/SOUE01/splits.txt b/config/SOUE01/splits.txt index 0257f5fc..79b80620 100644 --- a/config/SOUE01/splits.txt +++ b/config/SOUE01/splits.txt @@ -323,7 +323,10 @@ d/d_stage_parse.cpp: d/d_sys.cpp: .text start:0x80064250 end:0x80064F28 align:16 .ctors start:0x804DB694 end:0x804DB698 + .rodata start:0x804E0C98 end:0x804E0F18 + .data start:0x8050DE58 end:0x8050DF10 .sbss start:0x80575228 end:0x80575248 + .sdata2 start:0x80577928 end:0x80577930 .bss start:0x805A0720 end:0x805A0778 d/d_sys_init.cpp: diff --git a/config/SOUE01/symbols.txt b/config/SOUE01/symbols.txt index 17df3c55..29452858 100644 --- a/config/SOUE01/symbols.txt +++ b/config/SOUE01/symbols.txt @@ -552,7 +552,7 @@ create__3d2dFPQ23EGG4Heap = .text:0x80016630; // type:function size:0x58 setLytAllocator__3d2dFv = .text:0x80016690; // type:function size:0xC fn_800166A0 = .text:0x800166A0; // type:function size:0x58 create__3d3dFPQ23EGG4Heap = .text:0x80016700; // type:function size:0x160 -fn_80016860 = .text:0x80016860; // type:function size:0x28 +fn_80016860__3d3dFv = .text:0x80016860; // type:function size:0x28 createLightTextures__3d3dFv = .text:0x80016890; // type:function size:0x98 fn_80016930 = .text:0x80016930; // type:function size:0x2C worldToScreen__3d3dFR7mVec3_cRC7mVec3_c = .text:0x80016960; // type:function size:0x130 @@ -581,7 +581,7 @@ create3__Q23d3d13AnmMdlWrapperFR9dAcBase_cPvPvPCcPCcPQ33m3d5mdl_c13mdlCallback_c setAnm__Q23d3d14AnmMdlWrapper2FPCcQ23m3d10playMode_ef = .text:0x80017290; // type:function size:0xEC insertNode__3d3dFPQ23d3d12SomeListNodeff = .text:0x80017380; // type:function size:0xAC clearList__3d3dFv = .text:0x80017430; // type:function size:0xCC -fn_80017500 = .text:0x80017500; // type:function size:0x1DC +fn_80017500__3d3dFv = .text:0x80017500; // type:function size:0x1DC fn_800176E0 = .text:0x800176E0; // type:function size:0x10 unk2__3d3dFRQ34nw4r3g3d6ResMatRQ34nw4r3g3d14ResMatTevColorP13ActorLighting = .text:0x800176F0; // type:function size:0x418 setRoomTevColors__3d3dFQ34nw4r3g3d6ResMdlib = .text:0x80017B10; // type:function size:0x1D4 @@ -2780,10 +2780,10 @@ staticExecute__8dScene_cFv = .text:0x80062D00; // type:function size:0x68 setRootActor__8dScene_cFQ28fProfile14PROFILE_NAME_eUlll = .text:0x80062D70; // type:function size:0x30 __dt__8dScene_cFv = .text:0x80062DA0; // type:function size:0x5C scope:weak __sinit_\d_scene_cpp = .text:0x80062E00; // type:function size:0x3C scope:local -fn_80062E40 = .text:0x80062E40; // type:function size:0x4 -fn_80062E50 = .text:0x80062E50; // type:function size:0x60 -fn_80062EB0 = .text:0x80062EB0; // type:function size:0x4 -fn_80062EC0 = .text:0x80062EC0; // type:function size:0x4 +fn_80062E40__6dStateFv = .text:0x80062E40; // type:function size:0x4 +fn_80062E50__6dStateFv = .text:0x80062E50; // type:function size:0x60 +fn_80062EB0__6dStateFv = .text:0x80062EB0; // type:function size:0x4 +fn_80062EC0__6dStateFv = .text:0x80062EC0; // type:function size:0x4 handleBzsPcam__FiPC14BzsSectionHead = .text:0x80062ED0; // type:function size:0x1C scope:local handleBzsLyse__FiPC14BzsSectionHead = .text:0x80062EF0; // type:function size:0x20 scope:local handleBzsStif__FiPC14BzsSectionHead = .text:0x80062F10; // type:function size:0x54 scope:local @@ -2826,9 +2826,9 @@ initAudioMgr__6dSys_cFPQ23EGG4Heap = .text:0x80064250; // type:function size:0xB beginRender__6dSys_cFv = .text:0x80064300; // type:function size:0x38 endRender__6dSys_cFv = .text:0x80064340; // type:function size:0x18 beginFrame__6dSys_cFv = .text:0x80064360; // type:function size:0x68 -EGG__ConfigurationData__onBeginFrame = .text:0x800643D0; // type:function size:0x4 +onBeginFrame__Q23EGG129TSystemFv = .text:0x800643D0; // type:function size:0x4 endFrame__6dSys_cFv = .text:0x800643E0; // type:function size:0x48 -EGG__ConfigurationData__onEndFrame = .text:0x80064430; // type:function size:0x4 +onEndFrame__Q23EGG129TSystemFv = .text:0x80064430; // type:function size:0x4 setBlack__6dSys_cFb = .text:0x80064440; // type:function size:0x80 setFrameRate__6dSys_cFUc = .text:0x800644C0; // type:function size:0x10 getFrameRate__6dSys_cFv = .text:0x800644D0; // type:function size:0x10 @@ -2836,18 +2836,18 @@ setClearColor__6dSys_cFQ34nw4r2ut5Color = .text:0x800644E0; // type:function siz getClearColor__6dSys_cFv = .text:0x80064540; // type:function size:0x14 create__6dSys_cFv = .text:0x80064560; // type:function size:0x3BC setPosParam__Q23EGG14CoreControllerFff = .text:0x80064920; // type:function size:0x8 -EGG__TSystem__initialize = .text:0x80064930; // type:function size:0x1F4 +initialize__Q23EGG129TSystemFv = .text:0x80064930; // type:function size:0x1F4 execute__6dSys_cFv = .text:0x80064B30; // type:function size:0x268 fixHeaps__7dSystemFv = .text:0x80064DA0; // type:function size:0xB8 __sinit_\d_sys_cpp = .text:0x80064E60; // type:function size:0x34 -EGG__ConfigurationData__initRenderMode = .text:0x80064EA0; // type:function size:0x4 -getVideo__Q23EGG123TSystemFv = .text:0x80064EB0; // type:function size:0x8 -getSysHeap__Q23EGG123TSystemFv = .text:0x80064EC0; // type:function size:0x8 -getDisplay__Q23EGG123TSystemFv = .text:0x80064ED0; // type:function size:0x8 -getXfbMgr__Q23EGG123TSystemFv = .text:0x80064EE0; // type:function size:0x8 -getPerfView__Q23EGG123TSystemFv = .text:0x80064EF0; // type:function size:0x14 -getSceneMgr__Q23EGG123TSystemFv = .text:0x80064F10; // type:function size:0x8 -getAudioMgr__Q23EGG123TSystemFv = .text:0x80064F20; // type:function size:0x8 +initRenderMode__Q23EGG129TSystemFv = .text:0x80064EA0; // type:function size:0x4 +getVideo__Q23EGG129TSystemFv = .text:0x80064EB0; // type:function size:0x8 +getSysHeap__Q23EGG129TSystemFv = .text:0x80064EC0; // type:function size:0x8 +getDisplay__Q23EGG129TSystemFv = .text:0x80064ED0; // type:function size:0x8 +getXfbMgr__Q23EGG129TSystemFv = .text:0x80064EE0; // type:function size:0x8 +getPerfView__Q23EGG129TSystemFv = .text:0x80064EF0; // type:function size:0x14 +getSceneMgr__Q23EGG129TSystemFv = .text:0x80064F10; // type:function size:0x8 +getAudioMgr__Q23EGG129TSystemFv = .text:0x80064F20; // type:function size:0x8 fn_80064F30 = .text:0x80064F30; // type:function size:0x24 fn_80064F60 = .text:0x80064F60; // type:function size:0x2C fn_80064F90 = .text:0x80064F90; // type:function size:0x30 @@ -8504,8 +8504,8 @@ fn_80152C30 = .text:0x80152C30; // type:function size:0xE8 fn_80152D20 = .text:0x80152D20; // type:function size:0x54 fn_80152D80 = .text:0x80152D80; // type:function size:0x5C create__18dLytSystemWindow_cFv = .text:0x80152DE0; // type:function size:0x3C -fn_80152E20 = .text:0x80152E20; // type:function size:0xC8 -fn_80152EF0 = .text:0x80152EF0; // type:function size:0x8 +fn_80125E20__18dLytSystemWindow_cFv = .text:0x80152E20; // type:function size:0xC8 +fn_80125EF0__18dLytSystemWindow_cFv = .text:0x80152EF0; // type:function size:0x8 fn_80152F00 = .text:0x80152F00; // type:function size:0x8 fn_80152F10__18dLytSystemWindow_cFv = .text:0x80152F10; // type:function size:0x10 setSelectBtn__18dLytSystemWindow_cFff = .text:0x80152F20; // type:function size:0x18 @@ -10250,8 +10250,8 @@ dAcOInsect_0xA4__12dAcOInsect_cFv = .text:0x80190660; // type:function size:0x8 __dt__12dAcOInsect_cFv = .text:0x80190670; // type:function size:0xA0 fn_80190710 = .text:0x80190710; // type:function size:0x14 fn_80190730 = .text:0x80190730; // type:function size:0x48 -fn_80190780 = .text:0x80190780; // type:function size:0x40 -fn_801907C0 = .text:0x801907C0; // type:function size:0x4 +fn_80190780__15SaveTimeRelatedFPQ23EGG4Heap = .text:0x80190780; // type:function size:0x40 +fn_801907C0__15SaveTimeRelatedFv = .text:0x801907C0; // type:function size:0x4 fn_801907D0__15SaveTimeRelatedFv = .text:0x801907D0; // type:function size:0x1C fn_801907F0__15SaveTimeRelatedFv = .text:0x801907F0; // type:function size:0x38 fn_80190830 = .text:0x80190830; // type:function size:0x50 @@ -30885,10 +30885,13 @@ __vt__24daPlBaseScnObjCallback_c = .data:0x8050DDB8; // type:object size:0x20 @4670 = .data:0x8050DDE8; // type:object size:0xB scope:local data:string __vt__8dScene_c = .data:0x8050DDF8; // type:object size:0x4C @23343 = .data:0x8050DE48; // type:object size:0xE scope:local data:string -lbl_8050DE58 = .data:0x8050DE58; // type:object size:0x5C -lbl_8050DEB4 = .data:0x8050DEB4; // type:object size:0xD data:string -lbl_8050DEC4 = .data:0x8050DEC4; // type:object size:0xE data:string -RootHeapsManager__EGG__T_System<>__Configuration__vtable = .data:0x8050DED4; // type:object size:0x3C +@25556 = .data:0x8050DE58; // type:object size:0x11 scope:local data:string +@25619 = .data:0x8050DE6C; // type:object size:0x15 scope:local data:string +@25620 = .data:0x8050DE84; // type:object size:0x15 scope:local data:string +@25621 = .data:0x8050DE9C; // type:object size:0x15 scope:local data:string +@25756 = .data:0x8050DEB4; // type:object size:0xD scope:local data:string +@25757 = .data:0x8050DEC4; // type:object size:0xE scope:local data:string +__vt__Q23EGG129TSystem = .data:0x8050DED4; // type:object size:0x3C lbl_8050DF10 = .data:0x8050DF10; // type:object size:0x18 @9033 = .data:0x8050DF28; // type:object size:0x11 scope:local data:string @9034 = .data:0x8050DF3C; // type:object size:0x11 scope:local data:string @@ -42202,8 +42205,8 @@ ms_RootHeapMem2__6dSys_c = .sbss:0x80575230; // type:object size:0x4 data:4byte s_OrgMEM1ArenaLo__7dSystem = .sbss:0x80575234; // type:object size:0x4 data:4byte s_NewMEM1ArenaLo__7dSystem = .sbss:0x80575238; // type:object size:0x4 data:4byte s_OrgMEM1ArenaHi__7dSystem = .sbss:0x8057523C; // type:object size:0x4 data:4byte -s_NewMEM1ArenaHi__7dSystem = .sbss:0x80575240; // type:object size:0x8 data:4byte -dSystem__myDylinkInitPhase = .sbss:0x80575248; // type:object size:0x8 +s_NewMEM1ArenaHi__7dSystem = .sbss:0x80575240; // type:object size:0x4 data:4byte +myDylinkInitPhase__7dSystem = .sbss:0x80575248; // type:object size:0x8 sInstance__18ArcCallbackHandler = .sbss:0x80575250; // type:object size:0x8 data:4byte aspectRatio = .sbss:0x80575258; // type:object size:0x4 align:4 data:float sInstance__8dCsMgr_c = .sbss:0x80575260; // type:object size:0x4 data:4byte @@ -42664,7 +42667,7 @@ Ydchuff = .sbss:0x80575B60; // type:object size:0x8 data:4byte sm_numberMemo__10sStateID_c = .sbss:0x80575B68; // type:object size:0x4 data:4byte sAssertCallback__7sAssert = .sbss:0x80575B70; // type:object size:0x4 data:4byte m_gameFrame__10cCounter_c = .sbss:0x80575B78; // type:object size:0x4 data:4byte -lbl_80575B7C = .sbss:0x80575B7C; // type:object size:0x4 data:4byte +m_unkCounter__10cCounter_c = .sbss:0x80575B7C; // type:object size:0x4 data:4byte mFirst__24DynamicModuleControlBase = .sbss:0x80575B80; // type:object size:0x4 data:4byte mLast__24DynamicModuleControlBase = .sbss:0x80575B84; // type:object size:0x4 data:4byte sAllocBytes__20DynamicModuleControl = .sbss:0x80575B88; // type:object size:0x4 data:4byte @@ -44186,8 +44189,8 @@ lbl_80577910 = .sdata2:0x80577910; // type:object size:0x4 align:4 data:float lbl_80577914 = .sdata2:0x80577914; // type:object size:0x4 align:4 data:float lbl_80577918 = .sdata2:0x80577918; // type:object size:0x4 align:4 data:float roomActivateHandlers = .sdata2:0x80577920; // type:object size:0x8 scope:local -lbl_80577928 = .sdata2:0x80577928; // type:object size:0x4 align:4 data:float -lbl_8057792C = .sdata2:0x8057792C; // type:object size:0x4 align:4 data:float +@25622 = .sdata2:0x80577928; // type:object size:0x4 align:4 data:float +@25623 = .sdata2:0x8057792C; // type:object size:0x4 align:4 data:float lbl_80577930 = .sdata2:0x80577930; // type:object size:0x8 align:8 data:double lbl_80577938 = .sdata2:0x80577938; // type:object size:0x8 align:8 data:double lbl_80577940 = .sdata2:0x80577940; // type:object size:0x4 align:4 data:float diff --git a/include/d/d_sys.h b/include/d/d_sys.h index 61135bc4..f8fbc979 100644 --- a/include/d/d_sys.h +++ b/include/d/d_sys.h @@ -2,11 +2,21 @@ #define D_SYS_H #include "common.h" +#include "egg/core/eggAsyncDisplay.h" #include "egg/core/eggHeap.h" #include "egg/core/eggSystem.h" #include "nw4r/ut/ut_Color.h" -typedef EGG::TSystem System; +#define ROUND_UP_4KB(x) (((u32)(x) + 4096 - 1) & ~(4096 - 1)) + +typedef EGG::TSystem< + EGG::Video, + EGG::AsyncDisplay, + EGG::XfbManager, + EGG::SimpleAudioMgr, + EGG::SceneManager, + EGG::PerformanceView +> System; class dSndMgr_c; @@ -38,6 +48,11 @@ public: namespace dSystem { +void *s_OrgMEM1ArenaLo; +void *s_NewMEM1ArenaLo; +void *s_OrgMEM1ArenaHi; +void *s_NewMEM1ArenaHi; + void fixHeaps(); }; diff --git a/include/egg/core/eggController.h b/include/egg/core/eggController.h index a790b667..8dd447a4 100644 --- a/include/egg/core/eggController.h +++ b/include/egg/core/eggController.h @@ -346,6 +346,10 @@ public: sConnectCallback = cb; } + static void setWPADWorkSize(u32 size) { + sWPADWorkSize = size; + } + private: CoreControllerMgr(); diff --git a/include/egg/core/eggDisplay.h b/include/egg/core/eggDisplay.h index cdf2fe7a..986cfcda 100644 --- a/include/egg/core/eggDisplay.h +++ b/include/egg/core/eggDisplay.h @@ -58,6 +58,10 @@ public: mClearColor = color; } + u32 getClearZ() { + return mClearZ; + } + public: static u32 sTickPeriod; }; diff --git a/include/egg/core/eggDvdFile.h b/include/egg/core/eggDvdFile.h index ac36ae4e..6b511e2a 100644 --- a/include/egg/core/eggDvdFile.h +++ b/include/egg/core/eggDvdFile.h @@ -39,7 +39,7 @@ public: /* vt 0x24 */ virtual bool open(const char *path, void *); public: - void initialize(); + static void initialize(); DvdFile(); void initiate(); s32 sync(); diff --git a/include/egg/core/eggSystem.h b/include/egg/core/eggSystem.h index 97682fa3..c1686d2e 100644 --- a/include/egg/core/eggSystem.h +++ b/include/egg/core/eggSystem.h @@ -2,31 +2,336 @@ #define EGG_SYSTEM_H #include "common.h" +#include "egg/core/eggController.h" +#include "egg/core/eggDisplay.h" +#include "egg/core/eggDvdFile.h" #include "egg/core/eggGraphicsFifo.h" #include "egg/core/eggHeap.h" +#include "egg/core/eggVideo.h" +#include "egg/core/eggXfbManager.h" +#include "rvl/WPAD.h" +#include "toBeSorted/d_exception.h" -#include "rvl/SC.h" +namespace { -// Ported from https://github.com/snailspeed3/mkw/blob/master/lib/egg/core/eggSystem.hpp +// TODO Determine better names (+ location?) for this render mode set + +const GXRenderModeObj gRMO_Unk1 = { + 0, // tvInfo + 608, // fbWidth + 456, // efbHeight + 456, // xfbHeight + 25, // viXOrigin + 12, // viYOrigin + 670, // viWidth + 456, // viHeight + 1, // xfbMode + 0, // field_rendering + 0, // aa + { + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + }, // sample_pattern + {0, 0, 21, 22, 21, 0, 0} // vFilter +}; + +const GXRenderModeObj gRMO_Unk2 = { + 2, // tvInfo + 608, // fbWidth + 456, // efbHeight + 456, // xfbHeight + 25, // viXOrigin + 12, // viYOrigin + 670, // viWidth + 456, // viHeight + 0, // xfbMode + 0, // field_rendering + 0, // aa + { + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + }, // sample_pattern + {0, 0, 21, 22, 21, 0, 0} // vFilter +}; + +const GXRenderModeObj gRMO_Unk3 = { + 4, // tvInfo + 608, // fbWidth + 456, // efbHeight + 542, // xfbHeight + 27, // viXOrigin + 16, // viYOrigin + 666, // viWidth + 542, // viHeight + 1, // xfbMode + 0, // field_rendering + 0, // aa + { + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + }, // sample_pattern + {0, 0, 21, 22, 21, 0, 0} // vFilter +}; + +const GXRenderModeObj gRMO_Unk4 = { + 20, // tvInfo + 608, // fbWidth + 456, // efbHeight + 456, // xfbHeight + 25, // viXOrigin + 12, // viYOrigin + 670, // viWidth + 456, // viHeight + 1, // xfbMode + 0, // field_rendering + 0, // aa + { + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + }, // sample_pattern + {0, 0, 21, 22, 21, 0, 0} // vFilter +}; + +const GXRenderModeObj gRMO_Unk5 = { + 22, // tvInfo + 608, // fbWidth + 456, // efbHeight + 456, // xfbHeight + 25, // viXOrigin + 12, // viYOrigin + 670, // viWidth + 456, // viHeight + 0, // xfbMode + 0, // field_rendering + 0, // aa + { + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + }, // sample_pattern + {0, 0, 21, 22, 21, 0, 0} // vFilter +}; + +const GXRenderModeObj gRMO_Unk6 = { + 0, // tvInfo + 608, // fbWidth + 456, // efbHeight + 456, // xfbHeight + 17, // viXOrigin + 12, // viYOrigin + 686, // viWidth + 456, // viHeight + 1, // xfbMode + 0, // field_rendering + 0, // aa + { + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + }, // sample_pattern + {0, 0, 21, 22, 21, 0, 0} // vFilter +}; + +const GXRenderModeObj gRMO_Unk7 = { + 2, // tvInfo + 608, // fbWidth + 456, // efbHeight + 456, // xfbHeight + 17, // viXOrigin + 12, // viYOrigin + 686, // viWidth + 456, // viHeight + 0, // xfbMode + 0, // field_rendering + 0, // aa + { + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + }, // sample_pattern + {0, 0, 21, 22, 21, 0, 0} // vFilter +}; + +const GXRenderModeObj gRMO_Unk8 = { + 4, // tvInfo + 608, // fbWidth + 456, // efbHeight + 542, // xfbHeight + 19, // viXOrigin + 16, // viYOrigin + 682, // viWidth + 542, // viHeight + 1, // xfbMode + 0, // field_rendering + 0, // aa + { + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + }, // sample_pattern + {0, 0, 21, 22, 21, 0, 0} // vFilter +}; + +const GXRenderModeObj gRMO_Unk9 = { + 20, // tvInfo + 608, // fbWidth + 456, // efbHeight + 456, // xfbHeight + 17, // viXOrigin + 12, // viYOrigin + 686, // viWidth + 456, // viHeight + 1, // xfbMode + 0, // field_rendering + 0, // aa + { + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + }, // sample_pattern + {0, 0, 21, 22, 21, 0, 0} // vFilter +}; + +const GXRenderModeObj gRMO_Unk10 = { + 22, // tvInfo + 608, // fbWidth + 456, // efbHeight + 456, // xfbHeight + 17, // viXOrigin + 12, // viYOrigin + 686, // viWidth + 456, // viHeight + 0, // xfbMode + 0, // field_rendering + 0, // aa + { + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + {6, 6}, + }, // sample_pattern + {0, 0, 21, 22, 21, 0, 0} // vFilter +}; + +const EGG::Video::RenderModeObjSet gUnkRenderModeObjSet = { + {&gRMO_Unk1, &gRMO_Unk2, &gRMO_Unk3, + &gRMO_Unk4, &gRMO_Unk5, &gRMO_Unk6, + &gRMO_Unk7, &gRMO_Unk8, &gRMO_Unk9, + &gRMO_Unk10} +}; + +} namespace EGG { -class Display; -class Heap; -class PerformanceView; +// TODO Proper definition of PerformanceView +class PerformanceView { +public: + u8 placeholder[0x4c]; + /* 0x4c */ u32 _4c; +}; + class SceneManager; class SimpleAudioMgr; -class Thread; -class Video; -class XfbManager; -class BaseSystem { +class ConfigurationData { public: - static BaseSystem *sSystem; - -public: - inline BaseSystem() : mSysHeapSize(0x97000), mGraphicsFifoSize(0x80000), mRenderMode(nullptr) {} + inline ConfigurationData() : mSystemHeapSize(0x89000) {} + // vtable at 0x0 /* vt 0x08 */ virtual Video *getVideo() = 0; /* vt 0x0C */ virtual Heap *getSysHeap() = 0; /* vt 0x10 */ virtual Display *getDisplay() = 0; @@ -42,34 +347,51 @@ public: /* vt 0x38 */ virtual void initialize() = 0; public: - /* 0x04 */ void *mMEM1ArenaLo; - /* 0x08 */ void *mMEM1ArenaHi; - /* 0x0C */ void *mMEM2ArenaLo; - /* 0x10 */ void *mMEM2ArenaHi; - /* 0x14 */ u32 mMemorySize; + /* 0x04 */ u32 mRoot1HeapStart; + /* 0x08 */ u32 mRoot1HeapEnd; + /* 0x0C */ u32 mRoot2HeapStart; + /* 0x10 */ u32 mRoot2HeapEnd; + /* 0x14 */ u32 mMemSize; /* 0x18 */ Heap *mRootHeapMem1; /* 0x1C */ Heap *mRootHeapMem2; /* 0x20 */ Heap *mRootHeapDebug; - /* 0x24 */ Heap *mSysHeap; - /* 0x28 */ Thread *mThread; - /* 0x2C */ void *_2c; - /* 0x30 */ void *_30; - /* 0x34 */ u32 mSysHeapSize; - /* 0x38 */ u32 mGraphicsFifoSize; - /* 0x3C */ GXRenderModeObj *mRenderMode; + /* 0x24 */ Heap *mSystemHeap; + /* 0x28 */ Thread *mSystemThread; + /* 0x2C */ u32 field_0x2C; + /* 0x30 */ u32 mSystemHeapStart; + /* 0x34 */ u32 mSystemHeapSize; +}; +class BaseSystem { +public: + static ConfigurationData *mConfigData; + + static XfbManager *getXfbMgr() { + return mConfigData->getXfbMgr(); + } + static Display *getDisplay() { + return mConfigData->getDisplay(); + } + static Video *getVideo() { + return mConfigData->getVideo(); + } }; -template -class TSystem : public BaseSystem { +template +class TSystem : public ConfigurationData { public: - inline TSystem() : BaseSystem() {} + inline TSystem() : mGraphicsFifoSize(0x80000), mRenderMode() {} + + void onBeginFrame() override {} + void onEndFrame() override {} + + void initRenderMode() override {} Video *getVideo() override { return static_cast