Work around mono marshalling issue

Fixes #2116, but it'd be nice if mono fixed it too
This commit is contained in:
nattthebear 2020-06-12 15:22:46 -04:00
parent f21132a2ac
commit 25a5449a48
2 changed files with 10 additions and 3 deletions

View File

@ -176,8 +176,13 @@ namespace BizHawk.Emulation.Cores.Waterbox
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 101)]
public Track[] Tracks;
}
/// <summary>
/// Callback to receive a disk TOC
/// </summary>
/// <param name="disk"></param>
/// <param name="dest">Deposit a LibNymaCore.TOC here</param>
[UnmanagedFunctionPointer(CC)]
public delegate void CDTOCCallback(int disk, [In, Out]TOC toc);
public delegate void CDTOCCallback(int disk, IntPtr dest);
[UnmanagedFunctionPointer(CC)]
public delegate void CDSectorCallback(int disk, int lba, IntPtr dest);
[BizImport(CC)]

View File

@ -32,9 +32,11 @@ namespace BizHawk.Emulation.Cores.Waterbox
}
}
private void CDTOCCallback(int disk, [In, Out]LibNymaCore.TOC t)
private void CDTOCCallback(int disk, IntPtr dest)
{
SetupTOC(t, _disks[disk].TOC);
var toc = new LibNymaCore.TOC { Tracks = new LibNymaCore.TOC.Track[101] };
SetupTOC(toc, _disks[disk].TOC);
Marshal.StructureToPtr(toc, dest, false);
}
private void CDSectorCallback(int disk, int lba, IntPtr dest)
{