quicknes: cleanup
This commit is contained in:
parent
34fd1ec10a
commit
c2b8879303
|
@ -50,16 +50,16 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.QuickNES
|
|||
/// <param name="e">context</param>
|
||||
/// <param name="width">width</param>
|
||||
/// <param name="height">height</param>
|
||||
[DllImport(dllname, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void qn_get_image_dimensions(IntPtr e, ref int width, ref int height);
|
||||
//[DllImport(dllname, CallingConvention = CallingConvention.Cdecl)]
|
||||
//public static extern void qn_get_image_dimensions(IntPtr e, ref int width, ref int height);
|
||||
/// <summary>
|
||||
/// set output video buffer that will be used for all subsequent renders until replaced
|
||||
/// </summary>
|
||||
/// <param name="e">context</param>
|
||||
/// <param name="dest">8bpp, at least as big as qn_get_image_dimensions()</param>
|
||||
/// <param name="pitch">byte pitch</param>
|
||||
[DllImport(dllname, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void qn_set_pixels(IntPtr e, IntPtr dest, int pitch);
|
||||
//[DllImport(dllname, CallingConvention = CallingConvention.Cdecl)]
|
||||
//public static extern void qn_set_pixels(IntPtr e, IntPtr dest, int pitch);
|
||||
/// <summary>
|
||||
/// emulate a single frame
|
||||
/// </summary>
|
||||
|
|
|
@ -488,11 +488,11 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.QuickNES
|
|||
LibQuickNES.qn_delete(Context);
|
||||
Context = IntPtr.Zero;
|
||||
}
|
||||
if (VideoInput != null)
|
||||
{
|
||||
VideoInputH.Free();
|
||||
VideoInput = null;
|
||||
}
|
||||
//if (VideoInput != null)
|
||||
//{
|
||||
// VideoInputH.Free();
|
||||
// VideoInput = null;
|
||||
//}
|
||||
if (VideoOutput != null)
|
||||
{
|
||||
VideoOutputH.Free();
|
||||
|
@ -503,8 +503,8 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.QuickNES
|
|||
#region VideoProvider
|
||||
|
||||
int[] VideoOutput;
|
||||
byte[] VideoInput;
|
||||
GCHandle VideoInputH;
|
||||
//byte[] VideoInput;
|
||||
//GCHandle VideoInputH;
|
||||
GCHandle VideoOutputH;
|
||||
|
||||
int cropleft = 0;
|
||||
|
@ -523,10 +523,10 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.QuickNES
|
|||
void InitVideo()
|
||||
{
|
||||
int w = 0, h = 0;
|
||||
LibQuickNES.qn_get_image_dimensions(Context, ref w, ref h);
|
||||
VideoInput = new byte[w * h];
|
||||
VideoInputH = GCHandle.Alloc(VideoInput, GCHandleType.Pinned);
|
||||
LibQuickNES.qn_set_pixels(Context, VideoInputH.AddrOfPinnedObject(), w);
|
||||
//LibQuickNES.qn_get_image_dimensions(Context, ref w, ref h);
|
||||
//VideoInput = new byte[w * h];
|
||||
//VideoInputH = GCHandle.Alloc(VideoInput, GCHandleType.Pinned);
|
||||
//LibQuickNES.qn_set_pixels(Context, VideoInputH.AddrOfPinnedObject(), w);
|
||||
VideoOutput = new int[256 * 240];
|
||||
VideoOutputH = GCHandle.Alloc(VideoOutput, GCHandleType.Pinned);
|
||||
}
|
||||
|
|
Binary file not shown.
|
@ -49,18 +49,18 @@ EXPORT const char *qn_set_sample_rate(Nes_Emu *e, int rate)
|
|||
return ret;
|
||||
}
|
||||
|
||||
EXPORT void qn_get_image_dimensions(Nes_Emu *e, int *width, int *height)
|
||||
{
|
||||
if (width)
|
||||
*width = e->buffer_width;
|
||||
if (height)
|
||||
*height = e->buffer_height();
|
||||
}
|
||||
//EXPORT void qn_get_image_dimensions(Nes_Emu *e, int *width, int *height)
|
||||
//{
|
||||
// if (width)
|
||||
// *width = e->buffer_width;
|
||||
// if (height)
|
||||
// *height = e->buffer_height();
|
||||
//}
|
||||
|
||||
EXPORT void qn_set_pixels(Nes_Emu *e, void *dest, int pitch)
|
||||
{
|
||||
e->set_pixels(dest, pitch);
|
||||
}
|
||||
//EXPORT void qn_set_pixels(Nes_Emu *e, void *dest, int pitch)
|
||||
//{
|
||||
// e->set_pixels(dest, pitch);
|
||||
//}
|
||||
|
||||
EXPORT const char *qn_emulate_frame(Nes_Emu *e, int pad1, int pad2)
|
||||
{
|
||||
|
|
|
@ -34,9 +34,6 @@
|
|||
<ClCompile Include="..\nes_emu\Nes_Effects_Buffer.cpp" />
|
||||
<ClCompile Include="..\nes_emu\Nes_Emu.cpp" />
|
||||
<ClCompile Include="..\nes_emu\Nes_File.cpp" />
|
||||
<ClCompile Include="..\nes_emu\Nes_Film.cpp" />
|
||||
<ClCompile Include="..\nes_emu\Nes_Film_Data.cpp" />
|
||||
<ClCompile Include="..\nes_emu\Nes_Film_Packer.cpp" />
|
||||
<ClCompile Include="..\nes_emu\Nes_Fme7_Apu.cpp" />
|
||||
<ClCompile Include="..\nes_emu\Nes_Mapper.cpp" />
|
||||
<ClCompile Include="..\nes_emu\nes_mappers.cpp" />
|
||||
|
@ -47,7 +44,6 @@
|
|||
<ClCompile Include="..\nes_emu\Nes_Ppu.cpp" />
|
||||
<ClCompile Include="..\nes_emu\Nes_Ppu_Impl.cpp" />
|
||||
<ClCompile Include="..\nes_emu\Nes_Ppu_Rendering.cpp" />
|
||||
<ClCompile Include="..\nes_emu\Nes_Recorder.cpp" />
|
||||
<ClCompile Include="..\nes_emu\Nes_State.cpp" />
|
||||
<ClCompile Include="..\nes_emu\nes_util.cpp" />
|
||||
<ClCompile Include="..\nes_emu\Nes_Vrc6_Apu.cpp" />
|
||||
|
|
|
@ -84,15 +84,6 @@
|
|||
<ClCompile Include="..\nes_emu\Nes_File.cpp">
|
||||
<Filter>Source Files\nes_emu</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\nes_emu\Nes_Film.cpp">
|
||||
<Filter>Source Files\nes_emu</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\nes_emu\Nes_Film_Data.cpp">
|
||||
<Filter>Source Files\nes_emu</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\nes_emu\Nes_Film_Packer.cpp">
|
||||
<Filter>Source Files\nes_emu</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\nes_emu\Nes_Fme7_Apu.cpp">
|
||||
<Filter>Source Files\nes_emu</Filter>
|
||||
</ClCompile>
|
||||
|
@ -123,9 +114,6 @@
|
|||
<ClCompile Include="..\nes_emu\Nes_Ppu_Rendering.cpp">
|
||||
<Filter>Source Files\nes_emu</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\nes_emu\Nes_Recorder.cpp">
|
||||
<Filter>Source Files\nes_emu</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\nes_emu\Nes_State.cpp">
|
||||
<Filter>Source Files\nes_emu</Filter>
|
||||
</ClCompile>
|
||||
|
|
|
@ -25,9 +25,6 @@ SRCS = \
|
|||
../nes_emu/Nes_Effects_Buffer.cpp \
|
||||
../nes_emu/Nes_Emu.cpp \
|
||||
../nes_emu/Nes_File.cpp \
|
||||
../nes_emu/Nes_Film.cpp \
|
||||
../nes_emu/Nes_Film_Data.cpp \
|
||||
../nes_emu/Nes_Film_Packer.cpp \
|
||||
../nes_emu/Nes_Fme7_Apu.cpp \
|
||||
../nes_emu/Nes_Mapper.cpp \
|
||||
../nes_emu/nes_mappers.cpp \
|
||||
|
@ -38,7 +35,6 @@ SRCS = \
|
|||
../nes_emu/Nes_Ppu.cpp \
|
||||
../nes_emu/Nes_Ppu_Impl.cpp \
|
||||
../nes_emu/Nes_Ppu_Rendering.cpp \
|
||||
../nes_emu/Nes_Recorder.cpp \
|
||||
../nes_emu/Nes_State.cpp \
|
||||
../nes_emu/nes_util.cpp \
|
||||
../nes_emu/Nes_Vrc6_Apu.cpp \
|
||||
|
@ -46,6 +42,10 @@ SRCS = \
|
|||
../fex/Data_Reader.cpp \
|
||||
../fex/blargg_errors.cpp \
|
||||
../fex/blargg_common.cpp
|
||||
# ../nes_emu/Nes_Recorder.cpp
|
||||
# ../nes_emu/Nes_Film.cpp
|
||||
# ../nes_emu/Nes_Film_Data.cpp
|
||||
# ../nes_emu/Nes_Film_Packer.cpp
|
||||
|
||||
OBJS = $(SRCS:.cpp=.o)
|
||||
|
||||
|
|
|
@ -47,11 +47,14 @@ Nes_Emu::Nes_Emu()
|
|||
init_called = false;
|
||||
set_palette_range( 0 );
|
||||
memset( single_frame.palette, 0, sizeof single_frame.palette );
|
||||
host_pixel_buff = new char[buffer_width * buffer_height()];
|
||||
set_pixels(host_pixel_buff, buffer_width);
|
||||
}
|
||||
|
||||
Nes_Emu::~Nes_Emu()
|
||||
{
|
||||
delete default_sound_buf;
|
||||
delete[] host_pixel_buff;
|
||||
}
|
||||
|
||||
blargg_err_t Nes_Emu::init_()
|
||||
|
|
|
@ -37,11 +37,13 @@ public:
|
|||
enum { buffer_width = Nes_Ppu::buffer_width };
|
||||
int buffer_height() const { return buffer_height_; }
|
||||
enum { bits_per_pixel = 8 };
|
||||
|
||||
|
||||
private:
|
||||
// Set graphics buffer to render pixels to. Pixels points to top-left pixel and
|
||||
// row_bytes is the number of bytes to get to the next line (positive or negative).
|
||||
void set_pixels( void* pixels, long row_bytes );
|
||||
|
||||
public:
|
||||
|
||||
// Size of image generated in graphics buffer
|
||||
enum { image_width = 256 };
|
||||
enum { image_height = 240 };
|
||||
|
@ -241,6 +243,7 @@ private:
|
|||
void clear_sound_buf();
|
||||
void fade_samples( blip_sample_t*, int size, int step );
|
||||
|
||||
char* host_pixel_buff;
|
||||
char* host_pixels;
|
||||
int host_palette_size;
|
||||
frame_t single_frame;
|
||||
|
|
Loading…
Reference in New Issue