From 038119e69ac088a3bb98518f009814fb01a02387 Mon Sep 17 00:00:00 2001 From: NaraHiero Date: Tue, 22 Aug 2023 18:04:39 -0400 Subject: [PATCH] Match all RKSceneManager + some RKSystem functions --- pack/dol_objects.txt | 6 +- pack/dol_slices.yml | 4 +- pack/symbols.yml | 46 ++--- source/egg/core/eggSceneManager.hpp | 6 + source/egg/core/eggSystem.hpp | 43 +++- source/game/host_system/RKSystem.cpp | 293 +++++++++++++++++---------- source/game/host_system/RKSystem.hpp | 55 +++-- sources.py | 4 +- 8 files changed, 282 insertions(+), 175 deletions(-) diff --git a/pack/dol_objects.txt b/pack/dol_objects.txt index 691f8678..ee155809 100644 --- a/pack/dol_objects.txt +++ b/pack/dol_objects.txt @@ -7,8 +7,8 @@ out/dol/text_800072c0_80007f50.o out/dol/rodata_80244ec0_80245010.o out/SystemResource.o out/dol/text_80007f7c_80008e84.o -out/dol/rodata_802450b0_80248010.o -out/dol/data_80258580_802733f0.o +out/dol/rodata_802450b0_80245938.o +out/dol/data_80258580_80270c68.o out/dol/bss_802a4080_802a6968.o out/dol/sdata_80384c00_80384c38.o out/dol/sbss_80385fc0_803860a8.o @@ -16,6 +16,8 @@ out/dol/sdata2_80386fa0_80386ff8.o out/RKSystem.o out/dol/text_80009bc0_8000c948.o out/ansi_files.o +out/dol/rodata_80245a18_80248010.o +out/dol/data_80270c94_802733f0.o out/dol/sdata2_80387000_80387030.o out/ansi_fp.o out/dol/text_8000e418_8000ef04.o diff --git a/pack/dol_slices.yml b/pack/dol_slices.yml index f7276547..ca7c6dfb 100644 --- a/pack/dol_slices.yml +++ b/pack/dol_slices.yml @@ -14,8 +14,10 @@ source/game/host_system/SystemResource.cpp: source/game/host_system/RKSystem.cpp: text: [0x80008e84, 0x80009bc0] # ctors: [0x80244de4, 0x80244de8] + rodata: [0x80245938, 0x80245a18] # data: [0x80270bf0, 0x80270c94] - # bss: [0x802a4080, 0x802a4100] + data: [0x80270c68, 0x80270c94] + # bss: [0x802a4080, 0x802a4160] # sbss: [0x80385fc8, 0x80385fcc] sdata2: [0x80386ff8, 0x80387000] diff --git a/pack/symbols.yml b/pack/symbols.yml index 94e62b76..8763c27d 100644 --- a/pack/symbols.yml +++ b/pack/symbols.yml @@ -260,30 +260,30 @@ global: 0x80008e7c: 'onExit__Q23EGG6ThreadFv' 0x80008e80: 'onEnter__Q23EGG6ThreadFv' 0x80008e84: 'getStaticInstance__Q26System8RKSystemFv' - 0x80008e90: 'WPADAllocator' - 0x80008eb0: 'WPADFree' + 0x80008e90: 'WPADAllocator__6SystemFUl' + 0x80008eb0: 'WPADFree__6SystemFPv' 0x80008ef0: 'main__Q26System8RKSystemFiPPc' - 0x80008fac: 'RKSystem_getSysHeap' - 0x80008fb4: 'TSystem_initialize' - 0x80009190: 'unk_80009190' + 0x80008fac: 'getSysHeap__Q26System8RKSystemFv' + 0x80008fb4: 'initialize__Q23EGG10BaseSystemFv' + 0x80009190: 'initRenderMode__Q23EGG10BaseSystemFv' 0x80009194: 'initialize__Q26System8RKSystemFv' - 0x8000951c: 'RKSystem_run' + 0x8000951c: 'run__Q26System8RKSystemFv' 0x80009818: 'getDisplay__Q23EGG10BaseSystemFv' - 0x80009820: 'unk_80009820' - 0x80009824: 'unk_80009824' - 0x80009828: 'RKSystem_getSceneManager' - 0x80009830: 'RKSystem_getPerformanceView' - 0x80009844: 'RkSceneManager_changeSceneWithCreator' - 0x8000984c: 'RKSceneManager_calcCurrentFader' - 0x80009984: 'RkSceneManager_calc' - 0x80009988: 'RkSceneManager_draw' - 0x8000998c: 'unk_8000998c' - 0x8000999c: 'unk_8000999c' + 0x80009820: 'onBeginFrame__Q23EGG10BaseSystemFv' + 0x80009824: 'onEndFrame__Q23EGG10BaseSystemFv' + 0x80009828: 'getSceneManager__Q23EGG10BaseSystemFv' + 0x80009830: 'getPerformanceView__Q23EGG10BaseSystemFv' + 0x80009844: 'changeSceneWithCreatorAfterFadeOut__Q26System14RKSceneManagerFiPQ23EGG12SceneCreator' + 0x8000984c: 'calcCurrentFader__Q26System14RKSceneManagerFv' + 0x80009984: 'calc__Q26System14RKSceneManagerFv' + 0x80009988: 'draw__Q26System14RKSceneManagerFv' + 0x8000998c: 'doDrawFader__Q26System14RKSceneManagerFv' + 0x8000999c: 'doCalcFader__Q26System14RKSceneManagerFv' 0x800099ac: 'getVideo__Q23EGG10BaseSystemFv' 0x800099b4: 'getSysHeap__Q23EGG10BaseSystemFv' 0x800099bc: 'getXfbManager__Q23EGG10BaseSystemFv' - 0x800099c4: 'RKSystem_getAudioManager' - 0x800099cc: 'unk_800099cc' + 0x800099c4: 'getAudioManager__Q23EGG10BaseSystemFv' + 0x800099cc: '__sinit__RKSystem_cpp' 0x80009b40: '__dt__Q23EGG8Vector3fFv' 0x80009b80: '__dt__Q23EGG8Vector2fFv' 0x80009bc0: 'HeapCollection_setGroupIdAll' @@ -9378,8 +9378,8 @@ global: 0x802424c8: 'decomp__Q23EGG14LZStreamDecompFPCvUl' 0x802424f4: 'getHeaderSize__Q23EGG14LZStreamDecompFv' 0x802424fc: 'getUncompressedSize__Q23EGG14LZStreamDecompFPCv' - 0x80242504: 'ConfigurationData_initMemory' - 0x8024269c: 'ConfigurationData_run' + 0x80242504: 'initMemory__Q23EGG10BaseSystemFv' + 0x8024269c: 'run__Q23EGG10BaseSystemFv' 0x802428e8: 'create__Q23EGG10TaskThreadFiiUlPQ23EGG4Heap' 0x80242b94: '__ct__Q33EGG10TaskThread4TJobFv' 0x80242ba8: 'destroy__Q23EGG10TaskThreadFv' @@ -9852,8 +9852,8 @@ global: 0x80270bac: 'lbl_80270bac' 0x80270bc0: 'lbl_80270bc0' 0x80270bd8: 'lbl_80270bd8' - 0x80270bf0: 'lbl_80270bf0' - 0x80270c2c: 'lbl_80270c2c' + 0x80270bf0: '__vt__Q26System8RKSystem' + 0x80270c2c: '__vt__Q23EGG10BaseSystem' 0x80270c68: '__vt__Q26System14RKSceneManager' 0x80270c98: 'lbl_80270c98' 0x80270cb8: 'lbl_80270cb8' @@ -11401,7 +11401,7 @@ global: 0x802a3fc0: '__vt__Q23EGG6Thread' 0x802a3fd8: '__vt__Q23EGG8UnitHeap' 0x802a4008: 'lbl_802a4008' - 0x802A4080: 'sInstance__Q26System8RKSystem' + 0x802a4080: 'sInstance__Q26System8RKSystem' 0x802a4100: 'lbl_802a4100' 0x802a4118: 'lbl_802a4118' 0x802a4130: 'lbl_802a4130' diff --git a/source/egg/core/eggSceneManager.hpp b/source/egg/core/eggSceneManager.hpp index 469234dc..dbbc69f7 100644 --- a/source/egg/core/eggSceneManager.hpp +++ b/source/egg/core/eggSceneManager.hpp @@ -248,6 +248,10 @@ class SceneManager { inline int getCurrentSceneID() const { return mCurrentSceneID; } + inline Scene* getParentScene() const { return pParent; } + + inline ColorFader* getCurrentFader() const { return mCurrentFader; } + static inline EGG::Heap* getHeapForCreateScene_Mem1() { return sHeapMem1_ForCreateScene; } @@ -266,6 +270,8 @@ class SceneManager { mTransitionStatus = type; } + inline eAfterFadeType getAfterFadeType() { return mTransitionStatus; } + inline void setCreator(SceneCreator* creator) { mSceneCreator = creator; } inline void setNextSceneID(int ID) { mNextSceneID = ID; } diff --git a/source/egg/core/eggSystem.hpp b/source/egg/core/eggSystem.hpp index fd0b6568..8ad84fc0 100644 --- a/source/egg/core/eggSystem.hpp +++ b/source/egg/core/eggSystem.hpp @@ -9,6 +9,8 @@ #include +#include + struct GXRenderModeObj; @@ -28,28 +30,51 @@ class BaseSystem { public: static BaseSystem* sSystem; +public: + inline BaseSystem() + : mSysHeapSize(0x177000), mGraphicsFifoSize(0x80000), + mRenderMode(nullptr) {} + //! @brief [vt+0x08] Return a pointer to the video manager. //! - virtual Video* getVideo(); + virtual Video* getVideo();// { return mVideo; } //! @brief [vt+0x0c] Return a pointer to the system heap. //! - virtual Heap* getSysHeap(); + virtual Heap* getSysHeap();// { return mSysHeap; } //! @brief [vt+0x10] Return a pointer to the display manager. //! - virtual Display* getDisplay(); + virtual Display* getDisplay() { return mDisplay; } //! @brief [vt+0x14] Return a pointer to the Xfb manager. //! - virtual XfbManager* getXfbManager(); + virtual XfbManager* getXfbManager();// { return mXfbMgr; } + + //! @brief [vt+0x18] Return a pointer to the performance view. + //! + virtual PerformanceView* getPerformanceView() { + return static_cast(mProcessMeter); + } + + //! @brief [vt+0x1c] Return a pointer to the scene manager. + //! + virtual SceneManager* getSceneManager() { return mSceneMgr; } + + //! @brief [vt+0x20] Return a pointer to the audio manager. + //! + virtual AudioManager* getAudioManager();// { return mAudioMgr; } - virtual PerformanceView* getPerformanceView(); // [vt+0x18] - virtual SceneManager* getSceneManager(); // [vt+0x1c] - virtual AudioManager* getAudioManager(); // [vt+0x20] + //! @brief [vt+0x24] Called by `run` at the beginning of every frame right + //! after calling `beginFrame` on the display. + //! + virtual void onBeginFrame() {} + + //! @brief [vt+0x24] Called by `run` at the end of every frame right after + //! calling `endFrame` on the display. + //! + virtual void onEndFrame() {} - virtual void onBeginFrame(); // [vt+0x24] - virtual void onEndFrame(); // [vt+0x28] virtual void initRenderMode(); // [vt+0x2c] virtual void initMemory(); // [vt+0x30] diff --git a/source/game/host_system/RKSystem.cpp b/source/game/host_system/RKSystem.cpp index 764b9b6b..d3179b38 100644 --- a/source/game/host_system/RKSystem.cpp +++ b/source/game/host_system/RKSystem.cpp @@ -9,6 +9,7 @@ #include #include +#include #include #include #include @@ -24,6 +25,10 @@ extern void unk_80008c10(EGG::Heap*); extern UNKNOWN_FUNCTION(halt__Q23EGG14AsyncDvdStatusFv); // PAL: 0x80008e74 extern UNKNOWN_FUNCTION(printError__Q23EGG14AsyncDvdStatusFv); +// PAL: 0x80008e90..0x80008eb0 +extern UNKNOWN_FUNCTION(WPADAllocator__6SystemFUl); +// PAL: 0x80008eb0..0x80008ef0 +extern UNKNOWN_FUNCTION(WPADFree__6SystemFPv); // PAL: 0x80009b40 extern UNKNOWN_FUNCTION(__dt__Q23EGG8Vector3fFv); // PAL: 0x80009b80 @@ -142,9 +147,9 @@ extern UNKNOWN_DATA(lbl_80245938); // PAL: 0x80270bd8 extern void lbl_80270bd8(void); // PAL: 0x80270bf0 -extern UNKNOWN_DATA(lbl_80270bf0); +extern UNKNOWN_DATA(__vt__Q26System8RKSystem); // PAL: 0x80270c2c -extern UNKNOWN_DATA(lbl_80270c2c); +extern UNKNOWN_DATA(__vt__Q23EGG10BaseSystem); // PAL: 0x80270c68 extern UNKNOWN_DATA(__vt__Q26System14RKSceneManager); // PAL: 0x80270cd0 @@ -194,35 +199,21 @@ extern "C" { // .bss -// Symbol: getStaticInstance__Q26System8RKSystemFv -// PAL: 0x80008e84..0x80008e90 -MARK_BINARY_BLOB(getStaticInstance__Q26System8RKSystemFv, 0x80008e84, 0x80008e90); -asm UNKNOWN_FUNCTION(getStaticInstance__Q26System8RKSystemFv){ -#include "asm/80008e84.s" -} - namespace System { -#ifdef NON_MATCHING RKSystem* RKSystem::getStaticInstance() { return &sInstance; } -#endif -} // namespace System -// Symbol: WPADAllocator -// PAL: 0x80008e90..0x80008eb0 -MARK_BINARY_BLOB(WPADAllocator, 0x80008e90, 0x80008eb0); -asm void* WPADAllocator(u32) { -#include "asm/80008e90.s" +void* WPADAllocator(u32 size) { + return RKSystem::sInstance.mWPADAllocator->alloc(size); } -// Symbol: WPADFree -// PAL: 0x80008eb0..0x80008ef0 -MARK_BINARY_BLOB(WPADFree, 0x80008eb0, 0x80008ef0); -asm u8 WPADFree(void*) { -#include "asm/80008eb0.s" +u8 WPADFree(void* block) { + RKSystem::sInstance.mWPADAllocator->free(block); + return 1; } +} // namespace System // Symbol: main__Q26System8RKSystemFiPPc // PAL: 0x80008ef0..0x80008fac @@ -254,37 +245,38 @@ void RKSystem::main(int argc, char** argv) { #endif } // namespace System -// Symbol: RKSystem_getSysHeap +// Symbol: getSysHeap__Q26System8RKSystemFv // PAL: 0x80008fac..0x80008fb4 -MARK_BINARY_BLOB(RKSystem_getSysHeap, 0x80008fac, 0x80008fb4); -asm UNKNOWN_FUNCTION(RKSystem_getSysHeap){ +MARK_BINARY_BLOB(getSysHeap__Q26System8RKSystemFv, 0x80008fac, 0x80008fb4); +asm UNKNOWN_FUNCTION(getSysHeap__Q26System8RKSystemFv){ #include "asm/80008fac.s" } -// Symbol: TSystem_initialize +namespace System { + +#ifdef NON_MATCHING +EGG::Heap* RKSystem::getSysHeap() { + return mSysHeap2; +} +#endif +} // namespace System + +// Symbol: initialize__Q23EGG10BaseSystemFv // PAL: 0x80008fb4..0x80009190 -MARK_BINARY_BLOB(TSystem_initialize, 0x80008fb4, 0x80009190); -asm UNKNOWN_FUNCTION(TSystem_initialize){ +MARK_BINARY_BLOB(initialize__Q23EGG10BaseSystemFv, 0x80008fb4, 0x80009190); +asm UNKNOWN_FUNCTION(initialize__Q23EGG10BaseSystemFv){ #include "asm/80008fb4.s" } -// Symbol: unk_80009190 +// Symbol: initRenderMode__Q23EGG10BaseSystemFv // PAL: 0x80009190..0x80009194 -MARK_BINARY_BLOB(unk_80009190, 0x80009190, 0x80009194); -asm UNKNOWN_FUNCTION(unk_80009190){ +MARK_BINARY_BLOB(initRenderMode__Q23EGG10BaseSystemFv, 0x80009190, 0x80009194); +asm UNKNOWN_FUNCTION(initRenderMode__Q23EGG10BaseSystemFv){ #include "asm/80009190.s" } -// Symbol: initialize__Q26System8RKSystemFv -// PAL: 0x80009194..0x8000951c -MARK_BINARY_BLOB(initialize__Q26System8RKSystemFv, 0x80009194, 0x8000951c); -asm UNKNOWN_FUNCTION(initialize__Q26System8RKSystemFv){ -#include "asm/80009194.s" -} - namespace System { -#ifdef NON_MATCHING void RKSystem::initialize() { initMemory(); @@ -325,7 +317,7 @@ void RKSystem::initialize() { PADInit(); mWPADHeap->adjust(); - mSceneMgr = new RKSceneManager((EGG::SceneCreator*)0); + mSceneMgr = new RKSceneManager(nullptr); SystemManager::initStaticInstance(mSysHeap2); SystemManager::sInstance->setupSystem(mRootHeapMem2); @@ -341,7 +333,7 @@ void RKSystem::initialize() { else { OSReport("***********************************\n"); OSReport("* NTSC/Progressive/PAL60 mode *\n"); - OSReport("***********************************\n"); + OSReport("***********************************\n\0\0"); } ModuleLinker_initStaticInstance(); @@ -360,92 +352,175 @@ void RKSystem::initialize() { mModuleHeap = EGG::ExpHeap::create(0xa00000, mRootHeapMem1, 0); mRootHeapMem2->becomeCurrentHeap(); } -#endif -} // namespace System -// Symbol: RKSystem_run -// PAL: 0x8000951c..0x80009818 -MARK_BINARY_BLOB(RKSystem_run, 0x8000951c, 0x80009818); -asm UNKNOWN_FUNCTION(RKSystem_run){ -#include "asm/8000951c.s" +void RKSystem::run() { + bool flag1; + bool flag2 = _69; + + mFrameClock = true; + _6a = !flag2 || mFrameClock; + _6b = false; + _6c = false; + + bool ejectedDisc = false; + + while (true) { + if (mFrameClock) { + flag2 = _69; + } + + bool isBeginFrame = mFrameClock || !flag2; + bool isEndFrame = !mFrameClock || !flag2; + + _6a = isBeginFrame; + flag1 = _6c; + + if (isBeginFrame) { + beginFrame(); + + draw(); + + if (flag1) { + OSSleepTicks((s64)((__OSBusClock / 4) / 125000) * 500 / 8); + } + } + + _6b = true; // reading DVD flag? + if (EGG::AsyncDvdStatus::sInstance->_51) { + if (!ejectedDisc) { + VISetBlack(0); + ejectedDisc = true; + } + + EGG::AsyncDvdStatus::sInstance->halt(); + SystemManager::sInstance->handlePowerState(); + } + else { + ejectedDisc = false; + + calc(); + } + _6b = false; + + if (isEndFrame) { + endFrame(); + } + + if(flag1 && flag2 && isBeginFrame) { + OSSleepTicks((s64)((__OSBusClock / 4) / 125000) * 500 / 8); + } + + mFrameClock = !mFrameClock; + } } -// Symbol: getDisplay__Q23EGG10BaseSystemFv -// PAL: 0x80009818..0x80009820 -MARK_BINARY_BLOB(getDisplay__Q23EGG10BaseSystemFv, 0x80009818, 0x80009820); -asm UNKNOWN_FUNCTION(getDisplay__Q23EGG10BaseSystemFv){ -#include "asm/80009818.s" +// These inline functions are needed for BaseSystem's inline virtuals to be +// emitted in the correct order. +void RKSystem::beginFrame() { + getDisplay()->beginFrame(); + onBeginFrame(); } -// Symbol: unk_80009820 -// PAL: 0x80009820..0x80009824 -MARK_BINARY_BLOB(unk_80009820, 0x80009820, 0x80009824); -asm UNKNOWN_FUNCTION(unk_80009820){ -#include "asm/80009820.s" +void RKSystem::endFrame() { + getDisplay()->endFrame(); + onEndFrame(); } -// Symbol: unk_80009824 -// PAL: 0x80009824..0x80009828 -MARK_BINARY_BLOB(unk_80009824, 0x80009824, 0x80009828); -asm UNKNOWN_FUNCTION(unk_80009824){ -#include "asm/80009824.s" +void RKSystem::draw() { + getDisplay()->beginRender(); + + if (EGG::AsyncDvdStatus::sInstance->_51) { + EGG::AsyncDvdStatus::sInstance->printError(); + } + else { + getSceneManager()->draw(); + } + getPerformanceView()->draw(); + + getDisplay()->endRender(); } -// Symbol: RKSystem_getSceneManager -// PAL: 0x80009828..0x80009830 -MARK_BINARY_BLOB(RKSystem_getSceneManager, 0x80009828, 0x80009830); -asm UNKNOWN_FUNCTION(RKSystem_getSceneManager){ -#include "asm/80009828.s" +void RKSystem::calc() { + getSceneManager()->calc(); } -// Symbol: RKSystem_getPerformanceView -// PAL: 0x80009830..0x80009844 -MARK_BINARY_BLOB(RKSystem_getPerformanceView, 0x80009830, 0x80009844); -asm UNKNOWN_FUNCTION(RKSystem_getPerformanceView){ -#include "asm/80009830.s" + +/////////////////// +// RKSceneManager + +void RKSceneManager::changeSceneWithCreator(int sceneID) { + while (getCurrentScene()) { + destroyCurrentSceneNoIncoming(true); + } + + setCreator(mNextSceneCreator); + mNextSceneCreator = nullptr; + + changeSiblingScene(sceneID); } -// Symbol: RkSceneManager_changeSceneWithCreator -// PAL: 0x80009844..0x8000984c -MARK_BINARY_BLOB(RkSceneManager_changeSceneWithCreator, 0x80009844, 0x8000984c); -asm UNKNOWN_FUNCTION(RkSceneManager_changeSceneWithCreator){ -#include "asm/80009844.s" +void RKSceneManager::changeSceneWithCreatorAfterFadeOut(int id, EGG::SceneCreator* creator) { + mNextSceneCreator = creator; + changeSiblingSceneAfterFadeOut(id); } -// Symbol: RKSceneManager_calcCurrentFader -// PAL: 0x8000984c..0x80009984 -MARK_BINARY_BLOB(RKSceneManager_calcCurrentFader, 0x8000984c, 0x80009984); -asm UNKNOWN_FUNCTION(RKSceneManager_calcCurrentFader){ -#include "asm/8000984c.s" +void RKSceneManager::calcCurrentFader() { + EGG::ColorFader* currentFader = getCurrentFader(); + if (!currentFader) { + return; + } + if (!currentFader->calc() != 0) { + return; + } + + switch (getAfterFadeType()) { + case STATUS_CHANGE_SCENE: + changeScene(getNextSceneID()); + break; + + case STATUS_CHANGE_SIBLING_SCENE: + if (mNextSceneCreator) { + changeSceneWithCreator(getNextSceneID()); + } + else { + changeSiblingScene(); + } + break; + + case STATUS_OUTGOING: + outgoingParentScene(getParentScene()); + setupNextSceneID(); + createScene(getCurrentSceneID(), getParentScene()); + break; + + case STATUS_INCOMING: + destroyToSelectSceneID(getNextSceneID()); + break; + + case STATUS_REINITIALIZE: + reinitCurrentScene(); + break; + } + + setAfterFadeType(STATUS_IDLE); } -// Symbol: RkSceneManager_calc -// PAL: 0x80009984..0x80009988 -MARK_BINARY_BLOB(RkSceneManager_calc, 0x80009984, 0x80009988); -asm UNKNOWN_FUNCTION(RkSceneManager_calc){ -#include "asm/80009984.s" +void RKSceneManager::calc() { + EGG::SceneManager::calc(); } -// Symbol: RkSceneManager_draw -// PAL: 0x80009988..0x8000998c -MARK_BINARY_BLOB(RkSceneManager_draw, 0x80009988, 0x8000998c); -asm UNKNOWN_FUNCTION(RkSceneManager_draw){ -#include "asm/80009988.s" +void RKSceneManager::draw() { + EGG::SceneManager::draw(); } -// Symbol: unk_8000998c -// PAL: 0x8000998c..0x8000999c -MARK_BINARY_BLOB(unk_8000998c, 0x8000998c, 0x8000999c); -asm UNKNOWN_FUNCTION(unk_8000998c){ -#include "asm/8000998c.s" +void RKSceneManager::doDrawFader() { + drawCurrentFader(); } -// Symbol: unk_8000999c -// PAL: 0x8000999c..0x800099ac -MARK_BINARY_BLOB(unk_8000999c, 0x8000999c, 0x800099ac); -asm UNKNOWN_FUNCTION(unk_8000999c){ -#include "asm/8000999c.s" +void RKSceneManager::doCalcFader() { + calcCurrentFader(); } +} // namespace System // Symbol: getVideo__Q23EGG10BaseSystemFv // PAL: 0x800099ac..0x800099b4 @@ -468,17 +543,17 @@ asm UNKNOWN_FUNCTION(getXfbManager__Q23EGG10BaseSystemFv){ #include "asm/800099bc.s" } -// Symbol: RKSystem_getAudioManager +// Symbol: getAudioManager__Q23EGG10BaseSystemFv // PAL: 0x800099c4..0x800099cc -MARK_BINARY_BLOB(RKSystem_getAudioManager, 0x800099c4, 0x800099cc); -asm UNKNOWN_FUNCTION(RKSystem_getAudioManager) { +MARK_BINARY_BLOB(getAudioManager__Q23EGG10BaseSystemFv, 0x800099c4, 0x800099cc); +asm UNKNOWN_FUNCTION(getAudioManager__Q23EGG10BaseSystemFv) { #include "asm/800099c4.s" } -// Symbol: unk_800099cc +// Symbol: __sinit__RKSystem_cpp // PAL: 0x800099cc..0x80009b40 -MARK_BINARY_BLOB(unk_800099cc, 0x800099cc, 0x80009b40); -asm UNKNOWN_FUNCTION(unk_800099cc) { +MARK_BINARY_BLOB(__sinit__RKSystem_cpp, 0x800099cc, 0x80009b40); +asm UNKNOWN_FUNCTION(__sinit__RKSystem_cpp) { #include "asm/800099cc.s" } diff --git a/source/game/host_system/RKSystem.hpp b/source/game/host_system/RKSystem.hpp index c8beaa28..66ece8af 100644 --- a/source/game/host_system/RKSystem.hpp +++ b/source/game/host_system/RKSystem.hpp @@ -20,44 +20,28 @@ extern "C" { // PAL: 0x80008e84..0x80008e90 UNKNOWN_FUNCTION(getStaticInstance__Q26System8RKSystemFv); -// PAL: 0x80008e90..0x80008eb0 -void* WPADAllocator(u32); -// PAL: 0x80008eb0..0x80008ef0 -u8 WPADFree(void*); // PAL: 0x80008ef0..0x80008fac UNKNOWN_FUNCTION(main__Q26System8RKSystemFiPPc); // PAL: 0x80008fac..0x80008fb4 -UNKNOWN_FUNCTION(RKSystem_getSysHeap); +UNKNOWN_FUNCTION(getSysHeap__Q26System8RKSystemFv); // PAL: 0x80008fb4..0x80009190 -UNKNOWN_FUNCTION(TSystem_initialize); +UNKNOWN_FUNCTION(initialize__Q23EGG10BaseSystemFv); // PAL: 0x80009190..0x80009194 -UNKNOWN_FUNCTION(unk_80009190); +UNKNOWN_FUNCTION(initRenderMode__Q23EGG10BaseSystemFv); // PAL: 0x80009194..0x8000951c UNKNOWN_FUNCTION(initialize__Q26System8RKSystemFv); // PAL: 0x8000951c..0x80009818 -UNKNOWN_FUNCTION(RKSystem_run); +UNKNOWN_FUNCTION(run__Q26System8RKSystemFv); // PAL: 0x80009818..0x80009820 UNKNOWN_FUNCTION(getDisplay__Q23EGG10BaseSystemFv); // PAL: 0x80009820..0x80009824 -UNKNOWN_FUNCTION(unk_80009820); +UNKNOWN_FUNCTION(onBeginFrame__Q23EGG10BaseSystemFv); // PAL: 0x80009824..0x80009828 -UNKNOWN_FUNCTION(unk_80009824); +UNKNOWN_FUNCTION(onEndFrame__Q23EGG10BaseSystemFv); // PAL: 0x80009828..0x80009830 -UNKNOWN_FUNCTION(RKSystem_getSceneManager); +UNKNOWN_FUNCTION(getSceneManager__Q23EGG10BaseSystemFv); // PAL: 0x80009830..0x80009844 -UNKNOWN_FUNCTION(RKSystem_getPerformanceView); -// PAL: 0x80009844..0x8000984c -UNKNOWN_FUNCTION(RkSceneManager_changeSceneWithCreator); -// PAL: 0x8000984c..0x80009984 -UNKNOWN_FUNCTION(RKSceneManager_calcCurrentFader); -// PAL: 0x80009984..0x80009988 -UNKNOWN_FUNCTION(RkSceneManager_calc); -// PAL: 0x80009988..0x8000998c -UNKNOWN_FUNCTION(RkSceneManager_draw); -// PAL: 0x8000998c..0x8000999c -UNKNOWN_FUNCTION(unk_8000998c); -// PAL: 0x8000999c..0x800099ac -UNKNOWN_FUNCTION(unk_8000999c); +UNKNOWN_FUNCTION(getPerformanceView__Q23EGG10BaseSystemFv); // PAL: 0x800099ac..0x800099b4 UNKNOWN_FUNCTION(getVideo__Q23EGG10BaseSystemFv); // PAL: 0x800099b4..0x800099bc @@ -65,9 +49,9 @@ UNKNOWN_FUNCTION(getSysHeap__Q23EGG10BaseSystemFv); // PAL: 0x800099bc..0x800099c4 UNKNOWN_FUNCTION(getXfbManager__Q23EGG10BaseSystemFv); // PAL: 0x800099c4..0x800099cc -UNKNOWN_FUNCTION(RKSystem_getAudioManager); +UNKNOWN_FUNCTION(getAudioManager__Q23EGG10BaseSystemFv); // PAL: 0x800099cc..0x80009b40 -UNKNOWN_FUNCTION(unk_800099cc); +UNKNOWN_FUNCTION(__sinit__RKSystem_cpp); // PAL: 0x80009b40..0x80009b80 UNKNOWN_FUNCTION(__dt__Q23EGG8Vector3fFv); // PAL: 0x80009b80..0x80009bc0 @@ -92,9 +76,11 @@ class RKSceneManager : public EGG::SceneManager { virtual void doCalcFader(); // [vt+0x24] virtual void doDrawFader(); // [vt+0x28] - void changeSceneWithCreator(int id, EGG::SceneCreator* creator); + inline void changeSceneWithCreator(int sceneID); - u32 _2c; // [this+0x2c] + void changeSceneWithCreatorAfterFadeOut(int id, EGG::SceneCreator* creator); + + EGG::SceneCreator* mNextSceneCreator; // [this+0x2c] }; // vtable @ 80270bf0 @@ -103,15 +89,26 @@ class RKSystem : public EGG::BaseSystem { static RKSystem* spInstance; static RKSystem sInstance; +public: static RKSystem* getStaticInstance(); static void main(int argc, char** argv); +public: + inline RKSystem() : EGG::BaseSystem(), mFrameClock(true), _69(false) {} + EGG::Heap* getSysHeap() override; // [vt+0x0c] void run() override; // [vt+0x34] void initialize() override; // [vt+0x38] + inline void beginFrame(); + inline void endFrame(); + + inline void draw(); + inline void calc(); + +public: EGG::Heap* mWPADHeap; // [this+0x58] EGG::Allocator* mWPADAllocator; // [this+0x5c] EGG::Heap* mModuleHeap; // [this+0x60] @@ -120,7 +117,7 @@ class RKSystem : public EGG::BaseSystem { bool _69; bool _6a; bool _6b; - bool _6c; + volatile bool _6c; u8 _6d; u8 _6e; u8 _6f; diff --git a/sources.py b/sources.py index bf228f18..a6b1ef86 100644 --- a/sources.py +++ b/sources.py @@ -7,14 +7,14 @@ from itertools import chain -HOSTSYS_OPTS = ' -ipa file -rostr -str noreuse' +HOSTSYS_OPTS = ' -ipa file -rostr -str noreuse -use_lmw_stmw=on' RVL_OPTS = ' -lang=c99 -ipa file' MSL_LIBC_OPTS = ' -lang=c99 -ipa file' NW4R_OPTS = ' -lang=c99 -ipa file -inline auto -O4,p -pragma \"legacy_struct_alignment on\"' SPY_OPTS = RVL_OPTS + " -w nounusedexpr -w nounusedarg" RFL_OPTS = RVL_OPTS + " -O4,p" EGG_OPTS = ' -lang=c99 -use_lmw_stmw=on -ipa function -rostr' -REL_OPTS = HOSTSYS_OPTS + " -sdata 0 -sdata2 0 -lang=c++ -use_lmw_stmw=on -pragma \"legacy_struct_alignment on\" -DREL" +REL_OPTS = HOSTSYS_OPTS + " -sdata 0 -sdata2 0 -lang=c++ -pragma \"legacy_struct_alignment on\" -DREL" @dataclass