From f7b455a7f17b59f0094396f389245fb64d4337a0 Mon Sep 17 00:00:00 2001 From: Denis Molony Date: Wed, 28 Apr 2021 14:34:41 +1000 Subject: [PATCH] re-enabled bxy --- .../diskbrowser/disk/DiskFactory.java | 24 +++++++++++-------- .../diskbrowser/prodos/write/ProdosDisk.java | 1 - .../diskbrowser/utilities/Utility.java | 2 +- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/src/com/bytezone/diskbrowser/disk/DiskFactory.java b/src/com/bytezone/diskbrowser/disk/DiskFactory.java index 92ba1ce..3b4670c 100755 --- a/src/com/bytezone/diskbrowser/disk/DiskFactory.java +++ b/src/com/bytezone/diskbrowser/disk/DiskFactory.java @@ -31,6 +31,9 @@ public class DiskFactory // -----------------------------------------------------------------------------------// { private static boolean debug = false; + private static final int DISK_800K = 819200; + private static final int DISK_143K = 143360; + private static final int DISK_116K = 116480; // ---------------------------------------------------------------------------------// private DiskFactory () @@ -98,7 +101,7 @@ public class DiskFactory } catch (IOException e) // can get EOFException: Unexpected end of ZLIB input stream { - e.printStackTrace (); + System.out.printf ("Error unpacking: %s%n", file.getAbsolutePath ()); return null; } } @@ -141,15 +144,16 @@ public class DiskFactory } catch (IOException e) { - e.printStackTrace (); + System.out.printf ("Error unpacking: %s%n", file.getAbsolutePath ()); return null; } } - if ("sdk".equals (suffix) || "shk".equals (suffix)) // shrinkit disk/file archive + if ("sdk".equals (suffix) || "shk".equals (suffix) // shrinkit disk/file archive + || "bxy".equals (suffix)) { if (debug) - System.out.println (" ** sdk/shk **"); + System.out.println (" ** sdk/shk/bxy **"); try { NuFX nuFX = new NuFX (file.toPath ()); @@ -171,7 +175,7 @@ public class DiskFactory } catch (Exception e) { - e.printStackTrace (); + System.out.printf ("Error unpacking: %s%n", file.getAbsolutePath ()); return null; } } @@ -224,7 +228,7 @@ public class DiskFactory // Toolkit.do = 143488 if (((suffix.equals ("po") || suffix.equals ("dsk") || suffix.equals ("do")) - && file.length () > 143360)) + && file.length () > DISK_143K)) { if (file.length () < 143500) // slightly bigger than a floppy { @@ -245,13 +249,13 @@ public class DiskFactory return disk; } - if (file.length () == 819200) // 800K 3.5" + if (file.length () == DISK_800K) // 800K 3.5" { if (debug) System.out.println ("UniDos ?"); // 2 x 400k disk images AppleDisk appleDisk1 = new AppleDisk (file, 50, 32); - AppleDisk appleDisk2 = new AppleDisk (file, 50, 32, (int) (file.length () / 2)); + AppleDisk appleDisk2 = new AppleDisk (file, 50, 32, 0x64000); disk = checkUnidos (appleDisk1, 1); disk2 = checkUnidos (appleDisk2, 2); if (disk != null && disk2 != null) @@ -351,7 +355,7 @@ public class DiskFactory long length = file.length (); - if (length == 116480) // 13 sector disk + if (length == DISK_116K) // 13 sector floppy disk { if (debug) System.out.println (" ** 13 sector **"); @@ -363,7 +367,7 @@ public class DiskFactory return disk == null ? new DataDisk (appleDisk) : disk; } - if (length != 143360) + if (length != DISK_143K) // 16 sector floppy disk { System.out.printf ("%s: invalid file length : %,d%n", file.getName (), file.length ()); diff --git a/src/com/bytezone/diskbrowser/prodos/write/ProdosDisk.java b/src/com/bytezone/diskbrowser/prodos/write/ProdosDisk.java index a21c39d..fc9cc39 100644 --- a/src/com/bytezone/diskbrowser/prodos/write/ProdosDisk.java +++ b/src/com/bytezone/diskbrowser/prodos/write/ProdosDisk.java @@ -251,7 +251,6 @@ public class ProdosDisk { for (SubdirectoryHeader subdirectoryHeader : subdirectoryHeaders.values ()) { - // System.out.printf ("%-35s%n", subdirectoryHeader.fileName); FileEntry fileEntry = subdirectoryHeader.getParentFileEntry (); if (!fileEntry.fileName.equals (subdirectoryHeader.fileName)) System.out.printf ("fail: %s%n", subdirectoryHeader.fileName); diff --git a/src/com/bytezone/diskbrowser/utilities/Utility.java b/src/com/bytezone/diskbrowser/utilities/Utility.java index 6f50b4b..7f464c7 100644 --- a/src/com/bytezone/diskbrowser/utilities/Utility.java +++ b/src/com/bytezone/diskbrowser/utilities/Utility.java @@ -34,7 +34,7 @@ public class Utility public static final byte ASCII_CARET = 0x5E; public static final List suffixes = Arrays.asList ("po", "dsk", "do", "hdv", - "2mg", "v2d", "d13", "sdk", "shk", "woz", "img", "dimg"); + "2mg", "v2d", "d13", "sdk", "shk", "bxy", "woz", "img", "dimg"); // ---------------------------------------------------------------------------------// public static boolean test (Graphics2D g)