BizHawk/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/VBANext.IVideoProvider.cs

45 lines
1014 B
C#
Raw Normal View History

2015-01-17 20:48:31 +00:00
using System;
using BizHawk.Emulation.Common;
2017-04-25 16:14:24 +00:00
using BizHawk.Emulation.Cores.Nintendo.Gameboy;
2015-01-17 20:48:31 +00:00
namespace BizHawk.Emulation.Cores.Nintendo.GBA
{
public partial class VBANext : IVideoProvider
{
2017-04-25 16:14:24 +00:00
public int VirtualWidth => 240;
public int VirtualHeight => 160;
public int BufferWidth => 240;
public int BufferHeight => 160;
2015-01-17 20:48:31 +00:00
2017-04-25 16:14:24 +00:00
public int BackgroundColor => unchecked((int)0xff000000);
2015-01-17 20:48:31 +00:00
public int[] GetVideoBuffer()
{
2017-04-25 16:14:24 +00:00
return _videobuff;
2015-01-17 20:48:31 +00:00
}
public int VsyncNum => 262144;
public int VsyncDen => 4389;
2017-04-25 16:14:24 +00:00
private readonly int[] _videobuff = new int[240 * 160];
private readonly int[] _videopalette = new int[65536];
2015-01-17 20:48:31 +00:00
private void SetupColors()
{
2017-04-25 16:14:24 +00:00
int[] tmp = GBColors.GetLut(GBColors.ColorType.vivid);
2015-01-17 20:48:31 +00:00
// reorder
for (int i = 0; i < 32768; i++)
{
int j = i & 0x3e0 | (i & 0x1f) << 10 | i >> 10 & 0x1f;
2017-04-25 16:14:24 +00:00
_videopalette[i] = tmp[j];
2015-01-17 20:48:31 +00:00
}
2017-04-25 16:14:24 +00:00
2015-01-17 20:48:31 +00:00
// duplicate
2017-04-25 16:14:24 +00:00
Array.Copy(_videopalette, 0, _videopalette, 32768, 32768);
2015-01-17 20:48:31 +00:00
}
}
}