mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Add missing Opera structs and constants.
This commit is contained in:
@@ -1,4 +1,31 @@
|
||||
namespace DiscImageChef.Filesystems
|
||||
{
|
||||
public partial class OperaFS { }
|
||||
public partial class OperaFS
|
||||
{
|
||||
const string SYNC = "ZZZZZ";
|
||||
const uint FLAGS_MASK = 0xFF;
|
||||
const int MAX_NAME = 32;
|
||||
|
||||
/// <summary>
|
||||
/// Directory
|
||||
/// </summary>
|
||||
const uint TYPE_DIR = 0x2A646972;
|
||||
/// <summary>
|
||||
/// Disc label
|
||||
/// </summary>
|
||||
const uint TYPE_LBL = 0x2A6C626C;
|
||||
/// <summary>
|
||||
/// Catapult
|
||||
/// </summary>
|
||||
const uint TYPE_ZAP = 0x2A7A6170;
|
||||
|
||||
enum FileFlags : uint
|
||||
{
|
||||
File = 2,
|
||||
Special = 6,
|
||||
Directory = 7,
|
||||
LastEntryInBlock = 0x40000000,
|
||||
LastEntry = 0x80000000
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -23,7 +23,7 @@ namespace DiscImageChef.Filesystems
|
||||
|
||||
if(recordType != 1 || recordVersion != 1) return false;
|
||||
|
||||
return Encoding.ASCII.GetString(syncBytes) == "ZZZZZ";
|
||||
return Encoding.ASCII.GetString(syncBytes) == SYNC;
|
||||
}
|
||||
|
||||
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information,
|
||||
@@ -36,11 +36,11 @@ namespace DiscImageChef.Filesystems
|
||||
|
||||
byte[] sbSector = imagePlugin.ReadSector(0 + partition.Start);
|
||||
|
||||
OperaSuperBlock sb = Marshal.ByteArrayToStructureBigEndian<OperaSuperBlock>(sbSector);
|
||||
SuperBlock sb = Marshal.ByteArrayToStructureBigEndian<SuperBlock>(sbSector);
|
||||
sb.sync_bytes = new byte[5];
|
||||
|
||||
if(sb.record_type != 1 || sb.record_version != 1) return;
|
||||
if(Encoding.ASCII.GetString(sb.sync_bytes) != "ZZZZZ") return;
|
||||
if(Encoding.ASCII.GetString(sb.sync_bytes) != SYNC) return;
|
||||
|
||||
superBlockMetadata.AppendFormat("Opera filesystem disc.").AppendLine();
|
||||
if(!string.IsNullOrEmpty(StringHandlers.CToString(sb.volume_label, Encoding)))
|
||||
@@ -68,7 +68,7 @@ namespace DiscImageChef.Filesystems
|
||||
superBlockMetadata
|
||||
.AppendFormat("Volume size: {0} blocks, {1} bytes", sb.block_count, sb.block_size * sb.block_count)
|
||||
.AppendLine();
|
||||
if((ulong)sb.block_count > imagePlugin.Info.Sectors)
|
||||
if(sb.block_count > imagePlugin.Info.Sectors)
|
||||
superBlockMetadata
|
||||
.AppendFormat("WARNING: Filesystem indicates {0} blocks while device indicates {1} blocks",
|
||||
sb.block_count, imagePlugin.Info.Sectors);
|
||||
@@ -84,8 +84,8 @@ namespace DiscImageChef.Filesystems
|
||||
{
|
||||
Type = "Opera",
|
||||
VolumeName = StringHandlers.CToString(sb.volume_label, Encoding),
|
||||
ClusterSize = (uint)sb.block_size,
|
||||
Clusters = (ulong)sb.block_count
|
||||
ClusterSize = sb.block_size,
|
||||
Clusters = sb.block_count
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace DiscImageChef.Filesystems
|
||||
public partial class OperaFS
|
||||
{
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
struct OperaSuperBlock
|
||||
struct SuperBlock
|
||||
{
|
||||
/// <summary>0x000, Record type, must be 1</summary>
|
||||
public readonly byte record_type;
|
||||
@@ -17,25 +17,92 @@ namespace DiscImageChef.Filesystems
|
||||
/// <summary>0x007, Volume flags</summary>
|
||||
public readonly byte volume_flags;
|
||||
/// <summary>0x008, 32 bytes, volume comment</summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)]
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = MAX_NAME)]
|
||||
public readonly byte[] volume_comment;
|
||||
/// <summary>0x028, 32 bytes, volume label</summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)]
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = MAX_NAME)]
|
||||
public readonly byte[] volume_label;
|
||||
/// <summary>0x048, Volume ID</summary>
|
||||
public readonly int volume_id;
|
||||
public readonly uint volume_id;
|
||||
/// <summary>0x04C, Block size in bytes</summary>
|
||||
public readonly int block_size;
|
||||
public readonly uint block_size;
|
||||
/// <summary>0x050, Blocks in volume</summary>
|
||||
public readonly int block_count;
|
||||
public readonly uint block_count;
|
||||
/// <summary>0x054, Root directory ID</summary>
|
||||
public readonly int root_dirid;
|
||||
public readonly uint root_dirid;
|
||||
/// <summary>0x058, Root directory blocks</summary>
|
||||
public readonly int rootdir_blocks;
|
||||
public readonly uint rootdir_blocks;
|
||||
/// <summary>0x05C, Root directory block size</summary>
|
||||
public readonly int rootdir_bsize;
|
||||
public readonly uint rootdir_bsize;
|
||||
/// <summary>0x060, Last root directory copy</summary>
|
||||
public readonly int last_root_copy;
|
||||
public readonly uint last_root_copy;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
struct DirectoryHeader
|
||||
{
|
||||
/// <summary>
|
||||
/// Next block from this directory, -1 if last
|
||||
/// </summary>
|
||||
public readonly int next_block;
|
||||
/// <summary>
|
||||
/// Previous block from this directory, -1 if first
|
||||
/// </summary>
|
||||
public readonly int prev_block;
|
||||
/// <summary>
|
||||
/// Directory flags
|
||||
/// </summary>
|
||||
public readonly uint flags;
|
||||
/// <summary>
|
||||
/// Offset to first free unused byte in the directory
|
||||
/// </summary>
|
||||
public readonly uint first_free;
|
||||
/// <summary>
|
||||
/// Offset to first directory entry
|
||||
/// </summary>
|
||||
public readonly uint first_used;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
struct DirectoryEntry
|
||||
{
|
||||
/// <summary>
|
||||
/// File flags, see <see cref="FileFlags" />
|
||||
/// </summary>
|
||||
public readonly uint flags;
|
||||
/// <summary>
|
||||
/// Unique file identifier
|
||||
/// </summary>
|
||||
public readonly uint id;
|
||||
/// <summary>
|
||||
/// Entry type
|
||||
/// </summary>
|
||||
public readonly uint type;
|
||||
/// <summary>
|
||||
/// Block size
|
||||
/// </summary>
|
||||
public readonly uint block_size;
|
||||
/// <summary>
|
||||
/// Block count
|
||||
/// </summary>
|
||||
public readonly uint block_count;
|
||||
/// <summary>
|
||||
/// Unknown
|
||||
/// </summary>
|
||||
public readonly uint burst;
|
||||
/// <summary>
|
||||
/// Unknown
|
||||
/// </summary>
|
||||
public readonly uint gap;
|
||||
/// <summary>
|
||||
/// Filename
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = MAX_NAME)]
|
||||
public readonly byte[] name;
|
||||
/// <summary>
|
||||
/// Last copy
|
||||
/// </summary>
|
||||
public readonly uint last_copy;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user