2019-08-01 16:21:10 +01:00
|
|
|
using System.Runtime.InteropServices;
|
|
|
|
|
|
2020-02-27 00:33:26 +00:00
|
|
|
namespace Aaru.Filesystems
|
2019-08-01 16:21:10 +01:00
|
|
|
{
|
|
|
|
|
public partial class OperaFS
|
|
|
|
|
{
|
|
|
|
|
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
2019-08-01 17:00:30 +01:00
|
|
|
struct SuperBlock
|
2019-08-01 16:21:10 +01:00
|
|
|
{
|
|
|
|
|
/// <summary>0x000, Record type, must be 1</summary>
|
|
|
|
|
public readonly byte record_type;
|
|
|
|
|
/// <summary>0x001, 5 bytes, "ZZZZZ"</summary>
|
|
|
|
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)]
|
2019-08-01 23:10:52 +01:00
|
|
|
public readonly byte[] sync_bytes;
|
2019-08-01 16:21:10 +01:00
|
|
|
/// <summary>0x006, Record version, must be 1</summary>
|
|
|
|
|
public readonly byte record_version;
|
|
|
|
|
/// <summary>0x007, Volume flags</summary>
|
|
|
|
|
public readonly byte volume_flags;
|
|
|
|
|
/// <summary>0x008, 32 bytes, volume comment</summary>
|
2019-08-01 17:00:30 +01:00
|
|
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = MAX_NAME)]
|
2019-08-01 16:21:10 +01:00
|
|
|
public readonly byte[] volume_comment;
|
|
|
|
|
/// <summary>0x028, 32 bytes, volume label</summary>
|
2019-08-01 17:00:30 +01:00
|
|
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = MAX_NAME)]
|
2019-08-01 16:21:10 +01:00
|
|
|
public readonly byte[] volume_label;
|
|
|
|
|
/// <summary>0x048, Volume ID</summary>
|
2019-08-01 17:00:30 +01:00
|
|
|
public readonly uint volume_id;
|
2019-08-01 16:21:10 +01:00
|
|
|
/// <summary>0x04C, Block size in bytes</summary>
|
2019-08-01 17:00:30 +01:00
|
|
|
public readonly uint block_size;
|
2019-08-01 16:21:10 +01:00
|
|
|
/// <summary>0x050, Blocks in volume</summary>
|
2019-08-01 17:00:30 +01:00
|
|
|
public readonly uint block_count;
|
2019-08-01 16:21:10 +01:00
|
|
|
/// <summary>0x054, Root directory ID</summary>
|
2019-08-01 17:00:30 +01:00
|
|
|
public readonly uint root_dirid;
|
2019-08-01 16:21:10 +01:00
|
|
|
/// <summary>0x058, Root directory blocks</summary>
|
2019-08-01 17:00:30 +01:00
|
|
|
public readonly uint rootdir_blocks;
|
2019-08-01 16:21:10 +01:00
|
|
|
/// <summary>0x05C, Root directory block size</summary>
|
2019-08-01 17:00:30 +01:00
|
|
|
public readonly uint rootdir_bsize;
|
2019-08-01 16:21:10 +01:00
|
|
|
/// <summary>0x060, Last root directory copy</summary>
|
2019-08-01 17:00:30 +01:00
|
|
|
public readonly uint last_root_copy;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
|
|
|
|
struct DirectoryHeader
|
|
|
|
|
{
|
2020-02-29 18:03:35 +00:00
|
|
|
/// <summary>Next block from this directory, -1 if last</summary>
|
2019-08-01 17:00:30 +01:00
|
|
|
public readonly int next_block;
|
2020-02-29 18:03:35 +00:00
|
|
|
/// <summary>Previous block from this directory, -1 if first</summary>
|
2019-08-01 17:00:30 +01:00
|
|
|
public readonly int prev_block;
|
2020-02-29 18:03:35 +00:00
|
|
|
/// <summary>Directory flags</summary>
|
2019-08-01 17:00:30 +01:00
|
|
|
public readonly uint flags;
|
2020-02-29 18:03:35 +00:00
|
|
|
/// <summary>Offset to first free unused byte in the directory</summary>
|
2019-08-01 17:00:30 +01:00
|
|
|
public readonly uint first_free;
|
2020-02-29 18:03:35 +00:00
|
|
|
/// <summary>Offset to first directory entry</summary>
|
2019-08-01 17:00:30 +01:00
|
|
|
public readonly uint first_used;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
|
|
|
|
struct DirectoryEntry
|
|
|
|
|
{
|
2020-02-29 18:03:35 +00:00
|
|
|
/// <summary>File flags, see <see cref="FileFlags" /></summary>
|
2019-08-01 17:00:30 +01:00
|
|
|
public readonly uint flags;
|
2020-02-29 18:03:35 +00:00
|
|
|
/// <summary>Unique file identifier</summary>
|
2019-08-01 17:00:30 +01:00
|
|
|
public readonly uint id;
|
2020-02-29 18:03:35 +00:00
|
|
|
/// <summary>Entry type</summary>
|
2019-08-01 17:00:30 +01:00
|
|
|
public readonly uint type;
|
2020-02-29 18:03:35 +00:00
|
|
|
/// <summary>Block size</summary>
|
2019-08-01 17:00:30 +01:00
|
|
|
public readonly uint block_size;
|
2020-02-29 18:03:35 +00:00
|
|
|
/// <summary>Size in bytes</summary>
|
2019-08-01 23:10:52 +01:00
|
|
|
public readonly uint byte_count;
|
2020-02-29 18:03:35 +00:00
|
|
|
/// <summary>Block count</summary>
|
2019-08-01 17:00:30 +01:00
|
|
|
public readonly uint block_count;
|
2020-02-29 18:03:35 +00:00
|
|
|
/// <summary>Unknown</summary>
|
2019-08-01 17:00:30 +01:00
|
|
|
public readonly uint burst;
|
2020-02-29 18:03:35 +00:00
|
|
|
/// <summary>Unknown</summary>
|
2019-08-01 17:00:30 +01:00
|
|
|
public readonly uint gap;
|
2020-02-29 18:03:35 +00:00
|
|
|
/// <summary>Filename</summary>
|
2019-08-01 17:00:30 +01:00
|
|
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = MAX_NAME)]
|
|
|
|
|
public readonly byte[] name;
|
2020-02-29 18:03:35 +00:00
|
|
|
/// <summary>Last copy</summary>
|
2019-08-01 17:00:30 +01:00
|
|
|
public readonly uint last_copy;
|
2019-08-01 16:21:10 +01:00
|
|
|
}
|
2019-08-01 23:10:52 +01:00
|
|
|
|
2019-08-02 00:25:36 +01:00
|
|
|
class DirectoryEntryWithPointers
|
2019-08-01 23:10:52 +01:00
|
|
|
{
|
|
|
|
|
public DirectoryEntry entry;
|
|
|
|
|
public uint[] pointers;
|
|
|
|
|
}
|
2019-08-01 16:21:10 +01:00
|
|
|
}
|
|
|
|
|
}
|