mirror of
https://github.com/dmolony/DiskBrowser.git
synced 2024-11-26 23:51:57 +00:00
hdv bug
This commit is contained in:
parent
7381d8e66b
commit
81523d052b
@ -426,6 +426,7 @@ public class DiskFactory
|
||||
catch (Exception e)
|
||||
{
|
||||
System.out.println (e);
|
||||
System.out.println ("Prodos hard disk had error");
|
||||
}
|
||||
|
||||
if (debug)
|
||||
|
@ -123,21 +123,10 @@ class FileEntry extends CatalogEntry implements ProdosConstants
|
||||
return ((fileType & 0xF0) == 0x80);
|
||||
}
|
||||
|
||||
private void removeEmptyBlocks ()
|
||||
{
|
||||
while (dataBlocks.size () > 0)
|
||||
{
|
||||
DiskAddress da = dataBlocks.get (dataBlocks.size () - 1);
|
||||
if (da.getBlock () == 0)
|
||||
dataBlocks.remove (dataBlocks.size () - 1);
|
||||
else
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void traverseMasterIndex (int keyPtr)
|
||||
{
|
||||
byte[] buffer = disk.readSector (keyPtr); // master index
|
||||
|
||||
// find the last used index block
|
||||
// get the file size from the catalog and only check those blocks
|
||||
int highestBlock = 0;
|
||||
@ -151,9 +140,10 @@ class FileEntry extends CatalogEntry implements ProdosConstants
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i <= highestBlock; i++)
|
||||
{
|
||||
int block = HexFormatter.intValue (buffer[i], buffer[i + 256]); // index
|
||||
int block = HexFormatter.intValue (buffer[i], buffer[i + 256]); // index
|
||||
if (block != 0)
|
||||
traverseIndex (block);
|
||||
else
|
||||
@ -164,9 +154,23 @@ class FileEntry extends CatalogEntry implements ProdosConstants
|
||||
dataBlocks.add (da);
|
||||
}
|
||||
}
|
||||
|
||||
removeEmptyBlocks ();
|
||||
}
|
||||
|
||||
private void removeEmptyBlocks ()
|
||||
{
|
||||
while (dataBlocks.size () > 0)
|
||||
{
|
||||
DiskAddress da = dataBlocks.get (dataBlocks.size () - 1);
|
||||
|
||||
if (da == null || da.getBlock () != 0)
|
||||
break;
|
||||
|
||||
dataBlocks.remove (dataBlocks.size () - 1);
|
||||
}
|
||||
}
|
||||
|
||||
private void traverseIndex (int keyBlock)
|
||||
{
|
||||
parentDisk.setSectorType (keyBlock, parentDisk.indexSector);
|
||||
|
@ -85,12 +85,11 @@ public class ProdosDisk extends AbstractFormattedDisk
|
||||
byte[] sectorBuffer = disk.readSector (block);
|
||||
sectorTypes[block] = currentSectorType;
|
||||
|
||||
for (int ptr = 4, max =
|
||||
disk.getBlockSize () - ProdosConstants.ENTRY_SIZE; ptr < max; ptr +=
|
||||
ProdosConstants.ENTRY_SIZE)
|
||||
int max = disk.getBlockSize () - ProdosConstants.ENTRY_SIZE;
|
||||
for (int ptr = 4; ptr < max; ptr += ProdosConstants.ENTRY_SIZE)
|
||||
{
|
||||
int storageType = (sectorBuffer[ptr] & 0xF0) >> 4;
|
||||
if (storageType == 0) // deleted or unused
|
||||
if (storageType == 0) // deleted or unused
|
||||
continue;
|
||||
|
||||
byte[] entry = new byte[ProdosConstants.ENTRY_SIZE];
|
||||
|
Loading…
Reference in New Issue
Block a user