From a8e9c4c3452556aada4dcabaf4d62b31a00a11cb Mon Sep 17 00:00:00 2001 From: robojumper Date: Mon, 30 Jun 2025 22:35:29 +0200 Subject: [PATCH] EGG symbols maintenance --- config/SOUE01/symbols.txt | 20 +++++++-------- include/egg/gfx/eggDrawPathDOF.h | 2 +- include/egg/gfx/eggLightTextureMgr.h | 2 +- include/egg/gfx/eggPostEffectBlur.h | 2 +- include/egg/gfx/eggScreen.h | 4 +-- include/egg/gfx/eggStateEfb.h | 4 +-- include/egg/gfx/eggStateGX.h | 2 +- src/egg/core/eggAllocator.cpp | 17 ++++++------- src/egg/gfx/eggCpuTexture.cpp | 37 +++++++++------------------- src/egg/gfx/eggDrawPathDOF.cpp | 8 +++--- src/egg/gfx/eggLightTextureMgr.cpp | 8 +++--- src/egg/gfx/eggPostEffectBlur.cpp | 4 +-- src/egg/gfx/eggScreen.cpp | 8 +++--- src/egg/gfx/eggStateEfb.cpp | 12 ++++----- src/egg/gfx/eggStateGX.cpp | 4 +-- 15 files changed, 60 insertions(+), 74 deletions(-) diff --git a/config/SOUE01/symbols.txt b/config/SOUE01/symbols.txt index bddc4300..42fedafc 100644 --- a/config/SOUE01/symbols.txt +++ b/config/SOUE01/symbols.txt @@ -26181,8 +26181,8 @@ getUncompressedSize__Q23EGG14StreamDecompRLFPCv = .text:0x80495290; // type:func getHeaderSize__Q23EGG14StreamDecompRLFv = .text:0x804952A0; // type:function size:0x8 scope:weak getUncompressedSize__Q23EGG14StreamDecompLZFPCv = .text:0x804952B0; // type:function size:0x8 scope:weak getHeaderSize__Q23EGG14StreamDecompLZFv = .text:0x804952C0; // type:function size:0x8 scope:weak -MEM_AllocFor_Heap__FP12MEMAllocatorUl = .text:0x804952D0; // type:function size:0x1C scope:local -MEM_FreeFor_Heap__FP12MEMAllocatorPv = .text:0x804952F0; // type:function size:0x14 scope:local +AllocatorAllocForHeap___FP12MEMAllocatorUl = .text:0x804952D0; // type:function size:0x1C scope:local +AllocatorFreeForHeap___FP12MEMAllocatorPv = .text:0x804952F0; // type:function size:0x14 scope:local MEMInitAllocatorFor_Heap__FP12MEMAllocatorlPv = .text:0x80495310; // type:function size:0x1C __ct__Q23EGG9AllocatorFPQ23EGG4Heapl = .text:0x80495330; // type:function size:0x50 __dt__Q23EGG9AllocatorFv = .text:0x80495380; // type:function size:0x40 @@ -26430,7 +26430,7 @@ configure__Q23EGG10CapTextureFv = .text:0x8049D7C0; // type:function size:0x7C capture__Q23EGG10CapTextureFUsUsbi = .text:0x8049D840; // type:function size:0x184 fn_8049D9D0__Q23EGG10CapTextureFUc = .text:0x8049D9D0; // type:function size:0x58 calcColorGradient__Q23EGG27@unnamed@eggCpuTexture_cpp@FR8_GXColorRC8_GXColorRC8_GXColorf = .text:0x8049DA30; // type:function size:0x188 -makeGradient__Q23EGG27@unnamed@eggCpuTexture_cpp@FiP8_GXColoriiiRC8_GXColorRC8_GXColor = .text:0x8049DBC0; // type:function size:0x450 +makeGradient__Q23EGG27@unnamed@eggCpuTexture_cpp@FiP8_GXColorUsUsUsRC8_GXColorRC8_GXColor = .text:0x8049DBC0; // type:function size:0x450 __ct__Q23EGG10CpuTextureFv = .text:0x8049E010; // type:function size:0x44 __ct__Q23EGG10CpuTextureFUsUs9_GXTexFmt = .text:0x8049E060; // type:function size:0x40 __ct__Q23EGG10CpuTextureFPC9_GXTexObj = .text:0x8049E0A0; // type:function size:0xB0 @@ -26676,7 +26676,7 @@ drawAndCaptureTexture__Q23EGG19LightTextureManagerFffff = .text:0x804ADC80; // t SetBinaryInner__Q23EGG19LightTextureManagerFRCQ33EGG36IBinary3Bin = .text:0x804AE150; // type:function size:0x80 GetBinaryInner__Q23EGG19LightTextureManagerCFPQ33EGG36IBinary3Bin = .text:0x804AE1D0; // type:function size:0x90 getLtexFromLmap__Q23EGG19LightTextureManagerFPCvUs = .text:0x804AE260; // type:function size:0xDC -fn_804AE340__Q23EGG19LightTextureManagerFQ34nw4r3g3d6ResMat13_GXTexCoordID = .text:0x804AE340; // type:function size:0xBC +setupEnvmap__Q23EGG19LightTextureManagerFQ34nw4r3g3d6ResMat13_GXTexCoordID = .text:0x804AE340; // type:function size:0xBC GetBinarySize__Q23EGG19LightTextureManagerCFv = .text:0x804AE400; // type:function size:0x8 SetBinaryInner__Q23EGG36IBinaryFRCQ33EGG36IBinary3BinRCQ33EGG36IBinary3Binf = .text:0x804AE410; // type:function size:0x4 scope:weak SetBinary__Q23EGG29IBinaryFPCv = .text:0x804AE420; // type:function size:0x10 scope:weak @@ -26730,7 +26730,7 @@ CopyFromAnother__Q23EGG6ScreenFRCQ23EGG6Screen = .text:0x804B24C0; // type:funct Reset__Q23EGG6ScreenFffffQ33EGG7Frustum10CanvasMode = .text:0x804B2590; // type:function size:0x38 SetParent__Q23EGG6ScreenFPCQ23EGG6Screen = .text:0x804B25D0; // type:function size:0x30 SetUnkFlag8__Q23EGG6ScreenFv = .text:0x804B2600; // type:function size:0x24 -OnDirectEfb__Q23EGG6ScreenCFv = .text:0x804B2630; // type:function size:0x4D8 +GetPosSizeInEfb__Q23EGG6ScreenCFv = .text:0x804B2630; // type:function size:0x4D8 GetDataEfb__Q23EGG6ScreenCFv = .text:0x804B2B10; // type:function size:0x5C IsChangeEfb__Q23EGG6ScreenCFv = .text:0x804B2B70; // type:function size:0x2C CalcMatrixForDrawQuad__Q23EGG6ScreenCFPQ34nw4r4math5MTX34ffff = .text:0x804B2BA0; // type:function size:0xA8 @@ -26738,7 +26738,7 @@ FillBufferGX__Q23EGG6ScreenCFUl8_GXColorUl = .text:0x804B2C50; // type:function GetGlobalPos__Q23EGG6ScreenCFPfPf = .text:0x804B2D40; // type:function size:0xB0 SetTVMode__Q23EGG6ScreenFQ33EGG6Screen6TVMode = .text:0x804B2DF0; // type:function size:0xB0 SetTVModeDefault__Q23EGG6ScreenFv = .text:0x804B2EA0; // type:function size:0x34 -fn_804B2EE0__Q23EGG6ScreenCFPfPfff = .text:0x804B2EE0; // type:function size:0x14C +ConvertToEfb__Q23EGG6ScreenCFffPfPf = .text:0x804B2EE0; // type:function size:0x14C __sinit_\eggScreen_cpp = .text:0x804B3030; // type:function size:0x84 scope:local __ct__Q23EGG16ScreenEffectBaseFv = .text:0x804B30C0; // type:function size:0x18 __sinit_\eggScreenEffectBase_cpp = .text:0x804B30E0; // type:function size:0xC scope:local @@ -26758,9 +26758,9 @@ Clean__Q23EGG8StateEfbFv = .text:0x804B3DA0; // type:function size:0x78 captureEfb__Q23EGG8StateEfbFQ33EGG8StateEfb10BufferTypebUl = .text:0x804B3E20; // type:function size:0x3C8 releaseEfb__Q23EGG8StateEfbFQ33EGG8StateEfb10BufferTypeUl = .text:0x804B41F0; // type:function size:0x7C fn_804B4270__Q23EGG8StateEfbFQ33EGG8StateEfb10BufferTypeUl = .text:0x804B4270; // type:function size:0x98 -fn_804B4310__Q23EGG8StateEfbFQ33EGG8StateEfb10BufferTypeUl = .text:0x804B4310; // type:function size:0x23C +popWorkBuffer__Q23EGG8StateEfbFbUl = .text:0x804B4310; // type:function size:0x23C fn_804B4550__Q23EGG8StateEfbFv = .text:0x804B4550; // type:function size:0xA0 -GetShouldCapture__Q23EGG8StateEfbFv = .text:0x804B45F0; // type:function size:0xC +isEnableDirtyBufferMode__Q23EGG8StateEfbFv = .text:0x804B45F0; // type:function size:0xC GetUseTfRgb565__Q23EGG8StateEfbFv = .text:0x804B4600; // type:function size:0xC texRegionCallback__24@unnamed@eggStateGX_cpp@FPC9_GXTexObj11_GXTexMapID = .text:0x804B4610; // type:function size:0x28 scope:local initialize__Q23EGG7StateGXFUsUs8_GXColor11_GXPixelFmt = .text:0x804B4640; // type:function size:0x114 @@ -26775,7 +26775,7 @@ resetTexGen__Q23EGG7StateGXFv = .text:0x804B4CB0; // type:function size:0xB8 resetTev__Q23EGG7StateGXFv = .text:0x804B4D70; // type:function size:0x17C resetPE__Q23EGG7StateGXFv = .text:0x804B4EF0; // type:function size:0xB0 resetGXCache__Q23EGG7StateGXFv = .text:0x804B4FA0; // type:function size:0x40 -GXSetPixelFmt___Q23EGG7StateGXF11_GXPixelFmt9_GXZFmt16 = .text:0x804B4FE0; // type:function size:0xAC +setPixelFormatGX__Q23EGG7StateGXF11_GXPixelFmt9_GXZFmt16 = .text:0x804B4FE0; // type:function size:0xAC invalidateTexAllGX__Q23EGG7StateGXFv = .text:0x804B5090; // type:function size:0x4 GXSetColorUpdate___Q23EGG7StateGXFb = .text:0x804B50A0; // type:function size:0x4C GXSetAlphaUpdate___Q23EGG7StateGXFb = .text:0x804B50F0; // type:function size:0x4C @@ -49828,7 +49828,7 @@ VOLUME_INIT__Q44nw4r3snd6detail12EnvGenerator = .sdata2:0x8057EFD0; // type:obje @4069 = .sdata2:0x8057F2E0; // type:object size:0x4 scope:local align:4 data:float @4070 = .sdata2:0x8057F2E4; // type:object size:0x4 scope:local align:4 data:float @4006 = .sdata2:0x8057F2E8; // type:object size:0x4 scope:local align:4 data:float -eggAllocatorFuncs = .sdata2:0x8057F2F0; // type:object size:0x8 scope:local +@LOCAL@MEMInitAllocatorFor_Heap__FP12MEMAllocatorlPv@sAllocatorFunc = .sdata2:0x8057F2F0; // type:object size:0x8 scope:local @3922 = .sdata2:0x8057F2F8; // type:object size:0x4 scope:local align:4 data:float @3925 = .sdata2:0x8057F300; // type:object size:0x8 scope:local align:8 data:double @3503 = .sdata2:0x8057F308; // type:object size:0x4 scope:local align:4 data:float diff --git a/include/egg/gfx/eggDrawPathDOF.h b/include/egg/gfx/eggDrawPathDOF.h index 8ae49e79..a291f9c2 100644 --- a/include/egg/gfx/eggDrawPathDOF.h +++ b/include/egg/gfx/eggDrawPathDOF.h @@ -33,7 +33,7 @@ private: void internalDrawStandard(u16); void internalDrawLite(u16); - void afterDraw(u16 x, u16 y, u16 width, u16 height); + void allocAndCaptureBlurBuffer(u16 x, u16 y, u16 width, u16 height); /* 0x1C */ u16 field_0x1C; /* 0x1E */ u8 field_0x1E; diff --git a/include/egg/gfx/eggLightTextureMgr.h b/include/egg/gfx/eggLightTextureMgr.h index c12fc011..cd3ff842 100644 --- a/include/egg/gfx/eggLightTextureMgr.h +++ b/include/egg/gfx/eggLightTextureMgr.h @@ -71,7 +71,7 @@ public: } private: - static void fn_804AE340(nw4r::g3d::ResMat, GXTexCoordID); + static void setupEnvmap(nw4r::g3d::ResMat, GXTexCoordID); int getTextureIndex(const char *name) const; bool getSomeTfRelatedBool() const { diff --git a/include/egg/gfx/eggPostEffectBlur.h b/include/egg/gfx/eggPostEffectBlur.h index de6d9754..748c688a 100644 --- a/include/egg/gfx/eggPostEffectBlur.h +++ b/include/egg/gfx/eggPostEffectBlur.h @@ -57,7 +57,7 @@ public: } private: - void drawInternal(u8, u8, f32, f32); + void setMaterialMulti(u8, u8, f32, f32); /* 0x2C */ u8 field_0x2C; /* 0x30 */ f32 field_0x30; diff --git a/include/egg/gfx/eggScreen.h b/include/egg/gfx/eggScreen.h index 44fd56da..e78ba7bf 100644 --- a/include/egg/gfx/eggScreen.h +++ b/include/egg/gfx/eggScreen.h @@ -99,13 +99,13 @@ public: void CopyFromAnother(const Screen &other); void Reset(f32, f32, f32, f32, CanvasMode); - void OnDirectEfb() const; + void GetPosSizeInEfb() const; const DataEfb &GetDataEfb() const; bool IsChangeEfb() const; void CalcMatrixForDrawQuad(nw4r::math::MTX34 *, f32, f32, f32, f32) const; void FillBufferGX(u32, GXColor, u32) const; void GetGlobalPos(f32 *, f32 *) const; - void fn_804B2EE0(f32 *, f32 *, f32, f32) const; + void ConvertToEfb(f32, f32, f32 *, f32 *) const; f32 ScaleByX(f32 val) const { return val * StateGX::s_widthEfb / GetSizeXMax(GetComputedTVMode()); diff --git a/include/egg/gfx/eggStateEfb.h b/include/egg/gfx/eggStateEfb.h index 93386936..a1eac8e2 100644 --- a/include/egg/gfx/eggStateEfb.h +++ b/include/egg/gfx/eggStateEfb.h @@ -31,7 +31,7 @@ private: static s32 sPushCount; static u32 sFlag; - static bool GetShouldCapture(); + static bool isEnableDirtyBufferMode(); static bool GetUseTfRgb565(); public: @@ -45,7 +45,7 @@ private: // Unknown names static void fn_804B4270(BufferType type, u32 userData); - static void fn_804B4310(BufferType type, u32 userData); + static void popWorkBuffer(bool b, u32 userData); static f32 *fn_804B4550(); }; diff --git a/include/egg/gfx/eggStateGX.h b/include/egg/gfx/eggStateGX.h index 251d864e..697e3dc6 100644 --- a/include/egg/gfx/eggStateGX.h +++ b/include/egg/gfx/eggStateGX.h @@ -81,7 +81,7 @@ public: static void invalidateTexAllGX(); - static void GXSetPixelFmt_(GXPixelFmt pixelFmt, GXZFmt16 zFmt); + static void setPixelFormatGX(GXPixelFmt pixelFmt, GXZFmt16 zFmt); static bool GXSetColorUpdate_(bool); static bool GXSetAlphaUpdate_(bool); static bool GXSetDither_(bool); diff --git a/src/egg/core/eggAllocator.cpp b/src/egg/core/eggAllocator.cpp index d12d57a8..22780acf 100644 --- a/src/egg/core/eggAllocator.cpp +++ b/src/egg/core/eggAllocator.cpp @@ -2,23 +2,22 @@ #include "egg/core/eggHeap.h" - -/* 804952d0 */ static void *MEM_AllocFor_Heap(MEMAllocator *alloc, u32 size) { +/* 804952d0 */ static void *AllocatorAllocForHeap_(MEMAllocator *alloc, u32 size) { return static_cast(static_cast(alloc)->heap)->alloc(size, alloc->heapParam1); } -/* 804952f0 */ static void MEM_FreeFor_Heap(MEMAllocator *alloc, void *block) { +/* 804952f0 */ static void AllocatorFreeForHeap_(MEMAllocator *alloc, void *block) { return static_cast(static_cast(alloc)->heap)->free(block); } -const MEMAllocatorFuncs eggAllocatorFuncs = { - &MEM_AllocFor_Heap, - &MEM_FreeFor_Heap, -}; - // TODO this is used from eggHeap for some reason. Figure out // the correct privacy boundary later. /* 80495310 */ void MEMInitAllocatorFor_Heap(MEMAllocator *alloc, s32 align, void *heap) { - alloc->funcs = &eggAllocatorFuncs; + static const MEMAllocatorFuncs sAllocatorFunc = { + &AllocatorAllocForHeap_, + &AllocatorFreeForHeap_, + }; + + alloc->funcs = &sAllocatorFunc; alloc->heap = heap; alloc->heapParam1 = align; alloc->heapParam2 = 0; diff --git a/src/egg/gfx/eggCpuTexture.cpp b/src/egg/gfx/eggCpuTexture.cpp index 9cf4860c..f86a8bd3 100644 --- a/src/egg/gfx/eggCpuTexture.cpp +++ b/src/egg/gfx/eggCpuTexture.cpp @@ -27,19 +27,16 @@ void calcColorGradient(GXColor &outColor, const GXColor &c1, const GXColor &c2, } } -void makeGradient(int op, GXColor *outColor, int size, int start, int end, const GXColor &c1, const GXColor &c2) { - int start_p1 = start + 1; - // Weird instruction calculation - for (int i = 0; i < start_p1; i++) { +void makeGradient(int op, GXColor *outColor, u16 size, u16 start, u16 end, const GXColor &c1, const GXColor &c2) { + for (int i = 0; i < start + 1; i++) { outColor[i] = c1; } - int end_1 = end - 1; - for (int i = end_1; i < size; i++) { + for (int i = end - 1; i < size; i++) { outColor[i] = c2; } - for (int i = start_p1; i < end_1; i++) { + for (int i = start + 1; i < end - 1; i++) { f32 ratio = (f32)(i - start) / (f32)(end - start); switch (op) { case 0: break; @@ -188,6 +185,7 @@ void CpuTexture::fillNormalMapSphere(f32 f1, f32 f2) { vec(0) = fx; vec(1) = fy; + // TODO: std::sqrtf? vec(2) = fz < Math::zero() ? Math::zero() : (f32)sqrt(fz); PSVECNormalize(vec, vec); @@ -202,24 +200,19 @@ void CpuTexture::fillNormalMapSphere(f32 f1, f32 f2) { void CpuTexture::fillGradient( int op, int unk, u16 start, u16 end, const GXColor &c1, const GXColor &c2, bool b1, bool b2 ) { - // NONMATCHING - regswaps - GXColor gradient[1024]; GXColor colors[256]; bool swapMode = unk == 0x73 || unk == 0x53; u16 width = swapMode ? mWidth : mHeight; u16 height = swapMode ? mHeight : mWidth; + u16 mid = width / 2; makeGradient(op, gradient, width, start, end, c1, c2); if (b1) { - // Regswaps here - for (int i2 = mid, i = 0; i < width; i2++, i++) { - colors[i].r = gradient[i < mid ? i2 : i - mid].r; - colors[i].g = gradient[i < mid ? i2 : i - mid].g; - colors[i].b = gradient[i < mid ? i2 : i - mid].b; - colors[i].a = gradient[i < mid ? i2 : i - mid].a; + for (int i = 0; i < width; i++) { + colors[i] = gradient[i < mid ? i + mid : i - mid]; } for (int i = 0; i < width; i++) { @@ -295,16 +288,10 @@ void CpuTexture::setColor(u16 x, u16 y, GXColor color) { } case GX_TF_I8: case GX_TF_Z8: { - // Regswaps here - int pix = (x & 0x7); - int pix_y = (y & 0x3) * 8; + int offset = (x & 0x7) + (y & 0x3) * 8; // pixel + offset += ((x >> 3) + ((y >> 2) * (getWidth() / 8))) * 32; // block - int block = (x >> 3); - int block_y = (y >> 2) * (getWidth() / 8); - - pix = pix + pix_y + (block + block_y) * 0x20; - - u8 *dat = static_cast(getBuffer()) + pix; + u8 *dat = static_cast(getBuffer()) + offset; dat[0] = color.r; break; @@ -328,7 +315,6 @@ void CpuTexture::setColor(u16 x, u16 y, GXColor color) { } GXColor CpuTexture::getColor(u16 x, u16 y) const { - // NONMATCHING GXColor c; switch (getFormat()) { case GX_TF_RGBA8: @@ -343,6 +329,7 @@ GXColor CpuTexture::getColor(u16 x, u16 y) const { } case GX_TF_I8: case GX_TF_Z8: { + // TODO - probably fake int idx = (x & 0x7); int pixel_idx = (y & 0x3) * 8; int block_idx = ((getWidth() / 8) * (y >> 2) + (x >> 3)); diff --git a/src/egg/gfx/eggDrawPathDOF.cpp b/src/egg/gfx/eggDrawPathDOF.cpp index e649fab5..5b977e99 100644 --- a/src/egg/gfx/eggDrawPathDOF.cpp +++ b/src/egg/gfx/eggDrawPathDOF.cpp @@ -130,7 +130,7 @@ void DrawPathDOF::internalDraw(u16 idx) { switch (idx) { case 1: - StateEfb::fn_804B4310(StateEfb::BUFFER_0, reinterpret_cast(this)); + StateEfb::popWorkBuffer(StateEfb::BUFFER_0, reinterpret_cast(this)); StateEfb::releaseEfb(StateEfb::BUFFER_3, reinterpret_cast(this)); break; case 2: @@ -149,7 +149,7 @@ void DrawPathDOF::internalDrawLite(u16 idx) { switch (idx) { case 0: { TextureBuffer *capturedBuf = StateEfb::captureEfb(StateEfb::BUFFER_3, false, reinterpret_cast(this)); - StateGX::GXSetPixelFmt_(GX_PF_RGB8_Z24, GX_ZC_LINEAR); + StateGX::setPixelFormatGX(GX_PF_RGB8_Z24, GX_ZC_LINEAR); StateGX::ScopedColor colorGuard(true); StateGX::ScopedAlpha alphaGuard(false); StateGX::ScopedDither ditherGuard(false); @@ -184,8 +184,8 @@ void DrawPathDOF::internalDrawLite(u16 idx) { if (pTex2 != nullptr) { pTex2->free(); } - afterDraw(floats[0], floats[1], width, height); - StateGX::GXSetPixelFmt_(StateGX::s_pixFormat, StateGX::s_zFmt16); + allocAndCaptureBlurBuffer(floats[0], floats[1], width, height); + StateGX::setPixelFormatGX(StateGX::s_pixFormat, StateGX::s_zFmt16); break; } case 2: { diff --git a/src/egg/gfx/eggLightTextureMgr.cpp b/src/egg/gfx/eggLightTextureMgr.cpp index 17f28c6d..e9d0b27a 100644 --- a/src/egg/gfx/eggLightTextureMgr.cpp +++ b/src/egg/gfx/eggLightTextureMgr.cpp @@ -129,7 +129,7 @@ u16 LightTextureManager::replaceModelTexture(int tex, nw4r::g3d::ResMdl mdl) con u16 res = G3DUtility::SetTexture(mat, nullptr, mpTextures[tex]->getName(), &obj, false, buf, 0xFF, 2); for (int j = 0; j < res; j++) { if (buf[j].texCoordId != -1) { - fn_804AE340(mat, static_cast(buf[j].texCoordId)); + setupEnvmap(mat, static_cast(buf[j].texCoordId)); } } count += res; @@ -214,7 +214,7 @@ void LightTextureManager::drawAndCaptureTexture(f32 ox, f32 oy, f32 sx, f32 sy) } if (b1) { - StateGX::GXSetPixelFmt_(GX_PF_RGB8_Z24, GX_ZC_LINEAR); + StateGX::setPixelFormatGX(GX_PF_RGB8_Z24, GX_ZC_LINEAR); } nw4r::ut::Color c(StateGX::s_clearEfb); @@ -234,7 +234,7 @@ void LightTextureManager::drawAndCaptureTexture(f32 ox, f32 oy, f32 sx, f32 sy) } if (b1) { - StateGX::GXSetPixelFmt_(StateGX::s_pixFormat, StateGX::s_zFmt16); + StateGX::setPixelFormatGX(StateGX::s_pixFormat, StateGX::s_zFmt16); } if ((mFlags & 0x40) == 0 && buf != nullptr) { @@ -307,7 +307,7 @@ const void *LightTextureManager::getLtexFromLmap(const void *lmap, u16 index) { return buf; } -void LightTextureManager::fn_804AE340(nw4r::g3d::ResMat mat, GXTexCoordID id) { +void LightTextureManager::setupEnvmap(nw4r::g3d::ResMat mat, GXTexCoordID id) { nw4r::g3d::ResTexSrt dat = mat.GetResTexSrt(); dat.SetMapMode(id, 1, -1, -1); nw4r::g3d::ResMatTexCoordGen coordGen = mat.GetResMatTexCoordGen(); diff --git a/src/egg/gfx/eggPostEffectBlur.cpp b/src/egg/gfx/eggPostEffectBlur.cpp index 9bb52690..934ee0d3 100644 --- a/src/egg/gfx/eggPostEffectBlur.cpp +++ b/src/egg/gfx/eggPostEffectBlur.cpp @@ -38,14 +38,14 @@ void PostEffectBlur::draw(f32 width, f32 height) { for (u8 i = 0; i < field_0x2C; i++) { int maxNum = (field_0x38[i].field_0x00 - 1) / 8; for (u8 b = 0; b <= maxNum; b++) { - drawInternal(i, b, f1, f2); + setMaterialMulti(i, b, f1, f2); drawScreenInternal(mOffsetX, mOffsetY, width * mScaleX, height * mScaleY); DrawGX::SetBlendMode(DrawGX::BLEND_2); } } } -void PostEffectBlur::drawInternal(u8 kernelIdx, u8 p2, f32 f1, f32 f2) { +void PostEffectBlur::setMaterialMulti(u8 kernelIdx, u8 p2, f32 f1, f32 f2) { // NONMATCHING nw4r::math::MTX34 mtx; const Stage &k = field_0x38[kernelIdx]; diff --git a/src/egg/gfx/eggScreen.cpp b/src/egg/gfx/eggScreen.cpp index 768c4b2c..9a9d58cb 100644 --- a/src/egg/gfx/eggScreen.cpp +++ b/src/egg/gfx/eggScreen.cpp @@ -191,14 +191,14 @@ void Screen::SetUnkFlag8() { mFlags |= FLAG_0x08; } -void Screen::OnDirectEfb() const { +void Screen::GetPosSizeInEfb() const { f32 &x1 = mDataEfb.vp.x1; f32 &y1 = mDataEfb.vp.y1; if (mParent == nullptr) { x1 = mPosition.x * sCanvasScale.x; y1 = mPosition.y * sCanvasScale.y; } else { - mParent->fn_804B2EE0(&x1, &y1, mPosition.x, mPosition.y); + mParent->ConvertToEfb(mPosition.x, mPosition.y, &x1, &y1); } // TODO: Make this work without temporaries? @@ -242,7 +242,7 @@ void Screen::OnDirectEfb() const { const Screen::DataEfb &Screen::GetDataEfb() const { if (IsChangeEfb()) { - OnDirectEfb(); + GetPosSizeInEfb(); mDataEfb.vp.z1 = 0.0f; mDataEfb.vp.z2 = 1.0f; SetDirty(false); @@ -325,7 +325,7 @@ void Screen::SetTVModeDefault() { SetTVMode(SCGetAspectRatio() == SC_ASPECT_STD ? TV_MODE_4_3 : TV_MODE_16_9); } -void Screen::fn_804B2EE0(f32 *ox, f32 *oy, f32 a, f32 b) const { +void Screen::ConvertToEfb(f32 a, f32 b, f32 *ox, f32 *oy) const { GetGlobalPos(ox, oy); ConvertToCanvasLU(a, b, &a, &b); *ox = ScaleByX((*ox + a)); diff --git a/src/egg/gfx/eggStateEfb.cpp b/src/egg/gfx/eggStateEfb.cpp index a21cdf0b..5872e1ef 100644 --- a/src/egg/gfx/eggStateEfb.cpp +++ b/src/egg/gfx/eggStateEfb.cpp @@ -88,7 +88,7 @@ TextureBuffer *StateEfb::captureEfb(BufferType type, bool noTransparencyMaybe, u if (spBufferSet[type].buf != nullptr) { spBufferSet[type].buf->setPixModeSync(false); } - doCapture = GetShouldCapture(); + doCapture = isEnableDirtyBufferMode(); break; } @@ -151,7 +151,7 @@ void StateEfb::fn_804B4270(BufferType type, u32 userData) { } } -void StateEfb::fn_804B4310(BufferType type, u32 userData) { +void StateEfb::popWorkBuffer(bool b, u32 userData) { if (sWorkBuffer != -1) { BufferType i = static_cast(-1); if (sWorkBuffer == 0) { @@ -161,7 +161,7 @@ void StateEfb::fn_804B4310(BufferType type, u32 userData) { } if (spBufferSet[i].userData == userData) { - if (type == BUFFER_0) { + if (!b) { StateGX::ScopedColor colorGuard(true); StateGX::ScopedAlpha alphaGuard(true); StateGX::ScopedDither ditherGuard(false); @@ -186,9 +186,9 @@ void StateEfb::fn_804B4310(BufferType type, u32 userData) { nw4r::math::MTX34 mtx; PSMTXScale(mtx, parentScreen.GetSize().x, parentScreen.GetSize().y, 1.0f); - DrawGX::BeginDrawScreen(true, GetShouldCapture(), false); + DrawGX::BeginDrawScreen(true, isEnableDirtyBufferMode(), false); DrawGX::SetBlendMode(DrawGX::BLEND_14); - if (GetShouldCapture()) { + if (isEnableDirtyBufferMode()) { TextureBuffer *buf = spBufferSet[i].buf; buf->setFilt(GX_NEAR, GX_NEAR); buf->load(DrawGX::GetTexMapDefault()); @@ -218,7 +218,7 @@ f32 *StateEfb::fn_804B4550() { return sUnkBuffer; } -bool StateEfb::GetShouldCapture() { +bool StateEfb::isEnableDirtyBufferMode() { return ((sFlag >> 2) & 1) != 0; } diff --git a/src/egg/gfx/eggStateGX.cpp b/src/egg/gfx/eggStateGX.cpp index 4355176a..21972b94 100644 --- a/src/egg/gfx/eggStateGX.cpp +++ b/src/egg/gfx/eggStateGX.cpp @@ -66,7 +66,7 @@ void StateGX::initialize(u16 width, u16 height, GXColor color, GXPixelFmt pixelF } void StateGX::frameInit() { - GXSetPixelFmt_(s_pixFormat, s_zFmt16); + setPixelFormatGX(s_pixFormat, s_zFmt16); if (BaseSystem::mConfigData->getDisplay() != nullptr) { s_clearEfb = BaseSystem::mConfigData->getDisplay()->getClearColor(); } @@ -230,7 +230,7 @@ void StateGX::resetGXCache() { GXSetDstAlpha_(false, 0); } -void StateGX::GXSetPixelFmt_(GXPixelFmt pixelFmt, GXZFmt16 zFmt) { +void StateGX::setPixelFormatGX(GXPixelFmt pixelFmt, GXZFmt16 zFmt) { GXPixelFmt oldPixelFmt; GXZFmt16 oldZFmt;