Use the right `Sameboy` ctor in testroms project

This reverts commit 379eeeeed8.
This commit is contained in:
YoshiRulz 2023-04-16 09:05:40 +10:00
parent 236c748b1a
commit 6ffe99c006
No known key found for this signature in database
GPG Key ID: C4DE31C245353FB7
2 changed files with 33 additions and 2 deletions

View File

@ -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,

View File

@ -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<SameboySettings, SameboySyncSettings>
{
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