Add guarded native draw replay, motion interpolation and stable world filtering

This commit is contained in:
Matthew Stanley
2026-10-03 23:35:11 -07:00
parent 030cb00c45
commit d2c8f03e76
66 changed files with 3454 additions and 76 deletions
+21 -6
View File
@@ -14,6 +14,7 @@
#include "psx_interpreter.h"
#include "cdrom.h"
#include "fntrace.h"
#include "render_pass_projection.h"
#include "text_xlate.h"
#include "boot_state.h"
#include "bios_hle.h"
@@ -1040,6 +1041,7 @@ extern "C" void psx_frontend_on_savestate_notify(int is_load, int slot, int ok)
}
extern "C" void psx_frontend_on_savestate_loaded(void) {
psx_projection_reset_session();
mod_runtime_on_savestate_loaded();
#ifndef PSX_NO_DEBUG_TOOLS
debug_server_note_savestate_loaded();
@@ -1230,6 +1232,12 @@ static inline int cfg_fmv_filter_to_launcher(int cfg_value) {
return cfg_value + 1;
}
static int g_video_texfilter = 0; /* 0=nearest, 1=bilinear */
static int g_mod_texfilter = -1;
extern "C" void psx_mod_set_texture_filter(int mode) {
if(mode < 0 || mode > 2) return;
g_mod_texfilter = mode;
gr_set_texture_filter(mode);
}
/* Sub-pixel vertex precision + perspective-correct UVs (PGXP-style). Visual
* only: the PS1-visible GTE SXY FIFO stays integer, so guest-side culling and
* SXY readback are untouched. Default off = the faithful floor. */
@@ -1531,6 +1539,8 @@ extern "C" int psx_mod_set_adaptive_display_aspect(
static PSXModSessionBaseline g_mod_owned_baseline;
static void reset_mod_owned_presentation(void) {
g_mod_texfilter = -1;
gr_set_texture_filter(g_video_texfilter);
PSXModSessionScalars live;
live.video_vsync = g_video_vsync;
live.frame_interpolation = g_frame_interpolation;
@@ -1561,6 +1571,7 @@ static void reset_mod_owned_presentation(void) {
g_ws_adaptive_max_num = 16;
g_ws_adaptive_max_den = 9;
psx_mod_set_world_scene_predicate(nullptr);
gpu_ws_set_native_scene_predicate(nullptr);
psx_mod_set_retained_scene_predicate(nullptr);
psx_mod_set_adaptive_backdrop_preload(0);
(void)psx_mod_set_draw_distance_clamp(0);
@@ -1895,6 +1906,12 @@ static int g_ws_projection_num = 4;
static int g_ws_projection_den = 3;
static int g_ws_projection_mode = -1;
static void refresh_widescreen_projection() {
if (g_ws_engaged && !fntrace_is_game_started()) {
g_ws_engaged = false;
g_ws_projection_mode = -1;
gte_set_display_aspect(4, 3);
gpu_ws_configure(4, 3, g_ws_anchor_addr, 0, 0);
}
if (!g_ws_engaged) return;
const bool wide = g_video_aspect_num * 3 != g_video_aspect_den * 4;
@@ -4960,12 +4977,10 @@ static int pad_mode_boot_analog(int mode) {
return mode == PSXRecompV4::PAD_MODE_ANALOG ? 1 : 0;
}
/* Keyboard has no DualShock sticks/config handshake — always present as a
* plain digital pad (SCPH-1080). Leaving keyboard slots in ANALOG/policy mode made
* P2–P5 show as connected while games that expect digital multitap pads never
* saw usable button input. */
/* Keyboard mappings can drive both DualShock sticks. Honor the configured
* mode, including analog-only title locks; multitap policy belongs to the
* SIO seat below and applies equally to keyboards and physical controllers. */
static int effective_player_mode(const PlayerInput& p) {
if (p.kind == 1) return (int)PSXRecompV4::PAD_MODE_DIGITAL;
return p.mode;
}
@@ -16013,7 +16028,7 @@ session_reboot:
(net_cfg.enabled && s_netplay_gl_present &&
gl_renderer_cpu_auth_dual());
g_video_scale = gr_scale(); /* reflect any clamp / alloc fallback */
gr_set_texture_filter(g_video_texfilter);
gr_set_texture_filter(g_mod_texfilter < 0 ? g_video_texfilter : g_mod_texfilter);
/* Sub-pixel vertex precision + perspective-correct UVs. Both default off;
* with both off every setter below leaves the tracking caches disabled and
* the draw path is the faithful integer one, unchanged. */