From 1aebbe9cd6ac256b2f5e693a27db8537369e7a4b Mon Sep 17 00:00:00 2001 From: YoshiRulz Date: Thu, 8 Apr 2021 15:39:08 +1000 Subject: [PATCH] Add QuickBmpFile.LoadAuto helper --- src/BizHawk.Client.Common/QuickBmpFile.cs | 2 ++ src/BizHawk.Client.Common/movie/tasproj/TasBranch.cs | 10 ++++------ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/BizHawk.Client.Common/QuickBmpFile.cs b/src/BizHawk.Client.Common/QuickBmpFile.cs index 1fc6b34378..602451f3c4 100644 --- a/src/BizHawk.Client.Common/QuickBmpFile.cs +++ b/src/BizHawk.Client.Common/QuickBmpFile.cs @@ -333,5 +333,7 @@ namespace BizHawk.Client.Common s.Write(dst, 0, dst.Length); } + + public readonly bool LoadAuto(Stream s, out IVideoProvider vp) => Load(vp = new LoadedBMP(), s); } } diff --git a/src/BizHawk.Client.Common/movie/tasproj/TasBranch.cs b/src/BizHawk.Client.Common/movie/tasproj/TasBranch.cs index 0d05158424..5d3195bfb1 100644 --- a/src/BizHawk.Client.Common/movie/tasproj/TasBranch.cs +++ b/src/BizHawk.Client.Common/movie/tasproj/TasBranch.cs @@ -240,16 +240,14 @@ namespace BizHawk.Client.Common bl.GetLump(nframebuffer, true, delegate(Stream s, long length) { - var vp = new QuickBmpFile.LoadedBMP(); - QuickBmpFile.Load(vp, s); - b.OSDFrameBuffer = new BitmapBuffer(vp.BufferWidth, vp.BufferHeight, vp.VideoBuffer); + QuickBmpFile.LoadAuto(s, out var vp); + b.OSDFrameBuffer = new BitmapBuffer(vp.BufferWidth, vp.BufferHeight, vp.GetVideoBuffer()); }); bl.GetLump(ncoreframebuffer, false, delegate(Stream s, long length) { - var vp = new QuickBmpFile.LoadedBMP(); - QuickBmpFile.Load(vp, s); - b.CoreFrameBuffer = new BitmapBuffer(vp.BufferWidth, vp.BufferHeight, vp.VideoBuffer); + QuickBmpFile.LoadAuto(s, out var vp); + b.CoreFrameBuffer = new BitmapBuffer(vp.BufferWidth, vp.BufferHeight, vp.GetVideoBuffer()); }); b.Markers = new TasMovieMarkerList(movie);