Add files via upload
This commit is contained in:
parent
0cc5ec4fd3
commit
627b666d3e
|
@ -95,8 +95,11 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
|
|||
{
|
||||
if (GambatteState != IntPtr.Zero)
|
||||
{
|
||||
Console.WriteLine("disposing");
|
||||
LibGambatte.gambatte_destroy(GambatteState);
|
||||
Console.WriteLine("step2");
|
||||
GambatteState = IntPtr.Zero;
|
||||
Console.WriteLine("disposed");
|
||||
}
|
||||
|
||||
DisposeSound();
|
||||
|
|
|
@ -80,6 +80,11 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
|
|||
|
||||
public class GambatteSyncSettings
|
||||
{
|
||||
[DisplayName("Use System BIOS")]
|
||||
[Description("Boots game using system BIOS. Should be used for TASing")]
|
||||
[DefaultValue(false)]
|
||||
public bool EnableBIOS { get; set; }
|
||||
|
||||
[DisplayName("Force DMG Mode")]
|
||||
[Description("Force the game to run on DMG hardware, even if it's detected as a CGB game. Relevant for games that are \"CGB Enhanced\" but do not require CGB.")]
|
||||
[DefaultValue(false)]
|
||||
|
|
|
@ -52,6 +52,23 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
|
|||
throw new InvalidOperationException("gambatte_create() returned null???");
|
||||
}
|
||||
|
||||
Console.WriteLine(game.System);
|
||||
|
||||
byte[] BiosRom;
|
||||
|
||||
if (game.System == "GB")
|
||||
{
|
||||
BiosRom = new byte[256];
|
||||
BiosRom = comm.CoreFileProvider.GetFirmware("GB", "World", false);
|
||||
}
|
||||
else
|
||||
{
|
||||
BiosRom = new byte[2304];
|
||||
BiosRom = comm.CoreFileProvider.GetFirmware("GBC", "World", false);
|
||||
}
|
||||
|
||||
int bios_length = BiosRom == null ? 0 : BiosRom.Length;
|
||||
|
||||
try
|
||||
{
|
||||
_syncSettings = (GambatteSyncSettings)syncSettings ?? new GambatteSyncSettings();
|
||||
|
@ -63,6 +80,18 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
|
|||
|
||||
LibGambatte.LoadFlags flags = 0;
|
||||
|
||||
if (_syncSettings.EnableBIOS && BiosRom == null)
|
||||
{
|
||||
Console.WriteLine("Warning: BIOS not found, loading without BIOS");
|
||||
bios_length = 0;
|
||||
}
|
||||
|
||||
// to disable BIOS loading into gambatte, just set bios_length to 0
|
||||
if (!_syncSettings.EnableBIOS)
|
||||
{
|
||||
bios_length = 0;
|
||||
}
|
||||
|
||||
if (_syncSettings.ForceDMG)
|
||||
{
|
||||
flags |= LibGambatte.LoadFlags.FORCE_DMG;
|
||||
|
@ -78,7 +107,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
|
|||
flags |= LibGambatte.LoadFlags.MULTICART_COMPAT;
|
||||
}
|
||||
|
||||
if (LibGambatte.gambatte_load(GambatteState, file, (uint)file.Length, GetCurrentTime(), flags) != 0)
|
||||
if (LibGambatte.gambatte_load(GambatteState, file, (uint)file.Length, BiosRom, (uint)bios_length, GetCurrentTime(), flags) != 0)
|
||||
{
|
||||
throw new InvalidOperationException("gambatte_load() returned non-zero (is this not a gb or gbc rom?)");
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
|
|||
/// <param name="flags">ORed combination of LoadFlags.</param>
|
||||
/// <returns>0 on success, negative value on failure.</returns>
|
||||
[DllImport("libgambatte.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int gambatte_load(IntPtr core, byte[] romdata, uint length, long now, LoadFlags flags);
|
||||
public static extern int gambatte_load(IntPtr core, byte[] romdata, uint length, byte[] biosdata, uint bioslength, long now, LoadFlags flags);
|
||||
|
||||
/// <summary>
|
||||
/// Emulates until at least 'samples' stereo sound samples are produced in the supplied buffer,
|
||||
|
|
Loading…
Reference in New Issue