using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Runtime.InteropServices; namespace BizHawk.Emulation.Consoles.Sega.Saturn { public static class LibYabause { /// /// A,B,C,Start,DPad /// public enum Buttons1 : byte { B = 0x01, C = 0x02, A = 0x04, S = 0x08, U = 0x10, D = 0x20, L = 0x40, R = 0x80 } /// /// X,Y,Z,Shoulders /// public enum Buttons2 : byte { L = 0x08, Z = 0x10, Y = 0x20, X = 0x40, R = 0x80 } /// /// /// /// player1 /// player1 /// player2 /// player2 [DllImport("libyabause.dll", CallingConvention = CallingConvention.Cdecl)] public static extern void libyabause_setpads(Buttons1 p11, Buttons2 p12, Buttons1 p21, Buttons2 p22); /// /// set video buffer /// /// 704x512x32bit, should persist over time [DllImport("libyabause.dll", CallingConvention = CallingConvention.Cdecl)] public static extern void libyabause_setvidbuff(IntPtr buff); /// /// /// /// persistent location of s16 interleaved [DllImport("libyabause.dll", CallingConvention = CallingConvention.Cdecl)] public static extern void libyabause_setsndbuff(IntPtr buff); /// /// soft reset, or something like that /// [DllImport("libyabause.dll", CallingConvention = CallingConvention.Cdecl)] public static extern void libyabause_softreset(); /// /// /// /// width of framebuffer /// height of framebuffer /// number of sample pairs produced /// true if lagged [DllImport("libyabause.dll", CallingConvention = CallingConvention.Cdecl)] public static extern bool libyabause_frameadvance(out int w, out int h, out int nsamp); [DllImport("libyabause.dll", CallingConvention = CallingConvention.Cdecl)] public static extern void libyabause_deinit(); /// /// /// /// cd interface. struct need not persist after call, but the function pointers better /// path to bios, pass null to use built in bios emulation /// [DllImport("libyabause.dll", CallingConvention = CallingConvention.Cdecl)] public static extern bool libyabause_init(ref CDInterface intf, string biosfn); public struct CDInterface { public int DontTouch; public IntPtr DontTouch2; /// /// init cd functions /// /// /// 0 on success, -1 on failure [UnmanagedFunctionPointer(CallingConvention.Cdecl)] public delegate int Init(string unused); public Init InitFunc; /// /// deinit cd functions /// [UnmanagedFunctionPointer(CallingConvention.Cdecl)] public delegate void DeInit(); public DeInit DeInitFunc; /// /// 0 = cd present, spinning /// 1 = cd present, not spinning /// 2 = no cd /// 3 = tray open /// /// [UnmanagedFunctionPointer(CallingConvention.Cdecl)] public delegate int GetStatus(); public GetStatus GetStatusFunc; /// /// read all TOC entries /// /// place to copy to /// number of bytes written. should be 408 [UnmanagedFunctionPointer(CallingConvention.Cdecl)] public delegate int ReadTOC(IntPtr dest); public ReadTOC ReadTOCFunc; /// /// read a sector, should be 2352 bytes /// /// /// /// [UnmanagedFunctionPointer(CallingConvention.Cdecl)] public delegate int ReadSectorFAD(int FAD, IntPtr dest); public ReadSectorFAD ReadSectorFADFunc; /// /// hint the next sector, for async loading /// /// [UnmanagedFunctionPointer(CallingConvention.Cdecl)] public delegate void ReadAheadFAD(int FAD); public ReadAheadFAD ReadAheadFADFunc; } } }