2015-06-04 02:04:42 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Runtime.InteropServices;
|
|
|
|
|
using BizHawk.Emulation.Common;
|
|
|
|
|
|
|
|
|
|
namespace BizHawk.Emulation.Cores.Nintendo.GBA
|
|
|
|
|
{
|
|
|
|
|
public static class LibmGBA
|
|
|
|
|
{
|
|
|
|
|
const string dll = "mgba.dll";
|
|
|
|
|
const CallingConvention cc = CallingConvention.Cdecl;
|
|
|
|
|
|
2015-06-05 00:43:41 +00:00
|
|
|
|
[DllImport(dll, CallingConvention = cc)]
|
2015-06-04 02:04:42 +00:00
|
|
|
|
public static extern void BizDestroy(IntPtr ctx);
|
|
|
|
|
|
|
|
|
|
[DllImport(dll, CallingConvention = cc)]
|
2015-06-05 00:12:12 +00:00
|
|
|
|
public static extern IntPtr BizCreate(byte[] bios);
|
2015-06-04 02:04:42 +00:00
|
|
|
|
|
|
|
|
|
[DllImport(dll, CallingConvention = cc)]
|
|
|
|
|
public static extern void BizReset(IntPtr ctx);
|
|
|
|
|
|
2015-06-13 18:01:26 +00:00
|
|
|
|
[DllImport(dll, CallingConvention = cc)]
|
|
|
|
|
public static extern void BizSkipBios(IntPtr ctx);
|
|
|
|
|
|
2015-06-04 02:04:42 +00:00
|
|
|
|
[DllImport(dll, CallingConvention = cc)]
|
|
|
|
|
public static extern bool BizLoad(IntPtr ctx, byte[] data, int length);
|
|
|
|
|
|
|
|
|
|
[DllImport(dll, CallingConvention = cc)]
|
2015-06-10 01:19:09 +00:00
|
|
|
|
public static extern bool BizAdvance(IntPtr ctx, LibVBANext.Buttons keys, int[] vbuff, ref int nsamp, short[] sbuff,
|
2015-06-06 22:23:42 +00:00
|
|
|
|
long time, short gyrox, short gyroy, short gyroz, byte luma);
|
2015-06-04 02:04:42 +00:00
|
|
|
|
|
2015-06-05 00:43:41 +00:00
|
|
|
|
[StructLayout(LayoutKind.Sequential)]
|
|
|
|
|
public class MemoryAreas
|
|
|
|
|
{
|
|
|
|
|
public IntPtr bios;
|
|
|
|
|
public IntPtr wram;
|
|
|
|
|
public IntPtr iwram;
|
|
|
|
|
public IntPtr mmio;
|
|
|
|
|
public IntPtr palram;
|
|
|
|
|
public IntPtr vram;
|
|
|
|
|
public IntPtr oam;
|
|
|
|
|
public IntPtr rom;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[DllImport(dll, CallingConvention = cc)]
|
|
|
|
|
public static extern void BizGetMemoryAreas(IntPtr ctx, [Out]MemoryAreas dst);
|
2015-06-06 12:49:31 +00:00
|
|
|
|
|
|
|
|
|
[DllImport(dll, CallingConvention = cc)]
|
|
|
|
|
public static extern int BizGetSaveRamSize(IntPtr ctx);
|
|
|
|
|
[DllImport(dll, CallingConvention = cc)]
|
|
|
|
|
public static extern void BizGetSaveRam(IntPtr ctx, byte[] dest);
|
|
|
|
|
[DllImport(dll, CallingConvention = cc)]
|
|
|
|
|
public static extern void BizPutSaveRam(IntPtr ctx, byte[] src);
|
2015-06-06 17:34:19 +00:00
|
|
|
|
|
|
|
|
|
[DllImport(dll, CallingConvention = cc)]
|
|
|
|
|
public static extern int BizGetStateSize();
|
|
|
|
|
[DllImport(dll, CallingConvention = cc)]
|
|
|
|
|
public static extern void BizGetState(IntPtr ctx, byte[] dest);
|
|
|
|
|
[DllImport(dll, CallingConvention = cc)]
|
|
|
|
|
public static extern void BizPutState(IntPtr ctx, byte[] src);
|
2015-06-04 02:04:42 +00:00
|
|
|
|
}
|
|
|
|
|
}
|