From 9eb3ffcc30184c67bb8873ef39d9ffbfc1831dc6 Mon Sep 17 00:00:00 2001 From: Phnod Date: Fri, 1 Sep 2023 00:02:47 -0400 Subject: [PATCH] port: add a config option to disable texture filtering on fonts --- port/include/video.h | 1 + port/src/video.c | 8 ++++++++ src/game/game_1531a0.c | 7 ++++++- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/port/include/video.h b/port/include/video.h index 81738a76e..e5c82e576 100644 --- a/port/include/video.h +++ b/port/include/video.h @@ -19,6 +19,7 @@ s32 videoGetNativeHeight(void); s32 videoGetWidth(void); s32 videoGetHeight(void); f32 videoGetAspect(void); +u32 videoGetFontTextureFilter(void); s32 videoCreateFramebuffer(u32 w, u32 h); void videoSetFramebuffer(s32 target); diff --git a/port/src/video.c b/port/src/video.c index 17674ac80..e2928f338 100644 --- a/port/src/video.c +++ b/port/src/video.c @@ -20,6 +20,7 @@ static u32 dlcount = 0; static u32 frames = 0; static u32 framesPerSec = 0; static f64 startTime, endTime, fpsTime; +static u32 fontTextureFilter = 1; s32 videoInit(void) { @@ -46,6 +47,8 @@ s32 videoInit(void) if (filter > FILTER_THREE_POINT) filter = FILTER_THREE_POINT; renderingAPI->set_texture_filter((enum FilteringMode)filter); + fontTextureFilter = configGetInt("Video.FontTextureFilter", 1); + initDone = true; return 0; } @@ -134,6 +137,11 @@ f32 videoGetAspect(void) return gfx_current_dimensions.aspect_ratio; } +u32 videoGetFontTextureFilter(void) +{ + return fontTextureFilter; +} + s32 videoCreateFramebuffer(u32 w, u32 h) { return gfx_create_framebuffer(w, h); diff --git a/src/game/game_1531a0.c b/src/game/game_1531a0.c index 24fd38485..743d46c6a 100644 --- a/src/game/game_1531a0.c +++ b/src/game/game_1531a0.c @@ -394,7 +394,12 @@ Gfx *text0f153628(Gfx *gdl) } #endif else { - gDPSetTextureFilter(gdl++, G_TF_BILERP); + if (videoGetFontTextureFilter() == 0) { + gDPSetTextureFilter(gdl++, G_TF_POINT); + } + else { + gDPSetTextureFilter(gdl++, G_TF_BILERP); + } } return gdl;