This commit is contained in:
Lukas Höppner
2026-08-09 19:39:53 +02:00
parent 123a6e71b4
commit 93fc058120
3 changed files with 81 additions and 80 deletions
+43
View File
@@ -0,0 +1,43 @@
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)]
public delegate bool SdReadSectorDelegate(uint sectorIdx, IntPtr destinationBuffer, uint sectorCount);
[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_sector;
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();
}