From: Daniel Silsby Date: Tue, 12 Nov 2019 23:48:44 +0000 (-0500) Subject: cdrom: add missing BCD->int convert in cdrFreeze() X-Git-Tag: r24l~683 X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0204c39a68a1fd4bf667aa8ece5a769f2983b7d0;p=pcsx_rearmed.git cdrom: add missing BCD->int convert in cdrFreeze() For some Eboot .PBP game images, when loading a savestate, a zlib error like 'uncompress failed with -5 for block 5383, sector 86132' would be output to stdout/stderr. The savestate would still be playable, though. Traced it down to cdrFreeze() failing to convert cdr.Prev from BCD->int when calling ReadTrack(). Note that the odd 'cdr.Prev[0]++;' line seems to be someone's hacky way of forcing ReadTrack() to avoid skipping what it thinks is a duplicate sector read. --- diff --git a/libpcsxcore/cdrom.c b/libpcsxcore/cdrom.c index a65ca545..a417a528 100644 --- a/libpcsxcore/cdrom.c +++ b/libpcsxcore/cdrom.c @@ -1499,7 +1499,9 @@ int cdrFreeze(void *f, int Mode) { pTransfer = cdr.Transfer + tmp; // read right sub data - memcpy(tmpp, cdr.Prev, 3); + tmpp[0] = btoi(cdr.Prev[0]); + tmpp[1] = btoi(cdr.Prev[1]); + tmpp[2] = btoi(cdr.Prev[2]); cdr.Prev[0]++; ReadTrack(tmpp);