indicate resource forks

This commit is contained in:
Denis Molony 2021-05-05 13:10:33 +10:00
parent 73e964fe76
commit 33b58e8d79
9 changed files with 75 additions and 44 deletions

View File

@ -148,9 +148,10 @@ public class ProdosDirectory extends AbstractFile implements ProdosConstants
subType = "";
}
text.append (String.format ("%s%-15s %3s %5d %9s %5s %9s %5s %8d %7s%n",
locked, filename, ProdosConstants.fileTypes[type], blocks, dateM, timeM,
dateC, timeC, eof, subType));
String forkFlag = storageType == 5 ? "+" : " ";
text.append (String.format ("%s%-15s %3s%s %5d %9s %5s %9s %5s %8d %7s%n",
locked, filename, ProdosConstants.fileTypes[type], forkFlag, blocks, dateM,
timeM, dateC, timeC, eof, subType));
break;
default:

View File

@ -121,8 +121,8 @@ public class AppleDisk implements Disk
if (debug)
System.out.println (prefix2mg);
if (prefix2mg.diskData > 0)
this.blocks = prefix2mg.diskData / 4096 * 8; // reduce blocks to a multiple of 8
if (prefix2mg.length > 0)
this.blocks = prefix2mg.length / 4096 * 8; // reduce blocks to a multiple of 8
this.sectorSize = 512;
this.trackSize = 8 * sectorSize;

View File

