MelonDS: IVideoProvider

This commit is contained in:
SuuperW 2019-10-15 10:14:21 -05:00
parent de1980debe
commit 7fe705a120
3 changed files with 48 additions and 1 deletions

View File

@ -987,6 +987,7 @@
<Compile Include="Consoles\Nintendo\N64\NativeApi\mupen64plusInputApi.cs" />
<Compile Include="Consoles\Nintendo\N64\NativeApi\mupen64plusVideoApi.cs" />
<Compile Include="Consoles\Nintendo\NDS\MelonDS.cs" />
<Compile Include="Consoles\Nintendo\NDS\MelonDS_VideoProvider.cs" />
<Compile Include="Consoles\Nintendo\NES\APU.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\AVE-NINA.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\AxROM.cs">

View File

@ -10,7 +10,7 @@ using BizHawk.Emulation.Common;
namespace BizHawk.Emulation.Cores.Consoles.Nintendo.NDS
{
[Core("MelonDS", "Arisotura")]
unsafe class MelonDS : IEmulator
unsafe partial class MelonDS : IEmulator
{
private BasicServiceProvider _serviceProvider;
public IEmulatorServiceProvider ServiceProvider => _serviceProvider;

View File

@ -0,0 +1,46 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Runtime.InteropServices;
using BizHawk.Emulation.Common;
namespace BizHawk.Emulation.Cores.Consoles.Nintendo.NDS
{
unsafe partial class MelonDS : IVideoProvider
{
private const int NATIVE_WIDTH = 256;
/// <summary>
/// for a single screen
/// </summary>
private const int NATIVE_HEIGHT = 192;
public int VirtualWidth => NATIVE_WIDTH;
public int VirtualHeight => NATIVE_HEIGHT * 2;
public int BufferWidth => NATIVE_WIDTH;
public int BufferHeight => NATIVE_HEIGHT * 2;
public int VsyncNumerator => 60;
public int VsyncDenominator => 1;
public int BackgroundColor => 0;
[DllImport(dllPath)]
private static extern void VideoBuffer32bit(int* dstBuffer);
public int[] GetVideoBuffer()
{
int[] ret = new int[NATIVE_WIDTH * NATIVE_HEIGHT * 2];
fixed (int* v = ret)
{
VideoBuffer32bit(v);
}
return ret;
}
}
}