From 85717fac5e46bd946fda0860dc3620bf1dde66b6 Mon Sep 17 00:00:00 2001 From: Denis Molony Date: Sat, 9 Nov 2019 23:23:30 +1000 Subject: [PATCH] pascal hd --- .../diskbrowser/applefile/CharacterList.java | 53 +++--- .../diskbrowser/applefile/CharacterRom.java | 25 ++- .../diskbrowser/applefile/Charset.java | 25 ++- .../diskbrowser/applefile/Command.java | 180 ------------------ .../diskbrowser/applefile/FontFile.java | 26 ++- .../diskbrowser/applefile/PaletteFactory.java | 2 +- .../applefile/PascalProcedure.java | 4 +- .../diskbrowser/applefile/PascalSegment.java | 2 +- .../diskbrowser/applefile/PascalText.java | 3 + .../diskbrowser/applefile/QuickDrawFont.java | 58 +++--- .../applefile/SHRPictureFile2.java | 4 +- .../diskbrowser/applefile/ShapeTable.java | 4 +- .../diskbrowser/disk/DiskFactory.java | 10 +- .../diskbrowser/prodos/FileEntry.java | 2 + 14 files changed, 115 insertions(+), 283 deletions(-) delete mode 100644 src/com/bytezone/diskbrowser/applefile/Command.java diff --git a/src/com/bytezone/diskbrowser/applefile/CharacterList.java b/src/com/bytezone/diskbrowser/applefile/CharacterList.java index dabd394..8dd698f 100644 --- a/src/com/bytezone/diskbrowser/applefile/CharacterList.java +++ b/src/com/bytezone/diskbrowser/applefile/CharacterList.java @@ -1,7 +1,6 @@ package com.bytezone.diskbrowser.applefile; import java.awt.AlphaComposite; -import java.awt.Color; import java.awt.Graphics2D; import java.awt.image.BufferedImage; import java.awt.image.DataBuffer; @@ -25,44 +24,33 @@ abstract class CharacterList extends AbstractFile List characters = new ArrayList<> (); // ---------------------------------------------------------------------------------// - public CharacterList (String name, byte[] buffer, int charsX, int charsY) - // ---------------------------------------------------------------------------------// - { - this (name, buffer, charsX, charsY, 0); - } - - // ---------------------------------------------------------------------------------// - public CharacterList (String name, byte[] buffer, int charsX, int charsY, int offset) + public CharacterList (String name, byte[] buffer) // ---------------------------------------------------------------------------------// { super (name, buffer); + } - image = new BufferedImage ( // - Utility.dimension (charsX, borderX, sizeX, gapX), // - Utility.dimension (charsY, borderY, sizeY, gapY), // + // ---------------------------------------------------------------------------------// + void buildImage (int borderX, int borderY, int gapX, int gapY, int sizeX, int sizeY, + int charsX) + // ---------------------------------------------------------------------------------// + { + int charsY = (characters.size () - 1) / charsX + 1; + image = new BufferedImage ( // + Utility.dimension (charsX, borderX, sizeX, gapX), // + Utility.dimension (charsY, borderY, sizeY, gapY), // BufferedImage.TYPE_BYTE_GRAY); Graphics2D g2d = image.createGraphics (); g2d.setComposite (AlphaComposite.getInstance (AlphaComposite.SRC_OVER, (float) 1.0)); - if (false) // show gaps around the glyphs - { - g2d.setColor (new Color (245, 245, 245)); // match background - g2d.fillRect (0, 0, image.getWidth (), image.getHeight ()); - } - + int count = 0; int x = borderX; int y = borderY; - int count = 0; - int ptr = offset; - while (ptr < buffer.length) + for (Character character : characters) { - Character c = createCharacter (buffer, ptr); - characters.add (c); - ptr += sizeY; - - g2d.drawImage (c.image, x, y, null); + g2d.drawImage (character.image, x, y, null); if (++count % charsX == 0) { x = borderX; @@ -75,10 +63,6 @@ abstract class CharacterList extends AbstractFile g2d.dispose (); } - // ---------------------------------------------------------------------------------// - abstract Character createCharacter (byte[] buffer, int ptr); - // ---------------------------------------------------------------------------------// - // ---------------------------------------------------------------------------------// @Override public String getText () @@ -99,7 +83,14 @@ abstract class CharacterList extends AbstractFile class Character // ---------------------------------------------------------------------------------// { - BufferedImage image = new BufferedImage (sizeX, sizeY, BufferedImage.TYPE_BYTE_GRAY); + BufferedImage image; + + // -------------------------------------------------------------------------------// + public Character (int sizeX, int sizeY) + // -------------------------------------------------------------------------------// + { + image = new BufferedImage (sizeX, sizeY, BufferedImage.TYPE_BYTE_GRAY); + } // -------------------------------------------------------------------------------// @Override diff --git a/src/com/bytezone/diskbrowser/applefile/CharacterRom.java b/src/com/bytezone/diskbrowser/applefile/CharacterRom.java index 5b09871..f63c59a 100644 --- a/src/com/bytezone/diskbrowser/applefile/CharacterRom.java +++ b/src/com/bytezone/diskbrowser/applefile/CharacterRom.java @@ -1,8 +1,6 @@ package com.bytezone.diskbrowser.applefile; import java.awt.image.DataBuffer; -import java.util.ArrayList; -import java.util.List; import com.bytezone.diskbrowser.utilities.HexFormatter; @@ -12,19 +10,26 @@ public class CharacterRom extends CharacterList // -----------------------------------------------------------------------------------// { private static final int charsX = 16; - private static final int charsY = 6; private static final int HEADER_LENGTH = 0x100; String description; - List characters = new ArrayList<> (); // ---------------------------------------------------------------------------------// public CharacterRom (String name, byte[] buffer) // ---------------------------------------------------------------------------------// { - super (name, buffer, charsX, charsY, HEADER_LENGTH); + super (name, buffer); description = HexFormatter.getCString (buffer, 16); + int ptr = HEADER_LENGTH; + + while (ptr < buffer.length) + { + characters.add (new CharacterRomCharacter (buffer, ptr)); + ptr += sizeY; + } + + buildImage (borderX, borderY, gapX, gapY, sizeX, sizeY, charsX); } // ---------------------------------------------------------------------------------// @@ -41,14 +46,6 @@ public class CharacterRom extends CharacterList && buffer[5] == (byte) 0x07 && buffer[6] == (byte) 0x08; } - // ---------------------------------------------------------------------------------// - @Override - Character createCharacter (byte[] buffer, int ptr) - // ---------------------------------------------------------------------------------// - { - return new CharacterRomCharacter (buffer, ptr); - } - // ---------------------------------------------------------------------------------// class CharacterRomCharacter extends Character // ---------------------------------------------------------------------------------// @@ -57,6 +54,8 @@ public class CharacterRom extends CharacterList public CharacterRomCharacter (byte[] buffer, int ptr) // -------------------------------------------------------------------------------// { + super (sizeX, sizeY); + DataBuffer dataBuffer = image.getRaster ().getDataBuffer (); int element = 0; diff --git a/src/com/bytezone/diskbrowser/applefile/Charset.java b/src/com/bytezone/diskbrowser/applefile/Charset.java index 79727db..f504154 100755 --- a/src/com/bytezone/diskbrowser/applefile/Charset.java +++ b/src/com/bytezone/diskbrowser/applefile/Charset.java @@ -1,8 +1,6 @@ package com.bytezone.diskbrowser.applefile; import java.awt.image.DataBuffer; -import java.util.ArrayList; -import java.util.List; // Found on Pascal disks // -----------------------------------------------------------------------------------// @@ -10,23 +8,22 @@ public class Charset extends CharacterList // -----------------------------------------------------------------------------------// { private static final int charsX = 16; - private static final int charsY = 8; - - List characters = new ArrayList<> (); // ---------------------------------------------------------------------------------// public Charset (String name, byte[] buffer) // ---------------------------------------------------------------------------------// { - super (name, buffer, charsX, charsY); - } + super (name, buffer); - // ---------------------------------------------------------------------------------// - @Override - Character createCharacter (byte[] buffer, int ptr) - // ---------------------------------------------------------------------------------// - { - return new CharsetCharacter (buffer, ptr); + int ptr = 0; + + while (ptr < buffer.length) + { + characters.add (new CharsetCharacter (buffer, ptr)); + ptr += sizeY; + } + + buildImage (borderX, borderY, gapX, gapY, sizeX, sizeY, charsX); } // ---------------------------------------------------------------------------------// @@ -37,6 +34,8 @@ public class Charset extends CharacterList public CharsetCharacter (byte[] buffer, int ptr) // -------------------------------------------------------------------------------// { + super (sizeX, sizeY); + DataBuffer dataBuffer = image.getRaster ().getDataBuffer (); int element = 0; ptr += sizeY; // start at the end and move backwards diff --git a/src/com/bytezone/diskbrowser/applefile/Command.java b/src/com/bytezone/diskbrowser/applefile/Command.java deleted file mode 100644 index 9e79126..0000000 --- a/src/com/bytezone/diskbrowser/applefile/Command.java +++ /dev/null @@ -1,180 +0,0 @@ -package com.bytezone.diskbrowser.applefile; - -import java.util.ArrayList; -import java.util.List; - -// Brendan Robert's code from JACE - -public class Command -{ - public static enum TOKEN - { - END ((byte) 0x080, "END"), - FOR ((byte) 0x081, "FOR"), - NEXT ((byte) 0x082, "NEXT"), - DATA ((byte) 0x083, "DATA"), - INPUT ((byte) 0x084, "INPUT"), - DEL ((byte) 0x085, "DEL"), - DIM ((byte) 0x086, "DIM"), - READ ((byte) 0x087, "READ"), - GR ((byte) 0x088, "GR"), - TEXT ((byte) 0x089, "TEXT"), - PR ((byte) 0x08A, "PR#"), - IN ((byte) 0x08B, "IN#"), - CALL ((byte) 0x08C, "CALL"), - PLOT ((byte) 0x08D, "PLOT"), - HLIN ((byte) 0x08E, "HLIN"), - VLIN ((byte) 0x08F, "VLIN"), - HGR2 ((byte) 0x090, "HGR2"), - HGR ((byte) 0x091, "HGR"), - HCOLOR ((byte) 0x092, "HCOLOR="), - HPLOT ((byte) 0x093, "HPLOT"), - DRAW ((byte) 0x094, "DRAW"), - XDRAW ((byte) 0x095, "XDRAW"), - HTAB ((byte) 0x096, "HTAB"), - HOME ((byte) 0x097, "HOME"), - ROT ((byte) 0x098, "ROT="), - SCALE ((byte) 0x099, "SCALE="), - SHLOAD ((byte) 0x09A, "SHLOAD"), - TRACE ((byte) 0x09B, "TRACE"), - NOTRACE ((byte) 0x09C, "NOTRACE"), - NORMAL ((byte) 0x09D, "NORMAL"), - INVERSE ((byte) 0x09E, "INVERSE"), - FLASH ((byte) 0x09F, "FLASH"), - COLOR ((byte) 0x0A0, "COLOR="), - POP ((byte) 0x0A1, "POP"), - VTAB ((byte) 0x0A2, "VTAB"), - HIMEM ((byte) 0x0A3, "HIMEM:"), - LOMEM ((byte) 0x0A4, "LOMEM:"), - ONERR ((byte) 0x0A5, "ONERR"), - RESUME ((byte) 0x0A6, "RESUME"), - RECALL ((byte) 0x0A7, "RECALL"), - STORE ((byte) 0x0A8, "STORE"), - SPEED ((byte) 0x0A9, "SPEED="), - LET ((byte) 0x0AA, "LET"), - GOTO ((byte) 0x0AB, "GOTO"), - RUN ((byte) 0x0AC, "RUN"), - IF ((byte) 0x0AD, "IF"), - RESTORE ((byte) 0x0AE, "RESTORE"), - AMPERSAND ((byte) 0x0AF, "&"), - GOSUB ((byte) 0x0B0, "GOSUB"), - RETURN ((byte) 0x0B1, "RETURN"), - REM ((byte) 0x0B2, "REM"), - STOP ((byte) 0x0B3, "STOP"), - ONGOTO ((byte) 0x0B4, "ON"), - WAIT ((byte) 0x0B5, "WAIT"), - LOAD ((byte) 0x0B6, "LOAD"), - SAVE ((byte) 0x0B7, "SAVE"), - DEF ((byte) 0x0B8, "DEF"), - POKE ((byte) 0x0B9, "POKE"), - PRINT ((byte) 0x0BA, "PRINT"), - CONT ((byte) 0x0BB, "CONT"), - LIST ((byte) 0x0BC, "LIST"), - CLEAR ((byte) 0x0BD, "CLEAR"), - GET ((byte) 0x0BE, "GET"), - NEW ((byte) 0x0BF, "NEW"), - TAB ((byte) 0x0C0, "TAB("), - TO ((byte) 0x0C1, "TO"), - FN ((byte) 0x0C2, "FN"), - SPC ((byte) 0x0c3, "SPC"), - THEN ((byte) 0x0c4, "THEN"), - AT ((byte) 0x0c5, "AT"), - NOT ((byte) 0x0c6, "NOT"), - STEP ((byte) 0x0c7, "STEP"), - PLUS ((byte) 0x0c8, "+"), - MINUS ((byte) 0x0c9, "-"), - MULTIPLY ((byte) 0x0Ca, "*"), - DIVIDE ((byte) 0x0Cb, "/"), - POWER ((byte) 0x0Cc, "^"), - AND ((byte) 0x0Cd, "AND"), - OR ((byte) 0x0Ce, "OR"), - GREATER ((byte) 0x0CF, ">"), - EQUAL ((byte) 0x0d0, "="), - LESS ((byte) 0x0d1, "<"), - SGN ((byte) 0x0D2, "SGN"), - INT ((byte) 0x0D3, "INT"), - ABS ((byte) 0x0D4, "ABS"), - USR ((byte) 0x0D5, "USR"), - FRE ((byte) 0x0D6, "FRE"), - SCREEN ((byte) 0x0D7, "SCRN("), - PDL ((byte) 0x0D8, "PDL"), - POS ((byte) 0x0D9, "POS"), - SQR ((byte) 0x0DA, "SQR"), - RND ((byte) 0x0DB, "RND"), - LOG ((byte) 0x0DC, "LOG"), - EXP ((byte) 0x0DD, "EXP"), - COS ((byte) 0x0DE, "COS"), - SIN ((byte) 0x0DF, "SIN"), - TAN ((byte) 0x0E0, "TAN"), - ATN ((byte) 0x0E1, "ATN"), - PEEK ((byte) 0x0E2, "PEEK"), - LEN ((byte) 0x0E3, "LEN"), - STR ((byte) 0x0E4, "STR$"), - VAL ((byte) 0x0E5, "VAL"), - ASC ((byte) 0x0E6, "ASC"), - CHR ((byte) 0x0E7, "CHR$"), - LEFT ((byte) 0x0E8, "LEFT$"), - RIGHT ((byte) 0x0E9, "RIGHT$"), - MID ((byte) 0x0EA, "MID$"); - private final String str; - private final byte b; - - TOKEN (byte b, String str) - { - this.b = b; - this.str = str; - } - - @Override - public String toString () - { - return str; - } - - public static TOKEN fromByte (byte b) - { - for (TOKEN t : values ()) - if (t.b == b) - return t; - return null; - } - } - - public static class ByteOrToken - { - byte b; - TOKEN t; - boolean isToken = false; - - public ByteOrToken (byte b) - { - TOKEN t = TOKEN.fromByte (b); - if (t != null) - { - isToken = true; - this.t = t; - } - else - { - isToken = false; - this.b = b; - } - } - - @Override - public String toString () - { - return isToken ? " " + t.toString () + " " : String.valueOf ((char) b); - } - } - List parts = new ArrayList (); - - @Override - public String toString () - { - String out = ""; - for (ByteOrToken p : parts) - out += p.toString (); - return out; - } -} diff --git a/src/com/bytezone/diskbrowser/applefile/FontFile.java b/src/com/bytezone/diskbrowser/applefile/FontFile.java index ae9e977..5e29d9d 100644 --- a/src/com/bytezone/diskbrowser/applefile/FontFile.java +++ b/src/com/bytezone/diskbrowser/applefile/FontFile.java @@ -1,25 +1,29 @@ package com.bytezone.diskbrowser.applefile; import java.awt.image.DataBuffer; -import java.util.ArrayList; -import java.util.List; // -----------------------------------------------------------------------------------// public class FontFile extends CharacterList // -----------------------------------------------------------------------------------// { private static final int charsX = 16; - private static final int charsY = 6; - - List characters = new ArrayList (); // ---------------------------------------------------------------------------------// public FontFile (String name, byte[] buffer, int address) // ---------------------------------------------------------------------------------// { - super (name, buffer, charsX, charsY); + super (name, buffer); loadAddress = address; + int ptr = 0; + + while (ptr < buffer.length) + { + characters.add (new FontFileCharacter (buffer, ptr)); + ptr += sizeY; + } + + buildImage (borderX, borderY, gapX, gapY, sizeX, sizeY, charsX); } // ---------------------------------------------------------------------------------// @@ -34,14 +38,6 @@ public class FontFile extends CharacterList return true; } - // ---------------------------------------------------------------------------------// - @Override - Character createCharacter (byte[] buffer, int ptr) - // ---------------------------------------------------------------------------------// - { - return new FontFileCharacter (buffer, ptr); - } - // ---------------------------------------------------------------------------------// class FontFileCharacter extends Character // ---------------------------------------------------------------------------------// @@ -50,6 +46,8 @@ public class FontFile extends CharacterList public FontFileCharacter (byte[] buffer, int ptr) // -------------------------------------------------------------------------------// { + super (sizeX, sizeY); + DataBuffer dataBuffer = image.getRaster ().getDataBuffer (); int element = 0; diff --git a/src/com/bytezone/diskbrowser/applefile/PaletteFactory.java b/src/com/bytezone/diskbrowser/applefile/PaletteFactory.java index b744d11..13e494d 100644 --- a/src/com/bytezone/diskbrowser/applefile/PaletteFactory.java +++ b/src/com/bytezone/diskbrowser/applefile/PaletteFactory.java @@ -5,7 +5,7 @@ import java.util.List; public class PaletteFactory { - private final List palettes = new ArrayList (); + private final List palettes = new ArrayList<> (); private int currentPalette; public enum CycleDirection diff --git a/src/com/bytezone/diskbrowser/applefile/PascalProcedure.java b/src/com/bytezone/diskbrowser/applefile/PascalProcedure.java index 46672e7..90d2552 100755 --- a/src/com/bytezone/diskbrowser/applefile/PascalProcedure.java +++ b/src/com/bytezone/diskbrowser/applefile/PascalProcedure.java @@ -22,7 +22,7 @@ public class PascalProcedure int codeEnd; int parmSize; int dataSize; - List statements = new ArrayList (); + List statements = new ArrayList<> (); AssemblerProgram assembler; int jumpTable = -8; @@ -121,7 +121,7 @@ public class PascalProcedure public List extractStrings () { decode (); - List strings = new ArrayList (); + List strings = new ArrayList<> (); for (PascalCodeStatement cs : statements) if (cs.val == 166) strings.add (cs); diff --git a/src/com/bytezone/diskbrowser/applefile/PascalSegment.java b/src/com/bytezone/diskbrowser/applefile/PascalSegment.java index 67ae90a..3c9654b 100755 --- a/src/com/bytezone/diskbrowser/applefile/PascalSegment.java +++ b/src/com/bytezone/diskbrowser/applefile/PascalSegment.java @@ -116,7 +116,7 @@ public class PascalSegment extends AbstractFile implements PascalConstants private void buildProcedureList () { - procedures = new ArrayList (totalProcedures); + procedures = new ArrayList<> (totalProcedures); for (int i = 1; i <= totalProcedures; i++) procedures.add (new PascalProcedure (buffer, i)); diff --git a/src/com/bytezone/diskbrowser/applefile/PascalText.java b/src/com/bytezone/diskbrowser/applefile/PascalText.java index 121d44f..de14835 100755 --- a/src/com/bytezone/diskbrowser/applefile/PascalText.java +++ b/src/com/bytezone/diskbrowser/applefile/PascalText.java @@ -32,6 +32,9 @@ public class PascalText extends AbstractFile ptr += line.length () + 1; } + if (text.length () > 0) + text.deleteCharAt (text.length () - 1); + return text.toString (); } diff --git a/src/com/bytezone/diskbrowser/applefile/QuickDrawFont.java b/src/com/bytezone/diskbrowser/applefile/QuickDrawFont.java index 5502ce4..c646acf 100644 --- a/src/com/bytezone/diskbrowser/applefile/QuickDrawFont.java +++ b/src/com/bytezone/diskbrowser/applefile/QuickDrawFont.java @@ -11,10 +11,12 @@ import java.util.Map; import com.bytezone.diskbrowser.prodos.ProdosConstants; import com.bytezone.diskbrowser.utilities.HexFormatter; -// see big red computer club folder -public class QuickDrawFont extends AbstractFile +// see IIGS System 6.0.1 - Disk 5 Fonts.po +// -----------------------------------------------------------------------------------// +public class QuickDrawFont extends CharacterList +// -----------------------------------------------------------------------------------// { - Map characters = new HashMap (); + Map qdCharacters = new HashMap<> (); private boolean corrupt; private final int fileType; @@ -51,7 +53,9 @@ public class QuickDrawFont extends AbstractFile private BitSet[] strike; // bit image of all characters + // ---------------------------------------------------------------------------------// public QuickDrawFont (String name, byte[] buffer, int fileType, int auxType) + // ---------------------------------------------------------------------------------// { super (name, buffer); @@ -113,11 +117,14 @@ public class QuickDrawFont extends AbstractFile createStrike (); createCharacters (); - if (!corrupt) - buildDisplay (); + // buildDisplay (); + buildImage (10, 10, 5, 5, widMax, fRectHeight, + (int) (Math.sqrt (totalCharacters) + .5)); } + // ---------------------------------------------------------------------------------// private void createStrike () + // ---------------------------------------------------------------------------------// { // create bitset for each row strike = new BitSet[fRectHeight]; @@ -136,35 +143,35 @@ public class QuickDrawFont extends AbstractFile } } + // ---------------------------------------------------------------------------------// private void createCharacters () + // ---------------------------------------------------------------------------------// { - // System.out.printf ("Total chars: %d%n", totalCharacters); for (int i = 0, max = totalCharacters + 1; i < max; i++) { // index into the strike int location = HexFormatter.unsignedShort (buffer, locationTableOffset + i * 2); - // System.out.printf ("%3d %04X %n", i, location); int j = i + 1; // next character if (j < max) { int nextLocation = HexFormatter.unsignedShort (buffer, locationTableOffset + j * 2); int pixelWidth = nextLocation - location; - // if (pixelWidth < 0) - // { - // System.out.println ("*********** Bad pixelWidth"); - // corrupt = true; - // return; - // } if (pixelWidth > 0) - characters.put (i, new Character (location, pixelWidth)); + { + QuickDrawCharacter c = new QuickDrawCharacter (location, pixelWidth); + qdCharacters.put (i, c); + characters.add (c); + } } } } + // ---------------------------------------------------------------------------------// private void buildDisplay () + // ---------------------------------------------------------------------------------// { int inset = 10; int spacing = 5; @@ -184,10 +191,10 @@ public class QuickDrawFont extends AbstractFile for (int i = 0; i < totalCharacters + 1; i++) { - int pos = characters.containsKey (i) ? i : lastChar + 1; - Character character = characters.get (pos); + int pos = qdCharacters.containsKey (i) ? i : lastChar + 1; + QuickDrawCharacter character = qdCharacters.get (pos); - // how the character image to be drawn should be positioned with + // how the character image to be drawn should be positioned with // respect to the current pen location // int offset = buffer[offsetWidthTableOffset + i * 2 + 1]; // how far the pen should be advanced after the character is drawn @@ -206,8 +213,10 @@ public class QuickDrawFont extends AbstractFile g2d.dispose (); } + // ---------------------------------------------------------------------------------// @Override public String getText () + // ---------------------------------------------------------------------------------// { StringBuilder text = new StringBuilder ("Name : " + name + "\n\n"); text.append ("File type : Font\n"); @@ -260,16 +269,21 @@ public class QuickDrawFont extends AbstractFile location, pixelWidth, offset, width)); } + // text.append (super.getText ()); + return text.toString (); } - class Character + // ---------------------------------------------------------------------------------// + class QuickDrawCharacter extends Character + // ---------------------------------------------------------------------------------// { - private final BufferedImage image; - - public Character (int strikeOffset, int strikeWidth) + // -------------------------------------------------------------------------------// + public QuickDrawCharacter (int strikeOffset, int strikeWidth) + // -------------------------------------------------------------------------------// { - image = new BufferedImage (strikeWidth, fRectHeight, BufferedImage.TYPE_BYTE_GRAY); + super (strikeWidth, fRectHeight); + DataBuffer dataBuffer = image.getRaster ().getDataBuffer (); int element = 0; diff --git a/src/com/bytezone/diskbrowser/applefile/SHRPictureFile2.java b/src/com/bytezone/diskbrowser/applefile/SHRPictureFile2.java index 4627b29..b69bfe0 100644 --- a/src/com/bytezone/diskbrowser/applefile/SHRPictureFile2.java +++ b/src/com/bytezone/diskbrowser/applefile/SHRPictureFile2.java @@ -20,7 +20,7 @@ public class SHRPictureFile2 extends HiResImage switch (fileType) { case ProdosConstants.FILE_TYPE_PNT: // packed images - doPnt (buffer); + doPnt (); break; case ProdosConstants.FILE_TYPE_PIC: // unpacked images @@ -35,7 +35,7 @@ public class SHRPictureFile2 extends HiResImage createImage (); } - private void doPnt (byte[] buffer) + private void doPnt () { switch (auxType) { diff --git a/src/com/bytezone/diskbrowser/applefile/ShapeTable.java b/src/com/bytezone/diskbrowser/applefile/ShapeTable.java index 42c74e5..f7ac7ff 100755 --- a/src/com/bytezone/diskbrowser/applefile/ShapeTable.java +++ b/src/com/bytezone/diskbrowser/applefile/ShapeTable.java @@ -23,7 +23,7 @@ import com.bytezone.diskbrowser.utilities.HexFormatter; public class ShapeTable extends AbstractFile { - private final List shapes = new ArrayList (); + private final List shapes = new ArrayList<> (); private static final int SIZE = 400; int maxWidth = 0; int maxHeight = 0; @@ -326,7 +326,7 @@ public class ShapeTable extends AbstractFile private List split (String line) { - List list = new ArrayList (); + List list = new ArrayList<> (); while (line.length () > 48) { list.add (line.substring (0, 47)); diff --git a/src/com/bytezone/diskbrowser/disk/DiskFactory.java b/src/com/bytezone/diskbrowser/disk/DiskFactory.java index 04aee15..b55d042 100755 --- a/src/com/bytezone/diskbrowser/disk/DiskFactory.java +++ b/src/com/bytezone/diskbrowser/disk/DiskFactory.java @@ -159,7 +159,7 @@ public class DiskFactory { if (debug) System.out.println (" ** hdv **"); - ProdosDisk prodosDisk = checkHardDisk (file); + FormattedDisk prodosDisk = checkHardDisk (file); if (prodosDisk != null) return prodosDisk; @@ -520,7 +520,7 @@ public class DiskFactory return null; } - private static ProdosDisk checkHardDisk (File file) + private static FormattedDisk checkHardDisk (File file) { if (debug) { @@ -555,6 +555,12 @@ public class DiskFactory System.out.println (" --> PRODOS hard disk"); return new ProdosDisk (disk); } + if (PascalDisk.isCorrectFormat (disk, debug)) + { + if (debug) + System.out.println (" --> Pascal hard disk"); + return new PascalDisk (disk); + } } catch (Exception e) { diff --git a/src/com/bytezone/diskbrowser/prodos/FileEntry.java b/src/com/bytezone/diskbrowser/prodos/FileEntry.java index 9873239..7c9dcc7 100755 --- a/src/com/bytezone/diskbrowser/prodos/FileEntry.java +++ b/src/com/bytezone/diskbrowser/prodos/FileEntry.java @@ -382,6 +382,8 @@ class FileEntry extends CatalogEntry implements ProdosConstants case FILE_TYPE_PNT: if (auxType == 2) file = new SHRPictureFile1 (name, exactBuffer, fileType, auxType, endOfFile); + else if (endOfFile < 0x222) + file = new DefaultAppleFile (name, exactBuffer); else file = new SHRPictureFile2 (name, exactBuffer, fileType, auxType, endOfFile); break;