Get testroms projects building again
fixes8ae947fed
,e87536ea8
,e7f4ad822
,59fcdb04c
,72cc19266
,d788e603f
, and86684b689
This commit is contained in:
parent
a67a484715
commit
1f70320ea8
|
@ -17,6 +17,9 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
|
|||
[ServiceNotApplicable(new[] { typeof(IDriveLight) })]
|
||||
public partial class Gameboy : IInputPollable, IRomInfo, IGameboyCommon, ICycleTiming, ILinkable
|
||||
{
|
||||
/// <remarks>HACK disables BIOS requirement if the environment looks like a test runner...</remarks>
|
||||
private static readonly bool TestromsBIOSDisableHack = Type.GetType("Microsoft.VisualStudio.TestTools.UnitTesting.Assert, Microsoft.VisualStudio.TestPlatform.TestFramework") is not null;
|
||||
|
||||
[CoreConstructor(VSystemID.Raw.GB)]
|
||||
[CoreConstructor(VSystemID.Raw.GBC)]
|
||||
[CoreConstructor(VSystemID.Raw.SGB)]
|
||||
|
@ -132,7 +135,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
|
|||
return true;
|
||||
}
|
||||
|
||||
var useBios = _syncSettings.EnableBIOS || ForceBios();
|
||||
var useBios = _syncSettings.EnableBIOS || (!TestromsBIOSDisableHack && ForceBios());
|
||||
if (useBios)
|
||||
{
|
||||
FirmwareID fwid = new(
|
||||
|
|
|
@ -5,4 +5,8 @@ config="$1"
|
|||
shift
|
||||
res/download_from_ci.sh
|
||||
export LD_LIBRARY_PATH="$root/output/dll:$LD_LIBRARY_PATH"
|
||||
dotnet test -a "$root/test_output" -c "$config" -l "junit;LogFilePath=$root/test_output/{assembly}.coverage.xml;MethodFormat=Class;FailureBodyFormat=Verbose" -l "console;verbosity=detailed" "$@"
|
||||
dotnet test -c "$config" \
|
||||
-l "junit;LogFilePath=$root/test_output/{assembly}.coverage.xml;MethodFormat=Class;FailureBodyFormat=Verbose" \
|
||||
-l "console;verbosity=detailed" \
|
||||
--test-adapter-path "$root/test_output" \
|
||||
"$@"
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
</PropertyGroup>
|
||||
<Import Project="../MainSlnCommon.props" />
|
||||
<PropertyGroup>
|
||||
<NoWarn>$(NoWarn);CA1310;CA1416</NoWarn>
|
||||
<OutputPath>$(ProjectDir)../../test_output</OutputPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(BIZHAWKTEST_RUN_KNOWN_FAILURES)' == '' ">
|
||||
|
@ -22,6 +23,7 @@
|
|||
<PackageReference Include="MSTest.TestFramework" />
|
||||
<PackageReference Include="JunitXml.TestLogger" />
|
||||
<PackageReference Include="Magick.NET-Q8-AnyCPU" />
|
||||
<ProjectReference Include="$(ProjectDir)../BizHawk.Bizware.Graphics/BizHawk.Bizware.Graphics.csproj" />
|
||||
<ProjectReference Include="$(ProjectDir)../BizHawk.Client.Common/BizHawk.Client.Common.csproj" />
|
||||
<EmbeddedResource Include="res/**/*" />
|
||||
<Content Include="$(ProjectDir)../../Assets/gamedb/**/*" LinkBase="gamedb" CopyToOutputDirectory="PreserveNewest" />
|
||||
|
|
|
@ -5,6 +5,7 @@ using System.IO;
|
|||
using System.Linq;
|
||||
|
||||
using BizHawk.Bizware.BizwareGL;
|
||||
using BizHawk.Bizware.Graphics;
|
||||
using BizHawk.Client.Common;
|
||||
using BizHawk.Common.IOExtensions;
|
||||
using BizHawk.Emulation.Common;
|
||||
|
@ -73,77 +74,41 @@ namespace BizHawk.Tests.Testroms.GB
|
|||
|
||||
public string GetRetroSystemPath(IGameInfo game)
|
||||
=> throw new NotImplementedException();
|
||||
}
|
||||
|
||||
private sealed class FakeGraphicsControl : IGraphicsControl
|
||||
{
|
||||
private readonly IGL_GdiPlus _gdi;
|
||||
|
||||
private readonly Func<(int, int)> _getVirtualSize;
|
||||
|
||||
public Rectangle ClientRectangle
|
||||
{
|
||||
get
|
||||
{
|
||||
var (w, h) = _getVirtualSize();
|
||||
return new(0, 0, w, h);
|
||||
}
|
||||
}
|
||||
|
||||
public RenderTargetWrapper? RenderTargetWrapper { get; set; }
|
||||
|
||||
public FakeGraphicsControl(IGL_GdiPlus glImpl, Func<(int Width, int Height)> getVirtualSize)
|
||||
{
|
||||
_gdi = glImpl;
|
||||
_getVirtualSize = getVirtualSize;
|
||||
}
|
||||
|
||||
public void Begin()
|
||||
{
|
||||
_gdi.BeginControl(this);
|
||||
RenderTargetWrapper!.CreateGraphics();
|
||||
}
|
||||
|
||||
public Graphics CreateGraphics()
|
||||
{
|
||||
var (w, h) = _getVirtualSize();
|
||||
return Graphics.FromImage(new Bitmap(w, h));
|
||||
}
|
||||
|
||||
public void End()
|
||||
=> _gdi.EndControl(this);
|
||||
|
||||
public void SetVsync(bool state) {}
|
||||
|
||||
public void SwapBuffers()
|
||||
{
|
||||
_gdi.SwapControl(this);
|
||||
if (RenderTargetWrapper!.MyBufferedGraphics is null) return;
|
||||
RenderTargetWrapper.CreateGraphics();
|
||||
}
|
||||
|
||||
public void Dispose() {}
|
||||
public string GetUserPath(string sysID, bool temp)
|
||||
=> throw new NotImplementedException(); // only used by Encore
|
||||
}
|
||||
|
||||
public sealed class SimpleGDIPDisplayManager : DisplayManagerBase
|
||||
{
|
||||
private readonly FakeGraphicsControl _gc;
|
||||
|
||||
private SimpleGDIPDisplayManager(Config config, IEmulator emuCore, IGL_GdiPlus glImpl)
|
||||
: base(config, emuCore, inputManager: null, movieSession: null, EDispMethod.GdiPlus, glImpl, new GDIPlusGuiRenderer(glImpl))
|
||||
{
|
||||
_gc = (FakeGraphicsControl) glImpl.Internal_CreateGraphicsControl();
|
||||
Blank();
|
||||
}
|
||||
private SimpleGDIPDisplayManager(Config config, IEmulator emuCore, IGL_GDIPlus glImpl)
|
||||
: base(
|
||||
config,
|
||||
emuCore,
|
||||
inputManager: null,
|
||||
movieSession: null,
|
||||
EDispMethod.GdiPlus,
|
||||
glImpl,
|
||||
new GDIPlusGuiRenderer(glImpl))
|
||||
{}
|
||||
|
||||
public SimpleGDIPDisplayManager(Config config, IEmulator emuCore, Func<(int Width, int Height)> getVirtualSize)
|
||||
: this(config, emuCore, new IGL_GdiPlus(self => new FakeGraphicsControl(self, getVirtualSize))) {}
|
||||
: this(config, emuCore, new IGL_GDIPlus()) {}
|
||||
|
||||
protected override void ActivateGLContext()
|
||||
=> _gc.Begin();
|
||||
protected override void ActivateGraphicsControlContext() {}
|
||||
|
||||
protected override void SwapBuffersOfGraphicsControl()
|
||||
=> _gc.SwapBuffers();
|
||||
public override void ActivateOpenGLContext() {}
|
||||
|
||||
protected override Size GetGraphicsControlSize()
|
||||
=> throw new NotImplementedException();
|
||||
|
||||
public override Size GetPanelNativeSize()
|
||||
=> throw new NotImplementedException();
|
||||
|
||||
protected override Point GraphicsControlPointToClient(Point p)
|
||||
=> throw new NotImplementedException();
|
||||
|
||||
protected override void SwapBuffersOfGraphicsControl() {}
|
||||
}
|
||||
|
||||
private static int _totalFrames = 0;
|
||||
|
@ -198,7 +163,12 @@ namespace BizHawk.Tests.Testroms.GB
|
|||
var (core, biosWaitDuration) = init(
|
||||
efp,
|
||||
_config,
|
||||
new(Console.WriteLine, (s, _) => Console.WriteLine(s), efp, CoreComm.CorePreferencesFlags.None));
|
||||
new(
|
||||
Console.WriteLine,
|
||||
(s, _) => Console.WriteLine(s),
|
||||
efp,
|
||||
CoreComm.CorePreferencesFlags.None,
|
||||
oglProvider: null!));
|
||||
Core = core;
|
||||
_controller = new(Core.ControllerDefinition);
|
||||
FrameAdvanceTo(biosWaitDuration);
|
||||
|
|
Loading…
Reference in New Issue