scaffolding for framebuffer functions
This commit is contained in:
+81
-5
@@ -1,9 +1,75 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
internal static class Nova64Core
|
||||
internal static class Nova64
|
||||
{
|
||||
private const string LibName = "nova64_core";
|
||||
|
||||
/* ========================================================================== */
|
||||
/* Enums */
|
||||
/* ========================================================================== */
|
||||
|
||||
[Flags]
|
||||
public enum Nova64Transform : uint
|
||||
{
|
||||
None = 0,
|
||||
FlipH = 1 << 0,
|
||||
FlipV = 1 << 1,
|
||||
Rot90 = 1 << 2,
|
||||
Rot180 = 1 << 3,
|
||||
Rot270 = 1 << 4
|
||||
}
|
||||
|
||||
/* ========================================================================== */
|
||||
/* PPU Delegates */
|
||||
/* ========================================================================== */
|
||||
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||
public delegate void PpuFillRectDelegate(IntPtr dst, uint dstStride, int x, int y, int w, int h, ushort color);
|
||||
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||
public delegate void PpuBlitDelegate(IntPtr src, uint srcStride, IntPtr dst, uint dstStride, int srcX, int srcY, int dstX, int dstY, int w, int h);
|
||||
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||
public delegate void PpuBlitColorKeyDelegate(IntPtr src, uint srcStride, IntPtr dst, uint dstStride, int srcX, int srcY, int dstX, int dstY, int w, int h, ushort keyColor);
|
||||
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||
public delegate void PpuBlendDelegate(IntPtr src, uint srcStride, IntPtr dst, uint dstStride, int srcX, int srcY, int dstX, int dstY, int w, int h, byte globalAlpha);
|
||||
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||
public delegate void PpuBlitTransformDelegate(IntPtr src, uint srcStride, IntPtr dst, uint dstStride, int srcX, int srcY, int dstX, int dstY, int w, int h, Nova64Transform transform);
|
||||
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||
public delegate void PpuBlitScaleDelegate(IntPtr src, uint srcStride, int srcW, int srcH, IntPtr dst, uint dstStride, int dstX, int dstY, int dstW, int dstH);
|
||||
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||
public delegate void PpuWaitIdleDelegate();
|
||||
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public delegate bool PpuIsBusyDelegate();
|
||||
|
||||
/* ========================================================================== */
|
||||
/* PPU Interface Struct */
|
||||
/* ========================================================================== */
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct Nova64PpuInterface
|
||||
{
|
||||
public IntPtr fill_rect;
|
||||
public IntPtr blit;
|
||||
public IntPtr blit_colorkey;
|
||||
public IntPtr blend;
|
||||
public IntPtr blit_transform;
|
||||
public IntPtr blit_scale;
|
||||
public IntPtr wait_idle;
|
||||
public IntPtr is_busy;
|
||||
}
|
||||
|
||||
/* ========================================================================== */
|
||||
/* I/O Delegates */
|
||||
/* ========================================================================== */
|
||||
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||
public delegate void DisplayFlushDelegate(IntPtr buffer, ushort width, ushort height);
|
||||
|
||||
@@ -17,15 +83,18 @@ internal static class Nova64Core
|
||||
public delegate int SdGetFileSizeDelegate(uint slotIdx, string filePath);
|
||||
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||
public delegate void CartridgeStatusDelegate(uint slotIdx, bool isInserted);
|
||||
public delegate void CartridgeStatusDelegate(uint slotIdx, [MarshalAs(UnmanagedType.I1)] bool isInserted);
|
||||
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
|
||||
public delegate void LogMessageDelegate([MarshalAs(UnmanagedType.LPStr)] string message);
|
||||
|
||||
/* ========================================================================== */
|
||||
/* I/O Interface Struct */
|
||||
/* ========================================================================== */
|
||||
|
||||
[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;
|
||||
@@ -33,18 +102,25 @@ internal static class Nova64Core
|
||||
public IntPtr log_message;
|
||||
}
|
||||
|
||||
/* ========================================================================== */
|
||||
/* Native Imports */
|
||||
/* ========================================================================== */
|
||||
|
||||
[DllImport(LibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern bool nova64_init(IntPtr io_interface);
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool nova64_init(IntPtr io_interface, IntPtr ppu_interface);
|
||||
|
||||
[DllImport(LibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int nova64_main();
|
||||
|
||||
[DllImport(LibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool nova64_shutdown();
|
||||
|
||||
[DllImport(LibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool nova64_is_finalized();
|
||||
|
||||
[DllImport(LibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern uint nova64_get_version();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user