diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/QuickNES/LibQuickNES.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/QuickNES/LibQuickNES.cs index e38b2f90bd..c518cb8081 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/QuickNES/LibQuickNES.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/QuickNES/LibQuickNES.cs @@ -50,16 +50,16 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.QuickNES /// context /// width /// height - [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); /// /// set output video buffer that will be used for all subsequent renders until replaced /// /// context /// 8bpp, at least as big as qn_get_image_dimensions() /// byte pitch - [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); /// /// emulate a single frame /// diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/QuickNES/QuickNES.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/QuickNES/QuickNES.cs index 0f7a1855d8..2c9dbd701d 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/QuickNES/QuickNES.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/QuickNES/QuickNES.cs @@ -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); } diff --git a/output/dll/libquicknes.dll b/output/dll/libquicknes.dll index 2e69911bfc..df5f62974f 100644 Binary files a/output/dll/libquicknes.dll and b/output/dll/libquicknes.dll differ diff --git a/quicknes/bizinterface.cpp b/quicknes/bizinterface.cpp index 052f4ea5ff..66b8f193d2 100644 --- a/quicknes/bizinterface.cpp +++ b/quicknes/bizinterface.cpp @@ -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) { diff --git a/quicknes/libquicknes/libquicknes.vcxproj b/quicknes/libquicknes/libquicknes.vcxproj index e07d809c69..706beeead5 100644 --- a/quicknes/libquicknes/libquicknes.vcxproj +++ b/quicknes/libquicknes/libquicknes.vcxproj @@ -34,9 +34,6 @@ - - - @@ -47,7 +44,6 @@ - diff --git a/quicknes/libquicknes/libquicknes.vcxproj.filters b/quicknes/libquicknes/libquicknes.vcxproj.filters index 73b372c67e..10f27d6592 100644 --- a/quicknes/libquicknes/libquicknes.vcxproj.filters +++ b/quicknes/libquicknes/libquicknes.vcxproj.filters @@ -84,15 +84,6 @@ Source Files\nes_emu - - Source Files\nes_emu - - - Source Files\nes_emu - - - Source Files\nes_emu - Source Files\nes_emu @@ -123,9 +114,6 @@ Source Files\nes_emu - - Source Files\nes_emu - Source Files\nes_emu diff --git a/quicknes/mingw/Makefile b/quicknes/mingw/Makefile index 5f9700683c..a69360bd08 100644 --- a/quicknes/mingw/Makefile +++ b/quicknes/mingw/Makefile @@ -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) diff --git a/quicknes/nes_emu/Nes_Emu.cpp b/quicknes/nes_emu/Nes_Emu.cpp index 5b2a1ddc6b..a14cae5306 100644 --- a/quicknes/nes_emu/Nes_Emu.cpp +++ b/quicknes/nes_emu/Nes_Emu.cpp @@ -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_() diff --git a/quicknes/nes_emu/Nes_Emu.h b/quicknes/nes_emu/Nes_Emu.h index c3394e2154..cbd53be84f 100644 --- a/quicknes/nes_emu/Nes_Emu.h +++ b/quicknes/nes_emu/Nes_Emu.h @@ -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;