From b6db4eb1005d7daf4d5f235a7f5b140e411856c4 Mon Sep 17 00:00:00 2001 From: robojumper Date: Fri, 28 Mar 2025 18:59:44 +0100 Subject: [PATCH] GfxEngine OK --- config/SOUE01/splits.txt | 1 + config/SOUE01/symbols.txt | 2 +- configure.py | 2 +- include/egg/gfx/eggGfxEngine.h | 2 +- src/egg/gfx/eggGfxEngine.cpp | 37 +++++++++++++++++++++++++++++++++- 5 files changed, 40 insertions(+), 4 deletions(-) diff --git a/config/SOUE01/splits.txt b/config/SOUE01/splits.txt index edcd20d2..03669cd1 100644 --- a/config/SOUE01/splits.txt +++ b/config/SOUE01/splits.txt @@ -2242,6 +2242,7 @@ egg/gfx/eggG3DUtility.cpp: egg/gfx/eggGfxEngine.cpp: .text start:0x804A75B0 end:0x804A7744 + .data start:0x8056F048 end:0x8056F058 egg/gfx/eggGlobalDrawState.cpp: .text start:0x804A7750 end:0x804A7814 diff --git a/config/SOUE01/symbols.txt b/config/SOUE01/symbols.txt index 560bd020..7f9823ab 100644 --- a/config/SOUE01/symbols.txt +++ b/config/SOUE01/symbols.txt @@ -37367,7 +37367,7 @@ __vt__Q23EGG16DrawPathLightMap = .data:0x8056EFA0; // type:object size:0x50 __vt__Q23EGG3Fog = .data:0x8056EFF0; // type:object size:0x20 __vt__Q23EGG10FogManager = .data:0x8056F010; // type:object size:0x1C __vt__Q23EGG7Frustum = .data:0x8056F030; // type:object size:0x14 -EGG__GfxEnginer__Configuration__vtable = .data:0x8056F048; // type:object size:0x10 +__vt__Q33EGG9GfxEngine13Configuration = .data:0x8056F048; // type:object size:0xC __vt__Q23EGG8IScnProc = .data:0x8056F058; // type:object size:0x10 __vt__Q23EGG12LightManager = .data:0x8056F068; // type:object size:0x2C __vt__Q23EGG11LightObject = .data:0x8056F098; // type:object size:0x20 diff --git a/configure.py b/configure.py index c8b73a79..8b0a546e 100644 --- a/configure.py +++ b/configure.py @@ -880,7 +880,7 @@ config.libs = [ Object(Matching, "egg/gfx/eggFogManager.cpp"), Object(NonMatching, "egg/gfx/eggFrustum.cpp"), Object(NonMatching, "egg/gfx/eggG3DUtility.cpp"), - Object(NonMatching, "egg/gfx/eggGfxEngine.cpp"), + Object(Matching, "egg/gfx/eggGfxEngine.cpp"), Object(Matching, "egg/gfx/eggGlobalDrawState.cpp"), Object(NonMatching, "egg/gfx/eggGXUtility.cpp"), Object(Matching, "egg/gfx/eggIScnProc.cpp"), diff --git a/include/egg/gfx/eggGfxEngine.h b/include/egg/gfx/eggGfxEngine.h index 20b6729b..cd1a88ef 100644 --- a/include/egg/gfx/eggGfxEngine.h +++ b/include/egg/gfx/eggGfxEngine.h @@ -18,7 +18,7 @@ struct Configuration { /* 0x10 */ u32 bufferSize; /* 0x14 */ u16 field_0x14; /* 0x16 */ u16 field_0x16; - /* 0x18 */ u8 UNK_0x18[4]; + /* 0x18 */ u8 field_0x18; Configuration(); virtual ~Configuration() {} }; diff --git a/src/egg/gfx/eggGfxEngine.cpp b/src/egg/gfx/eggGfxEngine.cpp index 7a2da6a7..9a1fc150 100644 --- a/src/egg/gfx/eggGfxEngine.cpp +++ b/src/egg/gfx/eggGfxEngine.cpp @@ -1,3 +1,38 @@ #include "egg/gfx/eggGfxEngine.h" -namespace EGG {} // namespace EGG +#include "common.h" +#include "egg/core/eggDisplay.h" +#include "egg/core/eggSystem.h" +#include "egg/core/eggVideo.h" +#include "rvl/GX/GXTexture.h" +#include "rvl/GX/GXTypes.h" + +namespace EGG { + +// Needed for dtor placement +void ProbablySomethingCreatingThisConfiguration() { + GfxEngine::Configuration c; +} + +GfxEngine::Configuration::Configuration() + : efbWidth(640), + efbHeight(528), + clearColor((GXColor){0, 0, 0, 0}), + field_0x08(0), + field_0x0C(32), + field_0x0E(256), + bufferSize(0), + field_0x14(608), + field_0x16(812), + field_0x18(0) { + if (BaseSystem::getVideo() != nullptr) { + efbWidth = BaseSystem::getVideo()->pRenderMode->fbWidth; + efbHeight = BaseSystem::getVideo()->pRenderMode->efbHeight; + } + if (BaseSystem::getDisplay() != nullptr) { + clearColor = BaseSystem::getDisplay()->getClearColor(); + } + bufferSize = GXGetTexBufferSize(efbWidth, efbHeight, GX_TF_RGBA8, false, 0) * 3; +} + +} // namespace EGG