mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Use new marshaller in Anex86 disk images.
This commit is contained in:
@@ -49,7 +49,7 @@ namespace DiscImageChef.DiscImages
|
||||
byte[] hdrB = new byte[Marshal.SizeOf<Anex86Header>()];
|
||||
stream.Read(hdrB, 0, hdrB.Length);
|
||||
|
||||
fdihdr = Marshal.ByteArrayToStructureLittleEndian<Anex86Header>(hdrB);
|
||||
fdihdr = Marshal.SpanToStructureLittleEndian<Anex86Header>(hdrB);
|
||||
|
||||
DicConsole.DebugWriteLine("Anex86 plugin", "fdihdr.unknown = {0}", fdihdr.unknown);
|
||||
DicConsole.DebugWriteLine("Anex86 plugin", "fdihdr.hddtype = {0}", fdihdr.hddtype);
|
||||
|
||||
@@ -52,7 +52,7 @@ namespace DiscImageChef.DiscImages
|
||||
byte[] hdrB = new byte[Marshal.SizeOf<Anex86Header>()];
|
||||
stream.Read(hdrB, 0, hdrB.Length);
|
||||
|
||||
fdihdr = Marshal.ByteArrayToStructureLittleEndian<Anex86Header>(hdrB);
|
||||
fdihdr = Marshal.SpanToStructureLittleEndian<Anex86Header>(hdrB);
|
||||
|
||||
imageInfo.MediaType = Geometry.GetMediaType(((ushort)fdihdr.cylinders, (byte)fdihdr.heads,
|
||||
(ushort)fdihdr.spt, (uint)fdihdr.bps, MediaEncoding.MFM,
|
||||
|
||||
@@ -30,15 +30,15 @@
|
||||
// Copyright © 2011-2019 Natalia Portillo
|
||||
// ****************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using DiscImageChef.CommonTypes;
|
||||
using DiscImageChef.CommonTypes.Enums;
|
||||
using DiscImageChef.CommonTypes.Structs;
|
||||
using DiscImageChef.Helpers;
|
||||
using Schemas;
|
||||
using Marshal = DiscImageChef.Helpers.Marshal;
|
||||
|
||||
namespace DiscImageChef.DiscImages
|
||||
{
|
||||
@@ -187,11 +187,8 @@ namespace DiscImageChef.DiscImages
|
||||
}
|
||||
}
|
||||
|
||||
byte[] hdr = new byte[Marshal.SizeOf<Anex86Header>()];
|
||||
IntPtr hdrPtr = System.Runtime.InteropServices.Marshal.AllocHGlobal(Marshal.SizeOf<Anex86Header>());
|
||||
System.Runtime.InteropServices.Marshal.StructureToPtr(fdihdr, hdrPtr, true);
|
||||
System.Runtime.InteropServices.Marshal.Copy(hdrPtr, hdr, 0, hdr.Length);
|
||||
System.Runtime.InteropServices.Marshal.FreeHGlobal(hdrPtr);
|
||||
byte[] hdr = new byte[Marshal.SizeOf<Anex86Header>()];
|
||||
MemoryMarshal.Write(hdr, ref fdihdr);
|
||||
|
||||
writingStream.Seek(0, SeekOrigin.Begin);
|
||||
writingStream.Write(hdr, 0, hdr.Length);
|
||||
|
||||
Reference in New Issue
Block a user