[AaruFormat] Retrieve image information about negative and overflow sectors.

This commit is contained in:
2025-10-24 02:26:34 +01:00
parent 8c38d8dfa5
commit d6a51b2834
3 changed files with 40 additions and 10 deletions

View File

@@ -251,6 +251,16 @@ public sealed partial class AaruFormat
[UnmanagedCallConv(CallConvs = [typeof(CallConvStdcall)])]
private static partial Status aaruf_get_readable_media_tags(IntPtr context, byte[] buffer, ref nuint length);
// AARU_EXPORT int32_t AARU_CALL aaruf_get_negative_sectors(const void *context, uint16_t *sectors);
[LibraryImport("libaaruformat", EntryPoint = "aaruf_get_negative_sectors", SetLastError = true)]
[UnmanagedCallConv(CallConvs = [typeof(CallConvStdcall)])]
private static partial Status aaruf_get_negative_sectors(IntPtr context, ref ushort sectors);
// AARU_EXPORT int32_t AARU_CALL aaruf_get_overflow_sectors(const void *context, uint16_t *sectors);
[LibraryImport("libaaruformat", EntryPoint = "aaruf_get_overflow_sectors", SetLastError = true)]
[UnmanagedCallConv(CallConvs = [typeof(CallConvStdcall)])]
private static partial Status aaruf_get_overflow_sectors(IntPtr context, ref ushort sectors);
#region IWritableOpticalImage Members
/// <inheritdoc />

View File

@@ -64,9 +64,8 @@ public sealed partial class AaruFormat
// Convert array of booleans to List of enums
for(nuint i = 0; i < sizet_length; i++)
{
if(sectorTagsBuffer[i] != 0) _imageInfo.ReadableSectorTags.Add((SectorTagType)i);
}
if(sectorTagsBuffer[i] != 0)
_imageInfo.ReadableSectorTags.Add((SectorTagType)i);
sizet_length = 0;
ret = aaruf_get_readable_media_tags(_context, null, ref sizet_length);
@@ -80,9 +79,8 @@ public sealed partial class AaruFormat
// Convert array of booleans to List of enums
for(nuint i = 0; i < sizet_length; i++)
{
if(mediaTagsBuffer[i] != 0) _imageInfo.ReadableMediaTags.Add((MediaTagType)i);
}
if(mediaTagsBuffer[i] != 0)
_imageInfo.ReadableMediaTags.Add((MediaTagType)i);
ret = aaruf_get_media_sequence(_context, out int sequence, out int lastSequence);
@@ -243,6 +241,16 @@ public sealed partial class AaruFormat
SetMetadataFromTags();
ushort negativeSectors = 0;
ret = aaruf_get_negative_sectors(_context, ref negativeSectors);
if(ret == Status.Ok) _imageInfo.NegativeSectors = negativeSectors;
ushort overflowSectors = 0;
ret = aaruf_get_overflow_sectors(_context, ref overflowSectors);
if(ret == Status.Ok) _imageInfo.OverflowSectors = overflowSectors;
return ErrorNumber.NoError;
}

View File

@@ -288,8 +288,9 @@ public sealed partial class AaruFormat
// Convert array of booleans to List of enums
for(nuint i = 0; i < sizet_length; i++)
if(sectorTagsBuffer[i] != 0)
_imageInfo.ReadableSectorTags.Add((SectorTagType)i);
{
if(sectorTagsBuffer[i] != 0) _imageInfo.ReadableSectorTags.Add((SectorTagType)i);
}
sizet_length = 0;
ret = aaruf_get_readable_media_tags(_context, null, ref sizet_length);
@@ -313,8 +314,9 @@ public sealed partial class AaruFormat
// Convert array of booleans to List of enums
for(nuint i = 0; i < sizet_length; i++)
if(mediaTagsBuffer[i] != 0)
_imageInfo.ReadableMediaTags.Add((MediaTagType)i);
{
if(mediaTagsBuffer[i] != 0) _imageInfo.ReadableMediaTags.Add((MediaTagType)i);
}
ret = aaruf_get_media_sequence(_context, out int sequence, out int lastSequence);
@@ -475,6 +477,16 @@ public sealed partial class AaruFormat
SetMetadataFromTags();
ushort infoNegativeSectors = 0;
ret = aaruf_get_negative_sectors(_context, ref infoNegativeSectors);
if(ret == Status.Ok) _imageInfo.NegativeSectors = infoNegativeSectors;
ushort infoOverflowSectors = 0;
ret = aaruf_get_overflow_sectors(_context, ref infoOverflowSectors);
if(ret == Status.Ok) _imageInfo.OverflowSectors = infoOverflowSectors;
return true;
}