This commit is contained in:
Denis Molony 2021-04-18 20:11:26 +10:00
parent 838791ad05
commit e6100d247a
4 changed files with 16 additions and 33 deletions

View File

@ -131,8 +131,8 @@ 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");
System.out.printf ("%n*** Thread CRC failed *** %04X %04X%n", crc, calculatedCrc);
// throw new FileFormatException ("Thread CRC failed");
}
return buffer;

View File

@ -44,11 +44,6 @@ 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: " + record.getFileSystemID ());
// break;
// }
records.add (record);
if (debug)
@ -131,13 +126,12 @@ public class NuFX
}
else if (totalFiles > 0)
{
int[] diskSizes = { 280, 800, 1600, 3200, 6400, 65536 };
// System.out.printf ("Files require: %d blocks%n", totalBlocks);
// choose Volume Name
String volumeName = "DiskBrowser";
int nameOffset = 0;
// should check that files are all in prodos format
if (paths.size () == 1) // exactly one directory path
{
String onlyPath = paths.get (0);
@ -149,9 +143,9 @@ public class NuFX
nameOffset = volumeName.length () + 1; // skip volume name in all paths
}
int[] diskSizes = { 280, 800, 1600, 3200, 6400, 65536 };
for (int diskSize : diskSizes) // in case we choose a size that is too small
{
// System.out.printf ("Checking %d %d%n", diskSize, totalBlocks);
if (diskSize < (totalBlocks + 10))
continue;
@ -202,19 +196,6 @@ public class NuFX
return null;
}
// ---------------------------------------------------------------------------------//
public byte[] getFileBuffer (String fileName)
// ---------------------------------------------------------------------------------//
{
for (Record record : records)
if (record.hasFile (fileName))
for (Thread thread : record.threads)
if (thread.hasFile ())
return thread.getData ();
return null;
}
// ---------------------------------------------------------------------------------//
public int getTotalFiles ()
// ---------------------------------------------------------------------------------//

View File

@ -70,8 +70,8 @@ class Record
if (crc != Utility.getCRC (crcBuffer, crcBuffer.length, 0))
{
System.out.println ("***** Header CRC mismatch *****");
throw new FileFormatException ("Header CRC failed");
System.out.println ("***** Record CRC mismatch *****");
throw new FileFormatException ("Record CRC failed");
}
if (fileNameLength > 0)
@ -246,6 +246,7 @@ class Record
fileSystems[fileSystemID]));
text.append (String.format ("Separator ...... %s%n", separator));
text.append (String.format ("Access ......... %s %s%n", bits, decode));
if (storType < 16)
{
text.append (String.format ("File type ...... %02X %s%n", fileType,
@ -260,6 +261,7 @@ class Record
text.append (String.format ("Total blocks ... %,d%n", auxType));
text.append (String.format ("Block size ..... %,d%n", storType));
}
text.append (String.format ("Created ........ %s%n", created.format ()));
text.append (String.format ("Modified ....... %s%n", modified.format ()));
text.append (String.format ("Archived ....... %s%n", archived.format ()));

View File

@ -118,6 +118,7 @@ class Thread
break;
case 1: // undefined
break;
case 2: // undefined
break;
}
@ -223,5 +224,4 @@ class Thread
return text.toString ();
}
}