mirror of
https://github.com/aaru-dps/Aaru.Server.git
synced 2025-12-16 19:24:27 +00:00
Added disk geometry.
This commit is contained in:
@@ -124,8 +124,8 @@ namespace DiscImageChef.PartPlugins
|
||||
valid &= entry.lba_start != 0 || entry.lba_sectors != 0 || entry.start_cylinder != 0 || entry.start_head != 0 || entry.start_sector != 0 || entry.end_cylinder != 0 || entry.end_head != 0 || entry.end_sector != 0;
|
||||
if(entry.lba_start == 0 && entry.lba_sectors == 0 && valid)
|
||||
{
|
||||
lba_start = CHStoLBA(start_cylinder, entry.start_head, start_sector);
|
||||
lba_sectors = CHStoLBA(end_cylinder, entry.end_head, entry.end_sector) - lba_start;
|
||||
lba_start = Helpers.CHS.ToLBA(start_cylinder, entry.start_head, start_sector, imagePlugin.ImageInfo.heads, imagePlugin.ImageInfo.sectorsPerTrack);
|
||||
lba_sectors = Helpers.CHS.ToLBA(end_cylinder, entry.end_head, entry.end_sector, imagePlugin.ImageInfo.heads, imagePlugin.ImageInfo.sectorsPerTrack) - lba_start;
|
||||
}
|
||||
|
||||
// For optical media
|
||||
@@ -247,8 +247,8 @@ namespace DiscImageChef.PartPlugins
|
||||
ebr_entry.start_sector != 0 || ebr_entry.end_cylinder != 0 || ebr_entry.end_head != 0 || ebr_entry.end_sector != 0;
|
||||
if(ebr_entry.lba_start == 0 && ebr_entry.lba_sectors == 0 && ext_valid)
|
||||
{
|
||||
ext_start = CHStoLBA(start_cylinder, ebr_entry.start_head, start_sector);
|
||||
ext_sectors = CHStoLBA(end_cylinder, ebr_entry.end_head, ebr_entry.end_sector) - ext_start;
|
||||
ext_start = Helpers.CHS.ToLBA(start_cylinder, ebr_entry.start_head, start_sector, imagePlugin.ImageInfo.heads, imagePlugin.ImageInfo.sectorsPerTrack);
|
||||
ext_sectors = Helpers.CHS.ToLBA(end_cylinder, ebr_entry.end_head, ebr_entry.end_sector, imagePlugin.ImageInfo.heads, imagePlugin.ImageInfo.sectorsPerTrack) - ext_start;
|
||||
}
|
||||
ext_minix |= (ebr_entry.type == 0x81 || ebr_entry.type == 0x80);
|
||||
|
||||
@@ -364,8 +364,8 @@ namespace DiscImageChef.PartPlugins
|
||||
mnx_entry.start_sector != 0 || mnx_entry.end_cylinder != 0 || mnx_entry.end_head != 0 || mnx_entry.end_sector != 0;
|
||||
if(mnx_entry.lba_start == 0 && mnx_entry.lba_sectors == 0 && mnx_valid)
|
||||
{
|
||||
mnx_start = CHStoLBA(start_cylinder, mnx_entry.start_head, start_sector);
|
||||
mnx_sectors = CHStoLBA(end_cylinder, mnx_entry.end_head, mnx_entry.end_sector) - mnx_start;
|
||||
mnx_start = Helpers.CHS.ToLBA(start_cylinder, mnx_entry.start_head, start_sector, imagePlugin.ImageInfo.heads, imagePlugin.ImageInfo.sectorsPerTrack);
|
||||
mnx_sectors = Helpers.CHS.ToLBA(end_cylinder, mnx_entry.end_head, mnx_entry.end_sector, imagePlugin.ImageInfo.heads, imagePlugin.ImageInfo.sectorsPerTrack) - mnx_start;
|
||||
}
|
||||
|
||||
// For optical media
|
||||
@@ -404,14 +404,6 @@ namespace DiscImageChef.PartPlugins
|
||||
return any_mnx;
|
||||
}
|
||||
|
||||
|
||||
static uint CHStoLBA(ushort cyl, byte head, byte sector)
|
||||
{
|
||||
#pragma warning disable IDE0004 // Remove Unnecessary Cast
|
||||
return (((uint)cyl * 16) + (uint)head) * 63 + (uint)sector - 1;
|
||||
#pragma warning restore IDE0004 // Remove Unnecessary Cast
|
||||
}
|
||||
|
||||
static string DecodeMBRType(byte type)
|
||||
{
|
||||
switch(type)
|
||||
|
||||
@@ -92,14 +92,14 @@ namespace DiscImageChef.PartPlugins
|
||||
|
||||
Partition part = new Partition
|
||||
{
|
||||
Start = CHStoLBA(entry.dp_scyl, entry.dp_shd, entry.dp_ssect),
|
||||
Start = Helpers.CHS.ToLBA(entry.dp_scyl, entry.dp_shd, entry.dp_ssect, imagePlugin.ImageInfo.heads, imagePlugin.ImageInfo.sectorsPerTrack),
|
||||
Type = string.Format("{0}", (entry.dp_sid << 8) | entry.dp_mid),
|
||||
Name = StringHandlers.CToString(entry.dp_name, Encoding.GetEncoding(932)),
|
||||
Sequence = counter,
|
||||
Scheme = Name
|
||||
};
|
||||
part.Offset = part.Start * imagePlugin.GetSectorSize();
|
||||
part.Length = CHStoLBA(entry.dp_ecyl, entry.dp_ehd, entry.dp_esect) - part.Start;
|
||||
part.Length = Helpers.CHS.ToLBA(entry.dp_ecyl, entry.dp_ehd, entry.dp_esect, imagePlugin.ImageInfo.heads, imagePlugin.ImageInfo.sectorsPerTrack) - part.Start;
|
||||
part.Size = part.Length * imagePlugin.GetSectorSize();
|
||||
|
||||
if((entry.dp_sid & 0x7F) == 0x44 &&
|
||||
@@ -116,13 +116,6 @@ namespace DiscImageChef.PartPlugins
|
||||
return partitions.Count > 0;
|
||||
}
|
||||
|
||||
static uint CHStoLBA(ushort cyl, byte head, byte sector)
|
||||
{
|
||||
#pragma warning disable IDE0004 // Remove Unnecessary Cast
|
||||
return (((uint)cyl * 16) + (uint)head) * 63 + (uint)sector - 1;
|
||||
#pragma warning restore IDE0004 // Remove Unnecessary Cast
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
struct PC98Table
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user