From 4f38d1f8434e47c5505489144aac0ba40eaf2264 Mon Sep 17 00:00:00 2001 From: notaz Date: Sun, 10 Sep 2023 18:18:26 +0300 Subject: [PATCH] cdrom: add a hack for bad rips The game gets track times using CdlGetTN/CdlGetTD, but the rip only keeps the data track. The game then wants to play a track using a hardcoded track number, reading out of range of the list it got before, sending garbage to CDC with infinite retries. notaz/pcsx_rearmed#302 --- libpcsxcore/cdrom.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libpcsxcore/cdrom.c b/libpcsxcore/cdrom.c index 28358bf6..6f48df05 100644 --- a/libpcsxcore/cdrom.c +++ b/libpcsxcore/cdrom.c @@ -109,7 +109,7 @@ static struct { u8 DriveState; u8 FastForward; u8 FastBackward; - u8 unused8; + u8 errorRetryhack; u8 AttenuatorLeftToLeft, AttenuatorLeftToRight; u8 AttenuatorRightToRight, AttenuatorRightToLeft; @@ -749,6 +749,8 @@ void cdrInterrupt(void) { if (((cdr.Param[0] & 0x0F) > 0x09) || (cdr.Param[0] > 0x99) || ((cdr.Param[1] & 0x0F) > 0x09) || (cdr.Param[1] >= 0x60) || ((cdr.Param[2] & 0x0F) > 0x09) || (cdr.Param[2] >= 0x75)) { CDR_LOG_I("Invalid/out of range seek to %02X:%02X:%02X\n", cdr.Param[0], cdr.Param[1], cdr.Param[2]); + if (++cdr.errorRetryhack > 100) + break; error = ERROR_INVALIDARG; goto set_error; } @@ -759,6 +761,7 @@ void cdrInterrupt(void) { memcpy(cdr.SetSector, set_loc, 3); cdr.SetSector[3] = 0; cdr.SetlocPending = 1; + cdr.errorRetryhack = 0; } break; -- 2.39.5