From 07c3a513ef02cdbaa2ec08ae11ed1b4f07d4a860 Mon Sep 17 00:00:00 2001 From: fgsfds Date: Sun, 3 Sep 2023 00:36:27 +0200 Subject: [PATCH] port: generalize the texture font filter a bit now called TextureFilter2D; although for now I couldn't find anything other than fonts to use it on --- port/include/video.h | 2 +- port/src/video.c | 8 ++++---- src/game/game_1531a0.c | 7 +------ src/game/tex.c | 3 +++ src/game/texreset.c | 3 +++ src/include/data.h | 10 ++++++++++ 6 files changed, 22 insertions(+), 11 deletions(-) diff --git a/port/include/video.h b/port/include/video.h index e5c82e576..c0f676ec4 100644 --- a/port/include/video.h +++ b/port/include/video.h @@ -19,7 +19,7 @@ s32 videoGetNativeHeight(void); s32 videoGetWidth(void); s32 videoGetHeight(void); f32 videoGetAspect(void); -u32 videoGetFontTextureFilter(void); +u32 videoGetTextureFilter2D(void); s32 videoCreateFramebuffer(u32 w, u32 h); void videoSetFramebuffer(s32 target); diff --git a/port/src/video.c b/port/src/video.c index e2928f338..ccac1972f 100644 --- a/port/src/video.c +++ b/port/src/video.c @@ -20,7 +20,7 @@ static u32 dlcount = 0; static u32 frames = 0; static u32 framesPerSec = 0; static f64 startTime, endTime, fpsTime; -static u32 fontTextureFilter = 1; +static u32 texFilter2D = 1; s32 videoInit(void) { @@ -47,7 +47,7 @@ s32 videoInit(void) if (filter > FILTER_THREE_POINT) filter = FILTER_THREE_POINT; renderingAPI->set_texture_filter((enum FilteringMode)filter); - fontTextureFilter = configGetInt("Video.FontTextureFilter", 1); + texFilter2D = configGetIntClamped("Video.TextureFilter2D", 1, 0, 1); initDone = true; return 0; @@ -137,9 +137,9 @@ f32 videoGetAspect(void) return gfx_current_dimensions.aspect_ratio; } -u32 videoGetFontTextureFilter(void) +u32 videoGetTextureFilter2D(void) { - return fontTextureFilter; + return texFilter2D; } s32 videoCreateFramebuffer(u32 w, u32 h) diff --git a/src/game/game_1531a0.c b/src/game/game_1531a0.c index 52434cfc3..33a443e37 100644 --- a/src/game/game_1531a0.c +++ b/src/game/game_1531a0.c @@ -394,12 +394,7 @@ Gfx *text0f153628(Gfx *gdl) } #endif else { - if (videoGetFontTextureFilter() == 0) { - gDPSetTextureFilter(gdl++, G_TF_POINT); - } - else { - gDPSetTextureFilter(gdl++, G_TF_BILERP); - } + gDPSetTextureFilter(gdl++, TEX_FILTER_2D); } return gdl; diff --git a/src/game/tex.c b/src/game/tex.c index 82f29b5ea..953b5a464 100644 --- a/src/game/tex.c +++ b/src/game/tex.c @@ -39,6 +39,9 @@ s32 g_TexLutMode; u32 var800ab5b4; struct tilestate g_TexTileStates[8]; struct tilesize g_TexTileSizes[8]; +#ifndef PLATFORM_N64 +u32 g_TexFilter2D = G_TF_BILERP; +#endif // Default u16 g_SurfaceTypeDefaultSounds[] = { SFX_HIT_STONE_8087, SFX_HIT_STONE_8088 }; diff --git a/src/game/texreset.c b/src/game/texreset.c index 30251c2ff..4bf444113 100644 --- a/src/game/texreset.c +++ b/src/game/texreset.c @@ -136,6 +136,9 @@ void texReset(void) // reset backend texture cache videoResetTextureCache(); + + // get backend texture settings + g_TexFilter2D = videoGetTextureFilter2D() ? G_TF_BILERP : G_TF_POINT; #endif g_TexWords = mempAlloc(ALIGN16(g_TexNumConfigs * 4), MEMPOOL_STAGE); diff --git a/src/include/data.h b/src/include/data.h index c70056c8c..c6c84d346 100644 --- a/src/include/data.h +++ b/src/include/data.h @@ -528,12 +528,22 @@ extern struct menudialogdef g_HtDetailsMenuDialog; extern struct menudialogdef g_HtFailedMenuDialog; extern struct menudialogdef g_HtCompletedMenuDialog; extern struct menudialogdef g_HangarListMenuDialog; + #ifndef PLATFORM_N64 + extern f32 g_PlayerCrosshairSway; extern f32 g_PlayerDefaultFovY; extern s32 g_PlayerMouseAimMode; extern f32 g_PlayerMouseAimSpeedX; extern f32 g_PlayerMouseAimSpeedY; +extern u32 g_TexFilter2D; + +#define TEX_FILTER_2D g_TexFilter2D + +#else + +#define TEX_FILTER_2D G_TF_BILERP + #endif #endif