pizza: set up constructors right for SGB and GB

This commit is contained in:
nattthebear 2017-06-28 22:19:20 -04:00
parent 2e2df56531
commit 203a0521b5
4 changed files with 16 additions and 7 deletions

View File

@ -17,16 +17,24 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.Gameboy
private LibPizza _pizza;
private readonly bool _sgb;
[CoreConstructor("GB")]
[CoreConstructor("SGB")]
public Pizza(byte[] rom, CoreComm comm)
:base(comm, new Configuration
:this(rom, comm, true)
{ }
[CoreConstructor("GB")]
public Pizza(CoreComm comm, byte[] rom)
:this(rom, comm, false)
{ }
public Pizza(byte[] rom, CoreComm comm, bool sgb)
: base(comm, new Configuration
{
DefaultWidth = 160,
DefaultHeight = 144,
MaxWidth = 256,
MaxHeight = 224,
MaxSamples = 1024,
SystemId = "SGB",
DefaultFpsNumerator = TICKSPERSECOND,
DefaultFpsDenominator = TICKSPERFRAME
})
@ -41,8 +49,8 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.Gameboy
MmapHeapSizeKB = 0
});
var spc = comm.CoreFileProvider.GetFirmware("SGB", "SPC", true);
_sgb = true;
var spc = sgb ? comm.CoreFileProvider.GetFirmware("SGB", "SPC", true) : new byte[0];
_sgb = sgb;
if (!_pizza.Init(rom, rom.Length, _sgb, spc, spc.Length))
{
throw new InvalidOperationException("Core rejected the rom!");
@ -139,5 +147,6 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.Gameboy
public bool IsCGBMode() => _pizza.IsCGB();
public bool IsSGBMode() => _sgb;
public override string SystemId => _sgb ? "SGB" : "GB";
}
}

View File

@ -243,7 +243,7 @@ namespace BizHawk.Emulation.Cores.Waterbox
protected readonly BasicServiceProvider _serviceProvider;
public IEmulatorServiceProvider ServiceProvider => _serviceProvider;
public string SystemId { get; }
public virtual string SystemId { get; }
public bool DeterministicEmulation { get; protected set; } = true;
public IInputCallbackSystem InputCallbacks { get; } = new InputCallbackSystem();
public virtual ControllerDefinition ControllerDefinition { get; protected set; } = NullController.Instance.Definition;

Binary file not shown.

View File

@ -45,7 +45,7 @@ char cartridge_load(const void *data, size_t sz)
if (rom[0x143] == 0xC0 || rom[0x143] == 0x80)
{
utils_log("Gameboy Color cartridge\n");
global_cgb = 1;
global_cgb = global_sgb ? 0 : 1;
}
else
{