From a26e51cf4604eca6d545cc0b317b4f6da4604946 Mon Sep 17 00:00:00 2001 From: Dominic Masters Date: Mon, 9 Feb 2026 13:19:13 -0600 Subject: [PATCH] Use local mirror for cglm --- cmake/modules/Findcglm.cmake | 2 +- src/display/texture.c | 29 ++++++++++++++++++++++++++++- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/cmake/modules/Findcglm.cmake b/cmake/modules/Findcglm.cmake index b6450e5..ddb99e0 100644 --- a/cmake/modules/Findcglm.cmake +++ b/cmake/modules/Findcglm.cmake @@ -7,7 +7,7 @@ include(FetchContent) FetchContent_Declare( cglm - GIT_REPOSITORY https://github.com/recp/cglm.git + GIT_REPOSITORY https://git.wish.moe/YourWishes/cglm.git GIT_TAG v0.9.6 ) diff --git a/src/display/texture.c b/src/display/texture.c index 57f8174..126d83e 100644 --- a/src/display/texture.c +++ b/src/display/texture.c @@ -11,6 +11,7 @@ #include "util/math.h" #include "util/string.h" #include "display/palette/palettelist.h" +#include "debug/debug.h" const texture_t *TEXTURE_BOUND = NULL; @@ -258,7 +259,7 @@ void textureInit( ); break; - case TEXTURE_FORMAT_ALPHA: + case TEXTURE_FORMAT_ALPHA: { assertTrue( (width % 4) == 0 && (height % 4) == 0, "GX_TF_I8 requires w/h multiple of 4 (or pad)" @@ -312,6 +313,32 @@ void textureInit( GX_ANISO_1 ); break; + } + + case TEXTURE_FORMAT_PALETTE: { + // Not supported, convert to RGBA using lookup + printf("Warning: Palette textures not supported on Dolphin, converted to RGBA1\n"); + color_t* formatted = memoryAllocate(width * height * sizeof(color_t)); + for(int32_t i = 0; i < width * height; i++) { + uint8_t index = data.palette.data[i]; + assertTrue( + index < data.palette.palette->colorCount, + "Palette index out of range" + ); + formatted[i] = data.palette.palette->colors[index]; + printf("Index %i: Color %02X%02X%02X%02X\n", index, formatted[i].r, formatted[i].g, formatted[i].b, formatted[i].a); + } + printf("Warning: Palette textures not supported on Dolphin, converted to RGBA2\n"); + + textureInit( + texture, width, height, TEXTURE_FORMAT_RGBA, + (texturedata_t){ + .rgba = { .colors = formatted } + } + ); + memoryFree(formatted); + break; + } default: assertUnreachable("Unsupported texture format for Dolphin");