From 027c6a8fb76227c38b876d60bd45db289a603e00 Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Mon, 14 Jul 2025 19:47:50 +1000 Subject: [PATCH] 3DS: allow write access to VRAM --- misc/3ds/spec.rsf | 4 ++-- src/ps2/Graphics_PS2.c | 7 ++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/misc/3ds/spec.rsf b/misc/3ds/spec.rsf index fe48bca2a..d886beb31 100644 --- a/misc/3ds/spec.rsf +++ b/misc/3ds/spec.rsf @@ -73,10 +73,10 @@ AccessControlInfo: # Virtual Address Mappings IORegisterMapping: - - 1ff50000-1ff57fff # DSP memory + - 1ff50000-1ff57fff # DSP memory - 1ff70000-1ff77fff MemoryMapping: - - 1f000000-1f5fffff:r # VRAM + - 1f000000-1f5fffff # VRAM SystemCallAccess: ArbitrateAddress: 34 diff --git a/src/ps2/Graphics_PS2.c b/src/ps2/Graphics_PS2.c index b1860b394..4b403a231 100644 --- a/src/ps2/Graphics_PS2.c +++ b/src/ps2/Graphics_PS2.c @@ -464,7 +464,7 @@ GfxResourceID Gfx_AllocTexture(struct Bitmap* bmp, int rowWidth, cc_uint8 flags, tex->pal_index = pal_index; ConvertTexture_Palette((cc_uint8*)tex->pixels, bmp, rowWidth, palette, pal_count); - int size = VRAM_Size(1 << tex->log2_w, max(32, 1 << tex->log2_h), GS_PSM_4HH); + int size = VRAM_Size(tex->width, max(32, 1 << tex->log2_h), GS_PSM_4HH); // TODO fix properly. alignup instead int blocks = SIZE_TO_BLOCKS(size, TEXMEM_BLOCK_SIZE); tex->blocks = blocks; @@ -495,6 +495,11 @@ GfxResourceID Gfx_AllocTexture(struct Bitmap* bmp, int rowWidth, cc_uint8 flags, CopyPixels(tex->pixels, bmp->width * BITMAPCOLOR_SIZE, bmp->scan0, rowWidth * BITMAPCOLOR_SIZE, bmp->width, bmp->height); + + //int size = VRAM_Size(1 << tex->log2_w, max(32, 1 << tex->log2_h), GS_PSM_4HH); + // TODO fix properly. alignup instead + //int blocks = SIZE_TO_BLOCKS(size, TEXMEM_BLOCK_SIZE); size = blocks / (2048 / 64); + //Platform_Log4("32BPP: b %i / p %i (%i X %i)", &size, &blocks, &bmp->width, &bmp->height); } return tex; }