Files
Nova64/simulator/Nova64Core.cs
T

48 lines
1.8 KiB
C#

using System.Runtime.InteropServices;
internal static class Nova64Core
{
private const string LibName = "nova64_core";
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void DisplayFlushDelegate(IntPtr buffer, ushort width, ushort height);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void AudioOutputDelegate(IntPtr samples, uint count);
[UnmanagedFunctionPointer(CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
public delegate int SdReadFileDelegate(uint slotIdx, string filePath, IntPtr destinationBuffer, uint destinationLength);
[UnmanagedFunctionPointer(CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
public delegate int SdGetFileSizeDelegate(uint slotIdx, string filePath);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void CartridgeStatusDelegate(uint slotIdx, bool isInserted);
[UnmanagedFunctionPointer(CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
public delegate void LogMessageDelegate([MarshalAs(UnmanagedType.LPStr)] string message);
[StructLayout(LayoutKind.Sequential)]
public struct Nova64IoInterface
{
public IntPtr display_flush;
public IntPtr audio_output;
public IntPtr sd_read_file;
public IntPtr sd_get_file_size;
public IntPtr cartridge_status;
public IntPtr log_message;
}
[DllImport(LibName, CallingConvention = CallingConvention.Cdecl)]
public static extern bool nova64_init(IntPtr io_interface);
[DllImport(LibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int nova64_main();
[DllImport(LibName, CallingConvention = CallingConvention.Cdecl)]
public static extern bool nova64_shutdown();
[DllImport(LibName, CallingConvention = CallingConvention.Cdecl)]
public static extern uint nova64_get_version();
}