movie some video provider movie logic into an extension method
This commit is contained in:
parent
892185d2fd
commit
2a9710b63c
|
@ -44,13 +44,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
if (movie.SavestateFramebuffer != null && Emulator.HasVideoProvider())
|
||||
{
|
||||
var b1 = movie.SavestateFramebuffer;
|
||||
var b2 = Emulator.AsVideoProvider().GetVideoBuffer();
|
||||
int len = Math.Min(b1.Length, b2.Length);
|
||||
for (int i = 0; i < len; i++)
|
||||
{
|
||||
b2[i] = b1[i];
|
||||
}
|
||||
Emulator.AsVideoProvider().PopulateFromBuffer(movie.SavestateFramebuffer);
|
||||
}
|
||||
|
||||
Emulator.ResetCounters();
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
namespace BizHawk.Emulation.Common
|
||||
using System;
|
||||
|
||||
namespace BizHawk.Emulation.Common
|
||||
{
|
||||
/// <summary>
|
||||
/// This service provides the ability to pass video output to the client
|
||||
|
@ -62,4 +64,24 @@
|
|||
/// </summary>
|
||||
int BackgroundColor { get; }
|
||||
}
|
||||
|
||||
public static class VideoProviderExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Sets the frame buffer to the given frame buffer
|
||||
/// Note: This sets the value returned by <see cref="IVideoProvider.GetVideoBuffer" />
|
||||
/// which relies on the core to send a reference to the frame buffer instead of a copy,
|
||||
/// in order to work
|
||||
/// </summary>
|
||||
public static void PopulateFromBuffer(this IVideoProvider videoProvider, int[] frameBuffer)
|
||||
{
|
||||
var b1 = frameBuffer;
|
||||
var b2 = videoProvider.GetVideoBuffer();
|
||||
int len = Math.Min(b1.Length, b2.Length);
|
||||
for (int i = 0; i < len; i++)
|
||||
{
|
||||
b2[i] = b1[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue