mirror of
https://github.com/dmolony/DiskBrowser.git
synced 2024-11-26 23:51:57 +00:00
tidying
This commit is contained in:
parent
d4908d91a9
commit
c08a234fb3
@ -9,10 +9,11 @@ import com.bytezone.diskbrowser.utilities.HexFormatter;
|
||||
|
||||
public class SHRPictureFile extends HiResImage
|
||||
{
|
||||
List<Block> blocks = new ArrayList<Block> ();
|
||||
Main mainBlock;
|
||||
Multipal multipalBlock;
|
||||
private final List<Block> blocks = new ArrayList<Block> ();
|
||||
private Main mainBlock;
|
||||
private Multipal multipalBlock;
|
||||
|
||||
// 0xC0 aux = 2
|
||||
public SHRPictureFile (String name, byte[] buffer, int fileType, int auxType, int eof)
|
||||
{
|
||||
super (name, buffer, fileType, auxType, eof);
|
||||
@ -21,9 +22,9 @@ public class SHRPictureFile extends HiResImage
|
||||
while (ptr < buffer.length)
|
||||
{
|
||||
int len = HexFormatter.unsignedLong (buffer, ptr);
|
||||
int nameLen = buffer[ptr + 4] & 0xFF;
|
||||
// int nameLen = buffer[ptr + 4] & 0xFF;
|
||||
String kind = HexFormatter.getPascalString (buffer, ptr + 4);
|
||||
byte[] data = new byte[Math.min (len - (nameLen + 5), buffer.length - ptr)];
|
||||
byte[] data = new byte[Math.min (len, buffer.length - ptr)];
|
||||
System.arraycopy (buffer, ptr, data, 0, data.length);
|
||||
|
||||
if ("MAIN".equals (kind))
|
||||
@ -37,7 +38,10 @@ public class SHRPictureFile extends HiResImage
|
||||
blocks.add (multipalBlock);
|
||||
}
|
||||
else
|
||||
{
|
||||
blocks.add (new Block (kind, data));
|
||||
System.out.println ("Unknown block type: " + kind + " in " + name);
|
||||
}
|
||||
|
||||
ptr += len;
|
||||
}
|
||||
@ -47,7 +51,6 @@ public class SHRPictureFile extends HiResImage
|
||||
@Override
|
||||
protected void createMonochromeImage ()
|
||||
{
|
||||
// makeScreen (unpackedBuffer);
|
||||
image = new BufferedImage (320, 200, BufferedImage.TYPE_BYTE_GRAY);
|
||||
DataBuffer db = image.getRaster ().getDataBuffer ();
|
||||
|
||||
@ -83,8 +86,8 @@ public class SHRPictureFile extends HiResImage
|
||||
|
||||
ColorTable colorTable = multipalBlock != null ? multipalBlock.colorTables[row]
|
||||
: mainBlock.colorTables[lo & 0x0F];
|
||||
boolean fillMode = (lo & 0x20) != 0;
|
||||
|
||||
boolean fillMode = (lo & 0x20) != 0;
|
||||
if (fillMode)
|
||||
System.out.println ("fillmode " + fillMode);
|
||||
|
||||
@ -121,7 +124,7 @@ public class SHRPictureFile extends HiResImage
|
||||
return text.toString ();
|
||||
}
|
||||
|
||||
class Block
|
||||
private class Block
|
||||
{
|
||||
String kind;
|
||||
byte[] data;
|
||||
@ -144,7 +147,7 @@ public class SHRPictureFile extends HiResImage
|
||||
}
|
||||
}
|
||||
|
||||
class Multipal extends Block
|
||||
private class Multipal extends Block
|
||||
{
|
||||
int numPalettes;
|
||||
ColorTable[] colorTables;
|
||||
@ -169,7 +172,7 @@ public class SHRPictureFile extends HiResImage
|
||||
}
|
||||
}
|
||||
|
||||
class Main extends Block
|
||||
private class Main extends Block
|
||||
{
|
||||
int masterMode;
|
||||
int pixelsPerScanLine;
|
||||
|
@ -14,7 +14,21 @@ public class SHRPictureFile2 extends HiResImage
|
||||
{
|
||||
super (name, buffer, fileType, auxType, eof);
|
||||
|
||||
if (fileType == ProdosConstants.FILE_TYPE_PIC) // 0xC1
|
||||
if (fileType == ProdosConstants.FILE_TYPE_PNT) // 0xC0
|
||||
{
|
||||
if (auxType == 0)
|
||||
{
|
||||
System.out.println ("0xC0 aux 0 not written");
|
||||
}
|
||||
else if (auxType == 1) // Eagle/PackBytes
|
||||
{
|
||||
// this unpacks directly to the screen locations
|
||||
System.out.println ("0xC0 aux 1 not written");
|
||||
}
|
||||
else
|
||||
System.out.println ("unknown aux " + auxType);
|
||||
}
|
||||
else if (fileType == ProdosConstants.FILE_TYPE_PIC) // 0xC1
|
||||
{
|
||||
if (auxType == 0)
|
||||
{
|
||||
@ -41,19 +55,6 @@ public class SHRPictureFile2 extends HiResImage
|
||||
else
|
||||
System.out.println ("unknown aux " + auxType);
|
||||
}
|
||||
else if (fileType == ProdosConstants.FILE_TYPE_PNT) // 0xC0
|
||||
{
|
||||
if (auxType == 0)
|
||||
{
|
||||
System.out.println ("0xC0 aux 0 not written");
|
||||
}
|
||||
else if (auxType == 1)
|
||||
{
|
||||
System.out.println ("0xC0 aux 1 not written");
|
||||
}
|
||||
else
|
||||
System.out.println ("unknown aux " + auxType);
|
||||
}
|
||||
else
|
||||
System.out.println ("unknown filetype " + fileType);
|
||||
|
||||
@ -98,8 +99,16 @@ public class SHRPictureFile2 extends HiResImage
|
||||
text.append ("\n\n");
|
||||
|
||||
if (scb != null)
|
||||
for (int i = 0; i < scb.length; i++)
|
||||
text.append (String.format ("%3d %02X%n", i, scb[i]));
|
||||
{
|
||||
text.append ("SCB\n---\n");
|
||||
for (int i = 0; i < scb.length; i += 8)
|
||||
{
|
||||
for (int j = 0; j < 8; j++)
|
||||
text.append (String.format (" %3d: %02X ", i + j, scb[i + j]));
|
||||
text.append ("\n");
|
||||
}
|
||||
text.append ("\n");
|
||||
}
|
||||
|
||||
for (ColorTable colorTable : colorTables)
|
||||
{
|
||||
|
@ -352,24 +352,13 @@ class FileEntry extends CatalogEntry implements ProdosConstants
|
||||
file = new IconFile (name, exactBuffer);
|
||||
break;
|
||||
case FILE_TYPE_PNT:
|
||||
if (auxType == 0)
|
||||
file = new SHRPictureFile2 (name, exactBuffer, fileType, auxType, endOfFile);
|
||||
else if (auxType == 1)
|
||||
file = new SHRPictureFile2 (name, exactBuffer, fileType, auxType, endOfFile);
|
||||
else if (auxType == 2)
|
||||
if (auxType == 2)
|
||||
file = new SHRPictureFile (name, exactBuffer, fileType, auxType, endOfFile);
|
||||
else
|
||||
file =
|
||||
new OriginalHiResImage (name, exactBuffer, fileType, auxType, endOfFile);
|
||||
file = new SHRPictureFile2 (name, exactBuffer, fileType, auxType, endOfFile);
|
||||
break;
|
||||
case FILE_TYPE_PIC:
|
||||
// if (auxType == 1)
|
||||
file = new SHRPictureFile2 (name, exactBuffer, fileType, auxType, endOfFile);
|
||||
// else if (auxType == 2)
|
||||
// file = new SHRPictureFile2 (name, exactBuffer, fileType, auxType, endOfFile);
|
||||
// else
|
||||
// file =
|
||||
// new OriginalHiResImage (name, exactBuffer, fileType, auxType, endOfFile);
|
||||
break;
|
||||
case FILE_TYPE_FONT:
|
||||
file = new QuickDrawFont (name, exactBuffer, fileType, auxType);
|
||||
|
Loading…
Reference in New Issue
Block a user