From 4ce9be493599393764a9f3aaff7090d4308ed5d4 Mon Sep 17 00:00:00 2001 From: PeachyPeachSM64 <72323920+PeachyPeachSM64@users.noreply.github.com> Date: Wed, 26 Nov 2025 00:23:20 +0100 Subject: [PATCH] Fix 4-bit textures djui --- src/pc/gfx/gfx_pc.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/pc/gfx/gfx_pc.c b/src/pc/gfx/gfx_pc.c index b06133c9f..e1d789a94 100644 --- a/src/pc/gfx/gfx_pc.c +++ b/src/pc/gfx/gfx_pc.c @@ -2069,12 +2069,12 @@ static const struct { uint8_t LOAD_BLOCK; uint8_t SHIFT; uint8_t INCR; - uint8_t LINE_BYTES; + uint8_t LINE_NIBBLES; } G_IM_SIZ_[] = { - [G_IM_SIZ_4b] = { G_IM_SIZ_4b_LOAD_BLOCK, G_IM_SIZ_4b_SHIFT, G_IM_SIZ_4b_INCR, G_IM_SIZ_4b_LINE_BYTES }, - [G_IM_SIZ_8b] = { G_IM_SIZ_8b_LOAD_BLOCK, G_IM_SIZ_8b_SHIFT, G_IM_SIZ_8b_INCR, G_IM_SIZ_8b_LINE_BYTES }, - [G_IM_SIZ_16b] = { G_IM_SIZ_16b_LOAD_BLOCK, G_IM_SIZ_16b_SHIFT, G_IM_SIZ_16b_INCR, G_IM_SIZ_16b_LINE_BYTES }, - [G_IM_SIZ_32b] = { G_IM_SIZ_32b_LOAD_BLOCK, G_IM_SIZ_32b_SHIFT, G_IM_SIZ_32b_INCR, G_IM_SIZ_32b_LINE_BYTES }, + [G_IM_SIZ_4b] = { G_IM_SIZ_4b_LOAD_BLOCK, G_IM_SIZ_4b_SHIFT, G_IM_SIZ_4b_INCR, 1 }, + [G_IM_SIZ_8b] = { G_IM_SIZ_8b_LOAD_BLOCK, G_IM_SIZ_8b_SHIFT, G_IM_SIZ_8b_INCR, 2 * G_IM_SIZ_8b_LINE_BYTES }, + [G_IM_SIZ_16b] = { G_IM_SIZ_16b_LOAD_BLOCK, G_IM_SIZ_16b_SHIFT, G_IM_SIZ_16b_INCR, 2 * G_IM_SIZ_16b_LINE_BYTES }, + [G_IM_SIZ_32b] = { G_IM_SIZ_32b_LOAD_BLOCK, G_IM_SIZ_32b_SHIFT, G_IM_SIZ_32b_INCR, 2 * G_IM_SIZ_32b_LINE_BYTES }, }; static bool sDjuiClip = 0; @@ -2162,7 +2162,7 @@ static void OPTIMIZE_O3 djui_gfx_dp_execute_override(void) { gfx_dp_set_texture_image(fmt, G_IM_SIZ_[siz].LOAD_BLOCK, width, texture); gfx_dp_set_tile(fmt, siz, 0, 0, G_TX_LOADTILE, 0, 0, 0, 0, 0, 0, 0); gfx_dp_load_block(0, 0, 0, ((width * height + G_IM_SIZ_[siz].INCR) >> G_IM_SIZ_[siz].SHIFT) - 1, 0); - gfx_dp_set_tile(fmt, siz, (((width * G_IM_SIZ_[siz].LINE_BYTES) + 7) >> 3), 0, G_TX_RENDERTILE, 0, rdp.texture_tile.cmt, 0, 0, rdp.texture_tile.cms, 0, 0); + gfx_dp_set_tile(fmt, siz, (((width * G_IM_SIZ_[siz].LINE_NIBBLES) + 15) >> 4), 0, G_TX_RENDERTILE, 0, rdp.texture_tile.cmt, 0, 0, rdp.texture_tile.cms, 0, 0); } static void OPTIMIZE_O3 djui_gfx_dp_execute_djui(uint32_t opcode) {