From 78bb41e3cfa9ee4dade6ab90bcef5db928832676 Mon Sep 17 00:00:00 2001 From: adelikat Date: Sun, 4 Dec 2016 10:50:28 -0600 Subject: [PATCH] Mainform - make AV and Screenshot menus dependent on having a VideoProvider, and remove some usages of VideoProviderGlue --- BizHawk.Client.EmuHawk/MainForm.Events.cs | 4 ++++ BizHawk.Client.EmuHawk/MainForm.cs | 16 +++++++++------- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/BizHawk.Client.EmuHawk/MainForm.Events.cs b/BizHawk.Client.EmuHawk/MainForm.Events.cs index b276180ce8..0ba6115eb4 100644 --- a/BizHawk.Client.EmuHawk/MainForm.Events.cs +++ b/BizHawk.Client.EmuHawk/MainForm.Events.cs @@ -53,6 +53,10 @@ namespace BizHawk.Client.EmuHawk var font = new System.Drawing.Font(SaveRAMSubMenu.Font, needBold ? FontStyle.Bold : FontStyle.Regular); SaveRAMSubMenu.Font = font; } + + AVSubMenu.Enabled = + ScreenshotSubMenu.Enabled = + Global.Emulator.HasVideoProvider(); } private void RecentRomMenuItem_DropDownOpened(object sender, EventArgs e) diff --git a/BizHawk.Client.EmuHawk/MainForm.cs b/BizHawk.Client.EmuHawk/MainForm.cs index 26a66a107f..d1a371e6f6 100644 --- a/BizHawk.Client.EmuHawk/MainForm.cs +++ b/BizHawk.Client.EmuHawk/MainForm.cs @@ -912,7 +912,7 @@ namespace BizHawk.Client.EmuHawk public void TakeScreenshotClientToClipboard() { - using (var bb = GlobalWin.DisplayManager.RenderOffscreen(Global.Emulator.VideoProvider(), Global.Config.Screenshot_CaptureOSD)) + using (var bb = GlobalWin.DisplayManager.RenderOffscreen(Global.Emulator.AsVideoProvider(), Global.Config.Screenshot_CaptureOSD)) { using (var img = bb.ToSysdrawingBitmap()) Clipboard.SetImage(img); @@ -1895,7 +1895,7 @@ namespace BizHawk.Client.EmuHawk private static BitmapBuffer MakeScreenshotImage() { - return GlobalWin.DisplayManager.RenderVideoProvider(Global.Emulator.VideoProvider()); + return GlobalWin.DisplayManager.RenderVideoProvider(Global.Emulator.AsVideoProvider()); } private void SaveSlotSelectedMessage() @@ -2263,7 +2263,7 @@ namespace BizHawk.Client.EmuHawk public BitmapBuffer CaptureOSD() { - var bb = GlobalWin.DisplayManager.RenderOffscreen(Global.Emulator.VideoProvider(), true); + var bb = GlobalWin.DisplayManager.RenderOffscreen(Global.Emulator.AsVideoProvider(), true); bb.DiscardAlpha(); return bb; } @@ -2984,7 +2984,8 @@ namespace BizHawk.Client.EmuHawk } else { - aw.SetVideoParameters(Global.Emulator.VideoProvider().BufferWidth, Global.Emulator.VideoProvider().BufferHeight); + var videoProvider = Global.Emulator.AsVideoProvider(); + aw.SetVideoParameters(videoProvider.BufferWidth, videoProvider.BufferHeight); } aw.SetAudioParameters(44100, 2, 16); @@ -3161,7 +3162,8 @@ namespace BizHawk.Client.EmuHawk } else { - bbin = new BitmapBuffer(Global.Emulator.VideoProvider().BufferWidth, Global.Emulator.VideoProvider().BufferHeight, Global.Emulator.VideoProvider().GetVideoBuffer()); + var videoProvider = Global.Emulator.AsVideoProvider(); + bbin = new BitmapBuffer(videoProvider.BufferWidth, videoProvider.BufferHeight, videoProvider.GetVideoBuffer()); } bbin.DiscardAlpha(); @@ -3172,7 +3174,7 @@ namespace BizHawk.Client.EmuHawk { if (_avwriterpad) { - g.Clear(Color.FromArgb(Global.Emulator.VideoProvider().BackgroundColor)); + g.Clear(Color.FromArgb(Global.Emulator.AsVideoProvider().BackgroundColor)); g.DrawImageUnscaled(bmpin, (bmpout.Width - bmpin.Width) / 2, (bmpout.Height - bmpin.Height) / 2); } else @@ -3200,7 +3202,7 @@ namespace BizHawk.Client.EmuHawk disposableOutput = (IDisposable)output; } else - output = Global.Emulator.VideoProvider(); + output = Global.Emulator.AsVideoProvider(); } _currAviWriter.SetFrame(Global.Emulator.Frame);