remove some usages of VideoProviderGlue by checking for VideoProvider availability before doing some dependent processes
This commit is contained in:
parent
281b83fd40
commit
604ed74ff9
|
@ -34,9 +34,9 @@ namespace BizHawk.Client.Common
|
|||
bs.PutLump(BinaryStateLump.Corestate, bw => core.SaveStateBinary(bw));
|
||||
}
|
||||
|
||||
if (Global.Config.SaveScreenshotWithStates)
|
||||
if (Global.Config.SaveScreenshotWithStates && Global.Emulator.HasVideoProvider())
|
||||
{
|
||||
var vp = Global.Emulator.VideoProvider();
|
||||
var vp = Global.Emulator.AsVideoProvider();
|
||||
var buff = vp.GetVideoBuffer();
|
||||
if (buff.Length == 1)
|
||||
{
|
||||
|
@ -58,7 +58,7 @@ namespace BizHawk.Client.Common
|
|||
out_h /= 2;
|
||||
}
|
||||
using (new SimpleTime("Save Framebuffer"))
|
||||
bs.PutLump(BinaryStateLump.Framebuffer, (s) => QuickBmpFile.Save(Global.Emulator.VideoProvider(), s, out_w, out_h));
|
||||
bs.PutLump(BinaryStateLump.Framebuffer, (s) => QuickBmpFile.Save(Global.Emulator.AsVideoProvider(), s, out_w, out_h));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -96,14 +96,19 @@ namespace BizHawk.Client.Common
|
|||
|
||||
public static void PopulateFramebuffer(BinaryReader br)
|
||||
{
|
||||
if (!Global.Emulator.HasVideoProvider())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
using (new SimpleTime("Load Framebuffer"))
|
||||
QuickBmpFile.Load(Global.Emulator.VideoProvider(), br.BaseStream);
|
||||
QuickBmpFile.Load(Global.Emulator.AsVideoProvider(), br.BaseStream);
|
||||
}
|
||||
catch
|
||||
{
|
||||
var buff = Global.Emulator.VideoProvider().GetVideoBuffer();
|
||||
var buff = Global.Emulator.AsVideoProvider().GetVideoBuffer();
|
||||
try
|
||||
{
|
||||
for (int i = 0; i < buff.Length; i++)
|
||||
|
@ -219,9 +224,9 @@ namespace BizHawk.Client.Common
|
|||
}
|
||||
|
||||
var args = str.Split(' ');
|
||||
if (args[0] == "Framebuffer")
|
||||
if (args[0] == "Framebuffer" && Global.Emulator.HasVideoProvider())
|
||||
{
|
||||
Global.Emulator.VideoProvider().GetVideoBuffer().ReadFromHex(args[1]);
|
||||
Global.Emulator.AsVideoProvider().GetVideoBuffer().ReadFromHex(args[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -73,16 +73,18 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
Global.Emulator.AsStatable().LoadStateBinary(new BinaryReader(new MemoryStream(movie.BinarySavestate, false)));
|
||||
}
|
||||
if (movie.SavestateFramebuffer != null)
|
||||
|
||||
if (movie.SavestateFramebuffer != null && Global.Emulator.HasVideoProvider())
|
||||
{
|
||||
var b1 = movie.SavestateFramebuffer;
|
||||
var b2 = Global.Emulator.VideoProvider().GetVideoBuffer();
|
||||
var b2 = Global.Emulator.AsVideoProvider().GetVideoBuffer();
|
||||
int len = Math.Min(b1.Length, b2.Length);
|
||||
for (int i = 0; i < len; i++)
|
||||
{
|
||||
b2[i] = b1[i];
|
||||
}
|
||||
}
|
||||
|
||||
Global.Emulator.ResetCounters();
|
||||
}
|
||||
else if (Global.Emulator.HasSaveRam() && movie.StartsFromSaveRam)
|
||||
|
|
|
@ -112,9 +112,9 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
// hack: some IMovies eat the framebuffer, so don't bother with them
|
||||
movieToRecord.SavestateFramebuffer = new int[0];
|
||||
if (movieToRecord.SavestateFramebuffer != null)
|
||||
if (movieToRecord.SavestateFramebuffer != null && Global.Emulator.HasVideoProvider())
|
||||
{
|
||||
movieToRecord.SavestateFramebuffer = (int[])Global.Emulator.VideoProvider().GetVideoBuffer().Clone();
|
||||
movieToRecord.SavestateFramebuffer = (int[])Global.Emulator.AsVideoProvider().GetVideoBuffer().Clone();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -165,7 +165,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
Tastudio.CurrentTasMovie.LoadBranch(branch);
|
||||
var stateInfo = new KeyValuePair<int, byte[]>(branch.Frame, branch.CoreData);
|
||||
Tastudio.LoadState(stateInfo);
|
||||
QuickBmpFile.Copy(new BitmapBufferVideoProvider(branch.OSDFrameBuffer), Global.Emulator.VideoProvider());
|
||||
QuickBmpFile.Copy(new BitmapBufferVideoProvider(branch.OSDFrameBuffer), Tastudio.VideoProvider);
|
||||
//GlobalWin.MainForm.PauseEmulator();
|
||||
GlobalWin.MainForm.PauseOnFrame = null;
|
||||
Tastudio.RefreshDialog();
|
||||
|
|
Loading…
Reference in New Issue