MessageConfig - don't use Global.Emulator

This commit is contained in:
adelikat 2019-12-21 14:58:33 -06:00
parent 6748d32830
commit 18fbd9af1c
3 changed files with 3 additions and 10 deletions

View File

@ -1075,10 +1075,6 @@ namespace BizHawk.Client.EmuHawk
img.Save(fi.FullName, ImageFormat.Png);
}
/*
using (var fs = new FileStream($"{path}_test.bmp", FileMode.OpenOrCreate, FileAccess.Write))
QuickBmpFile.Save(Emulator.VideoProvider(), fs, r.Next(50, 500), r.Next(50, 500));
*/
AddOnScreenMessage($"{fi.Name} saved.");
}

View File

@ -2,9 +2,9 @@
using System.Drawing;
using System.Windows.Forms;
using BizHawk.Emulation.Common.IEmulatorExtensions;
using BizHawk.Client.Common;
using BizHawk.Client.EmuHawk.WinFormExtensions;
using BizHawk.Emulation.Common;
namespace BizHawk.Client.EmuHawk
{
@ -68,7 +68,7 @@ namespace BizHawk.Client.EmuHawk
private void SetMaxXy()
{
var video = Global.Emulator.AsVideoProvider(); // TODO: this is objectively wrong, these are core agnostic settings, why is the current core used here? Also this will crash on a core without a video provider
var video = NullVideo.Instance; // Good enough
XNumeric.Maximum = video.BufferWidth - 12;
YNumeric.Maximum = video.BufferHeight - 12;
PositionPanel.Size = new Size(video.BufferWidth + 2, video.BufferHeight + 2);

View File

@ -7,10 +7,7 @@
/// <seealso cref="IVideoProvider" />
public class NullVideo : IVideoProvider
{
public int[] GetVideoBuffer()
{
return new int[BufferWidth * BufferHeight];
}
public int[] GetVideoBuffer() => new int[BufferWidth * BufferHeight];
public static NullVideo Instance { get; } = new NullVideo();