diff --git a/src/com/bytezone/diskbrowser/applefile/ExoBuffer.java b/src/com/bytezone/diskbrowser/applefile/ExoBuffer.java index c3948f5..5e1cae1 100644 --- a/src/com/bytezone/diskbrowser/applefile/ExoBuffer.java +++ b/src/com/bytezone/diskbrowser/applefile/ExoBuffer.java @@ -19,7 +19,7 @@ public class ExoBuffer private static int PFLAG_BITS_ALIGN_START = (1 << PBIT_BITS_ALIGN_START); private static int PFLAG_4_OFFSET_TABLES = (1 << PBIT_4_OFFSET_TABLES); - byte[] outBuffer = new byte[8192]; + byte[] outBuffer = new byte[16384]; // ---------------------------------------------------------------------------------// public ExoBuffer (byte[] inBuffer) @@ -31,21 +31,26 @@ public class ExoBuffer // tableDump (decCtx.table); decCtxDecrunch (decCtx); + if (decCtx.outPos != outBuffer.length) + { + byte[] outBuffer2 = new byte[decCtx.outPos]; + System.arraycopy (outBuffer, 0, outBuffer2, 0, outBuffer2.length); + outBuffer = outBuffer2; + } reverse (outBuffer); - // System.out.println (HexFormatter.format (outBuffer)); } + // ---------------------------------------------------------------------------------// private void reverse (byte[] inBuffer) + // ---------------------------------------------------------------------------------// { int lo = 0; int hi = inBuffer.length - 1; while (lo < hi) { byte temp = inBuffer[lo]; - inBuffer[lo] = inBuffer[hi]; - inBuffer[hi] = temp; - ++lo; - --hi; + inBuffer[lo++] = inBuffer[hi]; + inBuffer[hi--] = temp; } } diff --git a/src/com/bytezone/diskbrowser/applefile/HiResImage.java b/src/com/bytezone/diskbrowser/applefile/HiResImage.java index 1cfee44..dd6d338 100644 --- a/src/com/bytezone/diskbrowser/applefile/HiResImage.java +++ b/src/com/bytezone/diskbrowser/applefile/HiResImage.java @@ -666,11 +666,9 @@ public abstract class HiResImage extends AbstractFile public static boolean isExo (byte[] buffer) // ---------------------------------------------------------------------------------// { - if (buffer[0] == 1 && buffer[1] == 0) - { - // ExoBuffer exoBuffer = new ExoBuffer (buffer); + if (buffer[0] == 1 && buffer[1] == 0) // this sucks return true; - } + return false; } diff --git a/src/com/bytezone/diskbrowser/prodos/FileEntry.java b/src/com/bytezone/diskbrowser/prodos/FileEntry.java index a6f098a..34c9bf1 100755 --- a/src/com/bytezone/diskbrowser/prodos/FileEntry.java +++ b/src/com/bytezone/diskbrowser/prodos/FileEntry.java @@ -322,12 +322,18 @@ class FileEntry extends CatalogEntry implements ProdosConstants else if (auxType == 0x3FF8 && HiResImage.isExo (exactBuffer)) { ExoBuffer exoBuffer = new ExoBuffer (exactBuffer); - file = new OriginalHiResImage (name, exoBuffer.getExpandedBuffer (), 0x4000); + byte[] outBuffer = exoBuffer.getExpandedBuffer (); + if (outBuffer.length == 0x2000) + file = new OriginalHiResImage (name, outBuffer, 0x3FF8); + else if (outBuffer.length == 0x4000) + file = new DoubleHiResImage (name, outBuffer); + else + file = new AssemblerProgram (name, exactBuffer, auxType); } else if (oneOf (endOfFile, 0x1FF8, 0x1FFF, 0x2000, 0x4000) && oneOf (auxType, 0x1FFF, 0x2000, 0x4000, 0x6000)) file = new OriginalHiResImage (name, exactBuffer, auxType); - else if (endOfFile == 38400 && name.startsWith ("LVL.")) + else if (endOfFile == 0x9600 && name.startsWith ("LVL.")) file = new LodeRunner (name, exactBuffer); else if (auxType == 0x1000 && CharacterRom.isRom (exactBuffer)) file = new CharacterRom (name, exactBuffer);