diff --git a/config/SOUE01/splits.txt b/config/SOUE01/splits.txt index 73f7cbd5..1f79f5f6 100644 --- a/config/SOUE01/splits.txt +++ b/config/SOUE01/splits.txt @@ -256,6 +256,7 @@ egg/core/eggAsyncDisplay.cpp: .data start:0x8056EB10 end:0x8056EB80 .sbss start:0x80576790 end:0x80576798 .sdata2 start:0x8057F310 end:0x8057F324 + .bss start:0x80673B20 end:0x80673B40 egg/core/eggVideo.cpp: .text start:0x80498690 end:0x804989D8 diff --git a/config/SOUE01/symbols.txt b/config/SOUE01/symbols.txt index fcbbdeb5..dfd2e61c 100644 --- a/config/SOUE01/symbols.txt +++ b/config/SOUE01/symbols.txt @@ -37103,7 +37103,7 @@ lbl_8056EA40 = .data:0x8056EA40; // type:object size:0x18 lbl_8056EA58 = .data:0x8056EA58; // type:object size:0x70 __vt__Q23EGG7Display = .data:0x8056EAC8; // type:object size:0x20 __vt__Q23EGG10ColorFader = .data:0x8056EAE8; // type:object size:0x24 -lbl_8056EB20 = .data:0x8056EB20; // type:object size:0x40 +clear_z_TX__29@unnamed@eggAsyncDisplay_cpp@ = .data:0x8056EB20; // type:object size:0x40 scope:local __vt__Q23EGG12AsyncDisplay = .data:0x8056EB60; // type:object size:0x20 lbl_8056EB80 = .data:0x8056EB80; // type:object size:0x10 lbl_8056EB90 = .data:0x8056EB90; // type:object size:0x18 @@ -40890,7 +40890,7 @@ lbl_80576770 = .sbss:0x80576770; // type:object size:0x8 data:4byte lbl_80576778 = .sbss:0x80576778; // type:object size:0x8 data:4byte mConfigData__Q23EGG10BaseSystem = .sbss:0x80576780; // type:object size:0x4 data:4byte sTickPeriod__Q23EGG7Display = .sbss:0x80576788; // type:object size:0x4 data:4byte -lbl_80576790 = .sbss:0x80576790; // type:object size:0x8 data:4byte +spSelector = .sbss:0x80576790; // type:object size:0x4 data:4byte lbl_80576798 = .sbss:0x80576798; // type:object size:0x4 data:4byte lbl_8057679C = .sbss:0x8057679C; // type:object size:0xC lbl_805767A8 = .sbss:0x805767A8; // type:object size:0x4 data:4byte @@ -49344,9 +49344,9 @@ lbl_80673AD8 = .bss:0x80673AD8; // type:object size:0x10 lbl_80673AE8 = .bss:0x80673AE8; // type:object size:0x10 lbl_80673AF8 = .bss:0x80673AF8; // type:object size:0x18 lbl_80673B10 = .bss:0x80673B10; // type:object size:0x10 -lbl_80673B20 = .bss:0x80673B20; // type:object size:0x20 +clear_z_tobj__29@unnamed@eggAsyncDisplay_cpp@ = .bss:0x80673B20; // type:object size:0x20 scope:local lbl_80673B40 = .bss:0x80673B40; // type:object size:0x10C0 data:4byte -lbl_80674C00 = .bss:0x80674C00; // type:object size:0x30 +ident__Q23EGG9Matrix34f = .bss:0x80674C00; // type:object size:0x30 zero__Q23EGG8Vector3f = .bss:0x80674C30; // type:object size:0xC data:float ex__Q23EGG8Vector3f = .bss:0x80674C3C; // type:object size:0xC data:float ey__Q23EGG8Vector3f = .bss:0x80674C48; // type:object size:0xC data:float diff --git a/include/egg/math/eggMatrix.h b/include/egg/math/eggMatrix.h index dd944f56..8ce8580c 100644 --- a/include/egg/math/eggMatrix.h +++ b/include/egg/math/eggMatrix.h @@ -90,7 +90,7 @@ public: ////////////////////////////////////////////////////////////////////////////// public: - /* 80674c00 */ static const Matrix34f ident; + /* 80674c00 */ static Matrix34f ident; }; } // namespace EGG diff --git a/src/egg/core/eggAsyncDisplay.cpp b/src/egg/core/eggAsyncDisplay.cpp index 0865b526..7a128d55 100644 --- a/src/egg/core/eggAsyncDisplay.cpp +++ b/src/egg/core/eggAsyncDisplay.cpp @@ -1,10 +1,23 @@ #include -#include #include -#include +#include #include +#include -static EGG::AsyncDisplay *lbl_80576790[2]; +// TODO: Find the proper place for this symbol? - Ghidra has it literally unused +extern "C" static EGG::Display *spSelector; + +namespace { +static GXTexObj clear_z_tobj; +// clang-format off +u8 clear_z_TX[64] ALIGN(32) = { + 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, + 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, +}; +// clang-format on +} // namespace // Hacks for float ordering static f32 one() { @@ -21,14 +34,14 @@ static f32 zero() { namespace EGG { -AsyncDisplay::AsyncDisplay(u8 maxRetrace): Display(maxRetrace) { +AsyncDisplay::AsyncDisplay(u8 maxRetrace) : Display(maxRetrace) { this->field_0x98 = 0; this->field_0x9C = 1.0f; this->field_0xA4 = 0; this->field_0xA8 = 0; this->field_0xAC = 0; this->field_0xB8 = 0; - lbl_80576790[0] = this; + spSelector = this; OSInitThreadQueue(&this->mThreadQueue); OSInitMessageQueue(&this->mMesgQueue, this->mMesgBuf, 4); } @@ -52,8 +65,8 @@ inline void AsyncDisplay::waitForMsg(bool b) { // This is really ugly but I couldn't find a different way // to make the compiler use the registers XfbManager *xfb; - while (!((xfb = BaseSystem::mConfigData->getXfbMgr(), 1 < xfb->mNumXfbs - this->field_0xAC) && (BaseSystem::mConfigData->getXfbMgr()->mToCopyXfb != nullptr || b))) { - + while (!((xfb = BaseSystem::mConfigData->getXfbMgr(), 1 < xfb->mNumXfbs - this->field_0xAC) && + (BaseSystem::mConfigData->getXfbMgr()->mToCopyXfb != nullptr || b))) { OSReceiveMessage(&this->mMesgQueue, this->mMesgBuf, 1); while (OSReceiveMessage(&this->mMesgQueue, this->mMesgBuf, 0)) {} @@ -153,7 +166,8 @@ void AsyncDisplay::preVRetrace() { void AsyncDisplay::clearEFB() { Video *video = BaseSystem::mConfigData->getVideo(); GXRenderModeObj const *renderMode = video->pRenderMode; - this->clearEFB(renderMode->fbWidth, renderMode->efbHeight, 0, 0, renderMode->fbWidth, renderMode->efbHeight, this->mClearColor); + this->clearEFB(renderMode->fbWidth, renderMode->efbHeight, 0, 0, renderMode->fbWidth, renderMode->efbHeight, + this->mClearColor); } u32 AsyncDisplay::getTickPerFrame() { @@ -164,22 +178,15 @@ u32 AsyncDisplay::getTickPerFrame() { } } -// TODO move -extern "C" { - extern GXTexObj lbl_80673B20, lbl_8056EB20; - extern Matrix34f lbl_80674C00; -} - void AsyncDisplay::clearEFB(u16 fbWidth, u16 fbHeight, u16 x, u16 y, u16 width, u16 height, nw4r::ut::Color color) { - - GXInitTexObj(&lbl_80673B20, &lbl_8056EB20, 4, 4, GX_TF_Z24X8, GX_REPEAT, GX_REPEAT, 0); - GXInitTexObjLOD(&lbl_80673B20, GX_NEAR, GX_NEAR, 0.0, 0.0, 0.0, 0, 0, GX_ANISO_1); + GXInitTexObj(&clear_z_tobj, &clear_z_TX, 4, 4, GX_TF_Z24X8, GX_REPEAT, GX_REPEAT, 0); + GXInitTexObjLOD(&clear_z_tobj, GX_NEAR, GX_NEAR, 0.0, 0.0, 0.0, 0, 0, GX_ANISO_1); Mtx44 mat; C_MTXOrtho(mat, 0.0, fbHeight, 0.0, fbWidth, 0.0, 1.0f); GXSetProjection(mat, GX_ORTHOGRAPHIC); GXSetViewport(0.0, 0.0, fbWidth, fbHeight, 0.0, 1.0f); GXSetScissor(0, 0, fbWidth, fbHeight); - lbl_80674C00.loadPosMtx(0); + Matrix34f::ident.loadPosMtx(0); GXSetCurrentMtx(0); GXClearVtxDesc(); GXSetVtxDesc(GX_VA_POS, GX_DIRECT); @@ -191,7 +198,7 @@ void AsyncDisplay::clearEFB(u16 fbWidth, u16 fbHeight, u16 x, u16 y, u16 width, GXSetChanCtrl(GX_COLOR1A1, false, GX_SRC_REG, GX_SRC_REG, GX_LIGHT_NULL, GX_DF_NONE, GX_AF_NONE); GXSetNumTexGens(1); GXSetTexCoordGen2(GX_TEXCOORD0, GX_TG_MTX2x4, GX_TG_TEX0, 0x3c, false, 0x7d); - GXLoadTexObj(&lbl_80673B20, GX_TEXMAP0); + GXLoadTexObj(&clear_z_tobj, GX_TEXMAP0); GXSetNumTevStages(1); GXSetTevColor(GX_TEVREG0, color); GXSetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD0, GX_TEXMAP0, GX_COLOR_NULL);