From 6a3fa6675c6e3d6c7d88028e8aae8c0a9e10b132 Mon Sep 17 00:00:00 2001 From: notaz Date: Wed, 11 Oct 2023 02:14:08 +0300 Subject: [PATCH] unbreak some old savestates I have too many of them --- libpcsxcore/psxcounters.c | 6 ++++++ plugins/dfsound/externals.h | 2 +- plugins/dfsound/freeze.c | 2 ++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/libpcsxcore/psxcounters.c b/libpcsxcore/psxcounters.c index ab8beeea..02191c71 100644 --- a/libpcsxcore/psxcounters.c +++ b/libpcsxcore/psxcounters.c @@ -561,6 +561,7 @@ void psxRcntInit() s32 psxRcntFreeze( void *f, s32 Mode ) { u32 spuSyncCount = 0; + u32 count; s32 i; gzfreeze( &rcnts, sizeof(Rcnt) * CounterQuantity ); @@ -573,7 +574,12 @@ s32 psxRcntFreeze( void *f, s32 Mode ) { rcnts[3].rate = 1; for( i = 0; i < CounterQuantity - 1; ++i ) + { _psxRcntWmode( i, rcnts[i].mode ); + count = (psxRegs.cycle - rcnts[i].cycleStart) / rcnts[i].rate; + if (count > 0x1000) + _psxRcntWcount( i, count & 0xffff ); + } scheduleRcntBase(); psxRcntSet(); } diff --git a/plugins/dfsound/externals.h b/plugins/dfsound/externals.h index fca387d1..d752acf2 100644 --- a/plugins/dfsound/externals.h +++ b/plugins/dfsound/externals.h @@ -190,7 +190,7 @@ typedef union union { struct { int pos; - signed short val[4]; + int val[4]; } gauss; int simple[5]; // 28-32 } interp; diff --git a/plugins/dfsound/freeze.c b/plugins/dfsound/freeze.c index c4afad83..8816a51c 100644 --- a/plugins/dfsound/freeze.c +++ b/plugins/dfsound/freeze.c @@ -341,6 +341,8 @@ long CALLBACK SPUfreeze(uint32_t ulFreezeMode, SPUFreeze_t * pF, load_register(H_CDLeft, cycles); load_register(H_CDRight, cycles); + if (spu.rvb->CurrAddr < spu.rvb->StartAddr) + spu.rvb->CurrAddr = spu.rvb->StartAddr; // fix to prevent new interpolations from crashing spu.interpolation = -1; -- 2.39.5