diff --git a/config/SOUE01/splits.txt b/config/SOUE01/splits.txt index 6fad7717..0257f5fc 100644 --- a/config/SOUE01/splits.txt +++ b/config/SOUE01/splits.txt @@ -324,6 +324,7 @@ d/d_sys.cpp: .text start:0x80064250 end:0x80064F28 align:16 .ctors start:0x804DB694 end:0x804DB698 .sbss start:0x80575228 end:0x80575248 + .bss start:0x805A0720 end:0x805A0778 d/d_sys_init.cpp: .text start:0x80064F30 end:0x80065034 align:16 diff --git a/config/SOUE01/symbols.txt b/config/SOUE01/symbols.txt index 20273ecd..17df3c55 100644 --- a/config/SOUE01/symbols.txt +++ b/config/SOUE01/symbols.txt @@ -2827,13 +2827,13 @@ 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 -dSys_c__endFrame = .text:0x800643E0; // type:function size:0x48 +endFrame__6dSys_cFv = .text:0x800643E0; // type:function size:0x48 EGG__ConfigurationData__onEndFrame = .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 setClearColor__6dSys_cFQ34nw4r2ut5Color = .text:0x800644E0; // type:function size:0x60 -dSys_c__getClearColor = .text:0x80064540; // type:function size:0x14 +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 diff --git a/include/d/d_sys.h b/include/d/d_sys.h index 384c5779..2caf7e36 100644 --- a/include/d/d_sys.h +++ b/include/d/d_sys.h @@ -6,6 +6,8 @@ #include "egg/core/eggSystem.h" #include "nw4r/ut/ut_Color.h" +typedef EGG::TSystem System; + class dSndMgr_c; class dSys_c { @@ -17,17 +19,19 @@ public: static void beginFrame(); static void endFrame(); - static void setBlack(bool); + static bool setBlack(bool); /* Frame rate values: 1 - 60fps, 2 - 30fps */ static void setFrameRate(u8); static u8 getFrameRate(); static void setClearColor(nw4r::ut::Color clr); + static nw4r::ut::Color getClearColor(); static void create(); static void execute(); - static EGG::BaseSystem *ms_configuration_p; +private: + static System *ms_configuration_p; static EGG::Heap *ms_RootHeapMem1; static EGG::Heap *ms_RootHeapMem2; }; diff --git a/src/d/d_sys.cpp b/src/d/d_sys.cpp index fe5a4281..26778af4 100644 --- a/src/d/d_sys.cpp +++ b/src/d/d_sys.cpp @@ -17,10 +17,12 @@ #include "d/lyt/d_lyt_battery.h" #include "d/lyt/d_lyt_system_window.h" #include "d/snd/d_snd_mgr.h" -#include "egg/core/eggExpHeap.h" #include "egg/core/eggAssertHeap.h" +#include "egg/core/eggDisplay.h" +#include "egg/core/eggExpHeap.h" #include "egg/core/eggSystem.h" #include "egg/core/eggVideo.h" +#include "egg/gfx/eggStateGX.h" #include "f/f_manager.h" #include "m/m_dvd.h" #include "m/m_heap.h" @@ -38,23 +40,71 @@ #include "toBeSorted/arc_managers/layout_arc_manager.h" #include "toBeSorted/arc_managers/oarc_manager.h" +#include "rvl/GX.h" #include "rvl/OS.h" -EGG::TSystem SysConfig; +System SysConfig; -void dSys_c::setBlack(bool on) { - - EGG::Video *video = EGG::BaseSystem::sSystem->getVideo(); - - if (video->mFlag.onBit(0) != on) { - create(); - } -} +System *dSys_c::ms_configuration_p; +EGG::Heap *dSys_c::ms_RootHeapMem1; +EGG::Heap *dSys_c::ms_RootHeapMem2; char *dummy = "オーディオヒープ"; // "Audio heap" extern u32 lbl_80574FA0; extern u32 lbl_80574FA4; +void dSys_c::beginRender() { + m3d::calcMaterial(); + ms_configuration_p->mDisplay->beginRender(); +} + +void dSys_c::endRender() { + ms_configuration_p->mDisplay->endRender(); +} + +void dSys_c::beginFrame() { + EGG::Display *pDisplay = ms_configuration_p->mDisplay; + + pDisplay->beginFrame(); + GXSetCopyClear(pDisplay->mClearColor, pDisplay->mClearZ); + ms_configuration_p->onBeginFrame(); +} + +void dSys_c::endFrame() { + ms_configuration_p->mDisplay->endFrame(); + ms_configuration_p->onEndFrame(); +} + +bool dSys_c::setBlack(bool on) { + EGG::Display *pDisplay = ms_configuration_p->mDisplay; + + EGG::Video *pVideo = EGG::BaseSystem::sSystem->getVideo(); + + if (pVideo->mFlag.onBit(0) != on && pDisplay->mScreenStateFlag.offBit(0)) { + pDisplay->mScreenStateFlag.setBit(0); + return true; + } + + return false; +} + +void dSys_c::setFrameRate(u8 maxRetraces) { + ms_configuration_p->mDisplay->mMaxRetraces = maxRetraces; +} + +u8 dSys_c::getFrameRate() { + return ms_configuration_p->mDisplay->mMaxRetraces; +} + +void dSys_c::setClearColor(nw4r::ut::Color clr) { + ms_configuration_p->mDisplay->setClearColor(clr); + EGG::StateGX::s_clearEfb = clr; +} + +nw4r::ut::Color dSys_c::getClearColor() { + return ms_configuration_p->mDisplay->getClearColor(); +} + void dSys_c::create() { EGG::Heap *pRootHeapMem1; EGG::Heap *pRootHeapMem2; @@ -248,7 +298,9 @@ void dSys_c::execute() { } dHbm::Manage_c::GetInstance()->DrawIcon(); + endRender(); + dState::fn_80062EB0(); dState::fn_80062E40(); dState::fn_80062E50();