diff --git a/src/platform/3ds/gui-font.c b/src/platform/3ds/gui-font.c index 4852f7b08..8ae3fb11e 100644 --- a/src/platform/3ds/gui-font.c +++ b/src/platform/3ds/gui-font.c @@ -26,18 +26,20 @@ struct GUIFont* GUIFontCreate(void) { struct ctrTexture* tex = &guiFont->texture; ctrTexture_Init(tex); - tex->data = linearAlloc(256 * 128 * 2); + tex->data = vramAlloc(256 * 128 * 2); tex->format = GPU_RGBA5551; tex->width = 256; tex->height = 128; - memcpy(tex->data, font, font_size); - GSPGPU_FlushDataCache(NULL, tex->data, font_size); + + GSPGPU_FlushDataCache(NULL, (u8*)font, font_size); + GX_RequestDma(NULL, (u32*)font, tex->data, font_size); + gspWaitForDMA(); return guiFont; } void GUIFontDestroy(struct GUIFont* font) { - linearFree(font->texture.data); + vramFree(font->texture.data); free(font); } diff --git a/src/platform/3ds/main.c b/src/platform/3ds/main.c index 07161a346..56a4b2b17 100644 --- a/src/platform/3ds/main.c +++ b/src/platform/3ds/main.c @@ -363,8 +363,14 @@ int main() { gbaOutputTexture.filter = GPU_LINEAR; gbaOutputTexture.width = 256; gbaOutputTexture.height = 256; - gbaOutputTexture.data = linearAlloc(256 * 256 * 2); - memset(gbaOutputTexture.data, 0, 256 * 256 * 2); + gbaOutputTexture.data = vramAlloc(256 * 256 * 2); + void* outputTextureEnd = (u8*)gbaOutputTexture.data + 256 * 256 * 2; + + // Zero texture data to make sure no garbage around the border interferes with filtering + GX_SetMemoryFill(NULL, + gbaOutputTexture.data, 0x0000, outputTextureEnd, GX_FILL_16BIT_DEPTH | GX_FILL_TRIGGER, + NULL, 0, NULL, 0); + gspWaitForPSC0(); sdmcArchive = (FS_archive) { ARCH_SDMC, @@ -410,7 +416,7 @@ cleanup: linearFree(renderer.outputBuffer); ctrDeinitGpu(); - linearFree(gbaOutputTexture.data); + vramFree(gbaOutputTexture.data); gfxExit();