diff --git a/src/BizHawk.Tests.Testroms.GB.GambatteSuite/GambatteSuite.cs b/src/BizHawk.Tests.Testroms.GB.GambatteSuite/GambatteSuite.cs index 884f0ca03b..bd576a05c7 100644 --- a/src/BizHawk.Tests.Testroms.GB.GambatteSuite/GambatteSuite.cs +++ b/src/BizHawk.Tests.Testroms.GB.GambatteSuite/GambatteSuite.cs @@ -139,7 +139,7 @@ namespace BizHawk.Tests.Testroms.GB.GambatteSuite { static bool GlyphMatches(Bitmap b, int xOffset, byte v) { - // `(x, 0)` is the top-left of an 8x8 square of pixels to read from `b`, which is compared against the glyph for the nybble `v` + // `(xOffset, 0)` is the top-left of an 8x8 square of pixels to read from `b`, which is compared against the glyph for the nybble `v` bool GlyphRowMatches(int y) { byte rowAsByte = 0; diff --git a/src/BizHawk.Tests.Testroms.GB/GB_GBC/GBHelper.cs b/src/BizHawk.Tests.Testroms.GB/GB_GBC/GBHelper.cs index b598469ee4..e4b23bba0e 100644 --- a/src/BizHawk.Tests.Testroms.GB/GB_GBC/GBHelper.cs +++ b/src/BizHawk.Tests.Testroms.GB/GB_GBC/GBHelper.cs @@ -37,17 +37,17 @@ namespace BizHawk.Tests.Testroms.GB Variant = variant; } - public override readonly string ToString() + public readonly override string ToString() => $"{Variant} in {CoreName}{(UseBIOS ? string.Empty : " (no BIOS)")}"; } private static readonly GambatteSettings GambatteSettings = new() { CGBColors = GBColors.ColorType.vivid }; - private static readonly GambatteSyncSettings GambatteSyncSettings_GB_NOBIOS = new() { ConsoleMode = GambatteSyncSettings.ConsoleModeType.GB, FrameLength = GambatteSyncSettings.FrameLengthType.EqualLengthFrames }; + private static readonly GambatteSyncSettings GambatteSyncSettings_GB_NOBIOS = new() { ConsoleMode = GambatteSyncSettings.ConsoleModeType.GB, EnableBIOS = false, FrameLength = GambatteSyncSettings.FrameLengthType.EqualLengthFrames }; private static readonly GambatteSyncSettings GambatteSyncSettings_GB_USEBIOS = new() { ConsoleMode = GambatteSyncSettings.ConsoleModeType.GB, EnableBIOS = true, FrameLength = GambatteSyncSettings.FrameLengthType.EqualLengthFrames }; - private static readonly GambatteSyncSettings GambatteSyncSettings_GBC_NOBIOS = new() { ConsoleMode = GambatteSyncSettings.ConsoleModeType.GBC, FrameLength = GambatteSyncSettings.FrameLengthType.EqualLengthFrames }; + private static readonly GambatteSyncSettings GambatteSyncSettings_GBC_NOBIOS = new() { ConsoleMode = GambatteSyncSettings.ConsoleModeType.GBC, EnableBIOS = false, FrameLength = GambatteSyncSettings.FrameLengthType.EqualLengthFrames }; private static readonly GambatteSyncSettings GambatteSyncSettings_GBC_USEBIOS = new() { ConsoleMode = GambatteSyncSettings.ConsoleModeType.GBC, EnableBIOS = true, FrameLength = GambatteSyncSettings.FrameLengthType.EqualLengthFrames }; @@ -117,13 +117,9 @@ namespace BizHawk.Tests.Testroms.GB } public static GambatteSyncSettings GetGambatteSyncSettings(ConsoleVariant variant, bool biosAvailable) - => biosAvailable - ? variant.IsColour() - ? GambatteSyncSettings_GBC_USEBIOS - : GambatteSyncSettings_GB_USEBIOS - : variant.IsColour() - ? GambatteSyncSettings_GBC_NOBIOS - : GambatteSyncSettings_GB_NOBIOS; + => variant.IsColour() + ? biosAvailable ? GambatteSyncSettings_GBC_USEBIOS : GambatteSyncSettings_GBC_NOBIOS + : biosAvailable ? GambatteSyncSettings_GB_USEBIOS : GambatteSyncSettings_GB_NOBIOS; public static GBSyncSettings GetGBHawkSyncSettings(ConsoleVariant variant) => variant.IsColour() @@ -154,8 +150,10 @@ namespace BizHawk.Tests.Testroms.GB /// converts Gambatte's GBC palette to GBHawk's; GB palette is the same public static Image NormaliseGBScreenshot(Image img, CoreSetup setup) - => setup.CoreName is CoreNames.Gambatte - ? ImageUtils.PaletteSwap(img, setup.Variant.IsColour() ? UnVividGBCPaletteMap : UnVividGBPaletteMap) - : img; + => setup.CoreName switch + { + CoreNames.Gambatte => ImageUtils.PaletteSwap(img, setup.Variant.IsColour() ? UnVividGBCPaletteMap : UnVividGBPaletteMap), + _ => img + }; } } diff --git a/src/BizHawk.Tests.Testroms.GB/GB_GBC/MealybugTearoomTests.cs b/src/BizHawk.Tests.Testroms.GB/GB_GBC/MealybugTearoomTests.cs index 56eca59731..55c18d80e7 100644 --- a/src/BizHawk.Tests.Testroms.GB/GB_GBC/MealybugTearoomTests.cs +++ b/src/BizHawk.Tests.Testroms.GB/GB_GBC/MealybugTearoomTests.cs @@ -7,7 +7,6 @@ using BizHawk.Common.IOExtensions; using BizHawk.Common.StringExtensions; using BizHawk.Emulation.Common; using BizHawk.Emulation.Cores; -using BizHawk.Emulation.Cores.Nintendo.Gameboy; using BizHawk.Emulation.Cores.Nintendo.GBHawk; using Microsoft.VisualStudio.TestTools.UnitTesting; @@ -218,13 +217,12 @@ namespace BizHawk.Tests.Testroms.GB fe.FrameAdvanceBy(5); if (testCase.TestName is "m3_lcdc_win_map_change2") fe.FrameAdvance(); // just happens to be an outlier } - var domain = fe.CoreAsMemDomains!.SystemBus; - Func derefPC = fe.Core switch + Func getPC = fe.Core switch { - Gameboy => () => domain.PeekByte((long) fe.CoreAsDebuggable!.GetCpuFlagsAndRegisters()["PC"].Value), - GBHawk gbHawk => () => domain.PeekByte(gbHawk.cpu.RegPC), - _ => throw new Exception() + GBHawk gbHawk => () => gbHawk.cpu.RegPC, + _ => () => (long) fe.CoreAsDebuggable!.GetCpuFlagsAndRegisters()["PC"].Value }; + var domain = fe.CoreAsMemDomains!.SystemBus; var finished = false; fe.CoreAsDebuggable!.MemoryCallbacks.Add(new MemoryCallback( domain.Name, @@ -232,7 +230,7 @@ namespace BizHawk.Tests.Testroms.GB "breakpoint", (_, _, _) => { - if (!finished && derefPC() is 0x40) finished = true; + if (!finished && domain.PeekByte(getPC()) is 0x40) finished = true; }, address: null, // all addresses mask: null)); diff --git a/src/BizHawk.Tests.Testroms.GB/ImageUtils.cs b/src/BizHawk.Tests.Testroms.GB/ImageUtils.cs index cab0d57f18..0db88f362d 100644 --- a/src/BizHawk.Tests.Testroms.GB/ImageUtils.cs +++ b/src/BizHawk.Tests.Testroms.GB/ImageUtils.cs @@ -21,7 +21,7 @@ namespace BizHawk.Tests.Testroms.GB private static (string Expect, string Actual, string Glob) GenFilenames((string Suite, string Case) id, string fileExt = "png") { var prefix = $"{id.Suite}/{id.Case.GetHashCode():X8}"; // hashcode of string sadly not stable - var suffix = $"{id.Case.RemoveInvalidFileSystemChars().Replace(' ', '_')}.{fileExt}"; + var suffix = $"{id.Case.RemoveInvalidFileSystemChars().Replace(' ', '_').Replace("(no BIOS)", "noBIOS")}.{fileExt}"; return ($"{prefix}_expect_{suffix}", $"{prefix}_actual_{suffix}", $"{prefix}_*_{suffix}"); }