From 81fcb96b0b7558c62ab92886a1f4d41f09a1f985 Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Mon, 2 Jun 2025 07:54:09 +1000 Subject: [PATCH] Fix --- src/Graphics_Dreamcast.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/Graphics_Dreamcast.c b/src/Graphics_Dreamcast.c index d431b408b..e63d99302 100644 --- a/src/Graphics_Dreamcast.c +++ b/src/Graphics_Dreamcast.c @@ -191,7 +191,7 @@ static cc_uint32 texmem_total_free(void) { cc_uint32 free = 0; for (cc_uint32 page = 0; page < texmem_pages; page++) { - if (!texmem_base[page]) free += TEXMEM_PAGE_SIZE; + if (!texmem_used[page]) free += TEXMEM_PAGE_SIZE; } return free; } @@ -200,7 +200,7 @@ static cc_uint32 texmem_total_used(void) { cc_uint32 used = 0; for (cc_uint32 page = 0; page < texmem_pages; page++) { - if (texmem_base[page]) used += TEXMEM_PAGE_SIZE; + if (texmem_used[page]) used += TEXMEM_PAGE_SIZE; } return used; } @@ -673,7 +673,7 @@ GfxResourceID Gfx_AllocTexture(struct Bitmap* bmp, int rowWidth, cc_uint8 flags, BitmapCol palette[MAX_PAL_ENTRIES]; int pal_count = 0; - int pal_index = FindFreePalette(flags); + int pal_index = -1;//FindFreePalette(flags); if (pal_index >= 0) { pal_count = CalcPalette(palette, bmp, rowWidth); @@ -681,6 +681,13 @@ GfxResourceID Gfx_AllocTexture(struct Bitmap* bmp, int rowWidth, cc_uint8 flags, } Platform_Log2("%i, %i", &pal_index, &pal_count); + int freeMem = texmem_total_free(); + int usedMem = texmem_total_used(); + + float freeMemMB = freeMem / (1024.0 * 1024.0); + float usedMemMB = usedMem / (1024.0 * 1024.0); + Platform_Log2("Texture memory: %f2 MB used, %f2 MB free\n", &usedMemMB, &freeMemMB); + tex->width = bmp->width; tex->height = bmp->height; tex->format = pal_count > 0 ? (PVR_TXRFMT_PAL4BPP | PVR_TXRFMT_4BPP_PAL(pal_index)) : PVR_TXRFMT_ARGB4444;