From c772f715b345caec2763d35f20e06784209f0415 Mon Sep 17 00:00:00 2001 From: gamemasterplc Date: Thu, 23 Nov 2023 21:23:02 -0600 Subject: [PATCH] Decompile printfunc.c --- config/GMPE01_00/symbols.txt | 2 +- include/dolphin/gx/GXVert.h | 6 ++++ src/game/printfunc.c | 55 ++++++++++++++++++++++++++++++++---- src/game/process.c | 1 - 4 files changed, 57 insertions(+), 7 deletions(-) diff --git a/config/GMPE01_00/symbols.txt b/config/GMPE01_00/symbols.txt index 313d5df6..b08ee403 100644 --- a/config/GMPE01_00/symbols.txt +++ b/config/GMPE01_00/symbols.txt @@ -4866,7 +4866,7 @@ jumptable_80122528 = .data:0x80122528; // type:object size:0x28 scope:local lbl_80122550 = .data:0x80122550; // type:object size:0x19 data:string lbl_80122569 = .data:0x80122569; // type:object size:0xA data:string lbl_80122573 = .data:0x80122573; // type:object size:0x2D -refMapData0 = .data:0x801225A0; // type:object size:0xAFC0 +refMapData0 = .data:0x801225A0; // type:object size:0xAFC0 noreloc lbl_8012D560 = .data:0x8012D560; // type:object size:0x1B data:string lbl_8012D57B = .data:0x8012D57B; // type:object size:0x16 data:string lbl_8012D591 = .data:0x8012D591; // type:object size:0x21 data:string diff --git a/include/dolphin/gx/GXVert.h b/include/dolphin/gx/GXVert.h index 50b234ad..91edb229 100644 --- a/include/dolphin/gx/GXVert.h +++ b/include/dolphin/gx/GXVert.h @@ -113,6 +113,12 @@ static inline void GXColor1u32(const u32 v) { GXWGFifo.u32 = v; } +static inline void GXColor3u8(const u8 r, const u8 g, const u8 b) { + GXWGFifo.u8 = r; + GXWGFifo.u8 = g; + GXWGFifo.u8 = b; +} + static inline void GXColor4u8(const u8 r, const u8 g, const u8 b, const u8 a) { GXWGFifo.u8 = r; GXWGFifo.u8 = g; diff --git a/src/game/printfunc.c b/src/game/printfunc.c index 0fb04960..f62322eb 100644 --- a/src/game/printfunc.c +++ b/src/game/printfunc.c @@ -1,6 +1,7 @@ #include "common.h" #include "dolphin/mtx.h" #include "dolphin/gx.h" +#include "dolphin/vi.h" #include "stdio.h" #include "stdarg.h" @@ -22,10 +23,10 @@ struct strline_data { static struct strline_data strline[256]; static char pfStrBuf[256]; -BOOL saftyFrameF; -u16 strlinecnt; -u16 empstrline; int fontcolor; +u16 empstrline; +u16 strlinecnt; +BOOL saftyFrameF; static void WireDraw(void); @@ -301,7 +302,51 @@ void pfDrawFonts(void) } } -static void WireDraw(void) +void WireDraw(void) //Is not private to prevent linker error due to analysis bug of refMapData0 { - + Mtx44 proj; + Mtx modelview; + MTXOrtho(proj, 0, 480, 0, 576, 0, 10); + GXSetProjection(proj, GX_ORTHOGRAPHIC); + if(RenderMode->field_rendering) { + GXSetViewportJitter(0, 0, 640, 480, 0, 1, VIGetNextField()); + } else { + GXSetViewport(0, 0, 640, 480, 0, 1); + } + GXSetScissor(0, 0, 640, 480); + GXClearVtxDesc(); + GXSetVtxDesc(GX_VA_POS, GX_DIRECT); + GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XY, GX_F32, 0); + GXSetVtxDesc(GX_VA_CLR0, GX_DIRECT); + GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_CLR0, GX_CLR_RGB, GX_RGB8, 0); + GXSetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD_NULL, GX_TEXMAP_NULL, GX_COLOR0A0); + GXSetTevColorIn(GX_TEVSTAGE0, GX_CC_RASC, GX_CC_ZERO, GX_CC_ZERO, GX_CC_ZERO); + GXSetTevColorOp(GX_TEVSTAGE0, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_TRUE, GX_TEVPREV); + GXSetTevAlphaIn(GX_TEVSTAGE0, GX_CA_KONST, GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO); + GXSetTevAlphaOp(GX_TEVSTAGE0, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_TRUE, GX_TEVPREV); + GXSetNumTexGens(0); + GXSetNumTevStages(1); + GXSetZMode(GX_FALSE, GX_ALWAYS, GX_FALSE); + GXSetNumChans(1); + GXSetChanCtrl(GX_COLOR0A0, GX_FALSE, GX_SRC_REG, GX_SRC_VTX, GX_LIGHT_NULL, GX_DF_CLAMP, GX_AF_NONE); + MTXIdentity(modelview); + GXLoadPosMtxImm(modelview, GX_PNMTX0); + GXBegin(GX_LINES, 0, 8); + GXPosition2f32(16, 40); + GXColor3u8(255, 0, 0); + GXPosition2f32(16, 440); + GXColor3u8(255, 0, 0); + GXPosition2f32(16, 40); + GXColor3u8(255, 0, 0); + GXPosition2f32(560, 40); + GXColor3u8(255, 0, 0); + GXPosition2f32(560, 440); + GXColor3u8(255, 0, 0); + GXPosition2f32(560, 40); + GXColor3u8(255, 0, 0); + GXPosition2f32(560, 440); + GXColor3u8(255, 0, 0); + GXPosition2f32(16, 440); + GXColor3u8(255, 0, 0); + GXEnd(); } \ No newline at end of file diff --git a/src/game/process.c b/src/game/process.c index d3cf8519..ae05bf07 100644 --- a/src/game/process.c +++ b/src/game/process.c @@ -1,6 +1,5 @@ #include "common.h" #include "dolphin/os.h" -#include "stdio.h" extern int gcsetjmp(jmp_buf *jump); extern void gclongjmp(jmp_buf *jump, int status);