mirror of https://github.com/zeldaret/mm.git
Gfxprint OK (#826)
* Match last two functions as well as some cleanup * One more small cleanup * Reviews * format * Move internal GFXP_FLAG defines to c file * Format
This commit is contained in:
parent
03ba917853
commit
271b7c7827
|
|
@ -3878,7 +3878,7 @@ _DW({ \
|
|||
|
||||
#define gDPLoadTextureBlock_4b(pkt, timg, fmt, width, height, \
|
||||
pal, cms, cmt, masks, maskt, shifts, shiftt) \
|
||||
{ \
|
||||
_DW({ \
|
||||
gDPSetTextureImage(pkt, fmt, G_IM_SIZ_16b, 1, timg); \
|
||||
gDPSetTile(pkt, fmt, G_IM_SIZ_16b, 0, 0, G_TX_LOADTILE, 0, \
|
||||
cmt, maskt, shiftt, cms, masks, shifts); \
|
||||
|
|
@ -3893,7 +3893,7 @@ _DW({ \
|
|||
gDPSetTileSize(pkt, G_TX_RENDERTILE, 0, 0, \
|
||||
((width)-1) << G_TEXTURE_IMAGE_FRAC, \
|
||||
((height)-1) << G_TEXTURE_IMAGE_FRAC); \
|
||||
}
|
||||
})
|
||||
|
||||
/* Load fix rww 27jun95 */
|
||||
/* The S at the end means odd lines are already word Swapped */
|
||||
|
|
@ -4246,7 +4246,7 @@ _DW({ \
|
|||
#define gDPLoadMultiTile_4b(pkt, timg, tmem, rtile, fmt, width, height, \
|
||||
uls, ult, lrs, lrt, pal, \
|
||||
cms, cmt, masks, maskt, shifts, shiftt) \
|
||||
{ \
|
||||
_DW({ \
|
||||
gDPSetTextureImage(pkt, fmt, G_IM_SIZ_8b, ((width)>>1), timg); \
|
||||
gDPSetTile(pkt, fmt, G_IM_SIZ_8b, \
|
||||
(((((lrs)-(uls)+1)>>1)+7)>>3), tmem, \
|
||||
|
|
@ -4268,7 +4268,7 @@ _DW({ \
|
|||
(ult)<<G_TEXTURE_IMAGE_FRAC, \
|
||||
(lrs)<<G_TEXTURE_IMAGE_FRAC, \
|
||||
(lrt)<<G_TEXTURE_IMAGE_FRAC); \
|
||||
}
|
||||
})
|
||||
|
||||
#define gsDPLoadTextureTile_4b(timg, fmt, width, height, \
|
||||
uls, ult, lrs, lrt, pal, \
|
||||
|
|
@ -4431,7 +4431,7 @@ _DW({ \
|
|||
#ifndef _HW_VERSION_1
|
||||
|
||||
#define gDPLoadTLUT(pkt, count, tmemaddr, dram) \
|
||||
{ \
|
||||
_DW({ \
|
||||
gDPSetTextureImage(pkt, G_IM_FMT_RGBA, G_IM_SIZ_16b, 1, dram); \
|
||||
gDPTileSync(pkt); \
|
||||
gDPSetTile(pkt, 0, 0, 0, tmemaddr, \
|
||||
|
|
@ -4439,7 +4439,7 @@ _DW({ \
|
|||
gDPLoadSync(pkt); \
|
||||
gDPLoadTLUTCmd(pkt, G_TX_LOADTILE, ((count)-1)); \
|
||||
gDPPipeSync(pkt); \
|
||||
}
|
||||
})
|
||||
|
||||
#else /* **** WORKAROUND hardware 1 load_tlut bug ****** */
|
||||
|
||||
|
|
|
|||
|
|
@ -132,22 +132,7 @@ void StackCheck_Cleanup(StackEntry* entry);
|
|||
StackStatus StackCheck_GetState(StackEntry* entry);
|
||||
u32 StackCheck_CheckAll(void);
|
||||
u32 StackCheck_Check(StackEntry* entry);
|
||||
void GfxPrint_InitDlist(GfxPrint* printer);
|
||||
void GfxPrint_SetColor(GfxPrint* printer, u32 r, u32 g, u32 b, u32 a);
|
||||
void GfxPrint_SetPosPx(GfxPrint* printer, s32 x, s32 y);
|
||||
void GfxPrint_SetPos(GfxPrint* printer, s32 x, s32 y);
|
||||
void GfxPrint_SetBasePosPx(GfxPrint* printer, s32 x, s32 y);
|
||||
void GfxPrint_PrintCharImpl(GfxPrint* printer, u8 c);
|
||||
void GfxPrint_PrintChar(GfxPrint* printer, u8 c);
|
||||
void GfxPrint_PrintStringWithSize(GfxPrint* printer, const void* buffer, size_t charSize, size_t charCount);
|
||||
void GfxPrint_PrintString(GfxPrint* printer, const char* str);
|
||||
GfxPrint* GfxPrint_Callback(GfxPrint* printer, const char* str, size_t size);
|
||||
void GfxPrint_Init(GfxPrint* printer);
|
||||
void GfxPrint_Destroy(GfxPrint* printer);
|
||||
void GfxPrint_Open(GfxPrint* printer, Gfx* dList);
|
||||
Gfx* GfxPrint_Close(GfxPrint* printer);
|
||||
s32 GfxPrint_VPrintf(GfxPrint* printer, const char* fmt, va_list args);
|
||||
s32 GfxPrint_Printf(GfxPrint* printer, const char* fmt, ...);
|
||||
|
||||
void MtxConv_F2L(Mtx* m1, MtxF* m2);
|
||||
void MtxConv_L2F(MtxF* m1, Mtx* m2);
|
||||
void __assert(const char* file, u32 lineNum);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,49 @@
|
|||
#ifndef GFXPRINT_H
|
||||
#define GFXPRINT_H
|
||||
|
||||
#include "color.h"
|
||||
#include "PR/gbi.h"
|
||||
#include "PR/ultratypes.h"
|
||||
#include "xstdio.h"
|
||||
|
||||
#define GFXP_UNUSED "\x8E"
|
||||
#define GFXP_UNUSED_CHAR 0x8E
|
||||
#define GFXP_HIRAGANA "\x8D"
|
||||
#define GFXP_HIRAGANA_CHAR 0x8D
|
||||
#define GFXP_KATAKANA "\x8C"
|
||||
#define GFXP_KATAKANA_CHAR 0x8C
|
||||
#define GFXP_RAINBOW_ON "\x8B"
|
||||
#define GFXP_RAINBOW_ON_CHAR 0x8B
|
||||
#define GFXP_RAINBOW_OFF "\x8A"
|
||||
#define GFXP_RAINBOW_OFF_CHAR 0x8A
|
||||
|
||||
typedef struct GfxPrint {
|
||||
/* 0x00 */ PrintCallback callback;
|
||||
/* 0x04 */ Gfx* dList;
|
||||
/* 0x08 */ u16 posX;
|
||||
/* 0x0A */ u16 posY;
|
||||
/* 0x0C */ u16 baseX;
|
||||
/* 0x0E */ u8 baseY;
|
||||
/* 0x0F */ u8 flags;
|
||||
/* 0x10 */ Color_RGBA8_u32 color;
|
||||
/* 0x14 */ UNK_TYPE1 unk_14[0x1C]; // unused
|
||||
} GfxPrint; // size = 0x30
|
||||
|
||||
void GfxPrint_Setup(GfxPrint* printer);
|
||||
void GfxPrint_SetColor(GfxPrint* printer, u32 r, u32 g, u32 b, u32 a);
|
||||
void GfxPrint_SetPosPx(GfxPrint* printer, s32 x, s32 y);
|
||||
void GfxPrint_SetPos(GfxPrint* printer, s32 x, s32 y);
|
||||
void GfxPrint_SetBasePosPx(GfxPrint* printer, s32 x, s32 y);
|
||||
void GfxPrint_PrintCharImpl(GfxPrint* printer, u8 c);
|
||||
void GfxPrint_PrintChar(GfxPrint* printer, u8 c);
|
||||
void GfxPrint_PrintStringWithSize(GfxPrint* printer, const void* buffer, size_t charSize, size_t charCount);
|
||||
void GfxPrint_PrintString(GfxPrint* printer, const char* str);
|
||||
void* GfxPrint_Callback(void* arg, const char* str, size_t size);
|
||||
void GfxPrint_Init(GfxPrint* printer);
|
||||
void GfxPrint_Destroy(GfxPrint* printer);
|
||||
void GfxPrint_Open(GfxPrint* printer, Gfx* dList);
|
||||
Gfx* GfxPrint_Close(GfxPrint* printer);
|
||||
s32 GfxPrint_VPrintf(GfxPrint* printer, const char* fmt, va_list args);
|
||||
s32 GfxPrint_Printf(GfxPrint* printer, const char* fmt, ...);
|
||||
|
||||
#endif
|
||||
|
|
@ -40,8 +40,8 @@ extern UNK_TYPE4 D_80096C30;
|
|||
extern StackEntry* sStackInfoListStart;
|
||||
extern StackEntry* sStackInfoListEnd;
|
||||
// extern UNK_TYPE1 sGfxPrintFontTLUT;
|
||||
// extern UNK_TYPE1 sGfxPrintUnkTLUT;
|
||||
// extern UNK_TYPE1 sGfxPrintUnkData;
|
||||
// extern UNK_TYPE1 sGfxPrintRainbowTLUT;
|
||||
// extern UNK_TYPE1 sGfxPrintRainbowData;
|
||||
// extern UNK_TYPE1 sGfxPrintFontData;
|
||||
// extern UNK_TYPE4 D_80097524;
|
||||
// extern u32 sRandInt;
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@
|
|||
#include "sfx.h"
|
||||
#include "message_data_static.h"
|
||||
|
||||
#include "gfxprint.h"
|
||||
#include "sys_matrix.h"
|
||||
#include "z64actor.h"
|
||||
#include "z64animation.h"
|
||||
|
|
@ -416,27 +417,6 @@ typedef struct {
|
|||
/* 0x38 */ FaultDrawerCallback inputCallback;
|
||||
} FaultDrawer; // size = 0x3C
|
||||
|
||||
typedef struct GfxPrint {
|
||||
/* 0x00 */ struct GfxPrint *(*callback)(struct GfxPrint*, const char*, size_t);
|
||||
/* 0x04 */ Gfx* dlist;
|
||||
/* 0x08 */ u16 posX;
|
||||
/* 0x0A */ u16 posY;
|
||||
/* 0x0C */ u16 baseX;
|
||||
/* 0x0E */ u8 baseY;
|
||||
/* 0x0F */ u8 flag;
|
||||
/* 0x10 */ Color_RGBA8_u32 color;
|
||||
/* 0x14 */ char unk_14[0x1C]; // unused
|
||||
} GfxPrint; // size = 0x30
|
||||
|
||||
typedef enum {
|
||||
GFXPRINT_FLAG1 = 1,
|
||||
GFXPRINT_USE_RGBA16 = 2,
|
||||
GFXPRINT_FLAG4 = 4,
|
||||
GFXPRINT_UPDATE_MODE = 8,
|
||||
GFXPRINT_FLAG64 = 0x40,
|
||||
GFXPRINT_OPEN = 0x80
|
||||
} GfxPrintFlag;
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ u8 countdown;
|
||||
/* 0x01 */ u8 playSfxEachFrame;
|
||||
|
|
|
|||
|
|
@ -1,50 +1,50 @@
|
|||
#include "global.h"
|
||||
|
||||
#define GFXP_FLAG_HIRAGANA (1 << 0)
|
||||
#define GFXP_FLAG_RAINBOW (1 << 1)
|
||||
#define GFXP_FLAG_SHADOW (1 << 2)
|
||||
#define GFXP_FLAG_UPDATE (1 << 3)
|
||||
#define GFXP_FLAG_ENLARGE (1 << 6)
|
||||
#define GFXP_FLAG_OPEN (1 << 7)
|
||||
|
||||
//! TODO: Need to extract
|
||||
extern u16 sGfxPrintFontTLUT[64];
|
||||
extern u16 sGfxPrintUnkTLUT[16];
|
||||
extern u8 sGfxPrintUnkData[8];
|
||||
extern u16 sGfxPrintRainbowTLUT[16];
|
||||
extern u8 sGfxPrintRainbowData[8];
|
||||
extern u8 sGfxPrintFontData[2048];
|
||||
|
||||
#define gDPSetPrimColorMod(pkt, m, l, rgba) \
|
||||
{ \
|
||||
Gfx* _g = (Gfx*)(pkt); \
|
||||
\
|
||||
_g->words.w0 = (_SHIFTL(G_SETPRIMCOLOR, 24, 8) | _SHIFTL(m, 8, 8) | _SHIFTL(l, 0, 8)); \
|
||||
_g->words.w1 = (rgba); \
|
||||
}
|
||||
|
||||
void GfxPrint_InitDlist(GfxPrint* this) {
|
||||
void GfxPrint_Setup(GfxPrint* this) {
|
||||
s32 width = 16;
|
||||
s32 height = 256;
|
||||
s32 i;
|
||||
|
||||
gDPPipeSync(this->dlist++);
|
||||
gDPSetOtherMode(this->dlist++,
|
||||
gDPPipeSync(this->dList++);
|
||||
gDPSetOtherMode(this->dList++,
|
||||
G_AD_DISABLE | G_CD_DISABLE | G_CK_NONE | G_TC_FILT | G_TF_BILERP | G_TT_IA16 | G_TL_TILE |
|
||||
G_TD_CLAMP | G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE,
|
||||
G_AC_NONE | G_ZS_PRIM | G_RM_XLU_SURF | G_RM_XLU_SURF2);
|
||||
gDPSetCombineMode(this->dlist++, G_CC_DECALRGBA, G_CC_DECALRGBA);
|
||||
gDPLoadTextureBlock_4b(this->dlist++, sGfxPrintFontData, G_IM_FMT_CI, width, height, 0, G_TX_NOMIRROR | G_TX_WRAP,
|
||||
gDPSetCombineMode(this->dList++, G_CC_DECALRGBA, G_CC_DECALRGBA);
|
||||
gDPLoadTextureBlock_4b(this->dList++, sGfxPrintFontData, G_IM_FMT_CI, width, height, 0, G_TX_NOMIRROR | G_TX_WRAP,
|
||||
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
|
||||
gDPLoadTLUT(this->dlist++, 64, 256, sGfxPrintFontTLUT);
|
||||
gDPLoadTLUT(this->dList++, 64, 256, sGfxPrintFontTLUT);
|
||||
|
||||
for (i = 1; i < 4; i++) {
|
||||
gDPSetTile(this->dlist++, G_IM_FMT_CI, G_IM_SIZ_4b, 1, 0, i * 2, i, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK,
|
||||
gDPSetTile(this->dList++, G_IM_FMT_CI, G_IM_SIZ_4b, 1, 0, i * 2, i, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK,
|
||||
G_TX_NOLOD, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD);
|
||||
gDPSetTileSize(this->dlist++, i * 2, 0, 0, 60, 1020);
|
||||
gDPSetTileSize(this->dList++, i * 2, 0, 0, 60, 1020);
|
||||
}
|
||||
|
||||
gDPSetPrimColorMod(this->dlist++, 0, 0, this->color.rgba);
|
||||
gDPSetColor(this->dList++, G_SETPRIMCOLOR, this->color.rgba);
|
||||
|
||||
gDPLoadMultiTile_4b(this->dlist++, sGfxPrintUnkData, 0, 1, G_IM_FMT_CI, 2, 8, 0, 0, 1, 7, 4,
|
||||
gDPLoadMultiTile_4b(this->dList++, sGfxPrintRainbowData, 0, 1, G_IM_FMT_CI, 2, 8, 0, 0, 1, 7, 4,
|
||||
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, 1, 3, G_TX_NOLOD, G_TX_NOLOD);
|
||||
|
||||
gDPLoadTLUT(this->dlist++, 16, 320, sGfxPrintUnkTLUT);
|
||||
gDPLoadTLUT(this->dList++, 16, 320, sGfxPrintRainbowTLUT);
|
||||
|
||||
for (i = 1; i < 4; i++) {
|
||||
gDPSetTile(this->dlist++, G_IM_FMT_CI, G_IM_SIZ_4b, 1, 0, i * 2 + 1, 4, G_TX_NOMIRROR | G_TX_WRAP, 3,
|
||||
gDPSetTile(this->dList++, G_IM_FMT_CI, G_IM_SIZ_4b, 1, 0, i * 2 + 1, 4, G_TX_NOMIRROR | G_TX_WRAP, 3,
|
||||
G_TX_NOLOD, G_TX_NOMIRROR | G_TX_WRAP, 1, G_TX_NOLOD);
|
||||
gDPSetTileSize(this->dlist++, i * 2 + 1, 0, 0, 4, 28);
|
||||
gDPSetTileSize(this->dList++, i * 2 + 1, 0, 0, 4, 28);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -53,8 +53,8 @@ void GfxPrint_SetColor(GfxPrint* this, u32 r, u32 g, u32 b, u32 a) {
|
|||
this->color.g = g;
|
||||
this->color.b = b;
|
||||
this->color.a = a;
|
||||
gDPPipeSync(this->dlist++);
|
||||
gDPSetPrimColorMod(this->dlist++, 0, 0, this->color.rgba);
|
||||
gDPPipeSync(this->dList++);
|
||||
gDPSetColor(this->dList++, G_SETPRIMCOLOR, this->color.rgba);
|
||||
}
|
||||
|
||||
void GfxPrint_SetPosPx(GfxPrint* this, s32 x, s32 y) {
|
||||
|
|
@ -71,108 +71,156 @@ void GfxPrint_SetBasePosPx(GfxPrint* this, s32 x, s32 y) {
|
|||
this->baseY = y << 2;
|
||||
}
|
||||
|
||||
/* regalloc in the final gSPTextureRectangle */
|
||||
#ifdef NON_MATCHING
|
||||
void GfxPrint_PrintCharImpl(GfxPrint* this, u8 c) {
|
||||
u32 tile = (c & 0xFF) * 2;
|
||||
u16 s = c & 4;
|
||||
u16 t = c >> 3;
|
||||
|
||||
if (this->flag & GFXPRINT_UPDATE_MODE) {
|
||||
this->flag &= ~GFXPRINT_UPDATE_MODE;
|
||||
if (this->flags & GFXP_FLAG_UPDATE) {
|
||||
this->flags &= ~GFXP_FLAG_UPDATE;
|
||||
|
||||
gDPPipeSync(this->dlist++);
|
||||
if (this->flag & GFXPRINT_USE_RGBA16) {
|
||||
gDPSetTextureLUT(this->dlist++, G_TT_RGBA16);
|
||||
gDPSetCycleType(this->dlist++, G_CYC_2CYCLE);
|
||||
gDPSetRenderMode(this->dlist++, G_RM_OPA_CI, G_RM_XLU_SURF2);
|
||||
gDPSetCombineMode(this->dlist++, G_CC_INTERFERENCE, G_CC_PASS2);
|
||||
gDPPipeSync(this->dList++);
|
||||
if (this->flags & GFXP_FLAG_RAINBOW) {
|
||||
gDPSetTextureLUT(this->dList++, G_TT_RGBA16);
|
||||
gDPSetCycleType(this->dList++, G_CYC_2CYCLE);
|
||||
gDPSetRenderMode(this->dList++, G_RM_OPA_CI, G_RM_XLU_SURF2);
|
||||
gDPSetCombineMode(this->dList++, G_CC_INTERFERENCE, G_CC_PASS2);
|
||||
} else {
|
||||
gDPSetTextureLUT(this->dlist++, G_TT_IA16);
|
||||
gDPSetCycleType(this->dlist++, G_CYC_1CYCLE);
|
||||
gDPSetRenderMode(this->dlist++, G_RM_XLU_SURF, G_RM_XLU_SURF2);
|
||||
gDPSetCombineMode(this->dlist++, G_CC_MODULATEIDECALA_PRIM, G_CC_MODULATEIDECALA_PRIM);
|
||||
gDPSetTextureLUT(this->dList++, G_TT_IA16);
|
||||
gDPSetCycleType(this->dList++, G_CYC_1CYCLE);
|
||||
gDPSetRenderMode(this->dList++, G_RM_XLU_SURF, G_RM_XLU_SURF2);
|
||||
gDPSetCombineMode(this->dList++, G_CC_MODULATEIDECALA_PRIM, G_CC_MODULATEIDECALA_PRIM);
|
||||
}
|
||||
}
|
||||
|
||||
if (this->flag & GFXPRINT_FLAG4) {
|
||||
gDPSetPrimColorMod(this->dlist++, 0, 0, 0);
|
||||
if (this->flags & GFXP_FLAG_SHADOW) {
|
||||
gDPSetColor(this->dList++, G_SETPRIMCOLOR, 0);
|
||||
|
||||
gSPTextureRectangle(this->dlist++, this->posX + 4, this->posY + 4, this->posX + 4 + 32, this->posY + 4 + 32,
|
||||
(c & 3) << 1, (u16)(c & 4) * 64, (u16)(c >> 3) * 256, 1024, 1024);
|
||||
gSPTextureRectangle(this->dList++, this->posX + 4, this->posY + 4, this->posX + 4 + 32, this->posY + 4 + 32,
|
||||
tile, s << 6, t << 8, 1 << 10, 1 << 10);
|
||||
|
||||
gDPSetPrimColorMod(this->dlist++, 0, 0, this->color.rgba);
|
||||
gDPSetColor(this->dList++, G_SETPRIMCOLOR, this->color.rgba);
|
||||
}
|
||||
|
||||
gSPTextureRectangle(this->dlist++, this->posX, this->posY, this->posX + 32, this->posY + 32, (u16)(tile & 7),
|
||||
(u16)(c & 4) * 64, (u16)(c >> 3) * 256, 1024, 1024);
|
||||
gSPTextureRectangle(this->dList++, this->posX, this->posY, this->posX + 32, this->posY + 32, tile, s << 6, t << 8,
|
||||
1 << 10, 1 << 10);
|
||||
|
||||
this->posX += 32;
|
||||
}
|
||||
#else
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/boot/gfxprint/GfxPrint_PrintCharImpl.s")
|
||||
#endif
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/boot/gfxprint/GfxPrint_PrintChar.s")
|
||||
void GfxPrint_PrintChar(GfxPrint* this, u8 c) {
|
||||
if (c == ' ') {
|
||||
this->posX += 32;
|
||||
} else if (c > ' ' && c < 0x7F) {
|
||||
GfxPrint_PrintCharImpl(this, c);
|
||||
} else if (c >= 0xA0 && c < 0xE0) {
|
||||
if (this->flags & GFXP_FLAG_HIRAGANA) {
|
||||
if (c < 0xC0) {
|
||||
c -= 0x20;
|
||||
} else {
|
||||
c += 0x20;
|
||||
}
|
||||
}
|
||||
GfxPrint_PrintCharImpl(this, c);
|
||||
} else {
|
||||
switch (c) {
|
||||
case '\0':
|
||||
break;
|
||||
case '\n':
|
||||
this->posY += 32;
|
||||
case '\r':
|
||||
this->posX = this->baseX;
|
||||
break;
|
||||
case '\t':
|
||||
do {
|
||||
GfxPrint_PrintCharImpl(this, ' ');
|
||||
} while ((this->posX - this->baseX) % 256);
|
||||
break;
|
||||
case GFXP_HIRAGANA_CHAR:
|
||||
this->flags |= GFXP_FLAG_HIRAGANA;
|
||||
break;
|
||||
case GFXP_KATAKANA_CHAR:
|
||||
this->flags &= ~GFXP_FLAG_HIRAGANA;
|
||||
break;
|
||||
case GFXP_RAINBOW_ON_CHAR:
|
||||
this->flags |= GFXP_FLAG_RAINBOW;
|
||||
this->flags |= GFXP_FLAG_UPDATE;
|
||||
break;
|
||||
case GFXP_RAINBOW_OFF_CHAR:
|
||||
this->flags &= ~GFXP_FLAG_RAINBOW;
|
||||
this->flags |= GFXP_FLAG_UPDATE;
|
||||
break;
|
||||
case GFXP_UNUSED_CHAR:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void GfxPrint_PrintStringWithSize(GfxPrint* this, const void* buffer, size_t charSize, size_t charCount) {
|
||||
const char* str = (const char*)buffer;
|
||||
size_t count = charSize * charCount;
|
||||
|
||||
while (count) {
|
||||
while (count != 0) {
|
||||
GfxPrint_PrintChar(this, *str++);
|
||||
count--;
|
||||
}
|
||||
}
|
||||
|
||||
void GfxPrint_PrintString(GfxPrint* this, const char* str) {
|
||||
while (*str) {
|
||||
GfxPrint_PrintChar(this, *(str++));
|
||||
while (*str != '\0') {
|
||||
GfxPrint_PrintChar(this, *str++);
|
||||
}
|
||||
}
|
||||
|
||||
GfxPrint* GfxPrint_Callback(GfxPrint* this, const char* str, size_t size) {
|
||||
void* GfxPrint_Callback(void* arg, const char* str, size_t size) {
|
||||
GfxPrint* this = arg;
|
||||
|
||||
GfxPrint_PrintStringWithSize(this, str, sizeof(char), size);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
void GfxPrint_Init(GfxPrint* this) {
|
||||
this->flag &= ~GFXPRINT_OPEN;
|
||||
this->flags &= ~GFXP_FLAG_OPEN;
|
||||
|
||||
this->callback = GfxPrint_Callback;
|
||||
|
||||
this->dlist = NULL;
|
||||
this->dList = NULL;
|
||||
this->posX = 0;
|
||||
this->posY = 0;
|
||||
this->baseX = 0;
|
||||
this->baseY = 0;
|
||||
this->color.rgba = 0;
|
||||
this->flag &= ~GFXPRINT_FLAG1;
|
||||
this->flag &= ~GFXPRINT_USE_RGBA16;
|
||||
this->flag |= GFXPRINT_FLAG4;
|
||||
this->flag |= GFXPRINT_UPDATE_MODE;
|
||||
|
||||
this->flags &= ~GFXP_FLAG_HIRAGANA;
|
||||
this->flags &= ~GFXP_FLAG_RAINBOW;
|
||||
this->flags |= GFXP_FLAG_SHADOW;
|
||||
this->flags |= GFXP_FLAG_UPDATE;
|
||||
}
|
||||
|
||||
void GfxPrint_Destroy(GfxPrint* this) {
|
||||
}
|
||||
|
||||
void GfxPrint_Open(GfxPrint* this, Gfx* dlist) {
|
||||
if (!(this->flag & GFXPRINT_OPEN)) {
|
||||
this->flag |= GFXPRINT_OPEN;
|
||||
this->dlist = dlist;
|
||||
GfxPrint_InitDlist(this);
|
||||
void GfxPrint_Open(GfxPrint* this, Gfx* dList) {
|
||||
if (!(this->flags & GFXP_FLAG_OPEN)) {
|
||||
this->flags |= GFXP_FLAG_OPEN;
|
||||
this->dList = dList;
|
||||
GfxPrint_Setup(this);
|
||||
}
|
||||
}
|
||||
|
||||
Gfx* GfxPrint_Close(GfxPrint* this) {
|
||||
Gfx* ret;
|
||||
|
||||
this->flag &= ~GFXPRINT_OPEN;
|
||||
ret = this->dlist;
|
||||
this->dlist = NULL;
|
||||
this->flags &= ~GFXP_FLAG_OPEN;
|
||||
ret = this->dList;
|
||||
this->dList = NULL;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
s32 GfxPrint_VPrintf(GfxPrint* this, const char* fmt, va_list args) {
|
||||
return PrintUtils_VPrintf((PrintCallback*)&this->callback, fmt, args);
|
||||
return PrintUtils_VPrintf(&this->callback, fmt, args);
|
||||
}
|
||||
|
||||
s32 GfxPrint_Printf(GfxPrint* this, const char* fmt, ...) {
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ FaultDrawer sFaultDrawerDefault = {
|
|||
NULL, // inputCallback
|
||||
};
|
||||
|
||||
//! TODO: Needs to be extracted
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/boot/fault_drawer/sFaultDrawerFont.s")
|
||||
|
||||
void FaultDrawer_SetOsSyncPrintfEnabled(u32 enabled) {
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@
|
|||
* Throughout this file, `mode` indicates whether to multiply the matrix on top of the stack by the new construction
|
||||
* (APPLY), or to just overwrite it (NEW).
|
||||
*/
|
||||
|
||||
#include "prevent_bss_reordering.h"
|
||||
#include "global.h"
|
||||
|
||||
/* data */
|
||||
|
|
|
|||
|
|
@ -137,7 +137,7 @@
|
|||
0x80085468:("StackCheck_GetState",),
|
||||
0x800854E0:("StackCheck_CheckAll",),
|
||||
0x80085538:("StackCheck_Check",),
|
||||
0x80085570:("GfxPrint_InitDlist",),
|
||||
0x80085570:("GfxPrint_Setup",),
|
||||
0x800859BC:("GfxPrint_SetColor",),
|
||||
0x80085A08:("GfxPrint_SetPosPx",),
|
||||
0x80085A2C:("GfxPrint_SetPos",),
|
||||
|
|
|
|||
|
|
@ -32,8 +32,8 @@
|
|||
0x80096C40:("sStackInfoListStart","StackEntry*","",0x4),
|
||||
0x80096C44:("sStackInfoListEnd","StackEntry*","",0x4),
|
||||
0x80096C50:("sGfxPrintFontTLUT","u16","[64]",0x80),
|
||||
0x80096CD0:("sGfxPrintUnkTLUT","u16","[16]",0x20),
|
||||
0x80096CF0:("sGfxPrintUnkData","u8","[8]",0x8),
|
||||
0x80096CD0:("sGfxPrintRainbowTLUT","u16","[16]",0x20),
|
||||
0x80096CF0:("sGfxPrintRainbowData","u8","[8]",0x8),
|
||||
0x80096CF8:("sGfxPrintFontData","u8","[0x800]",0x800),
|
||||
0x80097500:("sInitFuncs","void*","",0x4),
|
||||
0x80097504:("sNew","char","[4]",0x4),
|
||||
|
|
|
|||
|
|
@ -134,7 +134,7 @@ asm/non_matchings/boot/stackcheck/StackCheck_Cleanup.s,StackCheck_Cleanup,0x8008
|
|||
asm/non_matchings/boot/stackcheck/StackCheck_GetState.s,StackCheck_GetState,0x80085468,0x1E
|
||||
asm/non_matchings/boot/stackcheck/StackCheck_CheckAll.s,StackCheck_CheckAll,0x800854E0,0x16
|
||||
asm/non_matchings/boot/stackcheck/StackCheck_Check.s,StackCheck_Check,0x80085538,0xE
|
||||
asm/non_matchings/boot/gfxprint/GfxPrint_InitDlist.s,GfxPrint_InitDlist,0x80085570,0x113
|
||||
asm/non_matchings/boot/gfxprint/GfxPrint_Setup.s,GfxPrint_Setup,0x80085570,0x113
|
||||
asm/non_matchings/boot/gfxprint/GfxPrint_SetColor.s,GfxPrint_SetColor,0x800859BC,0x13
|
||||
asm/non_matchings/boot/gfxprint/GfxPrint_SetPosPx.s,GfxPrint_SetPosPx,0x80085A08,0x9
|
||||
asm/non_matchings/boot/gfxprint/GfxPrint_SetPos.s,GfxPrint_SetPos,0x80085A2C,0xA
|
||||
|
|
|
|||
|
Loading…
Reference in New Issue