From b64d8dbf3be1c58cd07a0f57e2088d496db926bb Mon Sep 17 00:00:00 2001 From: Walter van Niftrik Date: Sat, 27 Jan 2018 23:03:54 +0100 Subject: ADL: Ignore broken sectors --- engines/adl/disk.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'engines') diff --git a/engines/adl/disk.cpp b/engines/adl/disk.cpp index 6384daad4a..6174f6ff43 100644 --- a/engines/adl/disk.cpp +++ b/engines/adl/disk.cpp @@ -193,8 +193,10 @@ static Common::SeekableReadStream *readImage_NIB(const Common::String &filename, } byte checksum = buffer[pos++ % trackLen]; - if (checksum < 0x96 || oldVal != c_6and2_lookup[checksum - 0x96]) + if (checksum < 0x96 || oldVal != c_6and2_lookup[checksum - 0x96]) { warning("NIB: checksum mismatch @ (%x, %x)", track, sector); + continue; + } for (uint n = 0; n < 256; ++n) { output[n] = inbuffer[86 + n] << 2; @@ -244,10 +246,14 @@ static Common::SeekableReadStream *readImage_NIB(const Common::String &filename, oldVal = val ^ oldVal; inbuffer[n] = oldVal; } - if (!truncated) { - byte checksum = buffer[pos++ % trackLen]; - if (checksum < 0xaa || oldVal != c_5and3_lookup[checksum - 0xaa]) - warning("NIB: checksum mismatch @ (%x, %x)", track, sector); + + if (truncated) + continue; + + byte checksum = buffer[pos++ % trackLen]; + if (checksum < 0xaa || oldVal != c_5and3_lookup[checksum - 0xaa]) { + warning("NIB: checksum mismatch @ (%x, %x)", track, sector); + continue; } // 8 bytes of nibbles expand to 5 bytes -- cgit v1.2.3