Merge pull request #225 from robojumper/d_gfx

d_gfx mostly OK
This commit is contained in:
robojumper
2025-08-02 09:19:04 +02:00
committed by GitHub
24 changed files with 340 additions and 69 deletions
+4
View File
@@ -1,9 +1,13 @@
#ifndef D_D2D_H
#define D_D2D_H
#include "egg/core/eggHeap.h"
namespace d2d {
void create(EGG::Heap *);
void defaultSet();
void drawBefore();
void draw();
} // namespace d2d
+22 -1
View File
@@ -2,12 +2,28 @@
#define D_GFX_H
#include "common.h"
#include "egg/core/eggHeap.h"
#include "egg/gfx/eggTextureBuffer.h"
#include "nw4r/ut/ut_Color.h"
// Made up name
class dGfx_c {
public:
typedef void (*DrawCallback)(void);
dGfx_c();
EGG::TextureBuffer *getTextureBuffer();
void releaseTextureBuffer();
void drawBefore();
void drawLetterbox();
static void create(EGG::Heap *heap);
static void drawCapTexture(EGG::TextureBuffer *, nw4r::ut::Color *clr);
static bool isTvMode4To3();
static bool isTvModeWidescreen();
void setDrawCallback(DrawCallback cb) {
mDrawCallback = cb;
}
@@ -65,6 +81,7 @@ public:
static f32 getWidth4x3RightF() { return g_Width4x3Right_f32; }
static f32 get16x9to4x3WidthScaleF() { return g_16x9to4x3WidthScale; }
static f32 getCurrentScreenTo4x3WidthScaleF() { return g_CurrentScreenTo4x3WidthScale; }
// clang-format on
public:
@@ -113,8 +130,12 @@ public:
static f32 g_Width4x3Right_f32;
static f32 g_16x9to4x3WidthScale;
static f32 g_CurrentScreenTo4x3WidthScale;
/* 0x00 */ u8 _0x00[0x04 - 0x00];
private:
static void initGfxConstants();
/* 0x00 */ EGG::TextureBuffer *mpTextureBuffer;
/* 0x04 */ DrawCallback mDrawCallback;
/* 0x08 */ u8 field_0x08;
/* 0x09 */ u8 field_0x09;
+11 -6
View File
@@ -2,14 +2,19 @@
#define D_SYS_H
#include "common.h"
#include "m/m_color.h"
#include "egg/core/eggHeap.h"
#include "nw4r/ut/ut_Color.h"
namespace dSys {
class dSys_c {
public:
/* Frame rate values: 1 - 60fps, 2 - 30fps */
static void setFrameRate(u8);
static u8 getFrameRate();
void setFrameRate(u32);
u8 getFrameRate();
void setClearColor(mColor clr);
static void setClearColor(nw4r::ut::Color clr);
} // namespace dSys_c
static EGG::Heap *ms_RootHeapMem1;
static EGG::Heap *ms_RootHeapMem2;
};
#endif
+1 -1
View File
@@ -22,7 +22,7 @@ public:
static bool draw();
static bool drawDirectly();
bool setPriority(u8 priority);
void setPriority(u8 priority);
void setTargetPane(nw4r::lyt::Pane *pane);
void setShouldBeOn(bool value) {
+3
View File
@@ -156,6 +156,9 @@ public:
static void DrawDL16(const nw4r::math::MTX34 &mtx, GXColor clr) {
DrawDL(DL_16, mtx, clr);
}
static void DrawDL17(const nw4r::math::MTX34 &mtx, GXColor clr) {
DrawDL(DL_17, mtx, clr);
}
// TODO MORE
static void SetTevColor(GXTevRegID regId, GXColor tevClr, GXTevKColorID colorId, GXColor tevkClr) {
+3
View File
@@ -94,6 +94,9 @@ public:
const Screen *GetParent() const {
return mParent;
}
static Screen *GetRoot() {
return spRoot;
}
void SetParent(const Screen *parent);
void SetUnkFlag8();
+1 -1
View File
@@ -34,10 +34,10 @@ public:
void alloc(u32 size);
static TextureBuffer *alloc(u16 w, u16 h, GXTexFmt fmt);
void free();
static void setIncludesHeader(bool);
private:
static bool includesHeader();
static void setIncludesHeader(bool);
u32 mSize; // at 0x2C
EBufferState mState; // at 0x30
+3
View File
@@ -14,6 +14,9 @@ namespace m2d {
extern nw4r::ut::List l_list;
extern mAllocator_c *l_allocator;
void create(EGG::Heap *heap, u32 size);
void reset();
class Layout_c : public nw4r::lyt::Layout {
public:
virtual ~Layout_c() {}
+4
View File
@@ -12,6 +12,10 @@ void C_MTXFrustum(Mtx44, f32, f32, f32, f32, f32, f32);
void C_MTXPerspective(Mtx44, f32, f32, f32, f32);
void C_MTXOrtho(Mtx44, f32, f32, f32, f32, f32, f32);
#define MTXFrustum C_MTXFrustum
#define MTXPerspective C_MTXPerspective
#define MTXOrtho C_MTXOrtho
#ifdef __cplusplus
}
#endif
+2
View File
@@ -18,6 +18,8 @@
namespace d3d {
bool create(EGG::Heap *);
f32 fn_80016960(mVec3_c &, const mVec3_c &pos);
bool fn_80016A90(const mVec3_c &pos);
void fn_80016B60(mVec3_c &, const mVec3_c &pos);