summaryrefslogtreecommitdiff
path: root/include/egg
diff options
context:
space:
mode:
authorrobojumper <robojumper@gmail.com>2025-03-21 20:38:00 +0100
committerrobojumper <robojumper@gmail.com>2025-03-21 20:38:00 +0100
commitb6505d23ad73d1f0a32ef23dd57f85092a0e2745 (patch)
treee2ce089df8634f72e572d86796339278e28c1b41 /include/egg
parent4c9213be54d75373deacbe65258db19c978e920a (diff)
StateGX OK
Diffstat (limited to 'include/egg')
-rw-r--r--include/egg/core/eggDisplay.h9
-rw-r--r--include/egg/gfx/eggStateGX.h133
2 files changed, 80 insertions, 62 deletions
diff --git a/include/egg/core/eggDisplay.h b/include/egg/core/eggDisplay.h
index 08c02c1e..cdf2fe7a 100644
--- a/include/egg/core/eggDisplay.h
+++ b/include/egg/core/eggDisplay.h
@@ -5,6 +5,7 @@
#include "egg/core/eggSystem.h" // for BaseSystem config
#include "egg/core/eggVideo.h"
#include "egg/prim/eggBitFlag.h"
+#include "nw4r/ut/ut_Color.h"
#include "nw4r/ut.h" // IWYU pragma: export
#include "rvl/VI.h" // IWYU pragma: export
@@ -49,6 +50,14 @@ public:
void calcFrequency();
void setBlack(bool b) {}
+ nw4r::ut::Color getClearColor() const {
+ return mClearColor;
+ }
+
+ void setClearColor(nw4r::ut::Color color) {
+ mClearColor = color;
+ }
+
public:
static u32 sTickPeriod;
};
diff --git a/include/egg/gfx/eggStateGX.h b/include/egg/gfx/eggStateGX.h
index bcc4e9f8..9dcdf342 100644
--- a/include/egg/gfx/eggStateGX.h
+++ b/include/egg/gfx/eggStateGX.h
@@ -2,64 +2,71 @@
#define EGG_STATE_GX_H
#include "common.h"
+#include "rvl/GX/GXTexture.h"
#include "rvl/GX/GXTypes.h"
+
#include "rvl/GX.h" // IWYU pragma: export
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 GXColor& getDefaultTexColor() { return sDefaultTexColor; }
+ 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;
+ };
+
+ struct CacheGX {
+ /* 0x00 */ u8 _0x00[0xC];
+ /* 0x0C */ bool mDstAlphaEnable;
+ /* 0x0D */ u8 mDstAlpha;
+ /* 0x0E */ u8 _0x0E[0x18 - 0x0E];
+ };
+
+ struct MemLayout {
+ /* 0x00 */ int mLayout;
+ /* 0x04 */ u32 numRegions;
+ /* 0x08 */ GXTexRegion mRegions[10];
+ };
+
+ static GXColor &getClearEfb() {
+ return s_clearEfb;
+ }
static void initialize(u16, u16, GXColor, GXPixelFmt);
static void frameInit();
- static void textureInit(); // Guess for 804b4810
+ static void setTMemLayout(int layout);
static void resetGX();
static void resetVtx();
@@ -72,33 +79,35 @@ public:
static void resetGXCache();
- static void GXSetPixelFmt(GXPixelFmt pixelFmt, GXZFmt16 zFmt);
-
static void invalidateTexAllGX();
+ static void GXSetPixelFmt_(GXPixelFmt pixelFmt, GXZFmt16 zFmt);
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);
- static bool GXSetDither();
- static void GXCopyTex(void *data, bool);
- static bool GXSetDstAlpha();
- // Unk func here
- static void GXSetProjection(Mtx44, int);
+ static void GXCopyTex_(void *data, bool);
+ static CacheGX &GXSetDstAlpha_(bool, u8);
+ static void GXSetProjection_(Mtx44, GXProjectionType);
static void GXSetProjectionv_(const f32 *);
static void GXSetViewport_(f32, f32, f32, f32, f32, f32);
static void GXSetScissor_(u32, u32, u32, u32);
static void GXSetScissorBoxOffset_(s32, s32);
+ // not sure
+ static void CalculateScreenScissor(const f32 src[4], u32 dst[4]);
- static u16 s_commandFlag;
- static u16 s_flag;
static u16 s_widthEfb;
static u16 s_heightEfb;
- static GXColor sDefaultTexColor;
+ static GXPixelFmt s_pixFormat;
+ static GXZFmt16 s_zFmt16;
+ static GXColor s_clearEfb;
+ static u16 s_flag;
+ static u16 s_commandFlag;
+
+ static CacheGX s_cacheGX;
+ // Inofficial names
+ static GXTexObj sDefaultTexObj;
+ static MemLayout s_tmem_layout; // same name, different type
};
} // namespace EGG