This commit is contained in:
Denis Molony 2021-05-05 14:32:38 +10:00
parent 33b58e8d79
commit 7ec277e0a3
2 changed files with 33 additions and 13 deletions

View File

@ -9,8 +9,13 @@ public class ExtendedKeyBlock
private final ProdosDisk disk;
private final int ptr;
MiniEntry dataFork;
MiniEntry resourceFork;
private MiniEntry dataFork;
private MiniEntry resourceFork;
enum ForkType
{
DATA, RESOURCE;
}
// ---------------------------------------------------------------------------------//
public ExtendedKeyBlock (ProdosDisk disk, int ptr)
@ -21,15 +26,30 @@ public class ExtendedKeyBlock
}
// ---------------------------------------------------------------------------------//
void addMiniEntry (int type, byte storageType, int keyBlock, int blocksUsed, int eof)
void addMiniEntry (ForkType type, FileEntry fileEntry)
// ---------------------------------------------------------------------------------//
{
MiniEntry miniEntry = new MiniEntry (storageType, keyBlock, blocksUsed, eof);
addMiniEntry (type, fileEntry.storageType, fileEntry.keyPointer, fileEntry.blocksUsed,
fileEntry.eof);
}
if (type == 1) // enum??
dataFork = miniEntry;
// ---------------------------------------------------------------------------------//
void addMiniEntry (ForkType type, FileWriter fileWriter)
// ---------------------------------------------------------------------------------//
{
addMiniEntry (type, fileWriter.storageType, fileWriter.keyPointer,
fileWriter.blocksUsed, fileWriter.eof);
}
// ---------------------------------------------------------------------------------//
private void addMiniEntry (ForkType type, byte storageType, int keyPointer,
int blocksUsed, int eof)
// ---------------------------------------------------------------------------------//
{
if (type == ForkType.DATA)
dataFork = new MiniEntry (storageType, keyPointer, blocksUsed, eof);
else
resourceFork = miniEntry;
resourceFork = new MiniEntry (storageType, keyPointer, blocksUsed, eof);
}
// ---------------------------------------------------------------------------------//

View File

@ -19,6 +19,8 @@ import java.util.Map;
import java.util.Optional;
import java.util.TreeMap;
import com.bytezone.diskbrowser.prodos.write.ExtendedKeyBlock.ForkType;
// -----------------------------------------------------------------------------------//
public class ProdosDisk
// -----------------------------------------------------------------------------------//
@ -214,10 +216,8 @@ public class ProdosDisk
ExtendedKeyBlock extendedKeyBlock = new ExtendedKeyBlock (this, blockNo * BLOCK_SIZE);
extendedKeyBlock.addMiniEntry (1, fileEntry.storageType, fileEntry.keyPointer,
fileEntry.blocksUsed, fileEntry.eof);
extendedKeyBlock.addMiniEntry (2, fileWriter.storageType, fileWriter.keyPointer,
fileWriter.blocksUsed, fileWriter.eof);
extendedKeyBlock.addMiniEntry (ForkType.DATA, fileEntry);
extendedKeyBlock.addMiniEntry (ForkType.RESOURCE, fileWriter);
fileEntry.keyPointer = blockNo; // extended key block
fileEntry.storageType = 0x05; // extended