mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Use new little endian marshaller on decoders.
This commit is contained in:
1
.idea/.idea.DiscImageChef/.idea/contentModel.xml
generated
1
.idea/.idea.DiscImageChef/.idea/contentModel.xml
generated
@@ -2133,6 +2133,7 @@
|
||||
<e p="VTOC.cs" t="Include" />
|
||||
</e>
|
||||
<e p="Program.cs" t="Include" />
|
||||
<e p="TestResult.xml" t="Include" />
|
||||
<e p="bin" t="ExcludeRecursive" />
|
||||
<e p="obj" t="ExcludeRecursive">
|
||||
<e p="Debug" t="Include">
|
||||
|
||||
@@ -37,6 +37,7 @@ using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using DiscImageChef.Console;
|
||||
using DiscImageChef.Decoders.SCSI;
|
||||
using Marshal = DiscImageChef.Helpers.Marshal;
|
||||
|
||||
namespace DiscImageChef.Decoders.ATA
|
||||
{
|
||||
@@ -1863,10 +1864,7 @@ namespace DiscImageChef.Decoders.ATA
|
||||
return null;
|
||||
}
|
||||
|
||||
IntPtr ptr = Marshal.AllocHGlobal(512);
|
||||
Marshal.Copy(IdentifyDeviceResponse, 0, ptr, 512);
|
||||
IdentifyDevice ATAID = (IdentifyDevice)Marshal.PtrToStructure(ptr, typeof(IdentifyDevice));
|
||||
Marshal.FreeHGlobal(ptr);
|
||||
IdentifyDevice ATAID = Marshal.ByteArrayToStructureLittleEndian<IdentifyDevice>(IdentifyDeviceResponse);
|
||||
|
||||
ATAID.WWN = DescrambleWWN(ATAID.WWN);
|
||||
ATAID.WWNExtension = DescrambleWWN(ATAID.WWNExtension);
|
||||
@@ -1891,10 +1889,10 @@ namespace DiscImageChef.Decoders.ATA
|
||||
ataId.WWNExtension = DescrambleWWN(ataId.WWNExtension);
|
||||
|
||||
byte[] buf = new byte[512];
|
||||
IntPtr ptr = Marshal.AllocHGlobal(512);
|
||||
Marshal.StructureToPtr(ataId, ptr, false);
|
||||
Marshal.Copy(ptr, buf, 0, 512);
|
||||
Marshal.FreeHGlobal(ptr);
|
||||
IntPtr ptr = System.Runtime.InteropServices.Marshal.AllocHGlobal(512);
|
||||
System.Runtime.InteropServices.Marshal.StructureToPtr(ataId, ptr, false);
|
||||
System.Runtime.InteropServices.Marshal.Copy(ptr, buf, 0, 512);
|
||||
System.Runtime.InteropServices.Marshal.FreeHGlobal(ptr);
|
||||
|
||||
byte[] str = ScrambleATAString(ataId.SerialNumber, 20);
|
||||
Array.Copy(str, 0, buf, 10 * 2, 20);
|
||||
|
||||
@@ -36,6 +36,7 @@ using System.Globalization;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using DiscImageChef.Console;
|
||||
using Marshal = DiscImageChef.Helpers.Marshal;
|
||||
|
||||
namespace DiscImageChef.Decoders.Sega
|
||||
{
|
||||
@@ -134,10 +135,7 @@ namespace DiscImageChef.Decoders.Sega
|
||||
|
||||
if(ipbin_sector.Length < 512) return null;
|
||||
|
||||
IntPtr ptr = Marshal.AllocHGlobal(512);
|
||||
Marshal.Copy(ipbin_sector, 0, ptr, 512);
|
||||
IPBin ipbin = (IPBin)Marshal.PtrToStructure(ptr, typeof(IPBin));
|
||||
Marshal.FreeHGlobal(ptr);
|
||||
IPBin ipbin = Marshal.ByteArrayToStructureLittleEndian<IPBin>(ipbin_sector);
|
||||
|
||||
DicConsole.DebugWriteLine("SegaCD IP.BIN Decoder", "segacd_ipbin.volume_name = \"{0}\"",
|
||||
Encoding.ASCII.GetString(ipbin.volume_name));
|
||||
|
||||
@@ -36,6 +36,7 @@ using System.Globalization;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using DiscImageChef.Console;
|
||||
using Marshal = DiscImageChef.Helpers.Marshal;
|
||||
|
||||
namespace DiscImageChef.Decoders.Sega
|
||||
{
|
||||
@@ -109,10 +110,7 @@ namespace DiscImageChef.Decoders.Sega
|
||||
|
||||
if(ipbin_sector.Length < 512) return null;
|
||||
|
||||
IntPtr ptr = Marshal.AllocHGlobal(512);
|
||||
Marshal.Copy(ipbin_sector, 0, ptr, 512);
|
||||
IPBin ipbin = (IPBin)Marshal.PtrToStructure(ptr, typeof(IPBin));
|
||||
Marshal.FreeHGlobal(ptr);
|
||||
IPBin ipbin = Marshal.ByteArrayToStructureLittleEndian<IPBin>(ipbin_sector);
|
||||
|
||||
DicConsole.DebugWriteLine("Dreamcast IP.BIN Decoder", "dreamcast_ipbin.maker_id = \"{0}\"",
|
||||
Encoding.ASCII.GetString(ipbin.maker_id));
|
||||
|
||||
@@ -36,6 +36,7 @@ using System.Globalization;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using DiscImageChef.Console;
|
||||
using Marshal = DiscImageChef.Helpers.Marshal;
|
||||
|
||||
namespace DiscImageChef.Decoders.Sega
|
||||
{
|
||||
@@ -91,10 +92,7 @@ namespace DiscImageChef.Decoders.Sega
|
||||
|
||||
if(ipbin_sector.Length < 512) return null;
|
||||
|
||||
IntPtr ptr = Marshal.AllocHGlobal(512);
|
||||
Marshal.Copy(ipbin_sector, 0, ptr, 512);
|
||||
IPBin ipbin = (IPBin)Marshal.PtrToStructure(ptr, typeof(IPBin));
|
||||
Marshal.FreeHGlobal(ptr);
|
||||
IPBin ipbin = Marshal.ByteArrayToStructureLittleEndian<IPBin>(ipbin_sector);
|
||||
|
||||
DicConsole.DebugWriteLine("Saturn IP.BIN Decoder", "saturn_ipbin.maker_id = \"{0}\"",
|
||||
Encoding.ASCII.GetString(ipbin.maker_id));
|
||||
|
||||
Reference in New Issue
Block a user