Merge pull request #655 from RetroPortingToolKit/fix/launcher-texture-filter

Launcher handoff: keep the texture-filter enum (xBR no longer becomes bilinear)
This commit is contained in:
Matt Stanley
2026-10-13 00:53:21 -07:00
committed by GitHub
6 changed files with 57 additions and 4 deletions
+3
View File
@@ -23,6 +23,9 @@ psxrecomp_add_runtime_target(psx-runtime
# (docs/ENHANCEMENTS.md G1.10). Titles get their <exe>_pgxp the same way.
if(BUILD_TESTING)
add_executable(video_texture_filter_test tests/test_video_texture_filter.c src/video_texture_filter.c)
target_include_directories(video_texture_filter_test PRIVATE include)
add_test(NAME video_texture_filter_test COMMAND video_texture_filter_test)
add_executable(mod_netplay_test tests/test_mod_netplay.c
src/mod_netplay.c src/netplay_state_digest.c src/crc32.c src/psx_sha256.c)
target_include_directories(mod_netplay_test PRIVATE include)
+23
View File
@@ -0,0 +1,23 @@
/* video_texture_filter.h - the one texture-filter enum for settings.toml,
* the launcher handoff and live apply. */
#ifndef PSX_VIDEO_TEXTURE_FILTER_H
#define PSX_VIDEO_TEXTURE_FILTER_H
#ifdef __cplusplus
extern "C" {
#endif
/* Values match [video] texture_filtering and gr_set_texture_filter().
* STABLE_WORLD is set by mods, not by settings. */
#define PSX_TEXTURE_FILTER_NEAREST 0
#define PSX_TEXTURE_FILTER_BILINEAR 1
#define PSX_TEXTURE_FILTER_STABLE_WORLD 2
#define PSX_TEXTURE_FILTER_XBR 3
/* A launcher value to the enum: in-range values pass through (xBR included),
* anything else is nearest, the native default. Older launchers send 0/1. */
int psx_texture_filter_from_ui(int value);
#ifdef __cplusplus
}
#endif
#endif
+1
View File
@@ -432,6 +432,7 @@ set(PSXRECOMP_RUNTIME_SOURCES
${PSXRECOMP_ROOT}/runtime/src/bios_hle.c
${PSXRECOMP_ROOT}/runtime/src/bios_hle_plan.c
${PSXRECOMP_ROOT}/runtime/src/savestate.c
${PSXRECOMP_ROOT}/runtime/src/video_texture_filter.c
${PSXRECOMP_ROOT}/runtime/src/psx_savestate_menu.c
${PSXRECOMP_ROOT}/runtime/src/psx_rewind.c
${PSXRECOMP_ROOT}/runtime/src/host_osd.c
+5 -4
View File
@@ -115,6 +115,7 @@ extern "C" void psx_event_step_conservative_env_init(void);
#include "mod_local_input_policy.h"
#include "mod_session_baseline.h"
#include "mod_runtime.h"
#include "video_texture_filter.h"
#include "host_launch_timing.h"
#include "mod_packages.h"
#include "present_image_ring.h"
@@ -17929,10 +17930,10 @@ int main(int argc, char** argv) {
}
seed.has_aspect_ratio = true;
/* has_texture_filter is on (PSX profile) so the launcher edits
* ls.texture_filter directly (0=nearest,1=bilinear); ls.linear_filter
* ls.texture_filter as the [video] enum (psx_texture_filter_from_ui: 0 nearest, 1 bilinear, 3 xBR); ls.linear_filter
* is the legacy fallback field for consoles without the cap and is
* left unused here. */
seed.texture_filter = ls.texture_filter ? 1 : 0; seed.has_texture_filter = true;
seed.texture_filter = psx_texture_filter_from_ui(ls.texture_filter); seed.has_texture_filter = true;
seed.fmv_filter = launcher_fmv_filter_to_cfg(ls.fmv_filter);
seed.has_fmv_filter = true;
{
@@ -20545,7 +20546,7 @@ soft_return_lobby:
#endif
us.antialiasing = ls.antialiasing != 0;
us.has_antialiasing = true;
us.texture_filter = ls.texture_filter;
us.texture_filter = psx_texture_filter_from_ui(ls.texture_filter);
us.has_texture_filter = true;
us.fmv_filter = launcher_fmv_filter_to_cfg(ls.fmv_filter);
us.has_fmv_filter = true;
@@ -20621,7 +20622,7 @@ soft_return_lobby:
g_video_internal_res = ir.preset;
g_video_scale = ir.scale;
g_video_aa = ls.antialiasing;
g_video_texfilter = ls.texture_filter;
g_video_texfilter = psx_texture_filter_from_ui(ls.texture_filter);
g_video_fmv_filter = launcher_fmv_filter_to_cfg(ls.fmv_filter);
g_video_geometry_correction = ls.geometry_correction ? 1 : 0;
g_video_perspective_texturing = ls.perspective_texturing ? 1 : 0;
+7
View File
@@ -0,0 +1,7 @@
/* video_texture_filter.c - see video_texture_filter.h. */
#include "video_texture_filter.h"
int psx_texture_filter_from_ui(int value) {
return (value >= PSX_TEXTURE_FILTER_NEAREST && value <= PSX_TEXTURE_FILTER_XBR)
? value : PSX_TEXTURE_FILTER_NEAREST;
}
+18
View File
@@ -0,0 +1,18 @@
/* video_texture_filter_test: launcher texture-filter values to the enum. */
#include "video_texture_filter.h"
#include <stdio.h>
static int fails = 0;
#define CHECK(c) do { if (!(c)) { fprintf(stderr, "FAIL %s:%d %s\n", __FILE__, __LINE__, #c); ++fails; } } while (0)
int main(void) {
CHECK(psx_texture_filter_from_ui(0) == PSX_TEXTURE_FILTER_NEAREST);
CHECK(psx_texture_filter_from_ui(1) == PSX_TEXTURE_FILTER_BILINEAR);
CHECK(psx_texture_filter_from_ui(2) == PSX_TEXTURE_FILTER_STABLE_WORLD);
CHECK(psx_texture_filter_from_ui(3) == PSX_TEXTURE_FILTER_XBR); /* was collapsed to bilinear */
CHECK(psx_texture_filter_from_ui(9) == PSX_TEXTURE_FILTER_NEAREST);
CHECK(psx_texture_filter_from_ui(-1) == PSX_TEXTURE_FILTER_NEAREST);
if (!fails) printf("video_texture_filter_test: ok\n");
return fails ? 1 : 0;
}