hook up mGBA bios

This commit is contained in:
goyuken 2015-06-05 00:12:12 +00:00
parent 6d5d720d55
commit 43c7483ef6
2 changed files with 16 additions and 4 deletions

View File

@ -16,7 +16,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBA
public static extern void BizDestroy(IntPtr ctx);
[DllImport(dll, CallingConvention = cc)]
public static extern IntPtr BizCreate();
public static extern IntPtr BizCreate(byte[] bios);
[DllImport(dll, CallingConvention = cc)]
public static extern void BizReset(IntPtr ctx);

View File

@ -21,14 +21,26 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBA
ServiceProvider = ser;
CoreComm = comm;
core = LibmGBA.BizCreate();
byte[] bios = null;
if (true) // TODO: config me
{
bios = comm.CoreFileProvider.GetFirmware("GBA", "Bios", true);
}
if (bios != null && bios.Length != 16384)
{
throw new InvalidOperationException("BIOS must be exactly 16384 bytes!");
}
core = LibmGBA.BizCreate(bios);
if (core == IntPtr.Zero)
throw new InvalidOperationException("BizCreate() returned NULL!");
{
throw new InvalidOperationException("BizCreate() returned NULL! Bad BIOS?");
}
try
{
if (!LibmGBA.BizLoad(core, file, file.Length))
{
throw new InvalidOperationException("BizLoad() returned FALSE!");
throw new InvalidOperationException("BizLoad() returned FALSE! Bad ROM?");
}
}