[AaruFormat] On Open retrieve geometry from library.

This commit is contained in:
2025-10-11 20:39:03 +01:00
parent cc7d6e1057
commit 6f40b28afd
2 changed files with 16 additions and 1 deletions

View File

@@ -79,4 +79,11 @@ public sealed partial class AaruFormat
[LibraryImport("libaaruformat", EntryPoint = "aaruf_get_drive_firmware_revision", SetLastError = true)]
[UnmanagedCallConv(CallConvs = [typeof(CallConvStdcall)])]
private static partial Status aaruf_get_drive_firmware_revision(IntPtr context, byte[] buffer, ref int length);
// AARU_EXPORT int32_t AARU_CALL aaruf_get_geometry(const void *context, uint32_t *cylinders, uint32_t *heads,
// uint32_t *sectors_per_track)
[LibraryImport("libaaruformat", EntryPoint = "aaruf_get_geometry", SetLastError = true)]
[UnmanagedCallConv(CallConvs = [typeof(CallConvStdcall)])]
private static partial Status aaruf_get_geometry(IntPtr context, out uint cylinders, out uint heads,
out uint sectorsPerTrack);
}

View File

@@ -201,7 +201,15 @@ public sealed partial class AaruFormat
_imageInfo.DriveFirmwareRevision = StringHandlers.CToString(buffer, Encoding.Unicode, true);
}
// TODO: geometry
ret = aaruf_get_geometry(_context, out uint cylinders, out uint heads, out uint sectorsPerTrack);
if(ret == Status.Ok)
{
_imageInfo.Cylinders = cylinders;
_imageInfo.Heads = heads;
_imageInfo.SectorsPerTrack = sectorsPerTrack;
}
// TODO: metadata from media tags
return ErrorNumber.NoError;