From dd4173cb3d3aab9d692a794bbe708a654b883b20 Mon Sep 17 00:00:00 2001 From: goyuken Date: Sat, 22 Sep 2012 01:06:18 +0000 Subject: [PATCH] the legacy gif writer is now also affected by Global.Config.AVI_CaptureOSD --- BizHawk.MultiClient/MainForm.cs | 50 ++++++++++++++++++--------------- 1 file changed, 28 insertions(+), 22 deletions(-) diff --git a/BizHawk.MultiClient/MainForm.cs b/BizHawk.MultiClient/MainForm.cs index 644b961eba..1283de8e6c 100644 --- a/BizHawk.MultiClient/MainForm.cs +++ b/BizHawk.MultiClient/MainForm.cs @@ -2134,26 +2134,7 @@ namespace BizHawk.MultiClient if (Global.Config.AVI_CaptureOSD) { - // this code captures the emu display with OSD and lua composited onto it. - - // it's slow and a bit hackish; a better solution is to create a new - // "dummy render" class that implements IRenderer, IBlitter, and possibly - // IVideoProvider, and pass that to DisplayManager.UpdateSourceEx() - - var c = new RetainedViewportPanel(); - // this size can be different for showing off stretching or filters - c.Width = Global.Emulator.VideoProvider.BufferWidth; - c.Height = Global.Emulator.VideoProvider.BufferHeight; - var s = new SysdrawingRenderPanel(c); - - Global.DisplayManager.UpdateSourceEx(Global.Emulator.VideoProvider, s); - - var b = new AVOut.BmpVideoProvder(c.GetBitmap()); - - CurrAviWriter.AddFrame(b); - - s.Dispose(); - c.Dispose(); + CurrAviWriter.AddFrame(new AVOut.BmpVideoProvder(CaptureOSD())); } else { @@ -3261,6 +3242,31 @@ namespace BizHawk.MultiClient } } + /// + /// sort of like MakeScreenShot(), but with OSD and LUA captured as well. slow and bad. + /// + Bitmap CaptureOSD() + { + // this code captures the emu display with OSD and lua composited onto it. + // it's slow and a bit hackish; a better solution is to create a new + // "dummy render" class that implements IRenderer, IBlitter, and possibly + // IVideoProvider, and pass that to DisplayManager.UpdateSourceEx() + + var c = new RetainedViewportPanel(); + // this size can be different for showing off stretching or filters + c.Width = Global.Emulator.VideoProvider.BufferWidth; + c.Height = Global.Emulator.VideoProvider.BufferHeight; + var s = new SysdrawingRenderPanel(c); + + Global.DisplayManager.UpdateSourceEx(Global.Emulator.VideoProvider, s); + + Bitmap ret = (Bitmap)c.GetBitmap().Clone(); + + s.Dispose(); + c.Dispose(); + return ret; + } + #region Animaged Gifs /// /// Creates Animated Gifs @@ -3292,10 +3298,10 @@ namespace BizHawk.MultiClient #region Get the Images for the File int totalFrames = (gifSpeed > 0 ? num_images : (num_images * (gifSpeed * -1))); - images.Add(MakeScreenshotImage()); + images.Add(Global.Config.AVI_CaptureOSD ? CaptureOSD() : MakeScreenshotImage()); while (images.Count < totalFrames) { - tempImage = MakeScreenshotImage(); + tempImage = Global.Config.AVI_CaptureOSD ? CaptureOSD() : MakeScreenshotImage(); if (gifSpeed < 0) for (speedTracker = 0; speedTracker > gifSpeed; speedTracker--) images.Add(tempImage); //If the speed of the animation is to be slowed down, then add that many copies