Misc. cleanup of testroms projects
This commit is contained in:
parent
da06bd36d0
commit
7392df29d9
|
@ -139,7 +139,7 @@ namespace BizHawk.Tests.Testroms.GB.GambatteSuite
|
||||||
{
|
{
|
||||||
static bool GlyphMatches(Bitmap b, int xOffset, byte v)
|
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)
|
bool GlyphRowMatches(int y)
|
||||||
{
|
{
|
||||||
byte rowAsByte = 0;
|
byte rowAsByte = 0;
|
||||||
|
|
|
@ -37,17 +37,17 @@ namespace BizHawk.Tests.Testroms.GB
|
||||||
Variant = variant;
|
Variant = variant;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override readonly string ToString()
|
public readonly override string ToString()
|
||||||
=> $"{Variant} in {CoreName}{(UseBIOS ? string.Empty : " (no BIOS)")}";
|
=> $"{Variant} in {CoreName}{(UseBIOS ? string.Empty : " (no BIOS)")}";
|
||||||
}
|
}
|
||||||
|
|
||||||
private static readonly GambatteSettings GambatteSettings = new() { CGBColors = GBColors.ColorType.vivid };
|
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_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 };
|
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)
|
public static GambatteSyncSettings GetGambatteSyncSettings(ConsoleVariant variant, bool biosAvailable)
|
||||||
=> biosAvailable
|
=> variant.IsColour()
|
||||||
? variant.IsColour()
|
? biosAvailable ? GambatteSyncSettings_GBC_USEBIOS : GambatteSyncSettings_GBC_NOBIOS
|
||||||
? GambatteSyncSettings_GBC_USEBIOS
|
: biosAvailable ? GambatteSyncSettings_GB_USEBIOS : GambatteSyncSettings_GB_NOBIOS;
|
||||||
: GambatteSyncSettings_GB_USEBIOS
|
|
||||||
: variant.IsColour()
|
|
||||||
? GambatteSyncSettings_GBC_NOBIOS
|
|
||||||
: GambatteSyncSettings_GB_NOBIOS;
|
|
||||||
|
|
||||||
public static GBSyncSettings GetGBHawkSyncSettings(ConsoleVariant variant)
|
public static GBSyncSettings GetGBHawkSyncSettings(ConsoleVariant variant)
|
||||||
=> variant.IsColour()
|
=> variant.IsColour()
|
||||||
|
@ -154,8 +150,10 @@ namespace BizHawk.Tests.Testroms.GB
|
||||||
|
|
||||||
/// <summary>converts Gambatte's GBC palette to GBHawk's; GB palette is the same</summary>
|
/// <summary>converts Gambatte's GBC palette to GBHawk's; GB palette is the same</summary>
|
||||||
public static Image NormaliseGBScreenshot(Image img, CoreSetup setup)
|
public static Image NormaliseGBScreenshot(Image img, CoreSetup setup)
|
||||||
=> setup.CoreName is CoreNames.Gambatte
|
=> setup.CoreName switch
|
||||||
? ImageUtils.PaletteSwap(img, setup.Variant.IsColour() ? UnVividGBCPaletteMap : UnVividGBPaletteMap)
|
{
|
||||||
: img;
|
CoreNames.Gambatte => ImageUtils.PaletteSwap(img, setup.Variant.IsColour() ? UnVividGBCPaletteMap : UnVividGBPaletteMap),
|
||||||
|
_ => img
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,6 @@ using BizHawk.Common.IOExtensions;
|
||||||
using BizHawk.Common.StringExtensions;
|
using BizHawk.Common.StringExtensions;
|
||||||
using BizHawk.Emulation.Common;
|
using BizHawk.Emulation.Common;
|
||||||
using BizHawk.Emulation.Cores;
|
using BizHawk.Emulation.Cores;
|
||||||
using BizHawk.Emulation.Cores.Nintendo.Gameboy;
|
|
||||||
using BizHawk.Emulation.Cores.Nintendo.GBHawk;
|
using BizHawk.Emulation.Cores.Nintendo.GBHawk;
|
||||||
|
|
||||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||||
|
@ -218,13 +217,12 @@ namespace BizHawk.Tests.Testroms.GB
|
||||||
fe.FrameAdvanceBy(5);
|
fe.FrameAdvanceBy(5);
|
||||||
if (testCase.TestName is "m3_lcdc_win_map_change2") fe.FrameAdvance(); // just happens to be an outlier
|
if (testCase.TestName is "m3_lcdc_win_map_change2") fe.FrameAdvance(); // just happens to be an outlier
|
||||||
}
|
}
|
||||||
var domain = fe.CoreAsMemDomains!.SystemBus;
|
Func<long> getPC = fe.Core switch
|
||||||
Func<long> derefPC = fe.Core switch
|
|
||||||
{
|
{
|
||||||
Gameboy => () => domain.PeekByte((long) fe.CoreAsDebuggable!.GetCpuFlagsAndRegisters()["PC"].Value),
|
GBHawk gbHawk => () => gbHawk.cpu.RegPC,
|
||||||
GBHawk gbHawk => () => domain.PeekByte(gbHawk.cpu.RegPC),
|
_ => () => (long) fe.CoreAsDebuggable!.GetCpuFlagsAndRegisters()["PC"].Value
|
||||||
_ => throw new Exception()
|
|
||||||
};
|
};
|
||||||
|
var domain = fe.CoreAsMemDomains!.SystemBus;
|
||||||
var finished = false;
|
var finished = false;
|
||||||
fe.CoreAsDebuggable!.MemoryCallbacks.Add(new MemoryCallback(
|
fe.CoreAsDebuggable!.MemoryCallbacks.Add(new MemoryCallback(
|
||||||
domain.Name,
|
domain.Name,
|
||||||
|
@ -232,7 +230,7 @@ namespace BizHawk.Tests.Testroms.GB
|
||||||
"breakpoint",
|
"breakpoint",
|
||||||
(_, _, _) =>
|
(_, _, _) =>
|
||||||
{
|
{
|
||||||
if (!finished && derefPC() is 0x40) finished = true;
|
if (!finished && domain.PeekByte(getPC()) is 0x40) finished = true;
|
||||||
},
|
},
|
||||||
address: null, // all addresses
|
address: null, // all addresses
|
||||||
mask: null));
|
mask: null));
|
||||||
|
|
|
@ -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")
|
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 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}");
|
return ($"{prefix}_expect_{suffix}", $"{prefix}_actual_{suffix}", $"{prefix}_*_{suffix}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue