show NuFX contents on disk file display

This commit is contained in:
Denis Molony 2021-05-06 21:30:23 +10:00
parent 768111571e
commit 269a1bbd83
4 changed files with 60 additions and 43 deletions

View File

@ -18,6 +18,7 @@ import com.bytezone.diskbrowser.nib.NibFile;
import com.bytezone.diskbrowser.nib.V2dFile;
import com.bytezone.diskbrowser.nib.WozFile;
import com.bytezone.diskbrowser.utilities.FileFormatException;
import com.bytezone.diskbrowser.utilities.NuFX;
// -----------------------------------------------------------------------------------//
public class AppleDisk implements Disk
@ -37,6 +38,7 @@ public class AppleDisk implements Disk
private final int trackSize; // 4096
public int sectorSize; // 256 or 512
private NuFX nuFX;
private int interleave = 0;
private static int[][] interleaveSector = //
@ -232,6 +234,15 @@ public class AppleDisk implements Disk
checkSectorsForData ();
}
// ---------------------------------------------------------------------------------//
public AppleDisk (File file, int tracks, int sectors, NuFX nufx)
throws FileFormatException
// ---------------------------------------------------------------------------------//
{
this (file, tracks, sectors);
this.nuFX = nufx;
}
// ---------------------------------------------------------------------------------//
public AppleDisk (V2dFile disk, int tracks, int sectors)
// ---------------------------------------------------------------------------------//
@ -731,6 +742,12 @@ public class AppleDisk implements Disk
text.append (wozFile);
}
if (nuFX != null)
{
text.append ("\n\n");
text.append (nuFX);
}
return text.toString ();
}

View File

@ -61,7 +61,6 @@ public class DefaultDataSource implements DataSource
public JComponent getComponent ()
// ---------------------------------------------------------------------------------//
{
System.out.println ("In DefaultDataSource.getComponent()");
JPanel panel = new JPanel ();
return panel;
}

View File

@ -35,6 +35,8 @@ public class DiskFactory
private static final int DISK_143K = 143360;
private static final int DISK_116K = 116480;
private static NuFX nuFX;
// ---------------------------------------------------------------------------------//
private DiskFactory ()
// ---------------------------------------------------------------------------------//
@ -143,7 +145,7 @@ public class DiskFactory
System.out.println (" ** sdk/shk/bxy **");
try
{
NuFX nuFX = new NuFX (file.toPath ());
nuFX = new NuFX (file.toPath ());
if (nuFX.getTotalDisks () == 0 && nuFX.getTotalFiles () == 0)
return null;
@ -364,7 +366,12 @@ public class DiskFactory
}
AppleDisk appleDisk256 = new AppleDisk (file, 35, 16);
AppleDisk appleDisk512 = new AppleDisk (file, 35, 8);
AppleDisk appleDisk512;
if (nuFX == null)
appleDisk512 = new AppleDisk (file, 35, 8);
else
appleDisk512 = new AppleDisk (file, 35, 8, nuFX);
if (true)
{
@ -634,7 +641,12 @@ public class DiskFactory
{
System.out.println ("*** extended ***"); // System Addons.hdv
}
AppleDisk disk = new AppleDisk (file, tracks, 8);
AppleDisk disk;
if (nuFX == null)
disk = new AppleDisk (file, tracks, 8);
else
disk = new AppleDisk (file, tracks, 8, nuFX);
if (ProdosDisk.isCorrectFormat (disk))
{
if (debug)

View File

@ -78,37 +78,6 @@ public class NuFX
if (record.hasDisk ())
++totalDisks;
}
// printSummary ();
}
// ---------------------------------------------------------------------------------//
void printSummary ()
// ---------------------------------------------------------------------------------//
{
System.out.printf (" %s Created:%s Mod:%s Recs:%5d%n%n",
volumeName.getFileName (), masterHeader.getCreated2 (),
masterHeader.getModified2 (), masterHeader.getTotalRecords ());
System.out.println (" Name Type Auxtyp Archived"
+ " Fmat Size Un-Length");
System.out.println (UNDERLINE);
int totalUncompressedSize = 0;
int totalCompressedSize = 0;
for (Record record : records)
{
System.out.println (record.getLine ());
totalUncompressedSize += record.getUncompressedSize ();
totalCompressedSize += record.getCompressedSize ();
}
System.out.println (UNDERLINE);
float pct = 0;
if (totalUncompressedSize > 0)
pct = totalCompressedSize * 100 / totalUncompressedSize;
System.out.printf (" Uncomp:%7d Comp:%7d %%of orig:%3.0f%%%n%n",
totalUncompressedSize, totalCompressedSize, pct);
}
// ---------------------------------------------------------------------------------//
@ -274,12 +243,35 @@ public class NuFX
public String toString ()
// ---------------------------------------------------------------------------------//
{
for (Record record : records)
for (Thread thread : record.threads)
if (thread.hasDisk ())
return thread.toString ();
StringBuilder text = new StringBuilder ();
return "no disk";
text.append (String.format (" %s Created:%s Mod:%s Recs:%5d%n%n",
volumeName.getFileName (), masterHeader.getCreated2 (),
masterHeader.getModified2 (), masterHeader.getTotalRecords ()));
text.append (" Name Type Auxtyp Archived"
+ " Fmat Size Un-Length\n");
text.append (String.format ("%s%n", UNDERLINE));
int totalUncompressedSize = 0;
int totalCompressedSize = 0;
for (Record record : records)
{
text.append (String.format ("%s%n", record.getLine ()));
totalUncompressedSize += record.getUncompressedSize ();
totalCompressedSize += record.getCompressedSize ();
}
text.append (String.format ("%s%n", UNDERLINE));
float pct = 0;
if (totalUncompressedSize > 0)
pct = totalCompressedSize * 100 / totalUncompressedSize;
text.append (String.format (" Uncomp:%7d Comp:%7d %%of orig:%3.0f%%%n%n",
totalUncompressedSize, totalCompressedSize, pct));
return text.toString ();
}
// ---------------------------------------------------------------------------------//
@ -343,9 +335,6 @@ public class NuFX
private String getVolumeName ()
// -------------------------------------------------------------------------------//
{
// if (true)
// return volumeName;
if (rootContainsFiles)
return volumeName;