From 03e3fc5cfa63076033005cb9079e37d21103f473 Mon Sep 17 00:00:00 2001 From: robojumper Date: Sat, 15 Mar 2025 23:20:09 +0100 Subject: [PATCH] More --- config/SOUE01/splits.txt | 5 +-- config/SOUE01/symbols.txt | 12 +++---- configure.py | 2 +- include/egg/gfx/eggDrawPathDOF.h | 28 ++++++++++++++++- include/egg/gfx/eggStateGX.h | 54 +++++++++++++++++++++++++++++--- include/egg/prim/eggBinary.h | 2 ++ src/egg/gfx/eggCapTexture.cpp | 8 ++--- src/egg/gfx/eggDrawPathDOF.cpp | 18 ++++++++++- 8 files changed, 108 insertions(+), 21 deletions(-) diff --git a/config/SOUE01/splits.txt b/config/SOUE01/splits.txt index 02ccf1cf..db75cf74 100644 --- a/config/SOUE01/splits.txt +++ b/config/SOUE01/splits.txt @@ -2178,8 +2178,8 @@ egg/gfx/eggUnk1.cpp: .text start:0x8049CFF0 end:0x8049D7C0 egg/gfx/eggCapTexture.cpp: - .text start:0x8049D7C0 end:0x8049D9D0 - .rodata start:0x804FBA30 end:0x804FBA60 + .text start:0x8049D7C0 end:0x8049D9C4 + .rodata start:0x804FBA30 end:0x804FBA48 .data start:0x8056ED70 end:0x8056ED80 .sdata2 start:0x8057F410 end:0x8057F418 .sbss2 start:0x8057FFC0 end:0x8057FFC8 @@ -2201,6 +2201,7 @@ egg/gfx/eggDrawPathUnk1.cpp: egg/gfx/eggDrawPathDOF.cpp: .text start:0x804A29C0 end:0x804A4BE8 + .data start:0x8056EF28 end:0x8056EFA0 egg/gfx/eggDrawPathUnk2.cpp: .text start:0x804A4BF0 end:0x804A54E8 diff --git a/config/SOUE01/symbols.txt b/config/SOUE01/symbols.txt index d743d8d6..c032f17e 100644 --- a/config/SOUE01/symbols.txt +++ b/config/SOUE01/symbols.txt @@ -26779,11 +26779,11 @@ resetPE__Q23EGG7StateGXFv = .text:0x804B4EF0; // type:function size:0xB0 resetGXCache__Q23EGG7StateGXFv = .text:0x804B4FA0; // type:function size:0x40 EGG__StateGX__GXSetPixelFmt_ = .text:0x804B4FE0; // type:function size:0xAC invalidateTexAllGX__Q23EGG7StateGXFv = .text:0x804B5090; // type:function size:0x4 -GXSetColorUpdate___Q23EGG7StateGXFUc = .text:0x804B50A0; // type:function size:0x4C -GXSetAlphaUpdate___Q23EGG7StateGXFUc = .text:0x804B50F0; // type:function size:0x4C -GXSetDither___Q23EGG7StateGXFUc = .text:0x804B5140; // type:function size:0x4C +GXSetColorUpdate___Q23EGG7StateGXFb = .text:0x804B50A0; // type:function size:0x4C +GXSetAlphaUpdate___Q23EGG7StateGXFb = .text:0x804B50F0; // type:function size:0x4C +GXSetDither___Q23EGG7StateGXFb = .text:0x804B5140; // type:function size:0x4C GXCopyTex__Q23EGG7StateGXFPvb = .text:0x804B5190; // type:function size:0x8 -GXSetDstAlpha___Q23EGG7StateGXFUcUc = .text:0x804B51A0; // type:function size:0x4C +GXSetDstAlpha___Q23EGG7StateGXFbUc = .text:0x804B51A0; // type:function size:0x4C FUN_804b51f0 = .text:0x804B51F0; // type:function size:0x108 FUN_804b5300 = .text:0x804B5300; // type:function size:0x2C GXSetProjectionv___Q23EGG7StateGXFPCf = .text:0x804B5330; // type:function size:0x2C @@ -29159,7 +29159,7 @@ gRMO_Ntsc_640x456Prog_4x3__22@unnamed@eggVideo_cpp@ = .rodata:0x804FB980; // typ gRMO_Ntsc_640x456IntDf_4x3__22@unnamed@eggVideo_cpp@ = .rodata:0x804FB9BC; // type:object size:0x3C scope:local renderModes__3EGG = .rodata:0x804FB9F8; // type:object size:0x28 scope:local @4804 = .rodata:0x804FBA20; // type:object size:0x10 scope:local data:4byte -copyArg2__3EGG = .rodata:0x804FBA30; // type:object size:0x30 +copyArg2__3EGG = .rodata:0x804FBA30; // type:object size:0x18 lbl_804FBA60 = .rodata:0x804FBA60; // type:object size:0xD8 lbl_804FBB38 = .rodata:0x804FBB38; // type:object size:0x30 lbl_804FBB68 = .rodata:0x804FBB68; // type:object size:0xF0 @@ -37362,7 +37362,7 @@ jumptable_8056EDE0 = .data:0x8056EDE0; // type:object size:0x38 scope:local jumptable_8056EE18 = .data:0x8056EE18; // type:object size:0x48 scope:local __vt__Q23EGG12DrawPathBase = .data:0x8056EE60; // type:object size:0x50 lbl_8056EEB0 = .data:0x8056EEB0; // type:object size:0x78 -lbl_8056EF28 = .data:0x8056EF28; // type:object size:0x78 +__vt__Q23EGG11DrawPathDOF = .data:0x8056EF28; // type:object size:0x78 lbl_8056EFA0 = .data:0x8056EFA0; // type:object size:0x50 __vt__Q23EGG3Fog = .data:0x8056EFF0; // type:object size:0x20 __vt__Q23EGG10FogManager = .data:0x8056F010; // type:object size:0x20 diff --git a/configure.py b/configure.py index 69f286ad..e6d9ba62 100644 --- a/configure.py +++ b/configure.py @@ -869,7 +869,7 @@ config.libs = [ Object(NonMatching, "egg/gfx/eggPalette.cpp"), Object(NonMatching, "egg/gfx/eggTexture.cpp"), Object(NonMatching, "egg/gfx/eggUnk1.cpp"), # Unknown - Object(NonMatching, "egg/gfx/eggCapTexture.cpp"), + Object(Matching, "egg/gfx/eggCapTexture.cpp"), Object(NonMatching, "egg/gfx/eggCpuTexture.cpp"), Object(NonMatching, "egg/gfx/eggDrawGX.cpp"), Object(Matching, "egg/gfx/eggDrawPathBase.cpp"), diff --git a/include/egg/gfx/eggDrawPathDOF.h b/include/egg/gfx/eggDrawPathDOF.h index 054464d1..84a15f6a 100644 --- a/include/egg/gfx/eggDrawPathDOF.h +++ b/include/egg/gfx/eggDrawPathDOF.h @@ -1,6 +1,32 @@ #ifndef EGG_DRAW_PATH_DOF_H #define EGG_DRAW_PATH_DOF_H -namespace EGG {} // namespace EGG +#include "egg/prim/eggBinary.h" +#include "egg/gfx/eggDrawPathBase.h" + +namespace EGG { + +class DrawPathDOF : public DrawPathBase, public IBinary { +public: + class BinData { + // TODO + }; + DrawPathDOF(); + virtual ~DrawPathDOF(); + + virtual u16 getNumStep() { + return 3; + } + virtual void internalResetForDraw() override; + virtual void internalDraw() override; + + virtual void SetBinaryInner(const Bin &) override; + virtual void GetBinaryInner(Bin *) const override; + virtual void SetBinaryInner(const Bin &, const Bin &, f32) override; +private: + void *IHaveMembers; +}; + +} // namespace EGG #endif diff --git a/include/egg/gfx/eggStateGX.h b/include/egg/gfx/eggStateGX.h index 1d15ad01..321586ba 100644 --- a/include/egg/gfx/eggStateGX.h +++ b/include/egg/gfx/eggStateGX.h @@ -8,6 +8,52 @@ namespace EGG { class StateGX { public: + + struct ScopedColor + { + ScopedColor(bool x) + { + old = GXSetColorUpdate_(x); + } + + ~ScopedColor() + { + GXSetColorUpdate_(old); + } + + bool old; + }; + + struct ScopedAlpha + { + ScopedAlpha(bool x) + { + old = GXSetAlphaUpdate_(x); + } + + ~ScopedAlpha() + { + GXSetAlphaUpdate_(old); + } + + bool old; + }; + + struct ScopedDither + { + ScopedDither(bool x) + { + old = GXSetDither_(x); + } + + ~ScopedDither() + { + GXSetDither_(old); + } + + bool old; + }; + static void initialize(u16, u16, GXColor, GXPixelFmt); static void frameInit(); static void textureInit(); // Guess for 804b4810 @@ -27,10 +73,10 @@ public: static void invalidateTexAllGX(); - static GXBool GXSetColorUpdate_(GXBool); - static GXBool GXSetAlphaUpdate_(GXBool); - static GXBool GXSetDither_(GXBool); - static GXBool GXSetDstAlpha_(GXBool, u8); + static bool GXSetColorUpdate_(bool); + static bool GXSetAlphaUpdate_(bool); + static bool GXSetDither_(bool); + static bool GXSetDstAlpha_(bool, u8); static bool GXSetColorUpdate(bool); static bool GXSetAlphaUpdate(bool); diff --git a/include/egg/prim/eggBinary.h b/include/egg/prim/eggBinary.h index 990bd03c..f962a254 100644 --- a/include/egg/prim/eggBinary.h +++ b/include/egg/prim/eggBinary.h @@ -42,6 +42,8 @@ protected: /** Load the object from binary, interpolating between values */ virtual void SetBinaryInner(const Bin &, const Bin &, f32) = 0; + virtual ~IBinary() {} + /** Get a 4-bytes long ID string corresponding to this type */ static const char *GetBinaryType(); /** Get the current version of this type */ diff --git a/src/egg/gfx/eggCapTexture.cpp b/src/egg/gfx/eggCapTexture.cpp index 166275ae..9aee5996 100644 --- a/src/egg/gfx/eggCapTexture.cpp +++ b/src/egg/gfx/eggCapTexture.cpp @@ -35,9 +35,8 @@ void CapTexture::capture(u16 x, u16 y, bool upscale, int format) { 0, copyArg2, (mCapFlags & 8) ? true : false, (mCapFlags & 8) ? mCopyFilterArg.values : defaultFilter.values ); - // Regswap, grr - GXBool prevColorUpdate = StateGX::GXSetColorUpdate_((mCapFlags & 1) != 0); - GXBool prevAlphaUpdate = StateGX::GXSetAlphaUpdate_((mCapFlags & 2) != 0); + StateGX::ScopedColor colorUpdate((mCapFlags & 1) != 0); + StateGX::ScopedAlpha alphaUpdate((mCapFlags & 2) != 0); GXSetZMode(true, GX_ALWAYS, (mCapFlags & 4) != 0); GXSetCopyClear(mClearColor, field_0x20); GXSetCopyClamp(3); @@ -51,9 +50,6 @@ void CapTexture::capture(u16 x, u16 y, bool upscale, int format) { if ((mCapFlags & 0x20) != 0) { StateGX::invalidateTexAllGX(); } - - StateGX::GXSetAlphaUpdate_(prevAlphaUpdate); - StateGX::GXSetColorUpdate_(prevColorUpdate); } } // namespace EGG diff --git a/src/egg/gfx/eggDrawPathDOF.cpp b/src/egg/gfx/eggDrawPathDOF.cpp index 8f611cde..588f02ba 100644 --- a/src/egg/gfx/eggDrawPathDOF.cpp +++ b/src/egg/gfx/eggDrawPathDOF.cpp @@ -1,3 +1,19 @@ #include "egg/gfx/eggDrawPathDOF.h" -namespace EGG {} // namespace EGG +namespace EGG { + +DrawPathDOF::DrawPathDOF() {} + +DrawPathDOF::~DrawPathDOF() {} + +void DrawPathDOF::internalDraw() {} + +void DrawPathDOF::internalResetForDraw() {} + +void DrawPathDOF::SetBinaryInner(const Bin &bin) {} + +void DrawPathDOF::GetBinaryInner(Bin *pBin) const {} + +void DrawPathDOF::SetBinaryInner(const Bin &, const Bin &, f32) {} + +} // namespace EGG