From 6ffe99c00609f756f654d284874aff8586989e40 Mon Sep 17 00:00:00 2001 From: YoshiRulz Date: Sun, 16 Apr 2023 09:05:40 +1000 Subject: [PATCH] Use the right `Sameboy` ctor in testroms project This reverts commit 379eeeeed80f2adcdd2c8222144160df13d066e7. --- .../Consoles/Nintendo/SameBoy/SameBoy.cs | 2 +- .../GB_GBC/GBHelper.cs | 33 ++++++++++++++++++- 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/SameBoy/SameBoy.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/SameBoy/SameBoy.cs index f27d20af01..2c6840f871 100644 --- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/SameBoy/SameBoy.cs +++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/SameBoy/SameBoy.cs @@ -102,7 +102,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.Sameboy _stateBuf = new byte[LibSameboy.sameboy_statelen(SameboyState)]; } - public Sameboy( + private Sameboy( CoreComm comm, GameInfo game, byte[] file, diff --git a/src/BizHawk.Tests.Testroms.GB/GB_GBC/GBHelper.cs b/src/BizHawk.Tests.Testroms.GB/GB_GBC/GBHelper.cs index b2bccfbcd8..e6ecb07c9c 100644 --- a/src/BizHawk.Tests.Testroms.GB/GB_GBC/GBHelper.cs +++ b/src/BizHawk.Tests.Testroms.GB/GB_GBC/GBHelper.cs @@ -50,6 +50,29 @@ namespace BizHawk.Tests.Testroms.GB => $"{Variant} in {CoreName}{(UseBIOS ? string.Empty : " (no BIOS)")}"; } + public readonly struct DummyRomAsset : IRomAsset + { + private readonly byte[] _fileData; + + public string? Extension + => throw new NotImplementedException(); + + public byte[]? FileData + => _fileData; + + public GameInfo? Game + => throw new NotImplementedException(); + + public byte[]? RomData + => throw new NotImplementedException(); + + public string? RomPath + => throw new NotImplementedException(); + + public DummyRomAsset(byte[] fileData) + => _fileData = fileData; + } + private static readonly GambatteSettings GambatteSettings = new() { CGBColors = GBColors.ColorType.vivid }; private static readonly GambatteSyncSettings GambatteSyncSettings_GB_NOBIOS = new() { ConsoleMode = GambatteSyncSettings.ConsoleModeType.GB, EnableBIOS = false, FrameLength = GambatteSyncSettings.FrameLengthType.EqualLengthFrames }; @@ -167,7 +190,15 @@ namespace BizHawk.Tests.Testroms.GB { CoreNames.Gambatte => new Gameboy(coreComm, game, rom, GambatteSettings, GetGambatteSyncSettings(setup.Variant, setup.UseBIOS), deterministic: true), CoreNames.GbHawk => new GBHawk(coreComm, game, rom, new(), GetGBHawkSyncSettings(setup.Variant)), - CoreNames.Sameboy => new Sameboy(coreComm, game, rom, SameBoySettings, GetSameBoySyncSettings(setup.Variant, setup.UseBIOS), deterministic: true), + CoreNames.Sameboy => new Sameboy(new CoreLoadParameters + { + Comm = coreComm, + DeterministicEmulationRequested = true, + Game = game, + Roms = { new DummyRomAsset(rom) }, + Settings = SameBoySettings, + SyncSettings = GetSameBoySyncSettings(setup.Variant, setup.UseBIOS), + }), _ => throw new InvalidOperationException("unknown GB core") }; var biosWaitDuration = setup.UseBIOS || setup.CoreName is CoreNames.Sameboy