Use new little endian marshaller on media images.

This commit is contained in:
2019-02-27 23:57:52 +00:00
parent 45be793491
commit 0fe8e3c11f
54 changed files with 320 additions and 705 deletions

View File

@@ -30,11 +30,10 @@
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
using System;
using System.IO;
using System.Runtime.InteropServices;
using DiscImageChef.CommonTypes.Interfaces;
using DiscImageChef.Console;
using DiscImageChef.Helpers;
namespace DiscImageChef.DiscImages
{
@@ -50,10 +49,7 @@ namespace DiscImageChef.DiscImages
stream.Seek(0, SeekOrigin.Begin);
stream.Read(buffer, 0, buffer.Length);
IntPtr ftrPtr = Marshal.AllocHGlobal(buffer.Length);
Marshal.Copy(buffer, 0, ftrPtr, buffer.Length);
HdkHeader tmpHeader = (HdkHeader)Marshal.PtrToStructure(ftrPtr, typeof(HdkHeader));
Marshal.FreeHGlobal(ftrPtr);
HdkHeader tmpHeader = Marshal.ByteArrayToStructureLittleEndian<HdkHeader>(buffer);
DicConsole.DebugWriteLine("MAXI Disk plugin", "tmp_header.unknown = {0}", tmpHeader.unknown);
DicConsole.DebugWriteLine("MAXI Disk plugin", "tmp_header.diskType = {0}", tmpHeader.diskType);