@ -175,6 +175,7 @@ public class DiskFactory
}
catch (Exception e)
{
// e.printStackTrace ();
System.out.println (e.getMessage ());
System.out.printf ("Error unpacking: %s%n", file.getAbsolutePath ());
return null;

View File

@ -7,13 +7,22 @@ import com.bytezone.diskbrowser.utilities.Utility;
public class Prefix2mg
// -----------------------------------------------------------------------------------//
{
String[] creators = { "!nfc", "B2TR", "CTKG", "CdrP", "ShIm", "WOOF", "XGS!" };
String[] images = { "Dos3.3", "Prodos", "Nibbized" };
String prefix;
String creator;
int headerSize;
int version;
byte format;
int diskData;
int format;
int flags;
int length;
int blocks;
int offset;
int commentOffset;
int commentLength;
int creatorOffset;
int creatorLength;
// ---------------------------------------------------------------------------------//
public Prefix2mg (byte[] buffer)
@ -21,14 +30,20 @@ public class Prefix2mg
{
prefix = new String (buffer, 0, 4);
creator = new String (buffer, 4, 4);
headerSize = Utility.getWord (buffer, 8);
version = Utility.getWord (buffer, 10);
format = buffer[12];
diskData = Utility.getLong (buffer, 28);
blocks = Utility.intValue (buffer[20], buffer[21]); // 1600
headerSize = Utility.getWord (buffer, 0x08);
version = Utility.getWord (buffer, 0x0A);
format = Utility.getLong (buffer, 0x0C);
flags = Utility.getLong (buffer, 0x10);
blocks = Utility.getLong (buffer, 0x14); // 1600
offset = Utility.getLong (buffer, 0x18);
length = Utility.getLong (buffer, 0x1C);
commentOffset = Utility.getLong (buffer, 0x20);
commentLength = Utility.getLong (buffer, 0x24);
creatorOffset = Utility.getLong (buffer, 0x28);
creatorLength = Utility.getLong (buffer, 0x2C);
// see /Asimov disks/images/gs/os/prodos16/ProDOS 16v1_3.2mg
System.out.println (this);
}
// ---------------------------------------------------------------------------------//
@ -38,14 +53,19 @@ public class Prefix2mg
{
StringBuilder text = new StringBuilder ();
text.append (String.format ("Prefix : %s%n", prefix));
text.append (String.format ("Creator : %s%n", creator));
text.append (String.format ("Header : %d%n", headerSize));
text.append (String.format ("Version : %d%n", version));
text.append (String.format ("Format : %02X%n", format));
text.append (String.format ("Data size : %08X (%<,d)%n", diskData));
text.append (String.format ("Blocks : %,d%n", blocks));
text.append (String.format ("Prefix : %s%n", prefix));
text.append (String.format ("Creator : %s%n", creator));
text.append (String.format ("Header : %d%n", headerSize));
text.append (String.format ("Version : %d%n", version));
text.append (String.format ("Format : %02X%n", format));
text.append (String.format ("Flags : %,d%n", flags));
text.append (String.format ("Blocks : %,d%n", blocks));
text.append (String.format ("Offset : %,d%n", offset));
text.append (String.format ("Length : %08X (%<,d)%n", length));
text.append (String.format ("Comment Offset : %,d%n", commentOffset));
text.append (String.format ("Comment Length : %08X (%<,d)%n", commentLength));
text.append (String.format ("Creator Offset : %,d%n", creatorOffset));
text.append (String.format ("Creator Length : %08X (%<,d)", creatorLength));
return text.toString ();
}

View File

@ -130,14 +130,17 @@ public class FontFrame extends JFrame
{
String fonts[] =
GraphicsEnvironment.getLocalGraphicsEnvironment ().getAvailableFontFamilyNames ();
// for (String font : fonts)
// System.out.println (font);
String pf[] =
{ "Andale Mono", "Anonymous Pro", "Anonymous Pro Minus", "Apple2Forever",
"Apple2Forever80", "Consolas", "Bitstream Vera Sans Mono", "Consolas",
"Courier", "Courier New", "DejaVu Sans Mono", "Envy Code R", "Inconsolata",
"Input Mono", "Input Mono Narrow", "Iosevka", "Lucida Sans Typewriter",
"Luculent", "Menlo", "Monaco", "monofur", "Monospaced", "Nimbus Mono L",
"PCMyungjo", "PR Number 3", "Pragmata", "Print Char 21", "ProFont", "ProFontX",
"Proggy", "PT Mono", "Source Code Pro", "Ubuntu Mono" };
{ "Andale Mono", "Anonymous Pro", "Anonymous Pro Minus", "Apple II Display Pro",
"Apple II Pro", "Apple2Forever", "Apple2Forever80", "Bitstream Vera Sans Mono",
"Consolas", "Courier", "Courier New", "DejaVu Sans Mono", "Envy Code R",
"Inconsolata", "Input Mono", "Input Mono Narrow", "Iosevka",
"Lucida Sans Typewriter", "Luculent", "Menlo", "Monaco", "monofur",
"Monospaced", "Nimbus Mono L", "PCMyungjo", "PR Number 3", "Pragmata",
"Print Char 21", "ProFont", "ProFontX", "Proggy", "PT Mono", "Source Code Pro",
"Ubuntu Mono" };
DefaultListModel<String> lm = (DefaultListModel<String>) fontList.getModel ();

View File

@ -30,23 +30,23 @@ public class FileWriter
void writeFile (byte[] dataBuffer, int eof) throws DiskFullException
// ---------------------------------------------------------------------------------//
{
this.eof = eof;
this.eof = Math.min (eof, dataBuffer.length);
int dataPtr = 0;
int remaining = eof;
int remaining = this.eof;
while (dataPtr < eof)
while (dataPtr < this.eof)
{
int actualBlockNo = allocateNextBlock ();
map (dataPtr / BLOCK_SIZE, actualBlockNo);
int bufferPtr = actualBlockNo * BLOCK_SIZE;
int tfr = Math.min (remaining, BLOCK_SIZE);
int transfer = Math.min (remaining, BLOCK_SIZE);
System.arraycopy (dataBuffer, dataPtr, disk.getBuffer (), bufferPtr, tfr);
System.arraycopy (dataBuffer, dataPtr, disk.getBuffer (), bufferPtr, transfer);
dataPtr += BLOCK_SIZE;
remaining -= BLOCK_SIZE;
dataPtr += transfer;
remaining -= transfer;
}
writeIndices ();
@ -103,13 +103,13 @@ public class FileWriter
switch (storageType)
{
case TREE:
actualBlockNo =
masterIndexBlock.get (logicalBlockNo / 256).get (logicalBlockNo % 256);
actualBlockNo = masterIndexBlock.get (logicalBlockNo / 0x100)
.getPosition (logicalBlockNo % 0x100);
break;
case SAPLING:
if (logicalBlockNo < 256)
actualBlockNo = indexBlock.get (logicalBlockNo);
if (logicalBlockNo < 0x100)
actualBlockNo = indexBlock.getPosition (logicalBlockNo);
break;
case SEEDLING:
@ -141,7 +141,7 @@ public class FileWriter
private void map (int logicalBlockNo, int actualBlockNo) throws DiskFullException
// ---------------------------------------------------------------------------------//
{
if (logicalBlockNo > 255) // potential TREE
if (logicalBlockNo >= 0x100) // potential TREE
{
if (storageType != TREE)
{
@ -204,7 +204,7 @@ public class FileWriter
}
}
else
System.out.println ("Error");
System.out.println ("Error: " + logicalBlockNo);
}
// ---------------------------------------------------------------------------------//

View File

@ -28,7 +28,7 @@ public class IndexBlock
}
// ---------------------------------------------------------------------------------//
int get (int position)
int getPosition (int position)
// ---------------------------------------------------------------------------------//
{
return blocks[position];

View File

@ -222,8 +222,7 @@ public class ProdosDisk
fileEntry.keyPointer = blockNo; // extended key block
fileEntry.storageType = 0x05; // extended
fileEntry.blocksUsed += fileWriter.blocksUsed + 1;
// fileEntry.eof ??
fileEntry.eof = BLOCK_SIZE;
fileEntry.write ();
extendedKeyBlock.write ();

View File

@ -29,6 +29,13 @@ class MasterHeader
{
if (Utility.isMagic (buffer, ptr, NuFile))
break;
if (Utility.isMagic (buffer, 0x2000, NuFile))
{
System.out.println ("found it");
ptr = 0x2000;
bin2 = true;
break;
}
if (isBin2 (buffer, ptr))
{