This commit is contained in:
Denis Molony 2022-07-31 09:58:00 +10:00
parent 921c946ab5
commit 5add6c0729

View File

@ -46,7 +46,7 @@ public class Binary2
headers.add (binary2Header); headers.add (binary2Header);
totalBlocks += binary2Header.totalBlocks; totalBlocks += binary2Header.totalBlocks;
ptr += ((binary2Header.eof - 1) / 128 + 1) * 128 + 128; ptr += ((binary2Header.eof - 1) / 128 + 2) * 128;
} while (binary2Header.filesToFollow > 0); } while (binary2Header.filesToFollow > 0);
} }
@ -60,26 +60,22 @@ public class Binary2
for (Binary2Header header : headers) for (Binary2Header header : headers)
{ {
if (header.compressed && buffer[header.ptr + 128] == 0x76 byte[] dataBuffer = new byte[header.eof]; // this sux
&& buffer[header.ptr + 129] == (byte) 0xFF) System.arraycopy (buffer, header.ptr + 128, dataBuffer, 0, dataBuffer.length);
if (header.compressed && dataBuffer[0] == 0x76 && dataBuffer[1] == (byte) 0xFF)
{ {
byte[] tmp = new byte[header.eof]; // this sux String name = Utility.getCString (dataBuffer, 4);
System.arraycopy (buffer, header.ptr + 128, tmp, 0, tmp.length);
String name = Utility.getCString (tmp, 4);
Squeeze squeeze = new Squeeze (); Squeeze squeeze = new Squeeze ();
byte[] dataBuffer = squeeze.unSqueeze (tmp); byte[] tmp = squeeze.unSqueeze (dataBuffer);
disk.addFile (name, header.fileType, header.auxType, header.created, header.modified,
dataBuffer, header.eof); disk.addFile (name, header.fileType, header.auxType, header.created, header.modified, tmp,
tmp.length);
} }
else else
{
byte[] dataBuffer = new byte[header.eof]; // this sux
System.arraycopy (buffer, header.ptr + 128, dataBuffer, 0, dataBuffer.length);
disk.addFile (header.fileName, header.fileType, header.auxType, header.created, disk.addFile (header.fileName, header.fileType, header.auxType, header.created,
header.modified, dataBuffer, header.eof); header.modified, dataBuffer, header.eof);
}
} }
disk.close (); disk.close ();