crc bug with sdk disk images

This commit is contained in:
Denis Molony 2021-04-18 13:30:50 +10:00
parent a51a1251c6
commit 5681aa4270
5 changed files with 18 additions and 11 deletions

View File

@ -130,7 +130,10 @@ class LZW
int calculatedCrc = Utility.getCRC (buffer, length, crcBase);
if (crc != calculatedCrc)
{
System.out.printf ("%n*** LZW CRC mismatch *** %04X %04X%n", crc, calculatedCrc);
// throw new FileFormatException ("File CRC failed");
}
return buffer;
}

View File

@ -17,9 +17,10 @@ class LZW2 extends LZW
bytes = Objects.requireNonNull (buffer);
this.crc = crc;
this.v3eof = eof;
crcBase = 0xFFFF;
codeWord = 0;
v3eof = eof;
volume = buffer[0] & 0xFF;
runLengthChar = (byte) (buffer[1] & 0xFF);

View File

@ -44,11 +44,11 @@ public class NuFX
for (int rec = 0; rec < masterHeader.getTotalRecords (); rec++)
{
Record record = new Record (buffer, dataPtr);
if (record.getFileSystemID () != 1)
{
System.out.println ("Not Prodos");
break;
}
// if (record.getFileSystemID () != 1)
// {
// System.out.println ("Not Prodos: " + record.getFileSystemID ());
// break;
// }
records.add (record);
if (debug)
@ -175,7 +175,7 @@ public class NuFX
if (nameOffset > 0) // remove volume name from path
fileName = fileName.substring (nameOffset);
if (true)
if (false)
System.out.printf ("%3d %-35s %02X %,7d %,7d %,7d %s %s%n", ++count,
fileName, fileType, auxType, eof, buffer.length, created, modified);

View File

@ -37,7 +37,11 @@ class Thread
lzw = switch (header.threadFormat)
{
case 2 -> new LZW1 (data);
case 3 -> new LZW2 (data, header.threadCrc, header.uncompressedEOF);
case 3 ->
{
int length = header.threadKind == 1 ? 0 : header.uncompressedEOF;
yield new LZW2 (data, header.threadCrc, length);
}
default -> null; // 1 = Huffman Squeeze
};

View File

@ -49,9 +49,8 @@ class ThreadHeader
text.append (String.format (" kind .............. %d %s%n", threadKind,
threadKindText[threadClass][threadKind]));
text.append (String.format (" crc ............... %,d (%<04X)%n", threadCrc));
text.append (String.format (" uncompressedEOF ... %,d%n", uncompressedEOF));
text.append (String.format (" compressedEOF ..... %,d (%08X)", compressedEOF,
compressedEOF));
text.append (String.format (" uncompressedEOF ... %,d (%<08X)%n", uncompressedEOF));
text.append (String.format (" compressedEOF ..... %,d (%<08X)", compressedEOF));
return text.toString ();
}
}