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 = ""; subType = "";
} }
text.append (String.format ("%s%-15s %3s %5d %9s %5s %9s %5s %8d %7s%n", String forkFlag = storageType == 5 ? "+" : " ";
locked, filename, ProdosConstants.fileTypes[type], blocks, dateM, timeM, text.append (String.format ("%s%-15s %3s%s %5d %9s %5s %9s %5s %8d %7s%n",
dateC, timeC, eof, subType)); locked, filename, ProdosConstants.fileTypes[type], forkFlag, blocks, dateM,
timeM, dateC, timeC, eof, subType));
break; break;
default: default:

View File

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

View File

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

View File

@ -7,13 +7,22 @@ import com.bytezone.diskbrowser.utilities.Utility;
public class Prefix2mg public class Prefix2mg
// -----------------------------------------------------------------------------------// // -----------------------------------------------------------------------------------//
{ {
String[] creators = { "!nfc", "B2TR", "CTKG", "CdrP", "ShIm", "WOOF", "XGS!" };
String[] images = { "Dos3.3", "Prodos", "Nibbized" };
String prefix; String prefix;
String creator; String creator;
int headerSize; int headerSize;
int version; int version;
byte format; int format;
int diskData; int flags;
int length;
int blocks; int blocks;
int offset;
int commentOffset;
int commentLength;
int creatorOffset;
int creatorLength;
// ---------------------------------------------------------------------------------// // ---------------------------------------------------------------------------------//
public Prefix2mg (byte[] buffer) public Prefix2mg (byte[] buffer)
@ -21,14 +30,20 @@ public class Prefix2mg
{ {
prefix = new String (buffer, 0, 4); prefix = new String (buffer, 0, 4);
creator = new String (buffer, 4, 4); creator = new String (buffer, 4, 4);
headerSize = Utility.getWord (buffer, 8); headerSize = Utility.getWord (buffer, 0x08);
version = Utility.getWord (buffer, 10); version = Utility.getWord (buffer, 0x0A);
format = buffer[12]; format = Utility.getLong (buffer, 0x0C);
flags = Utility.getLong (buffer, 0x10);
diskData = Utility.getLong (buffer, 28); blocks = Utility.getLong (buffer, 0x14); // 1600
blocks = Utility.intValue (buffer[20], buffer[21]); // 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 // 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 (); StringBuilder text = new StringBuilder ();
text.append (String.format ("Prefix : %s%n", prefix)); text.append (String.format ("Prefix : %s%n", prefix));
text.append (String.format ("Creator : %s%n", creator)); text.append (String.format ("Creator : %s%n", creator));
text.append (String.format ("Header : %d%n", headerSize)); text.append (String.format ("Header : %d%n", headerSize));
text.append (String.format ("Version : %d%n", version)); text.append (String.format ("Version : %d%n", version));
text.append (String.format ("Format : %02X%n", format)); text.append (String.format ("Format : %02X%n", format));
text.append (String.format ("Flags : %,d%n", flags));
text.append (String.format ("Data size : %08X (%<,d)%n", diskData)); text.append (String.format ("Blocks : %,d%n", blocks));
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 (); return text.toString ();
} }

View File

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

View File

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

View File

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

View File

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