Add support for negative sectors to read and write sector calls in images.

This commit is contained in:
2025-10-23 03:07:43 +01:00
parent 0c19fe1b11
commit 69738f5f1a
289 changed files with 2676 additions and 1352 deletions

View File

@@ -131,7 +131,7 @@ public sealed partial class DriDiskCopy
}
/// <inheritdoc />
public bool WriteSector(byte[] data, ulong sectorAddress, SectorStatus sectorStatus)
public bool WriteSector(byte[] data, ulong sectorAddress, bool negative, SectorStatus sectorStatus)
{
if(!IsWriting)
{
@@ -140,6 +140,13 @@ public sealed partial class DriDiskCopy
return false;
}
if(negative)
{
ErrorMessage = Localization.Unsupported_feature;
return false;
}
if(data.Length != _imageInfo.SectorSize)
{
ErrorMessage = Localization.Incorrect_data_size;
@@ -163,7 +170,7 @@ public sealed partial class DriDiskCopy
}
/// <inheritdoc />
public bool WriteSectors(byte[] data, ulong sectorAddress, uint length, SectorStatus[] sectorStatus)
public bool WriteSectors(byte[] data, ulong sectorAddress, bool negative, uint length, SectorStatus[] sectorStatus)
{
if(!IsWriting)
{
@@ -172,6 +179,13 @@ public sealed partial class DriDiskCopy
return false;
}
if(negative)
{
ErrorMessage = Localization.Unsupported_feature;
return false;
}
if(data.Length % _imageInfo.SectorSize != 0)
{
ErrorMessage = Localization.Incorrect_data_size;
@@ -195,7 +209,7 @@ public sealed partial class DriDiskCopy
}
/// <inheritdoc />
public bool WriteSectorLong(byte[] data, ulong sectorAddress, SectorStatus sectorStatus)
public bool WriteSectorLong(byte[] data, ulong sectorAddress, bool negative, SectorStatus sectorStatus)
{
ErrorMessage = Localization.Writing_sectors_with_tags_is_not_supported;
@@ -203,7 +217,8 @@ public sealed partial class DriDiskCopy
}
/// <inheritdoc />
public bool WriteSectorsLong(byte[] data, ulong sectorAddress, uint length, SectorStatus[] sectorStatus)
public bool WriteSectorsLong(byte[] data, ulong sectorAddress, bool negative, uint length,
SectorStatus[] sectorStatus)
{
ErrorMessage = Localization.Writing_sectors_with_tags_is_not_supported;
@@ -245,7 +260,7 @@ public sealed partial class DriDiskCopy
public bool SetGeometry(uint cylinders, uint heads, uint sectorsPerTrack) => true;
/// <inheritdoc />
public bool WriteSectorTag(byte[] data, ulong sectorAddress, SectorTagType tag)
public bool WriteSectorTag(byte[] data, ulong sectorAddress, bool negative, SectorTagType tag)
{
ErrorMessage = Localization.Unsupported_feature;
@@ -253,7 +268,7 @@ public sealed partial class DriDiskCopy
}
/// <inheritdoc />
public bool WriteSectorsTag(byte[] data, ulong sectorAddress, uint length, SectorTagType tag)
public bool WriteSectorsTag(byte[] data, ulong sectorAddress, bool negative, uint length, SectorTagType tag)
{
ErrorMessage = Localization.Unsupported_feature;