From d6d1c0bf37a0b1de8249883a0300dac115deae60 Mon Sep 17 00:00:00 2001 From: briaguya <70942617+briaguya-ai@users.noreply.github.com> Date: Thu, 6 Apr 2023 22:18:48 -0400 Subject: [PATCH] fix: actually load hd debug font (#27) * fix: actually load hd debug font * toggle debug text correctly --------- Co-authored-by: briaguya --- soh/src/code/gfxprint.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/soh/src/code/gfxprint.c b/soh/src/code/gfxprint.c index 839784345d1..1384be2a9ba 100644 --- a/soh/src/code/gfxprint.c +++ b/soh/src/code/gfxprint.c @@ -128,7 +128,7 @@ u8 sGfxPrintFontData[(16 * 256) / 2] = { // Can be used to set GFXP_FLAG_ENLARGE by default static u8 sDefaultSpecialFlags; -static const char rGfxPrintFontData[] = "__OTR__textures/font/sGfxPrintFontData"; +static const char rGfxPrintFontData[] = "__OTR__hd/textures/font/sGfxPrintFontData"; void GfxPrint_Setup(GfxPrint* this) { s32 width = 16; @@ -142,8 +142,8 @@ void GfxPrint_Setup(GfxPrint* this) { G_AC_NONE | G_ZS_PRIM | G_RM_XLU_SURF | G_RM_XLU_SURF2); gDPSetCombineMode(this->dList++, G_CC_DECALRGBA, G_CC_DECALRGBA); - bool hasHDTexture = ResourceMgr_FileExists(rGfxPrintFontData); - if (!hasHDTexture) { + bool useHdTexture = ResourceMgr_FileExists(rGfxPrintFontData) && CVarGetInteger("gHdAssets", 0); + if (!useHdTexture) { 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); } else { @@ -154,7 +154,7 @@ void GfxPrint_Setup(GfxPrint* this) { gDPLoadTLUT(this->dList++, 64, 256, sGfxPrintFontTLUT); for (i = 1; i < 4; i++) { - if (hasHDTexture) { + if (useHdTexture) { gDPSetTile(this->dList++, G_IM_FMT_RGBA, G_IM_SIZ_4b, 1, 0, i * 2, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD); } else { @@ -204,7 +204,7 @@ void GfxPrint_SetBasePosPx(GfxPrint* this, s32 x, s32 y) { void GfxPrint_PrintCharImpl(GfxPrint* this, u8 c) { u32 tile = (c & 0xFF) * 2; u8 offset = ((c * 2) & 0x7) / 2; - u8 hasHDTexture = ResourceMgr_FileExists(rGfxPrintFontData); + u8 useHDTexture = ResourceMgr_FileExists(rGfxPrintFontData) && CVarGetInteger("gHdAssets", 0); if (this->flags & GFXP_FLAG_UPDATE) { this->flags &= ~GFXP_FLAG_UPDATE; @@ -242,8 +242,8 @@ void GfxPrint_PrintCharImpl(GfxPrint* this, u8 c) { gSPTextureRectangle(this->dList++, (this->posX) << 1, (this->posY) << 1, (this->posX + 32) << 1, (this->posY + 32) << 1, tile, (u16)(c & 4) * 64, (u16)(c >> 3) * 256, 1 << 9, 1 << 9); } else { - gSPTextureRectangle(this->dList++, this->posX, this->posY, this->posX + 32, this->posY + 32, hasHDTexture ? 0 : tile, - (hasHDTexture ? ((128 * 4) * offset) : 0) + (u16)((c & 4) * 64), (u16)(c >> 3) * 256, 1 << 10, 1 << 10); + gSPTextureRectangle(this->dList++, this->posX, this->posY, this->posX + 32, this->posY + 32, useHDTexture ? 0 : tile, + (useHDTexture ? ((128 * 4) * offset) : 0) + (u16)((c & 4) * 64), (u16)(c >> 3) * 256, 1 << 10, 1 << 10); } this->posX += CVarGetInteger("gGfxPrintCharSpacing", 32);