subneshawk - support DatachBarcode service

This commit is contained in:
adelikat 2020-02-18 11:52:24 -06:00
parent 09f90cc0a2
commit 0ff2539da7
3 changed files with 22 additions and 12 deletions

View File

@ -142,17 +142,21 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
// set controller definition first time only
if (ControllerDefinition == null)
{
ControllerDefinition = new ControllerDefinition(ControllerDeck.GetDefinition());
ControllerDefinition.Name = "NES Controller";
ControllerDefinition = new ControllerDefinition(ControllerDeck.GetDefinition())
{
Name = "NES Controller"
};
// controls other than the deck
ControllerDefinition.BoolButtons.Add("Power");
ControllerDefinition.BoolButtons.Add("Reset");
if (Board is FDS)
if (Board is FDS b)
{
var b = Board as FDS;
ControllerDefinition.BoolButtons.Add("FDS Eject");
for (int i = 0; i < b.NumSides; i++)
{
ControllerDefinition.BoolButtons.Add("FDS Insert " + i);
}
}
if (_isVS)
@ -164,7 +168,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
}
// Add in the reset timing float control for subneshawk
if (using_reset_timing && (ControllerDefinition.FloatControls.Count() == 0))
if (using_reset_timing && ControllerDefinition.FloatControls.Count == 0)
{
ControllerDefinition.FloatControls.Add("Reset Cycle");
ControllerDefinition.FloatRanges.Add(new ControllerDefinition.FloatRange(0, 0, 500000));

View File

@ -23,13 +23,13 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
var ser = new BasicServiceProvider(this);
ServiceProvider = ser;
byte[] fdsbios = comm.CoreFileProvider.GetFirmware("NES", "Bios_FDS", false);
if (fdsbios != null && fdsbios.Length == 40976)
byte[] fdsBios = comm.CoreFileProvider.GetFirmware("NES", "Bios_FDS", false);
if (fdsBios != null && fdsBios.Length == 40976)
{
comm.ShowMessage("Your FDS BIOS is a bad dump. BizHawk will attempt to use it, but no guarantees! You should find a new one.");
var tmp = new byte[8192];
Buffer.BlockCopy(fdsbios, 16 + 8192 * 3, tmp, 0, 8192);
fdsbios = tmp;
Buffer.BlockCopy(fdsBios, 16 + 8192 * 3, tmp, 0, 8192);
fdsBios = tmp;
}
SyncSettings = (NESSyncSettings)syncSettings ?? new NESSyncSettings();
@ -38,11 +38,11 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
BootGodDB.Initialize();
videoProvider = new MyVideoProvider(this);
Init(game, rom, fdsbios);
if (Board is FDS)
Init(game, rom, fdsBios);
if (Board is FDS fds)
{
DriveLightEnabled = true;
(Board as FDS).SetDriveLightCallback((val) => DriveLightOn = val);
fds.SetDriveLightCallback(val => DriveLightOn = val);
// bit of a hack: we don't have a private gamedb for FDS, but the frontend
// expects this to be set.
RomStatus = game.Status;

View File

@ -50,6 +50,12 @@ namespace BizHawk.Emulation.Cores.Nintendo.SubNESHawk
VBL_CNT = 0;
_nesStatable = subnes.ServiceProvider.GetService<IStatable>();
var barCodeService = subnes.ServiceProvider.GetService<DatachBarcode>();
if (barCodeService != null)
{
ser.Register(barCodeService);
}
}
public void HardReset() => subnes.HardReset();