[AaruFormat] Implement SetGeometry.

This commit is contained in:
2025-10-12 11:24:41 +01:00
parent c300058d82
commit 1c3e1febb2
3 changed files with 19 additions and 7 deletions

View File

@@ -1,13 +1,11 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Aaru" type="DotNetProject" factoryName=".NET Project">
<option name="EXE_PATH" value="$PROJECT_DIR$/Aaru/bin/Debug/net10.0/linux-x64/aaru" />
<option name="PROGRAM_PARAMETERS" value="m scan /dev/sdb" />
<option name="WORKING_DIRECTORY" value="/mnt/AaruTests/Media image formats/AaruFormat/V1" />
<option name="EXE_PATH" value="$PROJECT_DIR$/Aaru/bin/Debug/net10.0/osx-arm64/aaru" />
<option name="PROGRAM_PARAMETERS" value="i info mf2hd.aif" />
<option name="WORKING_DIRECTORY" value="/Volumes/AaruTests/Media image formats/AaruFormat/V2" />
<option name="PASS_PARENT_ENVS" value="1" />
<option name="USE_EXTERNAL_CONSOLE" value="0" />
<option name="ENV_FILE_PATHS" value="" />
<option name="REDIRECT_INPUT_PATH" value="" />
<option name="PTY_MODE" value="Auto" />
<option name="MIXED_MODE_DEBUG" value="0" />
<option name="USE_MONO" value="0" />
<option name="RUNTIME_ARGUMENTS" value="" />

View File

@@ -29,6 +29,16 @@ public sealed partial class AaruFormat
return aaruf_set_aaru_json_metadata(_context, buffer, (ulong)buffer.Length) == Status.Ok;
}
/// <inheritdoc />
public bool SetGeometry(uint cylinders, uint heads, uint sectorsPerTrack)
{
_imageInfo.Cylinders = cylinders;
_imageInfo.Heads = heads;
_imageInfo.SectorsPerTrack = sectorsPerTrack;
return aaruf_set_geometry(_context, cylinders, heads, sectorsPerTrack) == Status.Ok;
}
#endregion
// AARU_EXPORT int32_t AARU_CALL aaruf_get_image_info(const void *context, ImageInfo *image_info)
@@ -116,4 +126,10 @@ public sealed partial class AaruFormat
[LibraryImport("libaaruformat", EntryPoint = "aaruf_set_aaru_json_metadata", SetLastError = true)]
[UnmanagedCallConv(CallConvs = [typeof(CallConvStdcall)])]
private static partial Status aaruf_set_aaru_json_metadata(IntPtr context, [In] byte[] data, ulong length);
// AARU_EXPORT int32_t AARU_CALL aaruf_set_geometry(void *context, const uint32_t cylinders, const uint32_t heads,
// const uint32_t sectors_per_track)
[LibraryImport("libaaruformat", EntryPoint = "aaruf_set_geometry", SetLastError = true)]
[UnmanagedCallConv(CallConvs = [typeof(CallConvStdcall)])]
private static partial Status aaruf_set_geometry(IntPtr context, uint cylinders, uint heads, uint sectorsPerTrack);
}

View File

@@ -32,8 +32,6 @@ public sealed partial class AaruFormat
/// <inheritdoc />
public bool SetImageInfo(ImageInfo imageInfo) => throw new NotImplementedException();
/// <inheritdoc />
public bool SetGeometry(uint cylinders, uint heads, uint sectorsPerTrack) => throw new NotImplementedException();
/// <inheritdoc />
public bool WriteMediaTag(byte[] data, MediaTagType tag) => throw new NotImplementedException();