From 0e794f28b1a4629fa2b5d54a0bda3231d3451a56 Mon Sep 17 00:00:00 2001 From: Dominic Masters Date: Sat, 28 Mar 2026 15:40:30 -0500 Subject: [PATCH] Disable paletted textures for now --- src/dusk/asset/type/assettexture.c | 78 +++++++-------- src/dusk/display/display.c | 38 ++++---- src/dusk/display/texture/texture.h | 1 - .../display/texture/texturedolphin.c | 97 ++----------------- .../display/texture/texturedolphin.h | 6 +- 5 files changed, 71 insertions(+), 149 deletions(-) diff --git a/src/dusk/asset/type/assettexture.c b/src/dusk/asset/type/assettexture.c index a45aa94..867b636 100644 --- a/src/dusk/asset/type/assettexture.c +++ b/src/dusk/asset/type/assettexture.c @@ -12,50 +12,50 @@ #include "util/endian.h" errorret_t assetTextureLoad(assetentire_t entire) { - assertNotNull(entire.data, "Data pointer cannot be NULL."); - assertNotNull(entire.output, "Output pointer cannot be NULL."); + // assertNotNull(entire.data, "Data pointer cannot be NULL."); + // assertNotNull(entire.output, "Output pointer cannot be NULL."); - assettexture_t *assetData = (assettexture_t *)entire.data; - texture_t *texture = (texture_t *)entire.output; + // assettexture_t *assetData = (assettexture_t *)entire.data; + // texture_t *texture = (texture_t *)entire.output; - // Read header and version (first 4 bytes) - if( - assetData->header[0] != 'D' || - assetData->header[1] != 'P' || - assetData->header[2] != 'T' - ) { - errorThrow("Invalid texture header"); - } + // // Read header and version (first 4 bytes) + // if( + // assetData->header[0] != 'D' || + // assetData->header[1] != 'P' || + // assetData->header[2] != 'T' + // ) { + // errorThrow("Invalid texture header"); + // } - // Version (can only be 1 atm) - if(assetData->version != 0x01) { - errorThrow("Unsupported texture version"); - } + // // Version (can only be 1 atm) + // if(assetData->version != 0x01) { + // errorThrow("Unsupported texture version"); + // } - // Fix endian - assetData->width = endianLittleToHost32(assetData->width); - assetData->height = endianLittleToHost32(assetData->height); + // // Fix endian + // assetData->width = endianLittleToHost32(assetData->width); + // assetData->height = endianLittleToHost32(assetData->height); - // Check dimensions. - if( - assetData->width == 0 || assetData->width > ASSET_TEXTURE_WIDTH_MAX || - assetData->height == 0 || assetData->height > ASSET_TEXTURE_HEIGHT_MAX - ) { - errorThrow("Invalid texture dimensions"); - } + // // Check dimensions. + // if( + // assetData->width == 0 || assetData->width > ASSET_TEXTURE_WIDTH_MAX || + // assetData->height == 0 || assetData->height > ASSET_TEXTURE_HEIGHT_MAX + // ) { + // errorThrow("Invalid texture dimensions"); + // } - textureInit( - texture, - assetData->width, - assetData->height, - TEXTURE_FORMAT_PALETTE, - (texturedata_t){ - .paletted = { - .indices = NULL, - .palette = NULL - } - } - ); + // textureInit( + // texture, + // assetData->width, + // assetData->height, + // TEXTURE_FORMAT_PALETTE, + // (texturedata_t){ + // .paletted = { + // .indices = NULL, + // .palette = NULL + // } + // } + // ); - errorOk(); + // errorOk(); } \ No newline at end of file diff --git a/src/dusk/display/display.c b/src/dusk/display/display.c index 19bae08..1b2b24e 100644 --- a/src/dusk/display/display.c +++ b/src/dusk/display/display.c @@ -40,26 +40,26 @@ errorret_t displayInit(void) { errorChain(textInit()); errorChain(screenInit()); - PALETTES[0].colors[0] = COLOR_RED; - PALETTES[0].colors[1] = COLOR_GREEN; - PALETTES[0].colors[2] = COLOR_BLUE; - PALETTES[0].colors[3] = COLOR_WHITE; - PALETTES[0].colors[4] = COLOR_MAGENTA; - PALETTES[0].colors[5] = COLOR_CYAN; - PALETTES[0].colors[6] = COLOR_YELLOW; - PALETTES[0].colors[7] = COLOR_BLACK; - PALETTES[0].count = 8; + // PALETTES[0].colors[0] = COLOR_RED; + // PALETTES[0].colors[1] = COLOR_GREEN; + // PALETTES[0].colors[2] = COLOR_BLUE; + // PALETTES[0].colors[3] = COLOR_WHITE; + // PALETTES[0].colors[4] = COLOR_MAGENTA; + // PALETTES[0].colors[5] = COLOR_CYAN; + // PALETTES[0].colors[6] = COLOR_YELLOW; + // PALETTES[0].colors[7] = COLOR_BLACK; + // PALETTES[0].count = 8; - uint8_t indices[64] = { - 0,0,0,0,0,0,0,0, - 1,1,1,1,1,1,1,1, - 2,2,2,2,2,2,2,2, - 3,3,3,3,3,3,3,3, - 4,4,4,4,4,4,4,4, - 5,5,5,5,5,5,5,5, - 6,6,6,6,6,6,6,6, - 7,7,7,7,7,7,7,7 - }; + // uint8_t indices[64] = { + // 0,0,0,0,0,0,0,0, + // 1,1,1,1,1,1,1,1, + // 2,2,2,2,2,2,2,2, + // 3,3,3,3,3,3,3,3, + // 4,4,4,4,4,4,4,4, + // 5,5,5,5,5,5,5,5, + // 6,6,6,6,6,6,6,6, + // 7,7,7,7,7,7,7,7 + // }; // errorChain(textureInit( // &PALETTE_TEXTURE, diff --git a/src/dusk/display/texture/texture.h b/src/dusk/display/texture/texture.h index 94d6a69..cb6f202 100644 --- a/src/dusk/display/texture/texture.h +++ b/src/dusk/display/texture/texture.h @@ -26,7 +26,6 @@ typedef union texturedata_u { palette_t *palette; } paletted; color_t *rgbaColors; - uint8_t *compressedData; } texturedata_t; /** diff --git a/src/duskdolphin/display/texture/texturedolphin.c b/src/duskdolphin/display/texture/texturedolphin.c index 2721975..1384abb 100644 --- a/src/duskdolphin/display/texture/texturedolphin.c +++ b/src/duskdolphin/display/texture/texturedolphin.c @@ -69,83 +69,6 @@ errorret_t textureInitDolphin( break; } - case TEXTURE_FORMAT_RGB4A3: { - assertUnreachable("RGB4A3 texture format not yet implemented"); - } - - case TEXTURE_FORMAT_RGB5: { - assertUnreachable("RGB5 texture format not yet implemented"); - } - - // assertTrue( - // (width % 4) == 0 && (height % 4) == 0, - // "RGB4A3 requires w/h multiple of 4 (or pad)" - // ); - - // // Convert to RGB4A3 format - // size_t rgbaSize = width * height * sizeof(u16); - // texture->rgba = (u16*)memalign(32, rgbaSize); - // assertNotNull(texture->rgba, "Failed to allocate texture RGBA data"); - - // for(uint32_t y = 0; y < height; ++y) { - // for(uint32_t x = 0; x < width; ++x) { - // const int src = y * width + x; - - // const int tileX = x >> 2; - // const int tileY = y >> 2; - // const int tilesPerRow = width >> 2; - // const int tileIndex = tileY * tilesPerRow + tileX; - // const int tileBaseWords = tileIndex * 16; - // const int inTile = ((y & 3) << 2) + (x & 3); - // const int dest = tileBaseWords + inTile; - - // color4b_t col = data.rgbaColors[src]; - - // u16 outCol; - // if(col.a < 255) { - // // 0AAA RRRR GGGG BBBB - // outCol = ( - // (0u << 15) | - // ((u16)(col.a >> 5) << 12) | - // ((u16)(col.r >> 4) << 8) | - // ((u16)(col.g >> 4) << 4) | - // ((u16)(col.b >> 4) << 0) - // ); - // } else { - // // 1RRRR RRGG GGGB BBBB - // outCol = ( - // (1u << 15) | - // ((u16)(col.r >> 3) << 10) | - // ((u16)(col.g >> 3) << 5) | - // ((u16)(col.b >> 3) << 0) - // ); - // } - // texture->rgba[dest] = outCol; - // } - // } - - // DCFlushRange(texture->rgba, rgbaSize); - // GX_InitTexObj( - // &texture->texObj, - // texture->rgba, - // width, height, - // GX_TF_RGB5A3, - // GX_REPEAT, GX_REPEAT, - // GX_FALSE - // ); - - // DCFlushRange(texture->rgba, rgbaSize); - // GX_InvalidateTexAll(); - - // GX_InitTexObjLOD( - // &texture->texObj, - // GX_NEAR, GX_NEAR, - // 0.0f, 0.0f, 0.0f, - // GX_FALSE, - // GX_FALSE, - // GX_ANISO_1 - // ); - case TEXTURE_FORMAT_PALETTE: { assertUnreachable("Paletted textures not yet implemented for Dolphin"); break; @@ -171,18 +94,18 @@ errorret_t textureDisposeDolphin(texturedolphin_t *texture) { break; } - case TEXTURE_FORMAT_RGB4A3: { - assertUnreachable("RGB4A3 texture format not yet implemented"); - } + // case TEXTURE_FORMAT_RGB4A3: { + // assertUnreachable("RGB4A3 texture format not yet implemented"); + // } - case TEXTURE_FORMAT_RGB5: { - assertUnreachable("RGB5 texture format not yet implemented"); - } + // case TEXTURE_FORMAT_RGB5: { + // assertUnreachable("RGB5 texture format not yet implemented"); + // } - case TEXTURE_FORMAT_PALETTE: { - assertUnreachable("Paletted textures not yet implemented for Dolphin"); - break; - } + // case TEXTURE_FORMAT_PALETTE: { + // assertUnreachable("Paletted textures not yet implemented for Dolphin"); + // break; + // } default: { assertUnreachable("Unsupported texture format for Dolphin"); diff --git a/src/duskdolphin/display/texture/texturedolphin.h b/src/duskdolphin/display/texture/texturedolphin.h index e2beb80..bd39778 100644 --- a/src/duskdolphin/display/texture/texturedolphin.h +++ b/src/duskdolphin/display/texture/texturedolphin.h @@ -12,9 +12,9 @@ typedef union texturedata_u texturedata_t; typedef enum { TEXTURE_FORMAT_RGBA = GX_TF_RGBA8, - TEXTURE_FORMAT_PALETTE = GX_TF_CI8, - TEXTURE_FORMAT_RGB4A3 = GX_TF_RGB5A3, - TEXTURE_FORMAT_RGB5 = GX_TF_RGB565, + // TEXTURE_FORMAT_PALETTE = GX_TF_CI8, + // TEXTURE_FORMAT_RGB4A3 = GX_TF_RGB5A3, + // TEXTURE_FORMAT_RGB5 = GX_TF_RGB565, } textureformatdolphin_t; typedef struct {