BizHawk/BizHawk.Emulation.Cores/Consoles/Fairchild/ChannelF/ChannelF.IVideoProvider.cs

73 lines
1.6 KiB
C#
Raw Normal View History

using System;
2019-04-26 16:51:45 +00:00
using BizHawk.Common;
using BizHawk.Common.BufferExtensions;
using BizHawk.Emulation.Common;
namespace BizHawk.Emulation.Cores.Consoles.ChannelF
{
2019-04-17 21:28:12 +00:00
public partial class ChannelF : IVideoProvider, IRegionable
{
2019-05-07 13:43:36 +00:00
public int _frameHz = 60;
2019-04-26 16:51:45 +00:00
2019-05-07 13:43:36 +00:00
public int[] CroppedBuffer = new int[(128*64) * 2]; //new int[102 * 58];
2019-04-26 16:51:45 +00:00
2019-05-07 13:43:36 +00:00
#region IVideoProvider
2019-05-07 13:43:36 +00:00
public int VirtualWidth => BufferWidth * 2;
public int VirtualHeight => (int)((double)BufferHeight * 1.5) * 2;
public int BufferWidth => 128;// 102;
public int BufferHeight => 64; // 58;
public int BackgroundColor => Colors.ARGB(0x00, 0x00, 0x00);
public int VsyncNumerator => _frameHz;
public int VsyncDenominator => 1;
public int[] GetVideoBuffer()
{
2019-05-07 13:43:36 +00:00
BuildFrame();
/*
for (int i = 0; i < frameBuffer.Length; i++)
2019-04-26 16:51:45 +00:00
{
2019-05-07 13:43:36 +00:00
CroppedBuffer[i] = frameBuffer[i];
CroppedBuffer[i + frameBuffer.Length] = frameBuffer[i];
2019-04-26 16:51:45 +00:00
}
2019-04-25 22:52:35 +00:00
2019-05-07 13:43:36 +00:00
return CroppedBuffer;
*/
return frameBuffer;
2019-05-07 13:43:36 +00:00
// crop to visible area
var lR = 4;
var rR = 128 - BufferWidth - lR;
var tR = 4;
var bR = 64 - BufferHeight - tR;
var sW = 128 - lR - rR;
var startP = 128 * tR;
var endP = 128 * bR;
2019-04-17 21:28:12 +00:00
2019-05-07 13:43:36 +00:00
int index2 = 0;
2019-04-25 22:52:35 +00:00
2019-05-07 13:43:36 +00:00
// line by line
for (int i = startP; i < CroppedBuffer.Length - endP; i += sW + lR + rR)
2019-04-25 22:52:35 +00:00
{
2019-05-07 13:43:36 +00:00
// each pixel in each line
for (int p = lR; p < sW + lR + rR - rR; p++)
{
if (index2 == CroppedBuffer.Length)
break;
CroppedBuffer[index2++] = frameBuffer[i + p];
}
2019-04-25 22:52:35 +00:00
}
2019-05-07 13:43:36 +00:00
return CroppedBuffer;
2019-04-25 22:52:35 +00:00
}
2019-05-07 13:43:36 +00:00
#endregion
2019-04-25 22:52:35 +00:00
2019-04-17 21:28:12 +00:00
#region IRegionable
public DisplayType Region => DisplayType.NTSC;
#endregion
}
}