2016-07-21 17:36:51 +01:00
|
|
|
|
// /***************************************************************************
|
|
|
|
|
|
// The Disc Image Chef
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
//
|
|
|
|
|
|
// Filename : Structs.cs
|
2016-07-28 18:13:49 +01:00
|
|
|
|
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
2016-07-21 17:36:51 +01:00
|
|
|
|
//
|
2016-07-28 18:13:49 +01:00
|
|
|
|
// Component : Apple Lisa filesystem plugin.
|
2016-07-21 17:36:51 +01:00
|
|
|
|
//
|
|
|
|
|
|
// --[ Description ] ----------------------------------------------------------
|
|
|
|
|
|
//
|
2016-07-28 18:13:49 +01:00
|
|
|
|
// Apple Lisa filesystem structures.
|
2016-07-21 17:36:51 +01:00
|
|
|
|
//
|
|
|
|
|
|
// --[ License ] --------------------------------------------------------------
|
|
|
|
|
|
//
|
2016-07-28 18:13:49 +01:00
|
|
|
|
// This library is free software; you can redistribute it and/or modify
|
|
|
|
|
|
// it under the terms of the GNU Lesser General Public License as
|
|
|
|
|
|
// published by the Free Software Foundation; either version 2.1 of the
|
2016-07-21 17:36:51 +01:00
|
|
|
|
// License, or (at your option) any later version.
|
|
|
|
|
|
//
|
2016-07-28 18:13:49 +01:00
|
|
|
|
// This library is distributed in the hope that it will be useful, but
|
|
|
|
|
|
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
|
|
// Lesser General Public License for more details.
|
2016-07-21 17:36:51 +01:00
|
|
|
|
//
|
2016-07-28 18:13:49 +01:00
|
|
|
|
// You should have received a copy of the GNU Lesser General Public
|
|
|
|
|
|
// License along with this library; if not, see <http://www.gnu.org/licenses/>.
|
2016-07-21 17:36:51 +01:00
|
|
|
|
//
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
2016-07-28 18:13:49 +01:00
|
|
|
|
// Copyright © 2011-2016 Natalia Portillo
|
2016-07-21 17:36:51 +01:00
|
|
|
|
// ****************************************************************************/
|
2016-07-28 18:13:49 +01:00
|
|
|
|
|
2016-07-21 17:36:51 +01:00
|
|
|
|
using System;
|
|
|
|
|
|
namespace DiscImageChef.Filesystems.LisaFS
|
|
|
|
|
|
{
|
|
|
|
|
|
partial class LisaFS : Filesystem
|
|
|
|
|
|
{
|
2016-07-29 02:22:24 +01:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// The MDDF is the most import block on a Lisa FS volume.
|
|
|
|
|
|
/// It describes the volume and its contents.
|
|
|
|
|
|
/// On initialization the memory where it resides is not emptied
|
|
|
|
|
|
/// so it tends to contain a lot of garbage. This has difficulted
|
|
|
|
|
|
/// its reverse engineering.
|
|
|
|
|
|
/// </summary>
|
2016-07-21 18:28:34 +01:00
|
|
|
|
struct MDDF
|
2016-07-21 17:36:51 +01:00
|
|
|
|
{
|
|
|
|
|
|
/// <summary>0x00, Filesystem version</summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public ushort fsversion;
|
2016-07-21 17:36:51 +01:00
|
|
|
|
/// <summary>0x02, Volume ID</summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public ulong volid;
|
2016-07-21 17:36:51 +01:00
|
|
|
|
/// <summary>0x0A, Volume sequence number</summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public ushort volnum;
|
2016-07-21 17:36:51 +01:00
|
|
|
|
/// <summary>0x0C, Pascal string, 32+1 bytes, volume name</summary>
|
|
|
|
|
|
public string volname;
|
|
|
|
|
|
/// <summary>0x2D, unknown, possible padding</summary>
|
|
|
|
|
|
public byte unknown1;
|
|
|
|
|
|
/// <summary>0x2E, Pascal string, 32+1 bytes, password</summary>
|
|
|
|
|
|
public string password;
|
|
|
|
|
|
/// <summary>0x4F, unknown, possible padding</summary>
|
|
|
|
|
|
public byte unknown2;
|
|
|
|
|
|
/// <summary>0x50, Lisa serial number that init'ed this disk</summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public uint machine_id;
|
2016-07-21 17:36:51 +01:00
|
|
|
|
/// <summary>0x54, ID of the master copy ? no idea really</summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public uint master_copy_id;
|
2016-07-21 17:36:51 +01:00
|
|
|
|
/// <summary>0x58, Date of volume creation</summary>
|
|
|
|
|
|
public DateTime dtvc;
|
|
|
|
|
|
/// <summary>0x5C, Date...</summary>
|
|
|
|
|
|
public DateTime dtcc;
|
|
|
|
|
|
/// <summary>0x60, Date of volume backup</summary>
|
|
|
|
|
|
public DateTime dtvb;
|
|
|
|
|
|
/// <summary>0x64, Date of volume scavenging</summary>
|
|
|
|
|
|
public DateTime dtvs;
|
|
|
|
|
|
/// <summary>0x68, unknown</summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public uint unknown3;
|
2016-07-21 17:36:51 +01:00
|
|
|
|
/// <summary>0x6C, block the MDDF is residing on</summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public uint mddf_block;
|
2016-07-21 17:36:51 +01:00
|
|
|
|
/// <summary>0x70, volsize-1</summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public uint volsize_minus_one;
|
2016-07-21 17:36:51 +01:00
|
|
|
|
/// <summary>0x74, volsize-1-mddf_block</summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public uint volsize_minus_mddf_minus_one;
|
2016-07-21 17:36:51 +01:00
|
|
|
|
/// <summary>0x78, Volume size in blocks</summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public uint vol_size;
|
2016-07-21 17:36:51 +01:00
|
|
|
|
/// <summary>0x7C, Blocks size of underlying drive (data+tags)</summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public ushort blocksize;
|
2016-07-21 17:36:51 +01:00
|
|
|
|
/// <summary>0x7E, Data only block size</summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public ushort datasize;
|
2016-07-21 17:36:51 +01:00
|
|
|
|
/// <summary>0x80, unknown</summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public ushort unknown4;
|
2016-07-21 17:36:51 +01:00
|
|
|
|
/// <summary>0x82, unknown</summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public uint unknown5;
|
2016-07-21 17:36:51 +01:00
|
|
|
|
/// <summary>0x86, unknown</summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public uint unknown6;
|
2016-07-21 17:36:51 +01:00
|
|
|
|
/// <summary>0x8A, Size in sectors of filesystem clusters</summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public ushort clustersize;
|
2016-07-21 17:36:51 +01:00
|
|
|
|
/// <summary>0x8C, Filesystem size in blocks</summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public uint fs_size;
|
2016-07-21 17:36:51 +01:00
|
|
|
|
/// <summary>0x90, unknown</summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public uint unknown7;
|
2016-07-28 03:41:57 +01:00
|
|
|
|
/// <summary>0x94, Pointer to S-Records</summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public uint srec_ptr;
|
2016-07-21 17:36:51 +01:00
|
|
|
|
/// <summary>0x98, unknown</summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public ushort unknown9;
|
2016-07-28 03:41:57 +01:00
|
|
|
|
/// <summary>0x9A, S-Records length</summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public ushort srec_len;
|
2016-07-21 17:36:51 +01:00
|
|
|
|
/// <summary>0x9C, unknown</summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public uint unknown10;
|
2016-07-21 17:36:51 +01:00
|
|
|
|
/// <summary>0xA0, unknown</summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public uint unknown11;
|
2016-07-21 17:36:51 +01:00
|
|
|
|
/// <summary>0xA4, unknown</summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public uint unknown12;
|
2016-07-21 17:36:51 +01:00
|
|
|
|
/// <summary>0xA8, unknown</summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public uint unknown13;
|
2016-07-21 17:36:51 +01:00
|
|
|
|
/// <summary>0xAC, unknown</summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public uint unknown14;
|
2016-07-21 17:36:51 +01:00
|
|
|
|
/// <summary>0xB0, Files in volume</summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public ushort filecount;
|
2016-07-21 17:36:51 +01:00
|
|
|
|
/// <summary>0xB2, unknown</summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public uint unknown15;
|
2016-07-21 17:36:51 +01:00
|
|
|
|
/// <summary>0xB6, unknown</summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public uint unknown16;
|
2016-07-21 17:36:51 +01:00
|
|
|
|
/// <summary>0xBA, Free blocks</summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public uint freecount;
|
2016-07-21 17:36:51 +01:00
|
|
|
|
/// <summary>0xBE, unknown</summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public ushort unknown17;
|
2016-07-21 17:36:51 +01:00
|
|
|
|
/// <summary>0xC0, unknown</summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public uint unknown18;
|
2016-07-21 17:36:51 +01:00
|
|
|
|
/// <summary>0xC4, no idea</summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public ulong overmount_stamp;
|
2016-07-21 17:36:51 +01:00
|
|
|
|
/// <summary>0xCC, serialization, lisa serial number authorized to use blocked software on this volume</summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public uint serialization;
|
2016-07-21 17:36:51 +01:00
|
|
|
|
/// <summary>0xD0, unknown</summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public uint unknown19;
|
2016-07-21 17:36:51 +01:00
|
|
|
|
/// <summary>0xD4, unknown, possible timestamp</summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public uint unknown_timestamp;
|
2016-07-21 17:36:51 +01:00
|
|
|
|
/// <summary>0xD8, unknown</summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public uint unknown20;
|
2016-07-21 17:36:51 +01:00
|
|
|
|
/// <summary>0xDC, unknown</summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public uint unknown21;
|
2016-07-21 17:36:51 +01:00
|
|
|
|
/// <summary>0xE0, unknown</summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public uint unknown22;
|
2016-07-21 17:36:51 +01:00
|
|
|
|
/// <summary>0xE4, unknown</summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public uint unknown23;
|
2016-07-21 17:36:51 +01:00
|
|
|
|
/// <summary>0xE8, unknown</summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public uint unknown24;
|
2016-07-21 17:36:51 +01:00
|
|
|
|
/// <summary>0xEC, unknown</summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public uint unknown25;
|
2016-07-21 17:36:51 +01:00
|
|
|
|
/// <summary>0xF0, unknown</summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public uint unknown26;
|
2016-07-21 17:36:51 +01:00
|
|
|
|
/// <summary>0xF4, unknown</summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public uint unknown27;
|
2016-07-21 17:36:51 +01:00
|
|
|
|
/// <summary>0xF8, unknown</summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public uint unknown28;
|
2016-07-21 17:36:51 +01:00
|
|
|
|
/// <summary>0xFC, unknown</summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public uint unknown29;
|
2016-07-21 17:36:51 +01:00
|
|
|
|
/// <summary>0x100, unknown</summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public uint unknown30;
|
2016-07-21 17:36:51 +01:00
|
|
|
|
/// <summary>0x104, unknown</summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public uint unknown31;
|
2016-07-21 17:36:51 +01:00
|
|
|
|
/// <summary>0x108, unknown</summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public uint unknown32;
|
2016-07-21 17:36:51 +01:00
|
|
|
|
/// <summary>0x10C, unknown</summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public uint unknown33;
|
2016-07-21 17:36:51 +01:00
|
|
|
|
/// <summary>0x110, unknown</summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public uint unknown34;
|
2016-07-21 17:36:51 +01:00
|
|
|
|
/// <summary>0x114, unknown</summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public uint unknown35;
|
2016-07-21 17:36:51 +01:00
|
|
|
|
/// <summary>0x118, ID of volume where this volume was backed up</summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public ulong backup_volid;
|
2016-07-21 17:36:51 +01:00
|
|
|
|
/// <summary>0x120, Size of LisaInfo label</summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public ushort label_size;
|
2016-07-21 17:36:51 +01:00
|
|
|
|
/// <summary>0x122, not clear</summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public ushort fs_overhead;
|
2016-07-21 17:36:51 +01:00
|
|
|
|
/// <summary>0x124, Return code of Scavenger</summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public ushort result_scavenge;
|
2016-07-21 17:36:51 +01:00
|
|
|
|
/// <summary>0x126, No idea</summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public ushort boot_code;
|
2016-07-21 17:36:51 +01:00
|
|
|
|
/// <summary>0x128, No idea</summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public ushort boot_environ;
|
2016-07-21 17:36:51 +01:00
|
|
|
|
/// <summary>0x12A, unknown</summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public uint unknown36;
|
2016-07-21 17:36:51 +01:00
|
|
|
|
/// <summary>0x12E, unknown</summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public uint unknown37;
|
2016-07-21 17:36:51 +01:00
|
|
|
|
/// <summary>0x132, unknown</summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public uint unknown38;
|
2016-07-21 17:36:51 +01:00
|
|
|
|
/// <summary>0x136, Total volumes in sequence</summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public ushort vol_sequence;
|
2016-07-21 17:36:51 +01:00
|
|
|
|
/// <summary>0x138, Volume is dirty?</summary>
|
|
|
|
|
|
public byte vol_left_mounted;
|
|
|
|
|
|
/// <summary>Is password present? (On-disk position unknown)</summary>
|
|
|
|
|
|
public byte passwd_present;
|
|
|
|
|
|
/// <summary>Opened files (memory-only?) (On-disk position unknown)</summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public uint opencount;
|
2016-07-21 17:36:51 +01:00
|
|
|
|
/// <summary>No idea (On-disk position unknown)</summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public uint copy_thread;
|
2016-07-21 17:36:51 +01:00
|
|
|
|
// Flags are boolean, but Pascal seems to use them as full unsigned 8 bit values
|
|
|
|
|
|
/// <summary>No idea (On-disk position unknown)</summary>
|
|
|
|
|
|
public byte privileged;
|
|
|
|
|
|
/// <summary>Read-only volume (On-disk position unknown)</summary>
|
|
|
|
|
|
public byte write_protected;
|
|
|
|
|
|
/// <summary>Master disk (On-disk position unknown)</summary>
|
|
|
|
|
|
public byte master;
|
|
|
|
|
|
/// <summary>Copy disk (On-disk position unknown)</summary>
|
|
|
|
|
|
public byte copy;
|
|
|
|
|
|
/// <summary>No idea (On-disk position unknown)</summary>
|
|
|
|
|
|
public byte copy_flag;
|
|
|
|
|
|
/// <summary>No idea (On-disk position unknown)</summary>
|
|
|
|
|
|
public byte scavenge_flag;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2016-07-29 02:22:24 +01:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// The sector tag. Before the sector is encoded to GCR the tag is attached to the data.
|
|
|
|
|
|
/// Its size and format varies depending on device.
|
|
|
|
|
|
/// Lisa OS relies on tags for scavenging a floppy, but ignores most of them for normal usage,
|
|
|
|
|
|
/// except on hard disks where the checksum byte is absolutely enforced (a sector with an invalid
|
|
|
|
|
|
/// one gives an OS error).
|
|
|
|
|
|
/// </summary>
|
2016-07-21 18:28:34 +01:00
|
|
|
|
struct Tag
|
2016-07-21 17:36:51 +01:00
|
|
|
|
{
|
2016-07-27 22:13:47 +01:00
|
|
|
|
/// <summary>0x00 version</summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public ushort version;
|
2016-07-27 22:13:47 +01:00
|
|
|
|
/// <summary>0x02 unknown</summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public ushort unknown;
|
2016-07-21 17:40:49 +01:00
|
|
|
|
/// <summary>0x04 File ID. Negative numbers are extents for the file with same absolute value number</summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public short fileID;
|
2016-07-27 22:13:47 +01:00
|
|
|
|
/// <summary>Only in 20 bytes tag at 0x06, mask 0x8000 if valid tag</summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public ushort usedBytes;
|
2016-07-27 22:13:47 +01:00
|
|
|
|
/// <summary>Only in 20 bytes tag at 0x08, 3 bytes</summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public uint absoluteBlock;
|
2016-07-27 22:13:47 +01:00
|
|
|
|
/// <summary>Only in 20 bytes tag at 0x0B, checksum byte</summary>
|
|
|
|
|
|
public byte checksum;
|
|
|
|
|
|
/// <summary>0x06 in 12 bytes tag, 0x0C in 20 bytes tag, relative block</summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public ushort relBlock;
|
2016-07-27 22:13:47 +01:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Next block for this file.
|
|
|
|
|
|
/// In 12 bytes tag at 0x08, 2 bytes, 0x8000 bit seems always set, 0x07FF means this is last block.
|
|
|
|
|
|
/// In 20 bytes tag at 0x0E, 3 bytes, 0xFFFFFF means this is last block.
|
|
|
|
|
|
/// </summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public uint nextBlock;
|
2016-07-27 22:13:47 +01:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Previous block for this file.
|
|
|
|
|
|
/// In 12 bytes tag at 0x0A, 2 bytes, 0x07FF means this is first block.
|
|
|
|
|
|
/// In 20 bytes tag at 0x11, 3 bytes, 0xFFFFFF means this is first block.
|
|
|
|
|
|
/// </summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public uint prevBlock;
|
2016-07-27 22:13:47 +01:00
|
|
|
|
|
|
|
|
|
|
/// <summary>On-memory value for easy first block search.</summary>
|
|
|
|
|
|
public bool isFirst;
|
|
|
|
|
|
/// <summary>On-memory value for easy last block search.</summary>
|
|
|
|
|
|
public bool isLast;
|
2016-07-21 17:36:51 +01:00
|
|
|
|
}
|
2016-07-21 18:28:34 +01:00
|
|
|
|
|
2016-07-29 02:22:24 +01:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// An entry in the catalog from V3.
|
|
|
|
|
|
/// The first entry is bigger than the rest, may be a header, I have not needed any of its values so I just ignored it.
|
|
|
|
|
|
/// Each catalog is divided in 4-sector blocks, and if it needs more than a block there are previous and next block
|
|
|
|
|
|
/// pointers, effectively making the V3 catalog a double-linked list. Garbage is not zeroed.
|
|
|
|
|
|
/// </summary>
|
2016-07-21 18:28:34 +01:00
|
|
|
|
struct CatalogEntry
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>0x00, seems to be 0x24 when the entry is valid</summary>
|
|
|
|
|
|
public byte marker;
|
2016-07-29 02:22:24 +01:00
|
|
|
|
/// <summary>0x01, must be zero otherwise LisaOS gives an error</summary>
|
2016-07-21 18:28:34 +01:00
|
|
|
|
public ushort zero;
|
|
|
|
|
|
/// <summary>0x03, filename, 32-bytes, null-padded</summary>
|
|
|
|
|
|
public byte[] filename;
|
2016-07-27 02:35:29 +01:00
|
|
|
|
/// <summary>0x23, null-termination</summary>
|
|
|
|
|
|
public byte terminator;
|
2016-07-21 18:28:34 +01:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// At 0x24
|
|
|
|
|
|
/// 0x03 here for entries 64 bytes long
|
|
|
|
|
|
/// 0x08 here for entries 78 bytes long
|
|
|
|
|
|
/// This is incomplete, may fail, mostly works...
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public byte fileType;
|
|
|
|
|
|
/// <summary>0x25, lot of values found here, unknown</summary>
|
|
|
|
|
|
public byte unknown;
|
|
|
|
|
|
/// <summary>0x26, file ID, must be positive and bigger than 4</summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public short fileID;
|
2016-07-21 18:28:34 +01:00
|
|
|
|
/// <summary>0x28, creation date</summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public uint dtc;
|
2016-07-21 18:28:34 +01:00
|
|
|
|
/// <summary>0x2C, last modification date</summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public uint dtm;
|
2016-07-22 23:03:27 +01:00
|
|
|
|
/// <summary>0x30, file length in bytes</summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public int length;
|
2016-07-22 23:03:27 +01:00
|
|
|
|
/// <summary>0x34, file length in bytes, including wasted block space</summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public int wasted;
|
2016-07-21 18:28:34 +01:00
|
|
|
|
/// <summary>0x38, unknown</summary>
|
|
|
|
|
|
public byte[] tail;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2016-07-29 02:22:24 +01:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// An extent indicating a start and a run of sectors.
|
|
|
|
|
|
/// </summary>
|
2016-07-21 18:28:34 +01:00
|
|
|
|
struct Extent
|
|
|
|
|
|
{
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public int start;
|
|
|
|
|
|
public short length;
|
2016-07-21 18:28:34 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
2016-07-29 02:22:24 +01:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// The Extents File. There is one Extents File per each file stored on disk.
|
|
|
|
|
|
/// The file ID present on the sectors tags for the Extents File is the negated
|
|
|
|
|
|
/// value of the file ID it represents. e.g. file = 5 (0x0005) extents = -5 (0xFFFB)
|
|
|
|
|
|
/// It spans a single sector on V2 and V3 but 2 sectors on V1.
|
|
|
|
|
|
/// It contains all information about a file, and is indexed in the S-Records file.
|
|
|
|
|
|
/// It also contains the label. Garbage is zeroed.
|
|
|
|
|
|
/// </summary>
|
2016-07-21 18:28:34 +01:00
|
|
|
|
struct ExtentFile
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>0x00, filename length</summary>
|
|
|
|
|
|
public byte filenameLen;
|
|
|
|
|
|
/// <summary>0x01, filename</summary>
|
|
|
|
|
|
public byte[] filename;
|
2016-07-27 02:35:29 +01:00
|
|
|
|
/// <summary>0x20, unknown</summary>
|
|
|
|
|
|
public ushort unknown1;
|
|
|
|
|
|
/// <summary>0x22, 8 bytes</summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public ulong file_uid;
|
2016-07-27 02:35:29 +01:00
|
|
|
|
/// <summary>0x2A, unknown</summary>
|
|
|
|
|
|
public byte unknown2;
|
|
|
|
|
|
/// <summary>0x2B, entry type? gets modified</summary>
|
|
|
|
|
|
public byte etype;
|
|
|
|
|
|
/// <summary>0x2C, file type</summary>
|
|
|
|
|
|
public FileType ftype;
|
|
|
|
|
|
/// <summary>0x2D, unknown</summary>
|
|
|
|
|
|
public byte unknown3;
|
2016-07-21 18:28:34 +01:00
|
|
|
|
/// <summary>0x2E, creation time</summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public uint dtc;
|
2016-07-21 18:28:34 +01:00
|
|
|
|
/// <summary>0x32, last access time</summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public uint dta;
|
2016-07-21 18:28:34 +01:00
|
|
|
|
/// <summary>0x36, modification time</summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public uint dtm;
|
2016-07-21 18:28:34 +01:00
|
|
|
|
/// <summary>0x3A, backup time</summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public uint dtb;
|
2016-07-21 18:28:34 +01:00
|
|
|
|
/// <summary>0x3E, scavenge time</summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public uint dts;
|
2016-07-27 02:35:29 +01:00
|
|
|
|
/// <summary>0x42, machine serial number</summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public uint serial;
|
2016-07-27 02:35:29 +01:00
|
|
|
|
/// <summary>0x46, unknown</summary>
|
|
|
|
|
|
public byte unknown4;
|
|
|
|
|
|
/// <summary>0x47, locked file</summary>
|
|
|
|
|
|
public byte locked;
|
|
|
|
|
|
/// <summary>0x48, protected file</summary>
|
|
|
|
|
|
public byte protect;
|
|
|
|
|
|
/// <summary>0x49, master file</summary>
|
|
|
|
|
|
public byte master;
|
|
|
|
|
|
/// <summary>0x4A, scavenged file</summary>
|
|
|
|
|
|
public byte scavenged;
|
|
|
|
|
|
/// <summary>0x4B, file closed by os</summary>
|
|
|
|
|
|
public byte closed;
|
|
|
|
|
|
/// <summary>0x4C, file left open</summary>
|
|
|
|
|
|
public byte open;
|
|
|
|
|
|
/// <summary>0x4D, 11 bytes, unknown</summary>
|
|
|
|
|
|
public byte[] unknown5;
|
|
|
|
|
|
/// <summary>0x58, Release number</summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public ushort release;
|
2016-07-27 02:35:29 +01:00
|
|
|
|
/// <summary>0x5A, Build number</summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public ushort build;
|
2016-07-27 02:35:29 +01:00
|
|
|
|
/// <summary>0x5C, Compatibility level</summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public ushort compatibility;
|
2016-07-27 02:35:29 +01:00
|
|
|
|
/// <summary>0x5E, Revision level</summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public ushort revision;
|
2016-07-27 02:35:29 +01:00
|
|
|
|
/// <summary>0x60, unknown</summary>
|
|
|
|
|
|
public ushort unknown6;
|
|
|
|
|
|
/// <summary>0x62, 0x08 set if password is valid</summary>
|
|
|
|
|
|
public byte password_valid;
|
2016-07-21 18:28:34 +01:00
|
|
|
|
/// <summary>0x63, 8 bytes, scrambled password</summary>
|
|
|
|
|
|
public byte[] password;
|
2016-07-27 02:35:29 +01:00
|
|
|
|
/// <summary>0x6B, 3 bytes, unknown</summary>
|
|
|
|
|
|
public byte[] unknown7;
|
|
|
|
|
|
/// <summary>0x6E, filesystem overhead</summary>
|
|
|
|
|
|
public ushort overhead;
|
|
|
|
|
|
/// <summary>0x70, 16 bytes, unknown</summary>
|
|
|
|
|
|
public byte[] unknown8;
|
2016-07-28 05:34:23 +01:00
|
|
|
|
/// <summary>0x80, 0x200 in v1, file length in blocks</summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public int length;
|
2016-07-28 05:34:23 +01:00
|
|
|
|
/// <summary>0x84, 0x204 in v1, unknown</summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public int unknown9;
|
2016-07-28 05:34:23 +01:00
|
|
|
|
/// <summary>0x88, 0x208 in v1, extents, can contain up to 41 extents (85 in v1), dunno LisaOS maximum (never seen more than 3)</summary>
|
2016-07-21 18:28:34 +01:00
|
|
|
|
public Extent[] extents;
|
|
|
|
|
|
/// <summary>0x17E, unknown, empty, padding?</summary>
|
2016-07-27 02:35:29 +01:00
|
|
|
|
public short unknown10;
|
2016-07-29 02:22:24 +01:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// At 0x180, this is the label.
|
|
|
|
|
|
/// While 1982 pre-release documentation says the label can be up to 448 bytes, v1 onward only have space for a 128 bytes one.
|
|
|
|
|
|
/// Any application can write whatever they want in the label, however, Lisa Office uses it to store its own information, something
|
|
|
|
|
|
/// that will effectively overwrite any information a user application wrote there.
|
|
|
|
|
|
/// The information written here by Lisa Office is like the information Finder writes in the FinderInfo structures, plus
|
|
|
|
|
|
/// the non-unique name that is shown on the GUI. For this reason I called it LisaInfo.
|
|
|
|
|
|
/// I have not tried to reverse engineer it.
|
|
|
|
|
|
/// </summary>
|
2016-07-21 18:28:34 +01:00
|
|
|
|
public byte[] LisaInfo;
|
|
|
|
|
|
}
|
2016-07-28 03:41:57 +01:00
|
|
|
|
|
2016-07-29 02:22:24 +01:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// The S-Records File is a hashtable of S-Records, where the hash is the file ID they belong to.
|
|
|
|
|
|
/// The S-Records File cannot be fragmented or grown, and it can easily become full before the 32766 file IDs are exhausted.
|
|
|
|
|
|
/// Each S-Record entry contains a block pointer to the Extents File that correspond to that file ID as well as the real file size,
|
|
|
|
|
|
/// the only important information about a file that's not inside the Extents File.
|
|
|
|
|
|
/// It also contains a low value (less than 0x200) variable field of unknown meaning and another one that seems to be flags,
|
|
|
|
|
|
/// with values like 0, 1, 3 and 5.
|
|
|
|
|
|
/// </summary>
|
2016-07-28 03:41:57 +01:00
|
|
|
|
struct SRecord
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>0x00, block where ExtentsFile for this entry resides</summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public uint extent_ptr;
|
2016-07-28 03:41:57 +01:00
|
|
|
|
/// <summary>0x04, unknown</summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public uint unknown;
|
2016-07-28 03:41:57 +01:00
|
|
|
|
/// <summary>0x08, filesize in bytes</summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public uint filesize;
|
2016-07-28 03:41:57 +01:00
|
|
|
|
/// <summary>0x0C, some kind of flags, meaning unknown</summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public ushort flags;
|
2016-07-28 03:41:57 +01:00
|
|
|
|
}
|
2016-07-28 04:12:49 +01:00
|
|
|
|
|
2016-07-29 02:22:24 +01:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// The catalog entry for the V1 and V2 volume formats.
|
|
|
|
|
|
/// It merely contains the file name, type and ID, plus a few (mostly empty) unknown fields.
|
|
|
|
|
|
/// Contrary to V3, it has no header and instead of being a double-linked list it is fragmented using an Extents File.
|
|
|
|
|
|
/// The Extents File position for the root catalog is then stored in the S-Records File.
|
|
|
|
|
|
/// Its entries are not filed sequentially denoting some kind of in-memory structure while at the same time
|
|
|
|
|
|
/// forcing LisaOS to read the whole catalog. That or I missed the pointers.
|
|
|
|
|
|
/// Empty entries just contain a 0-len filename. Garbage is not zeroed.
|
|
|
|
|
|
/// </summary>
|
2016-07-28 04:12:49 +01:00
|
|
|
|
struct CatalogEntryV2
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>0x00, filename, 32-bytes, null-padded</summary>
|
|
|
|
|
|
public byte filenameLen;
|
|
|
|
|
|
/// <summary>0x01, filename, 31-bytes</summary>
|
|
|
|
|
|
public byte[] filename;
|
|
|
|
|
|
/// <summary>0x21, unknown</summary>
|
|
|
|
|
|
public byte unknown1;
|
|
|
|
|
|
/// <summary>0x22, unknown</summary>
|
|
|
|
|
|
public byte fileType;
|
|
|
|
|
|
/// <summary>0x23, unknown</summary>
|
|
|
|
|
|
public byte unknown2;
|
|
|
|
|
|
/// <summary>0x24, unknown</summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public short fileID;
|
2016-07-28 04:12:49 +01:00
|
|
|
|
/// <summary>0x26, 16 bytes, unknown</summary>
|
|
|
|
|
|
public byte[] unknown3;
|
|
|
|
|
|
}
|
2016-07-21 17:36:51 +01:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|