mirror of
https://github.com/dmolony/DiskBrowser.git
synced 2024-06-01 03:41:29 +00:00
Prodos disk not available
This commit is contained in:
parent
d84b4c4528
commit
5ec40c29e8
|
@ -18,6 +18,8 @@ public class HiResImage extends AbstractFile
|
|||
private static final int BLUE = 0x0000FF;
|
||||
private static final int VIOLET = 0xBB66FF;
|
||||
private static final int[][] palette = { { VIOLET, GREEN }, { BLUE, RED } };
|
||||
private static final byte[] pngHeader =
|
||||
{ (byte) 0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A };
|
||||
|
||||
private static boolean colourQuirks;
|
||||
private static boolean matchColourBits = false;
|
||||
|
@ -42,8 +44,8 @@ public class HiResImage extends AbstractFile
|
|||
|
||||
private void draw ()
|
||||
{
|
||||
if (isGif (buffer))
|
||||
makeGif ();
|
||||
if (isGif (buffer) || isPng (buffer))
|
||||
makeImage ();
|
||||
else if (monochrome)
|
||||
drawMonochrome (buffer);
|
||||
else
|
||||
|
@ -268,7 +270,7 @@ public class HiResImage extends AbstractFile
|
|||
return dst;
|
||||
}
|
||||
|
||||
private void makeGif ()
|
||||
private void makeImage ()
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -387,4 +389,16 @@ public class HiResImage extends AbstractFile
|
|||
String text = new String (buffer, 0, 6);
|
||||
return text.equals ("GIF89a") || text.equals ("GIF87a");
|
||||
}
|
||||
|
||||
public static boolean isPng (byte[] buffer)
|
||||
{
|
||||
if (buffer.length < pngHeader.length)
|
||||
return false;
|
||||
|
||||
for (int i = 0; i < pngHeader.length; i++)
|
||||
if (pngHeader[i] != buffer[i])
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -11,9 +11,13 @@ import com.bytezone.diskbrowser.utilities.HexFormatter;
|
|||
|
||||
class ProdosCatalogSector extends AbstractSector
|
||||
{
|
||||
ProdosCatalogSector (Disk disk, byte[] buffer, DiskAddress diskAddress)
|
||||
private final ProdosDisk parent;
|
||||
|
||||
ProdosCatalogSector (ProdosDisk parent, Disk disk, byte[] buffer,
|
||||
DiskAddress diskAddress)
|
||||
{
|
||||
super (disk, buffer, diskAddress);
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -36,7 +40,8 @@ class ProdosCatalogSector extends AbstractSector
|
|||
String hex1 = String.format ("%02X", buffer[i] & 0xF0);
|
||||
String hex2 = String.format ("%02X", nameLength);
|
||||
|
||||
// deleted files set file type and name length to zero, but the file name is still valid
|
||||
// deleted files set file type and name length to zero, but the file
|
||||
// name is still valid
|
||||
String typeText = hex1 + " = " + getType (buffer[i]);
|
||||
if (fileType == 0)
|
||||
addText (text, buffer, i, 1, typeText + " : " + getDeletedName (i + 1));
|
||||
|
@ -82,8 +87,7 @@ class ProdosCatalogSector extends AbstractSector
|
|||
addTextAndDecimal (text, buffer, offset + 19, 2, "Blocks used");
|
||||
addTextAndDecimal (text, buffer, offset + 21, 3, "EOF");
|
||||
GregorianCalendar created = HexFormatter.getAppleDate (buffer, offset + 24);
|
||||
String dateC =
|
||||
created == null ? "" : ((ProdosDisk) disk).df.format (created.getTime ());
|
||||
String dateC = created == null ? "" : parent.df.format (created.getTime ());
|
||||
addText (text, buffer, offset + 24, 4, "Creation date : " + dateC);
|
||||
addTextAndDecimal (text, buffer, offset + 28, 1, "Version");
|
||||
addText (text, buffer, offset + 29, 1, "Minimum version");
|
||||
|
@ -91,8 +95,7 @@ class ProdosCatalogSector extends AbstractSector
|
|||
addTextAndDecimal (text, buffer, offset + 31, 2,
|
||||
"Auxilliary type - " + getAuxilliaryText (fileType));
|
||||
GregorianCalendar modified = HexFormatter.getAppleDate (buffer, offset + 33);
|
||||
String dateM =
|
||||
modified == null ? "" : ((ProdosDisk) disk).df.format (modified.getTime ());
|
||||
String dateM = modified == null ? "" : parent.df.format (modified.getTime ());
|
||||
addText (text, buffer, offset + 33, 4, "Modification date : " + dateM);
|
||||
addTextAndDecimal (text, buffer, offset + 37, 2, "Header pointer");
|
||||
return text.toString ();
|
||||
|
@ -125,8 +128,7 @@ class ProdosCatalogSector extends AbstractSector
|
|||
StringBuilder text = new StringBuilder ();
|
||||
addText (text, buffer, offset + 20, 4, "Not used");
|
||||
GregorianCalendar created = HexFormatter.getAppleDate (buffer, offset + 24);
|
||||
String dateC =
|
||||
created == null ? "" : ((ProdosDisk) disk).df.format (created.getTime ());
|
||||
String dateC = created == null ? "" : parent.df.format (created.getTime ());
|
||||
addText (text, buffer, offset + 24, 4, "Creation date : " + dateC);
|
||||
addText (text, buffer, offset + 28, 1, "Prodos version");
|
||||
addText (text, buffer, offset + 29, 1, "Minimum version");
|
||||
|
@ -134,6 +136,7 @@ class ProdosCatalogSector extends AbstractSector
|
|||
addTextAndDecimal (text, buffer, offset + 31, 1, "Entry length");
|
||||
addTextAndDecimal (text, buffer, offset + 32, 1, "Entries per block");
|
||||
addTextAndDecimal (text, buffer, offset + 33, 2, "File count");
|
||||
|
||||
return text.toString ();
|
||||
}
|
||||
|
||||
|
|
|
@ -225,7 +225,7 @@ public class ProdosDisk extends AbstractFormattedDisk
|
|||
SectorType type = sectorTypes[da.getBlock ()];
|
||||
|
||||
if (type == catalogSector || type == subcatalogSector)
|
||||
return new ProdosCatalogSector (disk, buffer, da);
|
||||
return new ProdosCatalogSector (this, disk, buffer, da);
|
||||
if (type == volumeMapSector)
|
||||
return new ProdosBitMapSector (this, disk, buffer, da);
|
||||
if (type == masterIndexSector || type == indexSector)
|
||||
|
|
|
@ -213,7 +213,7 @@ class Cell implements Comparable<Cell>, Value
|
|||
{
|
||||
if (!isValue ())
|
||||
{
|
||||
System.out.println ("Not a value");
|
||||
// System.out.println ("Not a value");
|
||||
return this;
|
||||
}
|
||||
assert isValue () : "Cell type: " + type + " @ " + address;
|
||||
|
|
|
@ -124,7 +124,7 @@ class Expression implements Value
|
|||
@Override
|
||||
public Value calculate ()
|
||||
{
|
||||
System.out.printf ("Calculating: %s%n", text);
|
||||
// System.out.printf ("Calculating: %s%n", text);
|
||||
// if (text.equals ("@NA"))
|
||||
// Utility.printStackTrace ();
|
||||
|
||||
|
@ -135,7 +135,7 @@ class Expression implements Value
|
|||
if (thisValue.isError ())
|
||||
{
|
||||
valueType = thisValue.getValueType ();
|
||||
System.out.println ("error");
|
||||
// System.out.println ("error");
|
||||
return this;
|
||||
}
|
||||
value = thisValue.isNotAvailable () ? 0 : thisValue.getValue ();
|
||||
|
@ -151,7 +151,7 @@ class Expression implements Value
|
|||
if (thisValue.isError ())
|
||||
{
|
||||
valueType = thisValue.getValueType ();
|
||||
System.out.println ("error");
|
||||
// System.out.println ("error");
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user