From d0dc0dbcdffa90da67a195cb9254e12eb9f474f1 Mon Sep 17 00:00:00 2001 From: gameblabla Date: Sun, 24 Oct 2021 00:00:04 +0200 Subject: [PATCH] Hack fix for CDROM timings regression (Castlevania, Megaman X4) See https://github.com/libretro/pcsx_rearmed/issues/557. The CDROM timings changes from Redux fixed a bunch of games (Crash Team Racing's intro no longer cuts off too early, Worms Pinball gets further instead of just crashing, FF8 Lunar Cry FMV no longer crashes etc...) but it broke the other games that relied on ADPCM samples, which is most noticeable in games like Castlevania or Megaman X4. According to nicolasnoble, we should not cause a delay if seek destination is close to the current location. However, this would require a lot more work so in the meantime, let's do just that and add a comment. --- libpcsxcore/cdrom.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/libpcsxcore/cdrom.c b/libpcsxcore/cdrom.c index 6f0b92ce..c09ccb10 100644 --- a/libpcsxcore/cdrom.c +++ b/libpcsxcore/cdrom.c @@ -1181,6 +1181,19 @@ void cdrReadInterrupt() { int ret = xa_decode_sector(&cdr.Xa, cdr.Transfer+4, cdr.FirstSector); if (!ret) { cdrAttenuate(cdr.Xa.pcm, cdr.Xa.nsamples, cdr.Xa.stereo); + /* + * Gameblabla - + * This is a hack for Megaman X4, Castlevania etc... + * that regressed from the new m_locationChanged and CDROM timings changes. + * It is mostly noticeable in Castevania however and the stuttering can be very jarring. + * + * According to PCSX redux authors, we shouldn't cause a location change if + * the sector difference is too small. + * I attempted to go with that approach but came empty handed. + * So for now, let's just set cdr.m_locationChanged to false when playing back any ADPCM samples. + * This does not regress Crash Team Racing's intro at least. + */ + cdr.m_locationChanged = FALSE; SPU_playADPCMchannel(&cdr.Xa); cdr.FirstSector = 0; } -- 2.39.2