This commit is contained in:
Denis Molony 2018-07-23 17:39:25 +10:00
parent 4c42a5c26d
commit 2655db4da8
5 changed files with 14 additions and 56 deletions

View File

@ -567,7 +567,8 @@ public class DiskFactory
}
catch (Exception e)
{
System.out.println (e);
e.printStackTrace ();
// System.out.println (e);
}
if (debug)
System.out.println ("Not a Prodos 2mg disk");

View File

@ -44,7 +44,7 @@ public class DisksWindow extends JFrame
public DisksWindow (RootFolderData rootFolderData)
{
super ("Disk List - " + rootFolderData.getRootFolder ().getAbsolutePath ());
super (rootFolderData.getRootFolderPathText ());
this.rootFolderData = rootFolderData;
table = new JTable ();

View File

@ -132,6 +132,15 @@ public class RootFolderData
disksWindow = null; // force a recount
}
String getRootFolderPathText ()
{
String text = rootFolder.getAbsolutePath ();
String homeDir = System.getProperty ("user.home");
if (text.startsWith (homeDir))
text = text.replace (homeDir, "~");
return text;
}
private void clear ()
{
typeTotals = new int[4][Utility.suffixes.size ()];

View File

@ -32,15 +32,11 @@ class FileEntry extends CatalogEntry implements ProdosConstants
private boolean invalid;
private FileEntry link;
// private final Disk appleDisk;
public FileEntry (ProdosDisk fDisk, byte[] entryBuffer, DirectoryHeader parent,
int parentBlock)
{
super (fDisk, entryBuffer);
// appleDisk = fDisk.getDisk ();
assert parent != null;
this.parentDirectory = parent;
this.catalogBlock = this.disk.getDiskAddress (parentBlock);
@ -61,17 +57,11 @@ class FileEntry extends CatalogEntry implements ProdosConstants
break;
case SAPLING:
// if (isGSOSFile ()) // not sure why this exists
// traverseGEOSIndex (keyPtr);
// else
addDataBlocks (storageType, keyPtr);
break;
case TREE:
masterIndexBlock = disk.getDiskAddress (keyPtr);
// if (isGSOSFile ()) // not sure why this exists
// traverseGEOSMasterIndex (keyPtr);
// else
addDataBlocks (storageType, keyPtr);
break;
@ -203,49 +193,6 @@ class FileEntry extends CatalogEntry implements ProdosConstants
return blocks;
}
// should be removed
// private boolean isGSOSFile ()
// {
// // return ((fileType & 0xF0) == 0x80);
// if ((fileType & 0xF0) == 0x80)
// System.out.println ("GS/OS file: " + name);
// return false;
// }
// should be removed
// private void traverseGEOSMasterIndex (int keyPtr)
// {
// byte[] buffer = disk.readSector (keyPtr); // master index
// for (int i = 0; i < 0x80; i++)
// {
// int block = HexFormatter.intValue (buffer[i], buffer[i + 256]);
// if (block == 0)
// break;
// if (block == 0xFFFF)
// continue;
// traverseGEOSIndex (block);
// }
// }
// should be removed
// private void traverseGEOSIndex (int keyPtr)
// {
// parentDisk.setSectorType (keyPtr, parentDisk.indexSector);
// indexBlocks.add (disk.getDiskAddress (keyPtr));
// byte[] buffer = disk.readSector (keyPtr);
//
// for (int i = 0; i < 0x80; i++)
// {
// int block = HexFormatter.intValue (buffer[i], buffer[i + 256]);
// if (block == 0)
// break;
// if (block == 0xFFFF)
// continue;
// parentDisk.setSectorType (block, parentDisk.dataSector);
// dataBlocks.add (disk.getDiskAddress (block));
// }
// }
@Override
public DataSource getDataSource ()
{

View File

@ -40,7 +40,8 @@ class VolumeDirectoryHeader extends DirectoryHeader
} while (block > 0);
// convert the Free Sector Table
int bitMapBytes = totalBlocks / 8; // one bit per block
// int bitMapBytes = totalBlocks / 8; // one bit per block
int bitMapBytes = (totalBlocks - 1) / 8 + 1; // one bit per block
byte[] buffer = new byte[bitMapBytes];
int bitMapBlocks = (bitMapBytes - 1) / disk.getSectorsPerTrack () + 1;
int lastBitMapBlock = bitMapBlock + bitMapBlocks - 1;