diff options
author | Walter van Niftrik | 2018-01-27 23:03:54 +0100 |
---|---|---|
committer | Walter van Niftrik | 2018-02-02 22:18:25 +0100 |
commit | b64d8dbf3be1c58cd07a0f57e2088d496db926bb (patch) | |
tree | 58935763fd81909c284d03a11a9a0c6e44866424 /engines/adl/disk.cpp | |
parent | 1600c4dbb7df1b4c4ef041fe2d032e1467eacf8d (diff) | |
download | scummvm-rg350-b64d8dbf3be1c58cd07a0f57e2088d496db926bb.tar.gz scummvm-rg350-b64d8dbf3be1c58cd07a0f57e2088d496db926bb.tar.bz2 scummvm-rg350-b64d8dbf3be1c58cd07a0f57e2088d496db926bb.zip |
ADL: Ignore broken sectors
Diffstat (limited to 'engines/adl/disk.cpp')
-rw-r--r-- | engines/adl/disk.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
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 |