Fix gb roms running without bios
This commit is contained in:
parent
81628bf109
commit
ad16294b11
|
@ -88,8 +88,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
|
|||
|
||||
public class GambatteSyncSettings
|
||||
{
|
||||
[DisplayName("Enable BIOS: WARNING: File must exist!")]
|
||||
[Description("Boots game using system BIOS. Should be used for TASing")]
|
||||
[DisplayName("Enable official Nintendo BIOS")]
|
||||
[Description("Boots game using system BIOS. You must have the bios file. Should be used for TASing.")]
|
||||
[DefaultValue(false)]
|
||||
public bool EnableBIOS { get; set; }
|
||||
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
using System;
|
||||
|
||||
using System.IO;
|
||||
using BizHawk.Common.BufferExtensions;
|
||||
using BizHawk.Emulation.Common;
|
||||
using BizHawk.Emulation.Cores.Consoles.Nintendo.Gameboy;
|
||||
using BizHawk.Emulation.Cores.Properties;
|
||||
|
||||
namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
|
||||
{
|
||||
|
@ -83,6 +84,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
|
|||
throw new InvalidOperationException($"{nameof(LibGambatte.gambatte_load)}() returned non-zero (is this not a gb or gbc rom?)");
|
||||
}
|
||||
|
||||
byte[] bios;
|
||||
string biosName;
|
||||
if ((flags & LibGambatte.LoadFlags.FORCE_DMG) == LibGambatte.LoadFlags.FORCE_DMG)
|
||||
{
|
||||
|
@ -91,18 +93,40 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
|
|||
}
|
||||
else
|
||||
{
|
||||
// TODO: Fix AGB bios mode stuff
|
||||
// biosName = _syncSettings.GBACGB ? "AGB" : "GBC";
|
||||
biosName = "GBC";
|
||||
IsCgb = true;
|
||||
}
|
||||
|
||||
if (_syncSettings.EnableBIOS)
|
||||
{
|
||||
byte[] Bios;
|
||||
Bios = comm.CoreFileProvider.GetFirmware(biosName, "World", true, "BIOS Not Found, Cannot Load. Change SyncSettings to run without BIOS.");
|
||||
if (LibGambatte.gambatte_loadbios(GambatteState, Bios, (uint)Bios.Length) != 0)
|
||||
bios = comm.CoreFileProvider.GetFirmware(biosName, "World", true, "BIOS Not Found, Cannot Load. Change SyncSettings to run without BIOS.");
|
||||
}
|
||||
else
|
||||
{
|
||||
Lazy<byte[]> builtinBios;
|
||||
switch (biosName)
|
||||
{
|
||||
throw new InvalidOperationException($"{nameof(LibGambatte.gambatte_loadbios)}() returned non-zero (bios error)");
|
||||
case "GB":
|
||||
builtinBios = Resources.SameboyDmgBoot;
|
||||
break;
|
||||
case "GBC":
|
||||
builtinBios = Resources.SameboyCgbBoot;
|
||||
break;
|
||||
// TODO: This doesn't work; locks up before leaving the bios screen
|
||||
// case "AGB":
|
||||
// builtinBios = Resources.SameboyAgbBoot;
|
||||
// break;
|
||||
default:
|
||||
throw new Exception("Internal GB Error (BIOS??)");
|
||||
}
|
||||
bios = BizHawk.Common.Util.DecompressGzipFile(new MemoryStream(builtinBios.Value, false));
|
||||
}
|
||||
|
||||
if (LibGambatte.gambatte_loadbios(GambatteState, bios, (uint)bios.Length) != 0)
|
||||
{
|
||||
throw new InvalidOperationException($"{nameof(LibGambatte.gambatte_loadbios)}() returned non-zero (bios error)");
|
||||
}
|
||||
|
||||
// set real default colors (before anyone mucks with them at all)
|
||||
|
|
|
@ -16,6 +16,7 @@ namespace BizHawk.Emulation.Cores.Properties {
|
|||
internal static readonly Lazy<byte[]> CPC_OS_6128_ROM = new Lazy<byte[]>(() => ReadEmbeddedByteArray("CPC_OS_6128.ROM.gz"));
|
||||
internal static readonly Lazy<byte[]> OS_464_ROM = new Lazy<byte[]>(() => ReadEmbeddedByteArray("OS_464.ROM.gz"));
|
||||
internal static readonly Lazy<byte[]> SameboyCgbBoot = new Lazy<byte[]>(() => ReadEmbeddedByteArray("cgb_boot.rom.gz"));
|
||||
internal static readonly Lazy<byte[]> SameboyAgbBoot = new Lazy<byte[]>(() => ReadEmbeddedByteArray("agb_boot.rom.gz"));
|
||||
internal static readonly Lazy<byte[]> SameboyDmgBoot = new Lazy<byte[]>(() => ReadEmbeddedByteArray("dmg_boot.rom.gz"));
|
||||
internal static readonly Lazy<byte[]> SgbCartPresent_SPC = new Lazy<byte[]>(() => ReadEmbeddedByteArray("sgb-cart-present.spc.gz"));
|
||||
internal static readonly Lazy<byte[]> ZX_128_ROM = new Lazy<byte[]>(() => ReadEmbeddedByteArray("128.ROM.gz"));
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue