├── CWindow.cpp ├── CWindow.h ├── GPU_osd.cpp ├── GPU_osd.h ├── Icons ├── VBjin.bmp ├── VBjin.ico └── VBjin.png ├── ParseCmdLine.cpp ├── ParseCmdLine.h ├── Readme.md ├── agg ├── agg-2.5.lib └── include │ ├── agg_arc.h │ ├── agg_array.h │ ├── agg_basics.h │ ├── agg_bezier_arc.h │ ├── agg_bounding_rect.h │ ├── agg_clip_liang_barsky.h │ ├── agg_color_gray.h │ ├── agg_color_rgba.h │ ├── agg_config.h │ ├── agg_conv_adaptor_vcgen.h │ ├── agg_conv_curve.h │ ├── agg_conv_stroke.h │ ├── agg_conv_transform.h │ ├── agg_curves.h │ ├── agg_dda_line.h │ ├── agg_ellipse_bresenham.h │ ├── agg_embedded_raster_fonts.h │ ├── agg_font_cache_manager.h │ ├── agg_gamma_functions.h │ ├── agg_glyph_raster_bin.h │ ├── agg_image_accessors.h │ ├── agg_image_filters.h │ ├── agg_line_aa_basics.h │ ├── agg_math.h │ ├── agg_math_stroke.h │ ├── agg_path_storage.h │ ├── agg_pattern_filters_rgba.h │ ├── agg_pixfmt_rgb.h │ ├── agg_pixfmt_rgb_packed.h │ ├── agg_pixfmt_rgba.h │ ├── agg_rasterizer_cells_aa.h │ ├── agg_rasterizer_outline_aa.h │ ├── agg_rasterizer_scanline_aa.h │ ├── agg_rasterizer_sl_clip.h │ ├── agg_renderer_base.h │ ├── agg_renderer_markers.h │ ├── agg_renderer_mclip.h │ ├── agg_renderer_outline_aa.h │ ├── agg_renderer_outline_image.h │ ├── agg_renderer_primitives.h │ ├── agg_renderer_raster_text.h │ ├── agg_renderer_scanline.h │ ├── agg_rendering_buffer.h │ ├── agg_rounded_rect.h │ ├── agg_scanline_p.h │ ├── agg_scanline_u.h │ ├── agg_span_allocator.h │ ├── agg_span_converter.h │ ├── agg_span_gradient.h │ ├── agg_span_image_filter.h │ ├── agg_span_image_filter_gray.h │ ├── agg_span_image_filter_rgb.h │ ├── agg_span_image_filter_rgba.h │ ├── agg_span_interpolator_linear.h │ ├── agg_trans_affine.h │ ├── agg_trans_viewport.h │ ├── agg_vcgen_stroke.h │ └── agg_vertex_sequence.h ├── agg2d.h ├── agg2d.inl ├── aggdraw.cpp ├── aggdraw.h ├── aviout.cpp ├── aviout.h ├── d3d.cpp ├── d3d.h ├── dd.cpp ├── dd.h ├── directx ├── DxErr8.lib ├── ddraw.h ├── ddraw.lib ├── dinput.h ├── dinput8.lib ├── dsound.h ├── dsound.lib ├── dxerr8.h └── dxguid.lib ├── docs └── Changelog.txt ├── dxsound.cpp ├── dxsound.h ├── hotkey.cpp ├── hotkey.h ├── inttypes.h ├── lua-engine.cpp ├── lua-engine.h ├── lua ├── lauxlib.h ├── llimits.h ├── lmem.h ├── lobject.h ├── lstate.h ├── ltm.h ├── lua-5.1.4-x86.lib ├── lua.h ├── lua51.dll ├── lua51.lib ├── luaconf.h ├── lualib.h └── lzio.h ├── luaScripts └── MusicSelect.lua ├── luaconsole.cpp ├── main.cpp ├── main.h ├── mednafen ├── include │ ├── Fir_Resampler.h │ ├── blargg_common.h │ ├── blargg_config.h │ ├── blargg_endian.h │ ├── blargg_source.h │ ├── blip │ │ ├── Blip_Buffer.h │ │ ├── Stereo_Buffer.h │ │ └── old │ │ │ └── Blip_Buffer.h │ ├── config.h.in │ └── trio │ │ ├── trio.h │ │ ├── triodef.h │ │ ├── trionan.h │ │ ├── triop.h │ │ └── triostr.h └── src │ ├── compress │ ├── Makefile.am.inc │ ├── blz.c │ ├── blz.h │ ├── ioapi.c │ ├── ioapi.h │ ├── lzoconf.h │ ├── lzodefs.h │ ├── minilzo.c │ ├── minilzo.h │ ├── quicklz.cpp │ ├── quicklz.h │ ├── unzip.c │ └── unzip.h │ ├── endian.cpp │ ├── endian.h │ ├── error.cpp │ ├── error.h │ ├── file.cpp │ ├── file.h │ ├── general.cpp │ ├── general.h │ ├── git.h │ ├── hw_cpu │ └── v810 │ │ ├── fpu-new │ │ ├── mednafen-gcc.h │ │ ├── milieu.h │ │ ├── softfloat-macros │ │ ├── softfloat-specialize │ │ ├── softfloat.c │ │ ├── softfloat.h │ │ └── timesoftfloat.c │ │ ├── v810_cpu.cpp │ │ ├── v810_cpu.h │ │ ├── v810_cpuD.cpp │ │ ├── v810_cpuD.h │ │ ├── v810_do_am.h │ │ ├── v810_op_table.inc │ │ ├── v810_oploop.inc │ │ └── v810_opt.h │ ├── math_ops.cpp │ ├── math_ops.h │ ├── md5.cpp │ ├── md5.h │ ├── mednafen.cpp │ ├── mednafen.h │ ├── memory.cpp │ ├── memory.h │ ├── mempatcher.cpp │ ├── mempatcher.h │ ├── settings-common.h │ ├── settings-driver.h │ ├── settings.cpp │ ├── settings.h │ ├── sound.h │ ├── sound │ ├── Blip_Buffer.cpp │ ├── Fir_Resampler.cpp │ ├── Makefile.am │ ├── Makefile.in │ ├── Stereo_Buffer.cpp │ └── sound.cpp │ ├── state-common.h │ ├── state-driver.h │ ├── state.cpp │ ├── state.h │ ├── trio │ ├── Makefile.am │ ├── Makefile.in │ ├── trio.c │ ├── trionan.c │ └── triostr.c │ ├── vb │ ├── Makefile.am │ ├── Makefile.in │ ├── debug.cpp │ ├── debug.h │ ├── input.cpp │ ├── input.h │ ├── timer.cpp │ ├── timer.h │ ├── vb.cpp │ ├── vb.h │ ├── vip.cpp │ ├── vip.h │ ├── vip_draw.inc │ ├── vsu.cpp │ └── vsu.h │ ├── video.h │ └── video │ ├── png.cpp │ ├── png.h │ ├── video-common.h │ └── video.cpp ├── memView.cpp ├── memView.h ├── movie.cpp ├── movie.h ├── oculus ├── LibOVR │ ├── Include │ │ ├── Extras │ │ │ ├── OVR_CAPI_Util.h │ │ │ ├── OVR_Math.h │ │ │ └── OVR_StereoProjection.h │ │ ├── OVR_CAPI.h │ │ ├── OVR_CAPI_Audio.h │ │ ├── OVR_CAPI_D3D.h │ │ ├── OVR_CAPI_GL.h │ │ ├── OVR_CAPI_Keys.h │ │ ├── OVR_ErrorCode.h │ │ └── OVR_Version.h │ ├── Projects │ │ └── Windows │ │ │ ├── ForceRebuild.props │ │ │ ├── LibOVR.props │ │ │ ├── OVRRootPath.props │ │ │ ├── VS2010 │ │ │ ├── LibOVR.vcxproj │ │ │ └── LibOVR.vcxproj.filters │ │ │ ├── VS2012 │ │ │ ├── LibOVR.vcxproj │ │ │ └── LibOVR.vcxproj.filters │ │ │ ├── VS2013 │ │ │ ├── LibOVR.vcxproj │ │ │ └── LibOVR.vcxproj.filters │ │ │ └── VS2015 │ │ │ ├── LibOVR.vcxproj │ │ │ └── LibOVR.vcxproj.filters │ └── Src │ │ ├── OVR_CAPIShim.c │ │ ├── OVR_CAPI_Util.cpp │ │ ├── OVR_StereoProjection.cpp │ │ └── Resources │ │ └── Windows │ │ ├── LibOVR.rc │ │ ├── Oculus.ico │ │ └── resource.h ├── RenderTiny_D3D11_Device.cpp ├── RenderTiny_D3D11_Device.h └── Win32_DirectXAppUtil.h ├── pcejin.h ├── pcejin.rc ├── prefix.h ├── ramsearch.cpp ├── ramsearch.h ├── ramwatch.cpp ├── ramwatch.h ├── recentroms.cpp ├── recentroms.h ├── replay.cpp ├── replay.h ├── resource.h ├── targetver.h ├── throttle.cpp ├── types.h ├── unixstuff.h ├── utils ├── SubWCRev.bat ├── SubWCRev.exe ├── intl3_tsvn.dll ├── libapr_tsvn.dll ├── libaprutil_tsvn.dll ├── readwrite.cpp ├── readwrite.h ├── svnrev.h ├── svnrev_template.h ├── xstring.cpp └── xstring.h ├── vc10_vbjin.sln ├── vc10_vbjin.vcxproj ├── waveout.cpp ├── waveout.h └── zlib ├── zconf.h ├── zlib-2005-x32.lib ├── zlib-2005-x64.lib ├── zlib-2008-x32.lib ├── zlib-2008-x64.lib ├── zlib.h └── zutil.h /GPU_osd.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2006 yopyop 2 | yopyop156@ifrance.com 3 | yopyop156.ifrance.com 4 | 5 | Copyright (C) 2006-2008 DeSmuME team 6 | 7 | This file is part of DeSmuME 8 | 9 | DeSmuME is free software; you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation; either version 2 of the License, or 12 | (at your option) any later version. 13 | 14 | DeSmuME is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with DeSmuME; if not, write to the Free Software 21 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 22 | */ 23 | 24 | #ifndef __GPU_OSD_ 25 | #define __GPU_OSD_ 26 | 27 | #include 28 | #include 29 | #include "types.h" 30 | 31 | #include "aggdraw.h" 32 | 33 | #define OSD_MAX_LINES 4 34 | #define OSD_TIMER_SECS 2 35 | 36 | 37 | struct HudCoordinates{ 38 | int x; 39 | int y; 40 | int xsize; 41 | int ysize; 42 | int storedx; 43 | int storedy; 44 | int clicked; 45 | }; 46 | 47 | struct HudStruct 48 | { 49 | public: 50 | HudStruct() 51 | : fps(0) 52 | , fps3d(0) 53 | {} 54 | 55 | HudCoordinates SavestateSlots; 56 | HudCoordinates FpsDisplay; 57 | HudCoordinates FrameCounter; 58 | HudCoordinates InputDisplay; 59 | HudCoordinates LagFrameCounter; 60 | HudCoordinates Microphone; 61 | HudCoordinates Dummy; 62 | 63 | bool ShowInputDisplay; 64 | bool FrameCounterDisplay; 65 | bool ShowLagFrameCounter; 66 | bool DisplayStateSlots; 67 | 68 | HudCoordinates &hud(int i) { return ((HudCoordinates*)this)[i]; } 69 | void reset(); 70 | 71 | int fps, fps3d; 72 | }; 73 | 74 | void EditHud(s32 x, s32 y, HudStruct *hudstruct); 75 | void HudClickRelease(HudStruct *hudstruct); 76 | 77 | void DrawHUD(); 78 | 79 | extern HudStruct Hud; 80 | extern bool HudEditorMode; 81 | 82 | class OSDCLASS 83 | { 84 | private: 85 | u64 offset; 86 | u8 mode; 87 | 88 | u16 rotAngle; 89 | 90 | u16 lineText_x; 91 | u16 lineText_y; 92 | AggColor lineText_color; 93 | u8 lastLineText; 94 | char *lineText[OSD_MAX_LINES+1]; 95 | time_t lineTimer[OSD_MAX_LINES+1]; 96 | AggColor lineColor[OSD_MAX_LINES+1]; 97 | 98 | bool needUpdate; 99 | 100 | bool checkTimers(); 101 | public: 102 | char name[7]; // for debuging 103 | OSDCLASS(u8 core); 104 | ~OSDCLASS(); 105 | 106 | void setOffset(u16 ofs); 107 | void setRotate(u16 angle); 108 | void update(); 109 | void clear(); 110 | void setListCoord(u16 x, u16 y); 111 | void setLineColor(u8 r, u8 b, u8 g); 112 | void addLine(const char *fmt, ...); 113 | void addFixed(u16 x, u16 y, const char *fmt, ...); 114 | void border(bool enabled); 115 | }; 116 | 117 | extern OSDCLASS *osd; 118 | #endif 119 | -------------------------------------------------------------------------------- /Icons/VBjin.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/braindx/vbjin-ovr/d49106264b790ec35752bf492d6a824a7f452c10/Icons/VBjin.bmp -------------------------------------------------------------------------------- /Icons/VBjin.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/braindx/vbjin-ovr/d49106264b790ec35752bf492d6a824a7f452c10/Icons/VBjin.ico -------------------------------------------------------------------------------- /Icons/VBjin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/braindx/vbjin-ovr/d49106264b790ec35752bf492d6a824a7f452c10/Icons/VBjin.png -------------------------------------------------------------------------------- /ParseCmdLine.h: -------------------------------------------------------------------------------- 1 | void ParseCmdLine(LPSTR lpCmdLine, HWND HWnd); 2 | extern bool startPaused; 3 | extern int stateToLoad; -------------------------------------------------------------------------------- /Readme.md: -------------------------------------------------------------------------------- 1 | # VBjin-OVR - A Virtual Boy Emulator for the Oculus Rift 2 | 3 | VBjin-OVR is a Virtual Boy Emulator for Windows with support for the Oculus Rift VR display device. It's licensed under the terms of the GNU GPL v2, as is its predecessor, [vbjin]. 4 | 5 | ### Latest Version 6 | 3.0 (Oculus PC SDK 1.3.0, compatible with the CV1) 7 | 8 | ### Getting Started 9 | 1. Download the [latest release] 10 | 2. Make sure you have 'Unknown Sources' enabled in your Oculus Rift settings. To do this, check out the [Oculus support page on the subject] 11 | 3. Run VBjin-OVR.exe 12 | 4. Gamepad controls can be configured under Config -> Input Config 13 | 5. Go to File->Open Rom, and choose a ROM 14 | 6. Put on your CV1 15 | 16 | ### Configuration 17 | 1. The color can be changed from the traditional red to greyscale under View -> Coloring. 18 | 2. The viewing mode defaults to 'Head Locked' but can be set to 'Immersive' under View -> Oculus Rift Mode 19 | 20 | ### Oculus Rift Mode: Head Locked 21 | In this mode, the screen is fixed in view and head tracking is ignored. 22 | 23 | ### Oculus Rift Mode: Immersive 24 | In this mode, the screen is placed in the world and head tracking is used to allow you to look around. This mode should be considered experimental and suffers from artifacts inherent to the Virtual Boy's implementation. For example, rolling your head side to side will break the illusion because the Virtual Boy only separates the left and right eyes horizontally. 25 | 26 | [latest release]: 27 | [vbjin]: 28 | [Oculus support page on the subject]: -------------------------------------------------------------------------------- /agg/agg-2.5.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/braindx/vbjin-ovr/d49106264b790ec35752bf492d6a824a7f452c10/agg/agg-2.5.lib -------------------------------------------------------------------------------- /agg/include/agg_arc.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // Anti-Grain Geometry (AGG) - Version 2.5 3 | // A high quality rendering engine for C++ 4 | // Copyright (C) 2002-2006 Maxim Shemanarev 5 | // Contact: mcseem@antigrain.com 6 | // mcseemagg@yahoo.com 7 | // http://antigrain.com 8 | // 9 | // AGG is free software; you can redistribute it and/or 10 | // modify it under the terms of the GNU General Public License 11 | // as published by the Free Software Foundation; either version 2 12 | // of the License, or (at your option) any later version. 13 | // 14 | // AGG is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with AGG; if not, write to the Free Software 21 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 22 | // MA 02110-1301, USA. 23 | //---------------------------------------------------------------------------- 24 | 25 | #ifndef AGG_ARC_INCLUDED 26 | #define AGG_ARC_INCLUDED 27 | 28 | #include 29 | #include "agg_basics.h" 30 | 31 | namespace agg 32 | { 33 | 34 | //=====================================================================arc 35 | // 36 | // See Implementation agg_arc.cpp 37 | // 38 | class arc 39 | { 40 | public: 41 | arc() : m_scale(1.0), m_initialized(false) {} 42 | arc(double x, double y, 43 | double rx, double ry, 44 | double a1, double a2, 45 | bool ccw=true); 46 | 47 | void init(double x, double y, 48 | double rx, double ry, 49 | double a1, double a2, 50 | bool ccw=true); 51 | 52 | void approximation_scale(double s); 53 | double approximation_scale() const { return m_scale; } 54 | 55 | void rewind(unsigned); 56 | unsigned vertex(double* x, double* y); 57 | 58 | private: 59 | void normalize(double a1, double a2, bool ccw); 60 | 61 | double m_x; 62 | double m_y; 63 | double m_rx; 64 | double m_ry; 65 | double m_angle; 66 | double m_start; 67 | double m_end; 68 | double m_scale; 69 | double m_da; 70 | bool m_ccw; 71 | bool m_initialized; 72 | unsigned m_path_cmd; 73 | }; 74 | 75 | 76 | } 77 | 78 | 79 | #endif 80 | -------------------------------------------------------------------------------- /agg/include/agg_bounding_rect.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // Anti-Grain Geometry (AGG) - Version 2.5 3 | // A high quality rendering engine for C++ 4 | // Copyright (C) 2002-2006 Maxim Shemanarev 5 | // Contact: mcseem@antigrain.com 6 | // mcseemagg@yahoo.com 7 | // http://antigrain.com 8 | // 9 | // AGG is free software; you can redistribute it and/or 10 | // modify it under the terms of the GNU General Public License 11 | // as published by the Free Software Foundation; either version 2 12 | // of the License, or (at your option) any later version. 13 | // 14 | // AGG is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with AGG; if not, write to the Free Software 21 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 22 | // MA 02110-1301, USA. 23 | //---------------------------------------------------------------------------- 24 | 25 | #ifndef AGG_BOUNDING_RECT_INCLUDED 26 | #define AGG_BOUNDING_RECT_INCLUDED 27 | 28 | #include "agg_basics.h" 29 | 30 | namespace agg 31 | { 32 | 33 | //-----------------------------------------------------------bounding_rect 34 | template 35 | bool bounding_rect(VertexSource& vs, GetId& gi, 36 | unsigned start, unsigned num, 37 | CoordT* x1, CoordT* y1, CoordT* x2, CoordT* y2) 38 | { 39 | unsigned i; 40 | double x; 41 | double y; 42 | bool first = true; 43 | 44 | *x1 = CoordT(1); 45 | *y1 = CoordT(1); 46 | *x2 = CoordT(0); 47 | *y2 = CoordT(0); 48 | 49 | for(i = 0; i < num; i++) 50 | { 51 | vs.rewind(gi[start + i]); 52 | unsigned cmd; 53 | while(!is_stop(cmd = vs.vertex(&x, &y))) 54 | { 55 | if(is_vertex(cmd)) 56 | { 57 | if(first) 58 | { 59 | *x1 = CoordT(x); 60 | *y1 = CoordT(y); 61 | *x2 = CoordT(x); 62 | *y2 = CoordT(y); 63 | first = false; 64 | } 65 | else 66 | { 67 | if(CoordT(x) < *x1) *x1 = CoordT(x); 68 | if(CoordT(y) < *y1) *y1 = CoordT(y); 69 | if(CoordT(x) > *x2) *x2 = CoordT(x); 70 | if(CoordT(y) > *y2) *y2 = CoordT(y); 71 | } 72 | } 73 | } 74 | } 75 | return *x1 <= *x2 && *y1 <= *y2; 76 | } 77 | 78 | 79 | //-----------------------------------------------------bounding_rect_single 80 | template 81 | bool bounding_rect_single(VertexSource& vs, unsigned path_id, 82 | CoordT* x1, CoordT* y1, CoordT* x2, CoordT* y2) 83 | { 84 | double x; 85 | double y; 86 | bool first = true; 87 | 88 | *x1 = CoordT(1); 89 | *y1 = CoordT(1); 90 | *x2 = CoordT(0); 91 | *y2 = CoordT(0); 92 | 93 | vs.rewind(path_id); 94 | unsigned cmd; 95 | while(!is_stop(cmd = vs.vertex(&x, &y))) 96 | { 97 | if(is_vertex(cmd)) 98 | { 99 | if(first) 100 | { 101 | *x1 = CoordT(x); 102 | *y1 = CoordT(y); 103 | *x2 = CoordT(x); 104 | *y2 = CoordT(y); 105 | first = false; 106 | } 107 | else 108 | { 109 | if(CoordT(x) < *x1) *x1 = CoordT(x); 110 | if(CoordT(y) < *y1) *y1 = CoordT(y); 111 | if(CoordT(x) > *x2) *x2 = CoordT(x); 112 | if(CoordT(y) > *y2) *y2 = CoordT(y); 113 | } 114 | } 115 | } 116 | return *x1 <= *x2 && *y1 <= *y2; 117 | } 118 | 119 | 120 | } 121 | 122 | #endif 123 | -------------------------------------------------------------------------------- /agg/include/agg_config.h: -------------------------------------------------------------------------------- 1 | #ifndef AGG_CONFIG_INCLUDED 2 | #define AGG_CONFIG_INCLUDED 3 | 4 | // This file can be used to redefine certain data types. 5 | 6 | //--------------------------------------- 7 | // 1. Default basic types such as: 8 | // 9 | // AGG_INT8 10 | // AGG_INT8U 11 | // AGG_INT16 12 | // AGG_INT16U 13 | // AGG_INT32 14 | // AGG_INT32U 15 | // AGG_INT64 16 | // AGG_INT64U 17 | // 18 | // Just replace this file with new defines if necessary. 19 | // For example, if your compiler doesn't have a 64 bit integer type 20 | // you can still use AGG if you define the follows: 21 | // 22 | // #define AGG_INT64 int 23 | // #define AGG_INT64U unsigned 24 | // 25 | // It will result in overflow in 16 bit-per-component image/pattern resampling 26 | // but it won't result any crash and the rest of the library will remain 27 | // fully functional. 28 | 29 | 30 | //--------------------------------------- 31 | // 2. Default rendering_buffer type. Can be: 32 | // 33 | // Provides faster access for massive pixel operations, 34 | // such as blur, image filtering: 35 | // #define AGG_RENDERING_BUFFER row_ptr_cache 36 | // 37 | // Provides cheaper creation and destruction (no mem allocs): 38 | // #define AGG_RENDERING_BUFFER row_accessor 39 | // 40 | // You can still use both of them simultaneouslyin your applications 41 | // This #define is used only for default rendering_buffer type, 42 | // in short hand typedefs like pixfmt_rgba32. 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /agg/include/agg_conv_stroke.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // Anti-Grain Geometry (AGG) - Version 2.5 3 | // A high quality rendering engine for C++ 4 | // Copyright (C) 2002-2006 Maxim Shemanarev 5 | // Contact: mcseem@antigrain.com 6 | // mcseemagg@yahoo.com 7 | // http://antigrain.com 8 | // 9 | // AGG is free software; you can redistribute it and/or 10 | // modify it under the terms of the GNU General Public License 11 | // as published by the Free Software Foundation; either version 2 12 | // of the License, or (at your option) any later version. 13 | // 14 | // AGG is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with AGG; if not, write to the Free Software 21 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 22 | // MA 02110-1301, USA. 23 | //---------------------------------------------------------------------------- 24 | 25 | #ifndef AGG_CONV_STROKE_INCLUDED 26 | #define AGG_CONV_STROKE_INCLUDED 27 | 28 | #include "agg_basics.h" 29 | #include "agg_vcgen_stroke.h" 30 | #include "agg_conv_adaptor_vcgen.h" 31 | 32 | namespace agg 33 | { 34 | 35 | //-------------------------------------------------------------conv_stroke 36 | template 37 | struct conv_stroke : 38 | public conv_adaptor_vcgen 39 | { 40 | typedef Markers marker_type; 41 | typedef conv_adaptor_vcgen base_type; 42 | 43 | conv_stroke(VertexSource& vs) : 44 | conv_adaptor_vcgen(vs) 45 | { 46 | } 47 | 48 | void line_cap(line_cap_e lc) { base_type::generator().line_cap(lc); } 49 | void line_join(line_join_e lj) { base_type::generator().line_join(lj); } 50 | void inner_join(inner_join_e ij) { base_type::generator().inner_join(ij); } 51 | 52 | line_cap_e line_cap() const { return base_type::generator().line_cap(); } 53 | line_join_e line_join() const { return base_type::generator().line_join(); } 54 | inner_join_e inner_join() const { return base_type::generator().inner_join(); } 55 | 56 | void width(double w) { base_type::generator().width(w); } 57 | void miter_limit(double ml) { base_type::generator().miter_limit(ml); } 58 | void miter_limit_theta(double t) { base_type::generator().miter_limit_theta(t); } 59 | void inner_miter_limit(double ml) { base_type::generator().inner_miter_limit(ml); } 60 | void approximation_scale(double as) { base_type::generator().approximation_scale(as); } 61 | 62 | double width() const { return base_type::generator().width(); } 63 | double miter_limit() const { return base_type::generator().miter_limit(); } 64 | double inner_miter_limit() const { return base_type::generator().inner_miter_limit(); } 65 | double approximation_scale() const { return base_type::generator().approximation_scale(); } 66 | 67 | void shorten(double s) { base_type::generator().shorten(s); } 68 | double shorten() const { return base_type::generator().shorten(); } 69 | 70 | private: 71 | conv_stroke(const conv_stroke&); 72 | const conv_stroke& 73 | operator = (const conv_stroke&); 74 | 75 | }; 76 | 77 | } 78 | 79 | #endif 80 | -------------------------------------------------------------------------------- /agg/include/agg_conv_transform.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // Anti-Grain Geometry (AGG) - Version 2.5 3 | // A high quality rendering engine for C++ 4 | // Copyright (C) 2002-2006 Maxim Shemanarev 5 | // Contact: mcseem@antigrain.com 6 | // mcseemagg@yahoo.com 7 | // http://antigrain.com 8 | // 9 | // AGG is free software; you can redistribute it and/or 10 | // modify it under the terms of the GNU General Public License 11 | // as published by the Free Software Foundation; either version 2 12 | // of the License, or (at your option) any later version. 13 | // 14 | // AGG is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with AGG; if not, write to the Free Software 21 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 22 | // MA 02110-1301, USA. 23 | //---------------------------------------------------------------------------- 24 | 25 | #ifndef AGG_CONV_TRANSFORM_INCLUDED 26 | #define AGG_CONV_TRANSFORM_INCLUDED 27 | 28 | #include "agg_basics.h" 29 | #include "agg_trans_affine.h" 30 | 31 | namespace agg 32 | { 33 | 34 | //----------------------------------------------------------conv_transform 35 | template class conv_transform 36 | { 37 | public: 38 | conv_transform(VertexSource& source, const Transformer& tr) : 39 | m_source(&source), m_trans(&tr) {} 40 | void attach(VertexSource& source) { m_source = &source; } 41 | 42 | void rewind(unsigned path_id) 43 | { 44 | m_source->rewind(path_id); 45 | } 46 | 47 | unsigned vertex(double* x, double* y) 48 | { 49 | unsigned cmd = m_source->vertex(x, y); 50 | if(is_vertex(cmd)) 51 | { 52 | m_trans->transform(x, y); 53 | } 54 | return cmd; 55 | } 56 | 57 | void transformer(const Transformer& tr) 58 | { 59 | m_trans = &tr; 60 | } 61 | 62 | private: 63 | conv_transform(const conv_transform&); 64 | const conv_transform& 65 | operator = (const conv_transform&); 66 | 67 | VertexSource* m_source; 68 | const Transformer* m_trans; 69 | }; 70 | 71 | 72 | } 73 | 74 | #endif 75 | -------------------------------------------------------------------------------- /agg/include/agg_ellipse_bresenham.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // Anti-Grain Geometry (AGG) - Version 2.5 3 | // A high quality rendering engine for C++ 4 | // Copyright (C) 2002-2006 Maxim Shemanarev 5 | // Contact: mcseem@antigrain.com 6 | // mcseemagg@yahoo.com 7 | // http://antigrain.com 8 | // 9 | // AGG is free software; you can redistribute it and/or 10 | // modify it under the terms of the GNU General Public License 11 | // as published by the Free Software Foundation; either version 2 12 | // of the License, or (at your option) any later version. 13 | // 14 | // AGG is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with AGG; if not, write to the Free Software 21 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 22 | // MA 02110-1301, USA. 23 | //---------------------------------------------------------------------------- 24 | 25 | #ifndef AGG_ELLIPSE_BRESENHAM_INCLUDED 26 | #define AGG_ELLIPSE_BRESENHAM_INCLUDED 27 | 28 | 29 | #include "agg_basics.h" 30 | 31 | 32 | namespace agg 33 | { 34 | 35 | //------------------------------------------ellipse_bresenham_interpolator 36 | class ellipse_bresenham_interpolator 37 | { 38 | public: 39 | ellipse_bresenham_interpolator(int rx, int ry) : 40 | m_rx2(rx * rx), 41 | m_ry2(ry * ry), 42 | m_two_rx2(m_rx2 << 1), 43 | m_two_ry2(m_ry2 << 1), 44 | m_dx(0), 45 | m_dy(0), 46 | m_inc_x(0), 47 | m_inc_y(-ry * m_two_rx2), 48 | m_cur_f(0) 49 | {} 50 | 51 | int dx() const { return m_dx; } 52 | int dy() const { return m_dy; } 53 | 54 | void operator++ () 55 | { 56 | int mx, my, mxy, min_m; 57 | int fx, fy, fxy; 58 | 59 | mx = fx = m_cur_f + m_inc_x + m_ry2; 60 | if(mx < 0) mx = -mx; 61 | 62 | my = fy = m_cur_f + m_inc_y + m_rx2; 63 | if(my < 0) my = -my; 64 | 65 | mxy = fxy = m_cur_f + m_inc_x + m_ry2 + m_inc_y + m_rx2; 66 | if(mxy < 0) mxy = -mxy; 67 | 68 | min_m = mx; 69 | bool flag = true; 70 | 71 | if(min_m > my) 72 | { 73 | min_m = my; 74 | flag = false; 75 | } 76 | 77 | m_dx = m_dy = 0; 78 | 79 | if(min_m > mxy) 80 | { 81 | m_inc_x += m_two_ry2; 82 | m_inc_y += m_two_rx2; 83 | m_cur_f = fxy; 84 | m_dx = 1; 85 | m_dy = 1; 86 | return; 87 | } 88 | 89 | if(flag) 90 | { 91 | m_inc_x += m_two_ry2; 92 | m_cur_f = fx; 93 | m_dx = 1; 94 | return; 95 | } 96 | 97 | m_inc_y += m_two_rx2; 98 | m_cur_f = fy; 99 | m_dy = 1; 100 | } 101 | 102 | private: 103 | int m_rx2; 104 | int m_ry2; 105 | int m_two_rx2; 106 | int m_two_ry2; 107 | int m_dx; 108 | int m_dy; 109 | int m_inc_x; 110 | int m_inc_y; 111 | int m_cur_f; 112 | 113 | }; 114 | 115 | } 116 | 117 | #endif 118 | 119 | -------------------------------------------------------------------------------- /agg/include/agg_embedded_raster_fonts.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // Anti-Grain Geometry (AGG) - Version 2.5 3 | // A high quality rendering engine for C++ 4 | // Copyright (C) 2002-2006 Maxim Shemanarev 5 | // Contact: mcseem@antigrain.com 6 | // mcseemagg@yahoo.com 7 | // http://antigrain.com 8 | // 9 | // AGG is free software; you can redistribute it and/or 10 | // modify it under the terms of the GNU General Public License 11 | // as published by the Free Software Foundation; either version 2 12 | // of the License, or (at your option) any later version. 13 | // 14 | // AGG is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with AGG; if not, write to the Free Software 21 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 22 | // MA 02110-1301, USA. 23 | //---------------------------------------------------------------------------- 24 | 25 | #ifndef AGG_EMBEDDED_RASTER_FONTS_INCLUDED 26 | #define AGG_EMBEDDED_RASTER_FONTS_INCLUDED 27 | 28 | #include "agg_basics.h" 29 | 30 | namespace agg 31 | { 32 | extern const int8u gse4x6[]; 33 | extern const int8u gse4x8[]; 34 | extern const int8u gse5x7[]; 35 | extern const int8u gse5x9[]; 36 | extern const int8u gse6x12[]; 37 | extern const int8u gse6x9[]; 38 | extern const int8u gse7x11[]; 39 | extern const int8u gse7x11_bold[]; 40 | extern const int8u gse7x15[]; 41 | extern const int8u gse7x15_bold[]; 42 | extern const int8u gse8x16[]; 43 | extern const int8u gse8x16_bold[]; 44 | extern const int8u mcs11_prop[]; 45 | extern const int8u mcs11_prop_condensed[]; 46 | extern const int8u mcs12_prop[]; 47 | extern const int8u mcs13_prop[]; 48 | extern const int8u mcs5x10_mono[]; 49 | extern const int8u mcs5x11_mono[]; 50 | extern const int8u mcs6x10_mono[]; 51 | extern const int8u mcs6x11_mono[]; 52 | extern const int8u mcs7x12_mono_high[]; 53 | extern const int8u mcs7x12_mono_low[]; 54 | extern const int8u verdana12[]; 55 | extern const int8u verdana12_bold[]; 56 | extern const int8u verdana13[]; 57 | extern const int8u verdana13_bold[]; 58 | extern const int8u verdana14[]; 59 | extern const int8u verdana14_bold[]; 60 | extern const int8u verdana16[]; 61 | extern const int8u verdana16_bold[]; 62 | extern const int8u verdana17[]; 63 | extern const int8u verdana17_bold[]; 64 | extern const int8u verdana18[]; 65 | extern const int8u verdana18_bold[]; 66 | } 67 | 68 | #endif 69 | -------------------------------------------------------------------------------- /agg/include/agg_gamma_functions.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // Anti-Grain Geometry (AGG) - Version 2.5 3 | // A high quality rendering engine for C++ 4 | // Copyright (C) 2002-2006 Maxim Shemanarev 5 | // Contact: mcseem@antigrain.com 6 | // mcseemagg@yahoo.com 7 | // http://antigrain.com 8 | // 9 | // AGG is free software; you can redistribute it and/or 10 | // modify it under the terms of the GNU General Public License 11 | // as published by the Free Software Foundation; either version 2 12 | // of the License, or (at your option) any later version. 13 | // 14 | // AGG is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with AGG; if not, write to the Free Software 21 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 22 | // MA 02110-1301, USA. 23 | //---------------------------------------------------------------------------- 24 | 25 | #ifndef AGG_GAMMA_FUNCTIONS_INCLUDED 26 | #define AGG_GAMMA_FUNCTIONS_INCLUDED 27 | 28 | #include 29 | #include "agg_basics.h" 30 | 31 | namespace agg 32 | { 33 | //===============================================================gamma_none 34 | struct gamma_none 35 | { 36 | double operator()(double x) const { return x; } 37 | }; 38 | 39 | 40 | //==============================================================gamma_power 41 | class gamma_power 42 | { 43 | public: 44 | gamma_power() : m_gamma(1.0) {} 45 | gamma_power(double g) : m_gamma(g) {} 46 | 47 | void gamma(double g) { m_gamma = g; } 48 | double gamma() const { return m_gamma; } 49 | 50 | double operator() (double x) const 51 | { 52 | return pow(x, m_gamma); 53 | } 54 | 55 | private: 56 | double m_gamma; 57 | }; 58 | 59 | 60 | //==========================================================gamma_threshold 61 | class gamma_threshold 62 | { 63 | public: 64 | gamma_threshold() : m_threshold(0.5) {} 65 | gamma_threshold(double t) : m_threshold(t) {} 66 | 67 | void threshold(double t) { m_threshold = t; } 68 | double threshold() const { return m_threshold; } 69 | 70 | double operator() (double x) const 71 | { 72 | return (x < m_threshold) ? 0.0 : 1.0; 73 | } 74 | 75 | private: 76 | double m_threshold; 77 | }; 78 | 79 | 80 | //============================================================gamma_linear 81 | class gamma_linear 82 | { 83 | public: 84 | gamma_linear() : m_start(0.0), m_end(1.0) {} 85 | gamma_linear(double s, double e) : m_start(s), m_end(e) {} 86 | 87 | void set(double s, double e) { m_start = s; m_end = e; } 88 | void start(double s) { m_start = s; } 89 | void end(double e) { m_end = e; } 90 | double start() const { return m_start; } 91 | double end() const { return m_end; } 92 | 93 | double operator() (double x) const 94 | { 95 | if(x < m_start) return 0.0; 96 | if(x > m_end) return 1.0; 97 | return (x - m_start) / (m_end - m_start); 98 | } 99 | 100 | private: 101 | double m_start; 102 | double m_end; 103 | }; 104 | 105 | 106 | //==========================================================gamma_multiply 107 | class gamma_multiply 108 | { 109 | public: 110 | gamma_multiply() : m_mul(1.0) {} 111 | gamma_multiply(double v) : m_mul(v) {} 112 | 113 | void value(double v) { m_mul = v; } 114 | double value() const { return m_mul; } 115 | 116 | double operator() (double x) const 117 | { 118 | double y = x * m_mul; 119 | if(y > 1.0) y = 1.0; 120 | return y; 121 | } 122 | 123 | private: 124 | double m_mul; 125 | }; 126 | 127 | } 128 | 129 | #endif 130 | 131 | 132 | 133 | -------------------------------------------------------------------------------- /agg/include/agg_pattern_filters_rgba.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // Anti-Grain Geometry (AGG) - Version 2.5 3 | // A high quality rendering engine for C++ 4 | // Copyright (C) 2002-2006 Maxim Shemanarev 5 | // Contact: mcseem@antigrain.com 6 | // mcseemagg@yahoo.com 7 | // http://antigrain.com 8 | // 9 | // AGG is free software; you can redistribute it and/or 10 | // modify it under the terms of the GNU General Public License 11 | // as published by the Free Software Foundation; either version 2 12 | // of the License, or (at your option) any later version. 13 | // 14 | // AGG is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with AGG; if not, write to the Free Software 21 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 22 | // MA 02110-1301, USA. 23 | //---------------------------------------------------------------------------- 24 | 25 | #ifndef AGG_PATTERN_FILTERS_RGBA8_INCLUDED 26 | #define AGG_PATTERN_FILTERS_RGBA8_INCLUDED 27 | 28 | #include "agg_basics.h" 29 | #include "agg_line_aa_basics.h" 30 | #include "agg_color_rgba.h" 31 | 32 | 33 | namespace agg 34 | { 35 | 36 | //=======================================================pattern_filter_nn 37 | template struct pattern_filter_nn 38 | { 39 | typedef ColorT color_type; 40 | static unsigned dilation() { return 0; } 41 | 42 | static void AGG_INLINE pixel_low_res(color_type const* const* buf, 43 | color_type* p, int x, int y) 44 | { 45 | *p = buf[y][x]; 46 | } 47 | 48 | static void AGG_INLINE pixel_high_res(color_type const* const* buf, 49 | color_type* p, int x, int y) 50 | { 51 | *p = buf[y >> line_subpixel_shift] 52 | [x >> line_subpixel_shift]; 53 | } 54 | }; 55 | 56 | typedef pattern_filter_nn pattern_filter_nn_rgba8; 57 | typedef pattern_filter_nn pattern_filter_nn_rgba16; 58 | 59 | 60 | //===========================================pattern_filter_bilinear_rgba 61 | template struct pattern_filter_bilinear_rgba 62 | { 63 | typedef ColorT color_type; 64 | typedef typename color_type::value_type value_type; 65 | typedef typename color_type::calc_type calc_type; 66 | 67 | 68 | static unsigned dilation() { return 1; } 69 | 70 | static AGG_INLINE void pixel_low_res(color_type const* const* buf, 71 | color_type* p, int x, int y) 72 | { 73 | *p = buf[y][x]; 74 | } 75 | 76 | static AGG_INLINE void pixel_high_res(color_type const* const* buf, 77 | color_type* p, int x, int y) 78 | { 79 | calc_type r, g, b, a; 80 | r = g = b = a = line_subpixel_scale * line_subpixel_scale / 2; 81 | 82 | calc_type weight; 83 | int x_lr = x >> line_subpixel_shift; 84 | int y_lr = y >> line_subpixel_shift; 85 | 86 | x &= line_subpixel_mask; 87 | y &= line_subpixel_mask; 88 | const color_type* ptr = buf[y_lr] + x_lr; 89 | 90 | weight = (line_subpixel_scale - x) * 91 | (line_subpixel_scale - y); 92 | r += weight * ptr->r; 93 | g += weight * ptr->g; 94 | b += weight * ptr->b; 95 | a += weight * ptr->a; 96 | 97 | ++ptr; 98 | 99 | weight = x * (line_subpixel_scale - y); 100 | r += weight * ptr->r; 101 | g += weight * ptr->g; 102 | b += weight * ptr->b; 103 | a += weight * ptr->a; 104 | 105 | ptr = buf[y_lr + 1] + x_lr; 106 | 107 | weight = (line_subpixel_scale - x) * y; 108 | r += weight * ptr->r; 109 | g += weight * ptr->g; 110 | b += weight * ptr->b; 111 | a += weight * ptr->a; 112 | 113 | ++ptr; 114 | 115 | weight = x * y; 116 | r += weight * ptr->r; 117 | g += weight * ptr->g; 118 | b += weight * ptr->b; 119 | a += weight * ptr->a; 120 | 121 | p->r = (value_type)(r >> line_subpixel_shift * 2); 122 | p->g = (value_type)(g >> line_subpixel_shift * 2); 123 | p->b = (value_type)(b >> line_subpixel_shift * 2); 124 | p->a = (value_type)(a >> line_subpixel_shift * 2); 125 | } 126 | }; 127 | 128 | typedef pattern_filter_bilinear_rgba pattern_filter_bilinear_rgba8; 129 | typedef pattern_filter_bilinear_rgba pattern_filter_bilinear_rgba16; 130 | } 131 | 132 | #endif 133 | -------------------------------------------------------------------------------- /agg/include/agg_rounded_rect.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // Anti-Grain Geometry (AGG) - Version 2.5 3 | // A high quality rendering engine for C++ 4 | // Copyright (C) 2002-2006 Maxim Shemanarev 5 | // Contact: mcseem@antigrain.com 6 | // mcseemagg@yahoo.com 7 | // http://antigrain.com 8 | // 9 | // AGG is free software; you can redistribute it and/or 10 | // modify it under the terms of the GNU General Public License 11 | // as published by the Free Software Foundation; either version 2 12 | // of the License, or (at your option) any later version. 13 | // 14 | // AGG is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with AGG; if not, write to the Free Software 21 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 22 | // MA 02110-1301, USA. 23 | //---------------------------------------------------------------------------- 24 | 25 | #ifndef AGG_ROUNDED_RECT_INCLUDED 26 | #define AGG_ROUNDED_RECT_INCLUDED 27 | 28 | #include "agg_basics.h" 29 | #include "agg_arc.h" 30 | 31 | namespace agg 32 | { 33 | //------------------------------------------------------------rounded_rect 34 | // 35 | // See Implemantation agg_rounded_rect.cpp 36 | // 37 | class rounded_rect 38 | { 39 | public: 40 | rounded_rect() {} 41 | rounded_rect(double x1, double y1, double x2, double y2, double r); 42 | 43 | void rect(double x1, double y1, double x2, double y2); 44 | void radius(double r); 45 | void radius(double rx, double ry); 46 | void radius(double rx_bottom, double ry_bottom, double rx_top, double ry_top); 47 | void radius(double rx1, double ry1, double rx2, double ry2, 48 | double rx3, double ry3, double rx4, double ry4); 49 | void normalize_radius(); 50 | 51 | void approximation_scale(double s) { m_arc.approximation_scale(s); } 52 | double approximation_scale() const { return m_arc.approximation_scale(); } 53 | 54 | void rewind(unsigned); 55 | unsigned vertex(double* x, double* y); 56 | 57 | private: 58 | double m_x1; 59 | double m_y1; 60 | double m_x2; 61 | double m_y2; 62 | double m_rx1; 63 | double m_ry1; 64 | double m_rx2; 65 | double m_ry2; 66 | double m_rx3; 67 | double m_ry3; 68 | double m_rx4; 69 | double m_ry4; 70 | unsigned m_status; 71 | arc m_arc; 72 | }; 73 | 74 | } 75 | 76 | #endif 77 | 78 | -------------------------------------------------------------------------------- /agg/include/agg_span_allocator.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // Anti-Grain Geometry (AGG) - Version 2.5 3 | // A high quality rendering engine for C++ 4 | // Copyright (C) 2002-2006 Maxim Shemanarev 5 | // Contact: mcseem@antigrain.com 6 | // mcseemagg@yahoo.com 7 | // http://antigrain.com 8 | // 9 | // AGG is free software; you can redistribute it and/or 10 | // modify it under the terms of the GNU General Public License 11 | // as published by the Free Software Foundation; either version 2 12 | // of the License, or (at your option) any later version. 13 | // 14 | // AGG is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with AGG; if not, write to the Free Software 21 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 22 | // MA 02110-1301, USA. 23 | //---------------------------------------------------------------------------- 24 | 25 | #ifndef AGG_SPAN_ALLOCATOR_INCLUDED 26 | #define AGG_SPAN_ALLOCATOR_INCLUDED 27 | 28 | #include "agg_array.h" 29 | 30 | namespace agg 31 | { 32 | //----------------------------------------------------------span_allocator 33 | template class span_allocator 34 | { 35 | public: 36 | typedef ColorT color_type; 37 | 38 | //-------------------------------------------------------------------- 39 | AGG_INLINE color_type* allocate(unsigned span_len) 40 | { 41 | if(span_len > m_span.size()) 42 | { 43 | // To reduce the number of reallocs we align the 44 | // span_len to 256 color elements. 45 | // Well, I just like this number and it looks reasonable. 46 | //----------------------- 47 | m_span.resize(((span_len + 255) >> 8) << 8); 48 | } 49 | return &m_span[0]; 50 | } 51 | 52 | AGG_INLINE color_type* span() { return &m_span[0]; } 53 | AGG_INLINE unsigned max_span_len() const { return m_span.size(); } 54 | 55 | private: 56 | pod_array m_span; 57 | }; 58 | } 59 | 60 | 61 | #endif 62 | 63 | 64 | -------------------------------------------------------------------------------- /agg/include/agg_span_converter.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // Anti-Grain Geometry (AGG) - Version 2.5 3 | // A high quality rendering engine for C++ 4 | // Copyright (C) 2002-2006 Maxim Shemanarev 5 | // Contact: mcseem@antigrain.com 6 | // mcseemagg@yahoo.com 7 | // http://antigrain.com 8 | // 9 | // AGG is free software; you can redistribute it and/or 10 | // modify it under the terms of the GNU General Public License 11 | // as published by the Free Software Foundation; either version 2 12 | // of the License, or (at your option) any later version. 13 | // 14 | // AGG is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with AGG; if not, write to the Free Software 21 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 22 | // MA 02110-1301, USA. 23 | //---------------------------------------------------------------------------- 24 | 25 | #ifndef AGG_SPAN_CONVERTER_INCLUDED 26 | #define AGG_SPAN_CONVERTER_INCLUDED 27 | 28 | #include "agg_basics.h" 29 | 30 | namespace agg 31 | { 32 | //----------------------------------------------------------span_converter 33 | template class span_converter 34 | { 35 | public: 36 | typedef typename SpanGenerator::color_type color_type; 37 | 38 | span_converter(SpanGenerator& span_gen, SpanConverter& span_cnv) : 39 | m_span_gen(&span_gen), m_span_cnv(&span_cnv) {} 40 | 41 | void attach_generator(SpanGenerator& span_gen) { m_span_gen = &span_gen; } 42 | void attach_converter(SpanConverter& span_cnv) { m_span_cnv = &span_cnv; } 43 | 44 | //-------------------------------------------------------------------- 45 | void prepare() 46 | { 47 | m_span_gen->prepare(); 48 | m_span_cnv->prepare(); 49 | } 50 | 51 | //-------------------------------------------------------------------- 52 | void generate(color_type* span, int x, int y, unsigned len) 53 | { 54 | m_span_gen->generate(span, x, y, len); 55 | m_span_cnv->generate(span, x, y, len); 56 | } 57 | 58 | private: 59 | SpanGenerator* m_span_gen; 60 | SpanConverter* m_span_cnv; 61 | }; 62 | 63 | } 64 | 65 | #endif 66 | -------------------------------------------------------------------------------- /agg/include/agg_vcgen_stroke.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // Anti-Grain Geometry (AGG) - Version 2.5 3 | // A high quality rendering engine for C++ 4 | // Copyright (C) 2002-2006 Maxim Shemanarev 5 | // Contact: mcseem@antigrain.com 6 | // mcseemagg@yahoo.com 7 | // http://antigrain.com 8 | // 9 | // AGG is free software; you can redistribute it and/or 10 | // modify it under the terms of the GNU General Public License 11 | // as published by the Free Software Foundation; either version 2 12 | // of the License, or (at your option) any later version. 13 | // 14 | // AGG is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with AGG; if not, write to the Free Software 21 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 22 | // MA 02110-1301, USA. 23 | //---------------------------------------------------------------------------- 24 | 25 | #ifndef AGG_VCGEN_STROKE_INCLUDED 26 | #define AGG_VCGEN_STROKE_INCLUDED 27 | 28 | #include "agg_math_stroke.h" 29 | 30 | 31 | namespace agg 32 | { 33 | 34 | //============================================================vcgen_stroke 35 | // 36 | // See Implementation agg_vcgen_stroke.cpp 37 | // Stroke generator 38 | // 39 | //------------------------------------------------------------------------ 40 | class vcgen_stroke 41 | { 42 | enum status_e 43 | { 44 | initial, 45 | ready, 46 | cap1, 47 | cap2, 48 | outline1, 49 | close_first, 50 | outline2, 51 | out_vertices, 52 | end_poly1, 53 | end_poly2, 54 | stop 55 | }; 56 | 57 | public: 58 | typedef vertex_sequence vertex_storage; 59 | typedef pod_bvector coord_storage; 60 | 61 | vcgen_stroke(); 62 | 63 | void line_cap(line_cap_e lc) { m_stroker.line_cap(lc); } 64 | void line_join(line_join_e lj) { m_stroker.line_join(lj); } 65 | void inner_join(inner_join_e ij) { m_stroker.inner_join(ij); } 66 | 67 | line_cap_e line_cap() const { return m_stroker.line_cap(); } 68 | line_join_e line_join() const { return m_stroker.line_join(); } 69 | inner_join_e inner_join() const { return m_stroker.inner_join(); } 70 | 71 | void width(double w) { m_stroker.width(w); } 72 | void miter_limit(double ml) { m_stroker.miter_limit(ml); } 73 | void miter_limit_theta(double t) { m_stroker.miter_limit_theta(t); } 74 | void inner_miter_limit(double ml) { m_stroker.inner_miter_limit(ml); } 75 | void approximation_scale(double as) { m_stroker.approximation_scale(as); } 76 | 77 | double width() const { return m_stroker.width(); } 78 | double miter_limit() const { return m_stroker.miter_limit(); } 79 | double inner_miter_limit() const { return m_stroker.inner_miter_limit(); } 80 | double approximation_scale() const { return m_stroker.approximation_scale(); } 81 | 82 | void shorten(double s) { m_shorten = s; } 83 | double shorten() const { return m_shorten; } 84 | 85 | // Vertex Generator Interface 86 | void remove_all(); 87 | void add_vertex(double x, double y, unsigned cmd); 88 | 89 | // Vertex Source Interface 90 | void rewind(unsigned path_id); 91 | unsigned vertex(double* x, double* y); 92 | 93 | private: 94 | vcgen_stroke(const vcgen_stroke&); 95 | const vcgen_stroke& operator = (const vcgen_stroke&); 96 | 97 | math_stroke m_stroker; 98 | vertex_storage m_src_vertices; 99 | coord_storage m_out_vertices; 100 | double m_shorten; 101 | unsigned m_closed; 102 | status_e m_status; 103 | status_e m_prev_status; 104 | unsigned m_src_vertex; 105 | unsigned m_out_vertex; 106 | }; 107 | 108 | 109 | } 110 | 111 | #endif 112 | -------------------------------------------------------------------------------- /aviout.h: -------------------------------------------------------------------------------- 1 | #ifndef AVIOUT_H_INCLUDED 2 | #define AVIOUT_H_INCLUDED 3 | 4 | #include "prefix.h" 5 | 6 | #include "windows.h" 7 | #include "mednafen.h" 8 | 9 | int DRV_AviIsRecording(); 10 | bool DRV_AviBegin(const char* fname); 11 | 12 | void DRV_AviEnd(); 13 | void DRV_AviVideoUpdate(const uint16* buffer, EmulateSpecStruct *espec); 14 | void DRV_AviSoundUpdate(void* soundData, int soundLen); 15 | 16 | #endif -------------------------------------------------------------------------------- /d3d.h: -------------------------------------------------------------------------------- 1 | #ifndef __D3D_H_ 2 | #define __D3D_H_ 3 | 4 | #if USE_D3D 5 | 6 | bool D3DInit(); 7 | void render(); 8 | void OculusInit(); 9 | 10 | #endif // #if USE_D3D 11 | 12 | #endif // #ifndef __D3D_H_ -------------------------------------------------------------------------------- /dd.h: -------------------------------------------------------------------------------- 1 | #if USE_DDRAW 2 | 3 | #include 4 | #include 5 | #include "types.h" 6 | 7 | #define _15BIT(r,g,b) (((r&248)<<7) + ((g&248)<<2) + (b>>3)) 8 | #define _16BIT(r,g,b) (((r&248)<<8) + ((g&252)<<3) + (b>>3)) 9 | 10 | typedef u16 ushort ; 11 | 12 | void DirectDrawInit (void); 13 | extern LPDIRECTDRAWSURFACE7 lpPrimary; 14 | extern LPDIRECTDRAWSURFACE7 lpBack; 15 | void LockSurface (LPDIRECTDRAWSURFACE7 surface); 16 | void UnlockSurface (LPDIRECTDRAWSURFACE7 surface); 17 | void Pixel (int x, int y, ushort color); 18 | 19 | extern DDSURFACEDESC2 ddsd; 20 | extern ushort *lpscreen; 21 | 22 | extern LPDIRECTDRAWCLIPPER lpDDClipPrimary; 23 | extern LPDIRECTDRAW7 lpdd7; 24 | 25 | void ClearDirectDrawOutput(); 26 | int CreateDDrawBuffers(); 27 | void render(); 28 | 29 | #endif // #if USE_DDRAW -------------------------------------------------------------------------------- /directx/DxErr8.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/braindx/vbjin-ovr/d49106264b790ec35752bf492d6a824a7f452c10/directx/DxErr8.lib -------------------------------------------------------------------------------- /directx/ddraw.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/braindx/vbjin-ovr/d49106264b790ec35752bf492d6a824a7f452c10/directx/ddraw.lib -------------------------------------------------------------------------------- /directx/dinput8.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/braindx/vbjin-ovr/d49106264b790ec35752bf492d6a824a7f452c10/directx/dinput8.lib -------------------------------------------------------------------------------- /directx/dsound.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/braindx/vbjin-ovr/d49106264b790ec35752bf492d6a824a7f452c10/directx/dsound.lib -------------------------------------------------------------------------------- /directx/dxerr8.h: -------------------------------------------------------------------------------- 1 | /*==========================================================================; 2 | * 3 | * 4 | * File: dxerr8.h 5 | * Content: DirectX Error Library Include File 6 | * 7 | ****************************************************************************/ 8 | 9 | #ifndef _DXERR8_H_ 10 | #define _DXERR8_H_ 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif //__cplusplus 15 | 16 | // 17 | // DXGetErrorString8 18 | // 19 | // Desc: Converts a DirectX HRESULT to a string 20 | // 21 | // Args: HRESULT hr Can be any error code from 22 | // D3D8 D3DX8 DDRAW DPLAY8 DMUSIC DSOUND DINPUT DSHOW 23 | // 24 | // Return: Converted string 25 | // 26 | const char* WINAPI DXGetErrorString8A(HRESULT hr); 27 | const WCHAR* WINAPI DXGetErrorString8W(HRESULT hr); 28 | 29 | #ifdef UNICODE 30 | #define DXGetErrorString8 DXGetErrorString8W 31 | #else 32 | #define DXGetErrorString8 DXGetErrorString8A 33 | #endif 34 | 35 | 36 | // 37 | // DXGetErrorDescription8 38 | // 39 | // Desc: Returns a string description of a DirectX HRESULT 40 | // 41 | // Args: HRESULT hr Can be any error code from 42 | // D3D8 D3DX8 DDRAW DPLAY8 DMUSIC DSOUND DINPUT DSHOW 43 | // 44 | // Return: String description 45 | // 46 | const char* WINAPI DXGetErrorDescription8A(HRESULT hr); 47 | const WCHAR* WINAPI DXGetErrorDescription8W(HRESULT hr); 48 | 49 | #ifdef UNICODE 50 | #define DXGetErrorDescription8 DXGetErrorDescription8W 51 | #else 52 | #define DXGetErrorDescription8 DXGetErrorDescription8A 53 | #endif 54 | 55 | 56 | // 57 | // DXTrace 58 | // 59 | // Desc: Outputs a formatted error message to the debug stream 60 | // 61 | // Args: CHAR* strFile The current file, typically passed in using the 62 | // __FILE__ macro. 63 | // DWORD dwLine The current line number, typically passed in using the 64 | // __LINE__ macro. 65 | // HRESULT hr An HRESULT that will be traced to the debug stream. 66 | // CHAR* strMsg A string that will be traced to the debug stream (may be NULL) 67 | // BOOL bPopMsgBox If TRUE, then a message box will popup also containing the passed info. 68 | // 69 | // Return: The hr that was passed in. 70 | // 71 | HRESULT WINAPI DXTraceA( const char* strFile, DWORD dwLine, HRESULT hr, const char* strMsg, BOOL bPopMsgBox ); 72 | HRESULT WINAPI DXTraceW( const char* strFile, DWORD dwLine, HRESULT hr, const WCHAR* strMsg, BOOL bPopMsgBox ); 73 | 74 | #ifdef UNICODE 75 | #define DXTrace DXTraceW 76 | #else 77 | #define DXTrace DXTraceA 78 | #endif 79 | 80 | 81 | // 82 | // Helper macros 83 | // 84 | #if defined(DEBUG) | defined(_DEBUG) 85 | #define DXTRACE_MSG(str) DXTrace( __FILE__, (DWORD)__LINE__, 0, str, FALSE ) 86 | #define DXTRACE_ERR(str,hr) DXTrace( __FILE__, (DWORD)__LINE__, hr, str, TRUE ) 87 | #define DXTRACE_ERR_NOMSGBOX(str,hr) DXTrace( __FILE__, (DWORD)__LINE__, hr, str, FALSE ) 88 | #else 89 | #define DXTRACE_MSG(str) (0L) 90 | #define DXTRACE_ERR(str,hr) (hr) 91 | #define DXTRACE_ERR_NOMSGBOX(str,hr) (hr) 92 | #endif 93 | 94 | 95 | #ifdef __cplusplus 96 | } 97 | #endif //__cplusplus 98 | 99 | #endif // _DXERR8_H_ 100 | -------------------------------------------------------------------------------- /directx/dxguid.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/braindx/vbjin-ovr/d49106264b790ec35752bf492d6a824a7f452c10/directx/dxguid.lib -------------------------------------------------------------------------------- /docs/Changelog.txt: -------------------------------------------------------------------------------- 1 | Changes since SVN 61 2 | 3 | Memory Viewer dialog added (Ported from DeSmuME) 4 | Improved MusicSelect.lua 5 | Reset button implemented 6 | Fix Game name not diplayed on window if loading a recent ROM 7 | Small GUI cleanups 8 | 1.5 and .25x Window size options 9 | CScope display 10 | Fixed Video modes 11 | Add color choice to menu 12 | Fixed DirectDraw bugs 13 | Added option to select separation width for Side By Side mode. If 96 is used, the video should be able to be recorded in a mode compatible with YouTube's HD mode for 3D videos. 14 | Improved 4/3 aspect ratio support 15 | 16 | 17 | Ram Search: 18 | Fix reset button 19 | Fix change counts counting 20 | Support for multiple selection 21 | 22 | Ram Watch: 23 | Add Seperator button 24 | Support for multiple selection 25 | SaveFile dialog - generate default filename based on rom 26 | 27 | 28 | TODO: 29 | 30 | Fix loading a recent ROM not stopping movies first 31 | Fix so Lag counter resets when loading a ROM 32 | Restart Movie menu option 33 | Fix bug where Ram Watch would not update unless Ram Search was open 34 | 35 | Lua: 36 | emu.frameadvance() implemented 37 | 38 | Fix Recentroms menu was not properly initializing the sound driver, which caused the game to go auto-turbo. Fixed. 39 | 40 | Frame count resets when loading a new rom 41 | -------------------------------------------------------------------------------- /dxsound.h: -------------------------------------------------------------------------------- 1 | #ifndef __VBA_SOUND_DRIVER_H__ 2 | #define __VBA_SOUND_DRIVER_H__ 3 | 4 | #include "types.h" 5 | 6 | /** 7 | * Sound driver abstract interface for the core to use to output sound. 8 | * Subclass this to implement a new sound driver. 9 | */ 10 | class SoundDriver 11 | { 12 | public: 13 | 14 | /** 15 | * Destructor. Free the resources allocated by the sound driver. 16 | */ 17 | virtual ~SoundDriver() { }; 18 | 19 | /** 20 | * Initialize the sound driver. 21 | * @param sampleRate In Hertz 22 | */ 23 | virtual bool init(long sampleRate) = 0; 24 | 25 | /** 26 | * Tell the driver that the sound stream has paused 27 | */ 28 | virtual void pause() = 0; 29 | 30 | /** 31 | * Reset the sound driver 32 | */ 33 | virtual void reset() = 0; 34 | 35 | /** 36 | * Tell the driver that the sound stream has resumed 37 | */ 38 | virtual void resume() = 0; 39 | 40 | /** 41 | * Write length bytes of data from the finalWave buffer to the driver output buffer. 42 | */ 43 | virtual void write(u16 * finalWave, int length) = 0; 44 | 45 | virtual void setThrottle(unsigned short throttle) { }; 46 | 47 | bool userMute; 48 | 49 | virtual void mute() = 0; 50 | 51 | virtual void unMute() = 0; 52 | 53 | virtual void doUserMute() = 0; 54 | 55 | }; 56 | 57 | #endif // __VBA_SOUND_DRIVER_H__ -------------------------------------------------------------------------------- /inttypes.h: -------------------------------------------------------------------------------- 1 | #ifndef INTTYPES_H 2 | #define INTTYPES_H 3 | 4 | typedef signed __int8 int8_t; 5 | typedef signed __int16 int16_t; 6 | typedef signed __int32 int32_t; 7 | typedef unsigned __int8 uint8_t; 8 | typedef unsigned __int16 uint16_t; 9 | typedef unsigned __int32 uint32_t; 10 | typedef signed __int64 int64_t; 11 | typedef unsigned __int64 uint64_t; 12 | #endif -------------------------------------------------------------------------------- /lua-engine.h: -------------------------------------------------------------------------------- 1 | #ifndef LUA_SCRIPT_H 2 | #define LUA_SCRIPT_H 3 | 4 | 5 | void OpenLuaContext(int uid, void(*print)(int uid, const char* str) = 0, void(*onstart)(int uid) = 0, void(*onstop)(int uid, bool statusOK) = 0); 6 | void RunLuaScriptFile(int uid, const char* filename); 7 | void StopLuaScript(int uid); 8 | void RequestAbortLuaScript(int uid, const char* message = 0); 9 | void CloseLuaContext(int uid); 10 | 11 | enum LuaCallID 12 | { 13 | LUACALL_BEFOREEMULATION, 14 | LUACALL_AFTEREMULATION, 15 | LUACALL_AFTEREMULATIONGUI, 16 | LUACALL_BEFOREEXIT, 17 | LUACALL_BEFORESAVE, 18 | LUACALL_AFTERLOAD, 19 | LUACALL_ONSTART, 20 | 21 | LUACALL_SCRIPT_HOTKEY_1, 22 | LUACALL_SCRIPT_HOTKEY_2, 23 | LUACALL_SCRIPT_HOTKEY_3, 24 | LUACALL_SCRIPT_HOTKEY_4, 25 | LUACALL_SCRIPT_HOTKEY_5, 26 | LUACALL_SCRIPT_HOTKEY_6, 27 | LUACALL_SCRIPT_HOTKEY_7, 28 | LUACALL_SCRIPT_HOTKEY_8, 29 | LUACALL_SCRIPT_HOTKEY_9, 30 | LUACALL_SCRIPT_HOTKEY_10, 31 | LUACALL_SCRIPT_HOTKEY_11, 32 | LUACALL_SCRIPT_HOTKEY_12, 33 | LUACALL_SCRIPT_HOTKEY_13, 34 | LUACALL_SCRIPT_HOTKEY_14, 35 | LUACALL_SCRIPT_HOTKEY_15, 36 | LUACALL_SCRIPT_HOTKEY_16, 37 | 38 | LUACALL_COUNT 39 | }; 40 | void CallRegisteredLuaFunctions(LuaCallID calltype); 41 | 42 | enum LuaMemHookType 43 | { 44 | LUAMEMHOOK_WRITE, 45 | LUAMEMHOOK_READ, 46 | LUAMEMHOOK_EXEC, 47 | LUAMEMHOOK_WRITE_SUB, 48 | LUAMEMHOOK_READ_SUB, 49 | LUAMEMHOOK_EXEC_SUB, 50 | 51 | LUAMEMHOOK_COUNT 52 | }; 53 | void CallRegisteredLuaMemHook(unsigned int address, int size, unsigned int value, LuaMemHookType hookType); 54 | 55 | struct LuaSaveData 56 | { 57 | LuaSaveData() { recordList = 0; } 58 | ~LuaSaveData() { ClearRecords(); } 59 | 60 | struct Record 61 | { 62 | unsigned int key; // crc32 63 | unsigned int size; // size of data 64 | unsigned char* data; 65 | Record* next; 66 | }; 67 | 68 | Record* recordList; 69 | 70 | void SaveRecord(int uid, unsigned int key); // saves Lua stack into a record and pops it 71 | void LoadRecord(int uid, unsigned int key, unsigned int itemsToLoad) const; // pushes a record's data onto the Lua stack 72 | void SaveRecordPartial(int uid, unsigned int key, int idx); // saves part of the Lua stack (at the given index) into a record and does NOT pop anything 73 | 74 | void ExportRecords(void* file) const; // writes all records to an already-open file 75 | void ImportRecords(void* file); // reads records from an already-open file 76 | void ClearRecords(); // deletes all record data 77 | 78 | private: 79 | // disallowed, it's dangerous to call this 80 | // (because the memory the destructor deletes isn't refcounted and shouldn't need to be copied) 81 | // so pass LuaSaveDatas by reference and this should never get called 82 | LuaSaveData(const LuaSaveData& copy) {} 83 | }; 84 | void CallRegisteredLuaSaveFunctions(int savestateNumber, LuaSaveData& saveData); 85 | void CallRegisteredLuaLoadFunctions(int savestateNumber, const LuaSaveData& saveData); 86 | 87 | void StopAllLuaScripts(); 88 | void RestartAllLuaScripts(); 89 | void EnableStopAllLuaScripts(bool enable); 90 | void DontWorryLua(); 91 | 92 | 93 | 94 | #endif 95 | 96 | -------------------------------------------------------------------------------- /lua/llimits.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: llimits.h,v 1.69.1.1 2007/12/27 13:02:25 roberto Exp $ 3 | ** Limits, basic types, and some other `installation-dependent' definitions 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef llimits_h 8 | #define llimits_h 9 | 10 | 11 | #include 12 | #include 13 | 14 | 15 | #include "lua.h" 16 | 17 | 18 | typedef LUAI_UINT32 lu_int32; 19 | 20 | typedef LUAI_UMEM lu_mem; 21 | 22 | typedef LUAI_MEM l_mem; 23 | 24 | 25 | 26 | /* chars used as small naturals (so that `char' is reserved for characters) */ 27 | typedef unsigned char lu_byte; 28 | 29 | 30 | #define MAX_SIZET ((size_t)(~(size_t)0)-2) 31 | 32 | #define MAX_LUMEM ((lu_mem)(~(lu_mem)0)-2) 33 | 34 | 35 | #define MAX_INT (INT_MAX-2) /* maximum value of an int (-2 for safety) */ 36 | 37 | /* 38 | ** conversion of pointer to integer 39 | ** this is for hashing only; there is no problem if the integer 40 | ** cannot hold the whole pointer value 41 | */ 42 | #define IntPoint(p) ((unsigned int)(lu_mem)(p)) 43 | 44 | 45 | 46 | /* type to ensure maximum alignment */ 47 | typedef LUAI_USER_ALIGNMENT_T L_Umaxalign; 48 | 49 | 50 | /* result of a `usual argument conversion' over lua_Number */ 51 | typedef LUAI_UACNUMBER l_uacNumber; 52 | 53 | 54 | /* internal assertions for in-house debugging */ 55 | #ifdef lua_assert 56 | 57 | #define check_exp(c,e) (lua_assert(c), (e)) 58 | #define api_check(l,e) lua_assert(e) 59 | 60 | #else 61 | 62 | #define lua_assert(c) ((void)0) 63 | #define check_exp(c,e) (e) 64 | #define api_check luai_apicheck 65 | 66 | #endif 67 | 68 | 69 | #ifndef UNUSED 70 | #define UNUSED(x) ((void)(x)) /* to avoid warnings */ 71 | #endif 72 | 73 | 74 | #ifndef cast 75 | #define cast(t, exp) ((t)(exp)) 76 | #endif 77 | 78 | #define cast_byte(i) cast(lu_byte, (i)) 79 | #define cast_num(i) cast(lua_Number, (i)) 80 | #define cast_int(i) cast(int, (i)) 81 | 82 | 83 | 84 | /* 85 | ** type for virtual-machine instructions 86 | ** must be an unsigned with (at least) 4 bytes (see details in lopcodes.h) 87 | */ 88 | typedef lu_int32 Instruction; 89 | 90 | 91 | 92 | /* maximum stack for a Lua function */ 93 | #define MAXSTACK 250 94 | 95 | 96 | 97 | /* minimum size for the string table (must be power of 2) */ 98 | #ifndef MINSTRTABSIZE 99 | #define MINSTRTABSIZE 32 100 | #endif 101 | 102 | 103 | /* minimum size for string buffer */ 104 | #ifndef LUA_MINBUFFER 105 | #define LUA_MINBUFFER 32 106 | #endif 107 | 108 | 109 | #ifndef lua_lock 110 | #define lua_lock(L) ((void) 0) 111 | #define lua_unlock(L) ((void) 0) 112 | #endif 113 | 114 | #ifndef luai_threadyield 115 | #define luai_threadyield(L) {lua_unlock(L); lua_lock(L);} 116 | #endif 117 | 118 | 119 | /* 120 | ** macro to control inclusion of some hard tests on stack reallocation 121 | */ 122 | #ifndef HARDSTACKTESTS 123 | #define condhardstacktests(x) ((void)0) 124 | #else 125 | #define condhardstacktests(x) x 126 | #endif 127 | 128 | #endif 129 | -------------------------------------------------------------------------------- /lua/lmem.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lmem.h,v 1.31.1.1 2007/12/27 13:02:25 roberto Exp $ 3 | ** Interface to Memory Manager 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef lmem_h 8 | #define lmem_h 9 | 10 | 11 | #include 12 | 13 | #include "llimits.h" 14 | #include "lua.h" 15 | 16 | #define MEMERRMSG "not enough memory" 17 | 18 | 19 | #define luaM_reallocv(L,b,on,n,e) \ 20 | ((cast(size_t, (n)+1) <= MAX_SIZET/(e)) ? /* +1 to avoid warnings */ \ 21 | luaM_realloc_(L, (b), (on)*(e), (n)*(e)) : \ 22 | luaM_toobig(L)) 23 | 24 | #define luaM_freemem(L, b, s) luaM_realloc_(L, (b), (s), 0) 25 | #define luaM_free(L, b) luaM_realloc_(L, (b), sizeof(*(b)), 0) 26 | #define luaM_freearray(L, b, n, t) luaM_reallocv(L, (b), n, 0, sizeof(t)) 27 | 28 | #define luaM_malloc(L,t) luaM_realloc_(L, NULL, 0, (t)) 29 | #define luaM_new(L,t) cast(t *, luaM_malloc(L, sizeof(t))) 30 | #define luaM_newvector(L,n,t) \ 31 | cast(t *, luaM_reallocv(L, NULL, 0, n, sizeof(t))) 32 | 33 | #define luaM_growvector(L,v,nelems,size,t,limit,e) \ 34 | if ((nelems)+1 > (size)) \ 35 | ((v)=cast(t *, luaM_growaux_(L,v,&(size),sizeof(t),limit,e))) 36 | 37 | #define luaM_reallocvector(L, v,oldn,n,t) \ 38 | ((v)=cast(t *, luaM_reallocv(L, v, oldn, n, sizeof(t)))) 39 | 40 | 41 | LUAI_FUNC void *luaM_realloc_ (lua_State *L, void *block, size_t oldsize, 42 | size_t size); 43 | LUAI_FUNC void *luaM_toobig (lua_State *L); 44 | LUAI_FUNC void *luaM_growaux_ (lua_State *L, void *block, int *size, 45 | size_t size_elem, int limit, 46 | const char *errormsg); 47 | 48 | #endif 49 | 50 | -------------------------------------------------------------------------------- /lua/ltm.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: ltm.h,v 2.6.1.1 2007/12/27 13:02:25 roberto Exp $ 3 | ** Tag methods 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef ltm_h 8 | #define ltm_h 9 | 10 | 11 | #include "lobject.h" 12 | 13 | 14 | /* 15 | * WARNING: if you change the order of this enumeration, 16 | * grep "ORDER TM" 17 | */ 18 | typedef enum { 19 | TM_INDEX, 20 | TM_NEWINDEX, 21 | TM_GC, 22 | TM_MODE, 23 | TM_EQ, /* last tag method with `fast' access */ 24 | TM_ADD, 25 | TM_SUB, 26 | TM_MUL, 27 | TM_DIV, 28 | TM_MOD, 29 | TM_POW, 30 | TM_UNM, 31 | TM_LEN, 32 | TM_LT, 33 | TM_LE, 34 | TM_CONCAT, 35 | TM_CALL, 36 | TM_N /* number of elements in the enum */ 37 | } TMS; 38 | 39 | 40 | 41 | #define gfasttm(g,et,e) ((et) == NULL ? NULL : \ 42 | ((et)->flags & (1u<<(e))) ? NULL : luaT_gettm(et, e, (g)->tmname[e])) 43 | 44 | #define fasttm(l,et,e) gfasttm(G(l), et, e) 45 | 46 | LUAI_DATA const char *const luaT_typenames[]; 47 | 48 | 49 | LUAI_FUNC const TValue *luaT_gettm (Table *events, TMS event, TString *ename); 50 | LUAI_FUNC const TValue *luaT_gettmbyobj (lua_State *L, const TValue *o, 51 | TMS event); 52 | LUAI_FUNC void luaT_init (lua_State *L); 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /lua/lua-5.1.4-x86.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/braindx/vbjin-ovr/d49106264b790ec35752bf492d6a824a7f452c10/lua/lua-5.1.4-x86.lib -------------------------------------------------------------------------------- /lua/lua51.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/braindx/vbjin-ovr/d49106264b790ec35752bf492d6a824a7f452c10/lua/lua51.dll -------------------------------------------------------------------------------- /lua/lua51.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/braindx/vbjin-ovr/d49106264b790ec35752bf492d6a824a7f452c10/lua/lua51.lib -------------------------------------------------------------------------------- /lua/lualib.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lualib.h,v 1.36.1.1 2007/12/27 13:02:25 roberto Exp $ 3 | ** Lua standard libraries 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | 8 | #ifndef lualib_h 9 | #define lualib_h 10 | 11 | #include "lua.h" 12 | 13 | 14 | /* Key to file-handle type */ 15 | #define LUA_FILEHANDLE "FILE*" 16 | 17 | 18 | #define LUA_COLIBNAME "coroutine" 19 | LUALIB_API int (luaopen_base) (lua_State *L); 20 | 21 | #define LUA_TABLIBNAME "table" 22 | LUALIB_API int (luaopen_table) (lua_State *L); 23 | 24 | #define LUA_IOLIBNAME "io" 25 | LUALIB_API int (luaopen_io) (lua_State *L); 26 | 27 | #define LUA_OSLIBNAME "os" 28 | LUALIB_API int (luaopen_os) (lua_State *L); 29 | 30 | #define LUA_STRLIBNAME "string" 31 | LUALIB_API int (luaopen_string) (lua_State *L); 32 | 33 | #define LUA_MATHLIBNAME "math" 34 | LUALIB_API int (luaopen_math) (lua_State *L); 35 | 36 | #define LUA_DBLIBNAME "debug" 37 | LUALIB_API int (luaopen_debug) (lua_State *L); 38 | 39 | #define LUA_LOADLIBNAME "package" 40 | LUALIB_API int (luaopen_package) (lua_State *L); 41 | 42 | 43 | /* open all previous libraries */ 44 | LUALIB_API void (luaL_openlibs) (lua_State *L); 45 | 46 | 47 | 48 | #ifndef lua_assert 49 | #define lua_assert(x) ((void)0) 50 | #endif 51 | 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /lua/lzio.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lzio.h,v 1.21.1.1 2007/12/27 13:02:25 roberto Exp $ 3 | ** Buffered streams 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | 8 | #ifndef lzio_h 9 | #define lzio_h 10 | 11 | #include "lua.h" 12 | 13 | #include "lmem.h" 14 | 15 | 16 | #define EOZ (-1) /* end of stream */ 17 | 18 | typedef struct Zio ZIO; 19 | 20 | #define char2int(c) cast(int, cast(unsigned char, (c))) 21 | 22 | #define zgetc(z) (((z)->n--)>0 ? char2int(*(z)->p++) : luaZ_fill(z)) 23 | 24 | typedef struct Mbuffer { 25 | char *buffer; 26 | size_t n; 27 | size_t buffsize; 28 | } Mbuffer; 29 | 30 | #define luaZ_initbuffer(L, buff) ((buff)->buffer = NULL, (buff)->buffsize = 0) 31 | 32 | #define luaZ_buffer(buff) ((buff)->buffer) 33 | #define luaZ_sizebuffer(buff) ((buff)->buffsize) 34 | #define luaZ_bufflen(buff) ((buff)->n) 35 | 36 | #define luaZ_resetbuffer(buff) ((buff)->n = 0) 37 | 38 | 39 | #define luaZ_resizebuffer(L, buff, size) \ 40 | (luaM_reallocvector(L, (buff)->buffer, (buff)->buffsize, size, char), \ 41 | (buff)->buffsize = size) 42 | 43 | #define luaZ_freebuffer(L, buff) luaZ_resizebuffer(L, buff, 0) 44 | 45 | 46 | LUAI_FUNC char *luaZ_openspace (lua_State *L, Mbuffer *buff, size_t n); 47 | LUAI_FUNC void luaZ_init (lua_State *L, ZIO *z, lua_Reader reader, 48 | void *data); 49 | LUAI_FUNC size_t luaZ_read (ZIO* z, void* b, size_t n); /* read next n bytes */ 50 | LUAI_FUNC int luaZ_lookahead (ZIO *z); 51 | 52 | 53 | 54 | /* --------- Private Part ------------------ */ 55 | 56 | struct Zio { 57 | size_t n; /* bytes still unread */ 58 | const char *p; /* current position in buffer */ 59 | lua_Reader reader; 60 | void* data; /* additional data */ 61 | lua_State *L; /* Lua state (for reader) */ 62 | }; 63 | 64 | 65 | LUAI_FUNC int luaZ_fill (ZIO *z); 66 | 67 | #endif 68 | -------------------------------------------------------------------------------- /main.h: -------------------------------------------------------------------------------- 1 | #include "dxsound.h" 2 | #include "windows.h" 3 | #include "git.h" 4 | 5 | //#include "filter/filter.h" 6 | 7 | void ScaleScreen(float factor); 8 | 9 | void WritePrivateProfileInt(char* appname, char* keyname, int val, char* file); 10 | extern char IniName[MAX_PATH]; 11 | 12 | void GetINIPath(); 13 | 14 | extern HWND g_hWnd; 15 | extern HINSTANCE g_hInstance; 16 | 17 | //int MDFNSS_Save(const char *fname, const char *suffix, uint32 *fb, MDFN_Rect *LineWidths); 18 | //int MDFNSS_Load(const char *fname, const char *suffix); 19 | extern volatile MDFN_Surface *VTBuffer[2]; 20 | extern MDFN_Rect *VTLineWidths[2]; 21 | extern volatile int VTBackBuffer; 22 | 23 | extern int CurrentState; 24 | 25 | extern void LoadInputConfig(); 26 | extern BOOL di_init(); 27 | extern INT_PTR CALLBACK DlgInputConfig(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam); 28 | extern void PCE_Power(); 29 | extern void PCEINPUT_SetInput(int port, const char *type, void *ptr); 30 | extern SoundDriver *newDirectSound(); 31 | extern void input_process(); 32 | extern SoundDriver * soundDriver; 33 | 34 | void IncreaseSpeed(); 35 | void DecreaseSpeed(); 36 | 37 | LRESULT CALLBACK BiosSettingsDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); 38 | 39 | void SetInputDisplayCharacters(uint16 new_data[]); 40 | INT_PTR CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); 41 | extern EmulateSpecStruct espec; 42 | 43 | extern uint8 convert_buffer[1024*768*3]; 44 | 45 | void WritePrivateProfileBool(char* appname, char* keyname, bool val, char* file); 46 | bool GetPrivateProfileBool(const char* appname, const char* keyname, bool defval, const char* filename); 47 | 48 | void S9xUpdateJoypadButtons (); 49 | bool soundInit(); 50 | void PlayMovie(HWND hWnd); 51 | 52 | void RecordAvi(); 53 | void StopAvi(); 54 | 55 | void UpdateToolWindows(); 56 | 57 | void IncreaseSpeed(); 58 | void DecreaseSpeed(); 59 | void InitSpeedThrottle(); 60 | int SpeedThrottle(); 61 | std::string LoadMCM(const char* path, bool load); 62 | void UpdateTitleWithFilename(std::string filename); 63 | 64 | std::string GetGameName(); 65 | std::string noExtension(std::string path); -------------------------------------------------------------------------------- /mednafen/include/blargg_config.h: -------------------------------------------------------------------------------- 1 | // Library configuration. Modify this file as necessary. 2 | 3 | #ifndef BLARGG_CONFIG_H 4 | #define BLARGG_CONFIG_H 5 | 6 | // Uncomment to use zlib for transparent decompression of gzipped files 7 | //#define HAVE_ZLIB_H 8 | 9 | // Uncomment to support only the listed game music types. See gme_type_list.cpp 10 | // for a list of all types. 11 | //#define GME_TYPE_LIST gme_nsf_type, gme_gbs_type 12 | 13 | // Uncomment to enable platform-specific optimizations 14 | //#define BLARGG_NONPORTABLE 1 15 | 16 | // Uncomment to use faster, lower quality sound synthesis 17 | //#define BLIP_BUFFER_FAST 1 18 | 19 | // Uncomment if automatic byte-order determination doesn't work 20 | //#define BLARGG_BIG_ENDIAN 1 21 | 22 | // Uncomment if you get errors in the bool section of blargg_common.h 23 | //#define BLARGG_COMPILER_HAS_BOOL 1 24 | 25 | // Use standard config.h if present 26 | #ifdef HAVE_CONFIG_H 27 | #include "config.h" 28 | #endif 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /mednafen/include/blargg_source.h: -------------------------------------------------------------------------------- 1 | // Included at the beginning of library source files, after all other #include lines 2 | #ifndef BLARGG_SOURCE_H 3 | #define BLARGG_SOURCE_H 4 | 5 | // If debugging is enabled, abort program if expr is false. Meant for checking 6 | // internal state and consistency. A failed assertion indicates a bug in the module. 7 | // void assert( bool expr ); 8 | #include 9 | 10 | // If debugging is enabled and expr is false, abort program. Meant for checking 11 | // caller-supplied parameters and operations that are outside the control of the 12 | // module. A failed requirement indicates a bug outside the module. 13 | // void require( bool expr ); 14 | #undef require 15 | #define require( expr ) assert( expr ) 16 | 17 | // Like printf() except output goes to debug log file. Might be defined to do 18 | // nothing (not even evaluate its arguments). 19 | // void dprintf( const char* format, ... ); 20 | inline void blargg_dprintf_( const char*, ... ) { } 21 | #undef dprintf 22 | #define dprintf (1) ? (void) 0 : blargg_dprintf_ 23 | 24 | // If enabled, evaluate expr and if false, make debug log entry with source file 25 | // and line. Meant for finding situations that should be examined further, but that 26 | // don't indicate a problem. In all cases, execution continues normally. 27 | #undef check 28 | #define check( expr ) ((void) 0) 29 | 30 | // If expr yields error string, return it from current function, otherwise continue. 31 | #undef RETURN_ERR 32 | #define RETURN_ERR( expr ) do { \ 33 | blargg_err_t blargg_return_err_ = (expr); \ 34 | if ( blargg_return_err_ ) return blargg_return_err_; \ 35 | } while ( 0 ) 36 | 37 | // If ptr is 0, return out of memory error string. 38 | #undef CHECK_ALLOC 39 | #define CHECK_ALLOC( ptr ) do { if ( (ptr) == 0 ) return "Out of memory"; } while ( 0 ) 40 | 41 | // Avoid any macros which evaluate their arguments multiple times 42 | #undef min 43 | #undef max 44 | 45 | // using const references generates crappy code, and I am currenly only using these 46 | // for built-in types, so they take arguments by value 47 | 48 | template 49 | inline T min( T x, T y ) 50 | { 51 | if ( x < y ) 52 | return x; 53 | return y; 54 | } 55 | 56 | template 57 | inline T max( T x, T y ) 58 | { 59 | if ( x < y ) 60 | return y; 61 | return x; 62 | } 63 | 64 | // TODO: good idea? bad idea? 65 | #undef byte 66 | #define byte byte_ 67 | typedef unsigned char byte; 68 | 69 | // deprecated 70 | #define BLARGG_CHECK_ALLOC CHECK_ALLOC 71 | #define BLARGG_RETURN_ERR RETURN_ERR 72 | 73 | // BLARGG_SOURCE_BEGIN: If defined, #included, allowing redefition of dprintf and check 74 | #ifdef BLARGG_SOURCE_BEGIN 75 | #include BLARGG_SOURCE_BEGIN 76 | #endif 77 | 78 | #endif 79 | -------------------------------------------------------------------------------- /mednafen/include/blip/Stereo_Buffer.h: -------------------------------------------------------------------------------- 1 | 2 | // Simple stereo Blip_Buffer for sound emulators whose oscillators output 3 | // either on the left only, center, or right only. 4 | 5 | // Blip_Buffer 0.3.0. Copyright (C) 2003-2004 Shay Green. GNU GPL license. 6 | 7 | #ifndef STEREO_BUFFER_H 8 | #define STEREO_BUFFER_H 9 | 10 | #include "Blip_Buffer.h" 11 | 12 | class Stereo_Buffer { 13 | public: 14 | Stereo_Buffer(); 15 | ~Stereo_Buffer(); 16 | 17 | // Same as in Blip_Buffer (see Blip_Buffer.h) 18 | bool set_sample_rate( long, int msec = 0 ); 19 | void clock_rate( long ); 20 | void bass_freq( int ); 21 | void clear(); 22 | 23 | // Buffers to output synthesis to 24 | Blip_Buffer* left(); 25 | Blip_Buffer* center(); 26 | Blip_Buffer* right(); 27 | 28 | // Same as in Blip_Buffer. For more efficient operation, pass false 29 | // for was_stereo if the left and right buffers had nothing added 30 | // to them for this frame. 31 | void end_frame( blip_time_t, bool was_stereo = true ); 32 | 33 | // Output is stereo with channels interleved, left before right. Counts 34 | // are in samples, *not* pairs. 35 | long samples_avail() const; 36 | long read_samples( blip_sample_t*, long ); 37 | 38 | private: 39 | // noncopyable 40 | Stereo_Buffer( const Stereo_Buffer& ); 41 | Stereo_Buffer& operator = ( const Stereo_Buffer& ); 42 | 43 | enum { buf_count = 3 }; 44 | Blip_Buffer bufs [buf_count]; 45 | bool stereo_added; 46 | bool was_stereo; 47 | 48 | void mix_stereo( blip_sample_t*, long ); 49 | void mix_mono( blip_sample_t*, long ); 50 | void mix_stereo( float*, long ); 51 | void mix_mono( float*, long ); 52 | }; 53 | 54 | inline Blip_Buffer* Stereo_Buffer::left() { 55 | return &bufs [1]; 56 | } 57 | 58 | inline Blip_Buffer* Stereo_Buffer::center() { 59 | return &bufs [0]; 60 | } 61 | 62 | inline Blip_Buffer* Stereo_Buffer::right() { 63 | return &bufs [2]; 64 | } 65 | 66 | inline long Stereo_Buffer::samples_avail() const { 67 | return bufs [0].samples_avail(); 68 | } 69 | 70 | #endif 71 | 72 | -------------------------------------------------------------------------------- /mednafen/include/trio/trionan.h: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * 3 | * $Id: trionan.h,v 1.9 2005/03/27 18:52:45 breese Exp $ 4 | * 5 | * Copyright (C) 2001 Bjorn Reese 6 | * 7 | * Permission to use, copy, modify, and distribute this software for any 8 | * purpose with or without fee is hereby granted, provided that the above 9 | * copyright notice and this permission notice appear in all copies. 10 | * 11 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED 12 | * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF 13 | * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE AUTHORS AND 14 | * CONTRIBUTORS ACCEPT NO RESPONSIBILITY IN ANY CONCEIVABLE MANNER. 15 | * 16 | ************************************************************************/ 17 | 18 | #ifndef TRIO_TRIONAN_H 19 | #define TRIO_TRIONAN_H 20 | 21 | #include "triodef.h" 22 | 23 | #ifdef __cplusplus 24 | extern "C" { 25 | #endif 26 | 27 | #if !defined(TRIO_PUBLIC_NAN) 28 | # if !defined(TRIO_PUBLIC) 29 | # define TRIO_PUBLIC 30 | # endif 31 | # define TRIO_PUBLIC_NAN TRIO_PUBLIC 32 | #endif 33 | 34 | enum { 35 | TRIO_FP_INFINITE, 36 | TRIO_FP_NAN, 37 | TRIO_FP_NORMAL, 38 | TRIO_FP_SUBNORMAL, 39 | TRIO_FP_ZERO 40 | }; 41 | 42 | /************************************************************************* 43 | * Dependencies 44 | */ 45 | 46 | #if defined(TRIO_EMBED_NAN) 47 | 48 | /* 49 | * The application that trionan is embedded in must define which functions 50 | * it uses. 51 | * 52 | * The following resolves internal dependencies. 53 | */ 54 | 55 | # if defined(TRIO_FUNC_ISNAN) \ 56 | || defined(TRIO_FUNC_ISINF) 57 | # if !defined(TRIO_FUNC_FPCLASSIFY_AND_SIGNBIT) 58 | # define TRIO_FUNC_FPCLASSIFY_AND_SIGNBIT 59 | # endif 60 | # endif 61 | 62 | # if defined(TRIO_FUNC_NAN) 63 | # if !defined(TRIO_FUNC_PINF) 64 | # define TRIO_FUNC_PINF 65 | # endif 66 | # endif 67 | 68 | # if defined(TRIO_FUNC_NINF) 69 | # if !defined(TRIO_FUNC_PINF) 70 | # define TRIO_FUNC_PINF 71 | # endif 72 | # endif 73 | 74 | #else 75 | 76 | /* 77 | * When trionan is not embedded all all functions are defined. 78 | */ 79 | 80 | # define TRIO_FUNC_NAN 81 | # define TRIO_FUNC_PINF 82 | # define TRIO_FUNC_NINF 83 | # define TRIO_FUNC_NZERO 84 | # define TRIO_FUNC_ISNAN 85 | # define TRIO_FUNC_ISINF 86 | # define TRIO_FUNC_ISFINITE 87 | # define TRIO_FUNC_SIGNBIT 88 | # define TRIO_FUNC_FPCLASSIFY 89 | # define TRIO_FUNC_FPCLASSIFY_AND_SIGNBIT 90 | 91 | #endif 92 | 93 | /************************************************************************* 94 | * Functions 95 | */ 96 | 97 | /* 98 | * Return NaN (Not-a-Number). 99 | */ 100 | #if defined(TRIO_FUNC_NAN) 101 | TRIO_PUBLIC_NAN double 102 | trio_nan 103 | TRIO_PROTO((void)); 104 | #endif 105 | 106 | /* 107 | * Return positive infinity. 108 | */ 109 | #if defined(TRIO_FUNC_PINF) 110 | TRIO_PUBLIC_NAN double 111 | trio_pinf 112 | TRIO_PROTO((void)); 113 | #endif 114 | 115 | /* 116 | * Return negative infinity. 117 | */ 118 | #if defined(TRIO_FUNC_NINF) 119 | TRIO_PUBLIC_NAN double 120 | trio_ninf 121 | TRIO_PROTO((void)); 122 | #endif 123 | 124 | /* 125 | * Return negative zero. 126 | */ 127 | #if defined(TRIO_FUNC_NZERO) 128 | TRIO_PUBLIC_NAN double 129 | trio_nzero 130 | TRIO_PROTO((TRIO_NOARGS)); 131 | #endif 132 | 133 | /* 134 | * If number is a NaN return non-zero, otherwise return zero. 135 | */ 136 | #if defined(TRIO_FUNC_ISNAN) 137 | TRIO_PUBLIC_NAN int 138 | trio_isnan 139 | TRIO_PROTO((double number)); 140 | #endif 141 | 142 | /* 143 | * If number is positive infinity return 1, if number is negative 144 | * infinity return -1, otherwise return 0. 145 | */ 146 | #if defined(TRIO_FUNC_ISINF) 147 | TRIO_PUBLIC_NAN int 148 | trio_isinf 149 | TRIO_PROTO((double number)); 150 | #endif 151 | 152 | /* 153 | * If number is finite return non-zero, otherwise return zero. 154 | */ 155 | #if defined(TRIO_FUNC_ISFINITE) 156 | TRIO_PUBLIC_NAN int 157 | trio_isfinite 158 | TRIO_PROTO((double number)); 159 | #endif 160 | 161 | #if defined(TRIO_FUNC_SIGNBIT) 162 | TRIO_PUBLIC_NAN int 163 | trio_signbit 164 | TRIO_PROTO((double number)); 165 | #endif 166 | 167 | #if defined(TRIO_FUNC_FPCLASSIFY) 168 | TRIO_PUBLIC_NAN int 169 | trio_fpclassify 170 | TRIO_PROTO((double number)); 171 | #endif 172 | 173 | #if defined(TRIO_FUNC_FPCLASSIFY_AND_SIGNBIT) 174 | TRIO_PUBLIC_NAN int 175 | trio_fpclassify_and_signbit 176 | TRIO_PROTO((double number, int *is_negative)); 177 | #endif 178 | 179 | #ifdef __cplusplus 180 | } 181 | #endif 182 | 183 | #endif /* TRIO_TRIONAN_H */ 184 | -------------------------------------------------------------------------------- /mednafen/src/compress/Makefile.am.inc: -------------------------------------------------------------------------------- 1 | mednafen_SOURCES += compress/minilzo.c compress/quicklz.cpp compress/blz.cpp compress/ioapi.c compress/unzip.c 2 | -------------------------------------------------------------------------------- /mednafen/src/compress/blz.h: -------------------------------------------------------------------------------- 1 | /* Fast data compressor for keeping data compressed in memory. Data format subject 2 | to change, so not suitable for long-term storage or transfer between computers. */ 3 | 4 | /* blz 0.9.1 */ 5 | #ifndef BLZ_H 6 | #define BLZ_H 7 | 8 | #ifdef __cplusplus 9 | extern "C" { 10 | #endif 11 | 12 | /* All functions are thread-safe */ 13 | 14 | /* Temporary buffer type that you must allocate. Does NOT need to be cleared 15 | before calling blz_pack(), and can be freed immediately afterwards. */ 16 | typedef struct blz_pack_t { unsigned char const* dict [0x1000]; } blz_pack_t; 17 | 18 | /* Compresses data_size bytes from data_in to packed_out and returns packed size, 19 | at most data_size + blz_worst_case. Requires data_size + blz_pack_extra bytes 20 | allocated to packed_out. Requires that data_size be 0 to 0x7FFFFFFF (2 GB). 21 | If temp is NULL, stores data uncompressed. */ 22 | enum { blz_pack_extra = 320 }; 23 | enum { blz_worst_case = 4 }; 24 | int blz_pack( void const* data_in, int data_size, void* packed_out, blz_pack_t* temp ); 25 | 26 | /* Decompresses from packed_in to data_out and returns original data size. 27 | Does NOT do any consistency checking, so corrupt data can crash program. */ 28 | int blz_unpack( void const* packed_in, void* data_out ); 29 | 30 | /* Size of original data before compression */ 31 | int blz_size( void const* packed_in ); 32 | 33 | /* String describing version of blz. Currently either "fast" or "slow". */ 34 | extern char const blz_version []; 35 | 36 | #ifdef __cplusplus 37 | } 38 | #endif 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /mednafen/src/compress/ioapi.c: -------------------------------------------------------------------------------- 1 | /* ioapi.c -- IO base function header for compress/uncompress .zip 2 | files using zlib + zip or unzip API 3 | 4 | Version 1.01e, February 12th, 2005 5 | 6 | Copyright (C) 1998-2005 Gilles Vollant 7 | */ 8 | 9 | #include 10 | #include 11 | #include 12 | 13 | #include "zlib.h" 14 | #include "ioapi.h" 15 | 16 | 17 | 18 | /* I've found an old Unix (a SunOS 4.1.3_U1) without all SEEK_* defined.... */ 19 | 20 | #ifndef SEEK_CUR 21 | #define SEEK_CUR 1 22 | #endif 23 | 24 | #ifndef SEEK_END 25 | #define SEEK_END 2 26 | #endif 27 | 28 | #ifndef SEEK_SET 29 | #define SEEK_SET 0 30 | #endif 31 | 32 | voidpf ZCALLBACK fopen_file_func OF(( 33 | voidpf opaque, 34 | const char* filename, 35 | int mode)); 36 | 37 | uLong ZCALLBACK fread_file_func OF(( 38 | voidpf opaque, 39 | voidpf stream, 40 | void* buf, 41 | uLong size)); 42 | 43 | uLong ZCALLBACK fwrite_file_func OF(( 44 | voidpf opaque, 45 | voidpf stream, 46 | const void* buf, 47 | uLong size)); 48 | 49 | long ZCALLBACK ftell_file_func OF(( 50 | voidpf opaque, 51 | voidpf stream)); 52 | 53 | long ZCALLBACK fseek_file_func OF(( 54 | voidpf opaque, 55 | voidpf stream, 56 | uLong offset, 57 | int origin)); 58 | 59 | int ZCALLBACK fclose_file_func OF(( 60 | voidpf opaque, 61 | voidpf stream)); 62 | 63 | int ZCALLBACK ferror_file_func OF(( 64 | voidpf opaque, 65 | voidpf stream)); 66 | 67 | 68 | voidpf ZCALLBACK fopen_file_func (opaque, filename, mode) 69 | voidpf opaque; 70 | const char* filename; 71 | int mode; 72 | { 73 | FILE* file = NULL; 74 | const char* mode_fopen = NULL; 75 | if ((mode & ZLIB_FILEFUNC_MODE_READWRITEFILTER)==ZLIB_FILEFUNC_MODE_READ) 76 | mode_fopen = "rb"; 77 | else 78 | if (mode & ZLIB_FILEFUNC_MODE_EXISTING) 79 | mode_fopen = "r+b"; 80 | else 81 | if (mode & ZLIB_FILEFUNC_MODE_CREATE) 82 | mode_fopen = "wb"; 83 | 84 | if ((filename!=NULL) && (mode_fopen != NULL)) 85 | file = fopen(filename, mode_fopen); 86 | return file; 87 | } 88 | 89 | 90 | uLong ZCALLBACK fread_file_func (opaque, stream, buf, size) 91 | voidpf opaque; 92 | voidpf stream; 93 | void* buf; 94 | uLong size; 95 | { 96 | uLong ret; 97 | ret = (uLong)fread(buf, 1, (size_t)size, (FILE *)stream); 98 | return ret; 99 | } 100 | 101 | 102 | uLong ZCALLBACK fwrite_file_func (opaque, stream, buf, size) 103 | voidpf opaque; 104 | voidpf stream; 105 | const void* buf; 106 | uLong size; 107 | { 108 | uLong ret; 109 | ret = (uLong)fwrite(buf, 1, (size_t)size, (FILE *)stream); 110 | return ret; 111 | } 112 | 113 | long ZCALLBACK ftell_file_func (opaque, stream) 114 | voidpf opaque; 115 | voidpf stream; 116 | { 117 | long ret; 118 | ret = ftell((FILE *)stream); 119 | return ret; 120 | } 121 | 122 | long ZCALLBACK fseek_file_func (opaque, stream, offset, origin) 123 | voidpf opaque; 124 | voidpf stream; 125 | uLong offset; 126 | int origin; 127 | { 128 | int fseek_origin=0; 129 | long ret; 130 | switch (origin) 131 | { 132 | case ZLIB_FILEFUNC_SEEK_CUR : 133 | fseek_origin = SEEK_CUR; 134 | break; 135 | case ZLIB_FILEFUNC_SEEK_END : 136 | fseek_origin = SEEK_END; 137 | break; 138 | case ZLIB_FILEFUNC_SEEK_SET : 139 | fseek_origin = SEEK_SET; 140 | break; 141 | default: return -1; 142 | } 143 | ret = 0; 144 | fseek((FILE *)stream, offset, fseek_origin); 145 | return ret; 146 | } 147 | 148 | int ZCALLBACK fclose_file_func (opaque, stream) 149 | voidpf opaque; 150 | voidpf stream; 151 | { 152 | int ret; 153 | ret = fclose((FILE *)stream); 154 | return ret; 155 | } 156 | 157 | int ZCALLBACK ferror_file_func (opaque, stream) 158 | voidpf opaque; 159 | voidpf stream; 160 | { 161 | int ret; 162 | ret = ferror((FILE *)stream); 163 | return ret; 164 | } 165 | 166 | void fill_fopen_filefunc (pzlib_filefunc_def) 167 | zlib_filefunc_def* pzlib_filefunc_def; 168 | { 169 | pzlib_filefunc_def->zopen_file = fopen_file_func; 170 | pzlib_filefunc_def->zread_file = fread_file_func; 171 | pzlib_filefunc_def->zwrite_file = fwrite_file_func; 172 | pzlib_filefunc_def->ztell_file = ftell_file_func; 173 | pzlib_filefunc_def->zseek_file = fseek_file_func; 174 | pzlib_filefunc_def->zclose_file = fclose_file_func; 175 | pzlib_filefunc_def->zerror_file = ferror_file_func; 176 | pzlib_filefunc_def->opaque = NULL; 177 | } 178 | -------------------------------------------------------------------------------- /mednafen/src/compress/ioapi.h: -------------------------------------------------------------------------------- 1 | /* ioapi.h -- IO base function header for compress/uncompress .zip 2 | files using zlib + zip or unzip API 3 | 4 | Version 1.01e, February 12th, 2005 5 | 6 | Copyright (C) 1998-2005 Gilles Vollant 7 | */ 8 | 9 | #ifndef _ZLIBIOAPI_H 10 | #define _ZLIBIOAPI_H 11 | 12 | 13 | #define ZLIB_FILEFUNC_SEEK_CUR (1) 14 | #define ZLIB_FILEFUNC_SEEK_END (2) 15 | #define ZLIB_FILEFUNC_SEEK_SET (0) 16 | 17 | #define ZLIB_FILEFUNC_MODE_READ (1) 18 | #define ZLIB_FILEFUNC_MODE_WRITE (2) 19 | #define ZLIB_FILEFUNC_MODE_READWRITEFILTER (3) 20 | 21 | #define ZLIB_FILEFUNC_MODE_EXISTING (4) 22 | #define ZLIB_FILEFUNC_MODE_CREATE (8) 23 | 24 | 25 | #ifndef ZCALLBACK 26 | 27 | #if (defined(WIN32) || defined (WINDOWS) || defined (_WINDOWS)) && defined(CALLBACK) && defined (USEWINDOWS_CALLBACK) 28 | #define ZCALLBACK CALLBACK 29 | #else 30 | #define ZCALLBACK 31 | #endif 32 | #endif 33 | 34 | #ifdef __cplusplus 35 | extern "C" { 36 | #endif 37 | 38 | typedef voidpf (ZCALLBACK *open_file_func) OF((voidpf opaque, const char* filename, int mode)); 39 | typedef uLong (ZCALLBACK *read_file_func) OF((voidpf opaque, voidpf stream, void* buf, uLong size)); 40 | typedef uLong (ZCALLBACK *write_file_func) OF((voidpf opaque, voidpf stream, const void* buf, uLong size)); 41 | typedef long (ZCALLBACK *tell_file_func) OF((voidpf opaque, voidpf stream)); 42 | typedef long (ZCALLBACK *seek_file_func) OF((voidpf opaque, voidpf stream, uLong offset, int origin)); 43 | typedef int (ZCALLBACK *close_file_func) OF((voidpf opaque, voidpf stream)); 44 | typedef int (ZCALLBACK *testerror_file_func) OF((voidpf opaque, voidpf stream)); 45 | 46 | typedef struct zlib_filefunc_def_s 47 | { 48 | open_file_func zopen_file; 49 | read_file_func zread_file; 50 | write_file_func zwrite_file; 51 | tell_file_func ztell_file; 52 | seek_file_func zseek_file; 53 | close_file_func zclose_file; 54 | testerror_file_func zerror_file; 55 | voidpf opaque; 56 | } zlib_filefunc_def; 57 | 58 | 59 | 60 | void fill_fopen_filefunc OF((zlib_filefunc_def* pzlib_filefunc_def)); 61 | 62 | #define ZREAD(filefunc,filestream,buf,size) ((*((filefunc).zread_file))((filefunc).opaque,filestream,buf,size)) 63 | #define ZWRITE(filefunc,filestream,buf,size) ((*((filefunc).zwrite_file))((filefunc).opaque,filestream,buf,size)) 64 | #define ZTELL(filefunc,filestream) ((*((filefunc).ztell_file))((filefunc).opaque,filestream)) 65 | #define ZSEEK(filefunc,filestream,pos,mode) ((*((filefunc).zseek_file))((filefunc).opaque,filestream,pos,mode)) 66 | #define ZCLOSE(filefunc,filestream) ((*((filefunc).zclose_file))((filefunc).opaque,filestream)) 67 | #define ZERROR(filefunc,filestream) ((*((filefunc).zerror_file))((filefunc).opaque,filestream)) 68 | 69 | 70 | #ifdef __cplusplus 71 | } 72 | #endif 73 | 74 | #endif 75 | 76 | -------------------------------------------------------------------------------- /mednafen/src/compress/minilzo.h: -------------------------------------------------------------------------------- 1 | /* minilzo.h -- mini subset of the LZO real-time data compression library 2 | 3 | This file is part of the LZO real-time data compression library. 4 | 5 | Copyright (C) 2005 Markus Franz Xaver Johannes Oberhumer 6 | Copyright (C) 2004 Markus Franz Xaver Johannes Oberhumer 7 | Copyright (C) 2003 Markus Franz Xaver Johannes Oberhumer 8 | Copyright (C) 2002 Markus Franz Xaver Johannes Oberhumer 9 | Copyright (C) 2001 Markus Franz Xaver Johannes Oberhumer 10 | Copyright (C) 2000 Markus Franz Xaver Johannes Oberhumer 11 | Copyright (C) 1999 Markus Franz Xaver Johannes Oberhumer 12 | Copyright (C) 1998 Markus Franz Xaver Johannes Oberhumer 13 | Copyright (C) 1997 Markus Franz Xaver Johannes Oberhumer 14 | Copyright (C) 1996 Markus Franz Xaver Johannes Oberhumer 15 | All Rights Reserved. 16 | 17 | The LZO library is free software; you can redistribute it and/or 18 | modify it under the terms of the GNU General Public License as 19 | published by the Free Software Foundation; either version 2 of 20 | the License, or (at your option) any later version. 21 | 22 | The LZO library is distributed in the hope that it will be useful, 23 | but WITHOUT ANY WARRANTY; without even the implied warranty of 24 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 25 | GNU General Public License for more details. 26 | 27 | You should have received a copy of the GNU General Public License 28 | along with the LZO library; see the file COPYING. 29 | If not, write to the Free Software Foundation, Inc., 30 | 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 31 | 32 | Markus F.X.J. Oberhumer 33 | 34 | http://www.oberhumer.com/opensource/lzo/ 35 | */ 36 | 37 | /* 38 | * NOTE: 39 | * the full LZO package can be found at 40 | * http://www.oberhumer.com/opensource/lzo/ 41 | */ 42 | 43 | 44 | #ifndef __MINILZO_H 45 | #define __MINILZO_H 46 | 47 | #define MINILZO_VERSION 0x2010 48 | 49 | #ifdef __LZOCONF_H 50 | # error "you cannot use both LZO and miniLZO" 51 | #endif 52 | 53 | #undef LZO_HAVE_CONFIG_H 54 | #include "lzoconf.h" 55 | 56 | #if !defined(LZO_VERSION) || (LZO_VERSION != MINILZO_VERSION) 57 | # error "version mismatch in header files" 58 | #endif 59 | 60 | 61 | #ifdef __cplusplus 62 | extern "C" { 63 | #endif 64 | 65 | 66 | /*********************************************************************** 67 | // 68 | ************************************************************************/ 69 | 70 | /* Memory required for the wrkmem parameter. 71 | * When the required size is 0, you can also pass a NULL pointer. 72 | */ 73 | 74 | #define LZO1X_MEM_COMPRESS LZO1X_1_MEM_COMPRESS 75 | #define LZO1X_1_MEM_COMPRESS ((lzo_uint32) (16384L * lzo_sizeof_dict_t)) 76 | #define LZO1X_MEM_DECOMPRESS (0) 77 | 78 | 79 | /* compression */ 80 | LZO_EXTERN(int) 81 | lzo1x_1_compress ( const lzo_bytep src, lzo_uint src_len, 82 | lzo_bytep dst, lzo_uintp dst_len, 83 | lzo_voidp wrkmem ); 84 | 85 | /* decompression */ 86 | LZO_EXTERN(int) 87 | lzo1x_decompress ( const lzo_bytep src, lzo_uint src_len, 88 | lzo_bytep dst, lzo_uintp dst_len, 89 | lzo_voidp wrkmem /* NOT USED */ ); 90 | 91 | /* safe decompression with overrun testing */ 92 | LZO_EXTERN(int) 93 | lzo1x_decompress_safe ( const lzo_bytep src, lzo_uint src_len, 94 | lzo_bytep dst, lzo_uintp dst_len, 95 | lzo_voidp wrkmem /* NOT USED */ ); 96 | 97 | 98 | #ifdef __cplusplus 99 | } /* extern "C" */ 100 | #endif 101 | 102 | #endif /* already included */ 103 | 104 | -------------------------------------------------------------------------------- /mednafen/src/compress/quicklz.h: -------------------------------------------------------------------------------- 1 | #ifndef __QUICKLZ_H 2 | #define __QUICKLZ_H 3 | 4 | #include 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | uint32 qlz_compress(const void *source, char *destination, uint32 size); 11 | uint32 qlz_decompress(const char *source, void *destination); 12 | 13 | #ifdef __cplusplus 14 | } 15 | #endif 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /mednafen/src/endian.h: -------------------------------------------------------------------------------- 1 | #ifndef __MDFN_ENDIAN_H 2 | #define __MDFN_ENDIAN_H 3 | 4 | #ifdef MSB_FIRST 5 | #ifdef LSB_FIRST 6 | #error Only define one of LSB_FIRST and MSB_FIRST 7 | #endif 8 | 9 | #ifndef le32toh 10 | #define le32toh(l) ((((l)>>24) & 0xff) | (((l)>>8) & 0xff00) \ 11 | | (((l)<<8) & 0xff0000) | (((l)<<24) & 0xff000000)) 12 | #endif 13 | #ifndef le16toh 14 | #define le16toh(l) ((((l)>>8) & 0xff) | (((l)<<8) & 0xff00)) 15 | #endif 16 | #else 17 | #ifndef le32toh 18 | #define le32toh(l) (l) 19 | #endif 20 | #ifndef le16toh 21 | #define le16toh(l) (l) 22 | #endif 23 | #endif 24 | 25 | #ifndef htole32 26 | #define htole32 le32toh 27 | #endif 28 | 29 | #ifndef htole16 30 | #define htole16 le16toh 31 | #endif 32 | 33 | 34 | int write16le(uint16 b, FILE *fp); 35 | int write32le(uint32 b, FILE *fp); 36 | int read32le(uint32 *Bufo, FILE *fp); 37 | 38 | void Endian_A16_Swap(void *src, uint32 nelements); 39 | void Endian_A32_Swap(void *src, uint32 nelements); 40 | void Endian_A64_Swap(void *src, uint32 nelements); 41 | 42 | void Endian_A16_NE_to_LE(void *src, uint32 nelements); 43 | void Endian_A32_NE_to_LE(void *src, uint32 nelements); 44 | void Endian_A64_NE_to_LE(void *src, uint32 nelements); 45 | 46 | void Endian_A16_LE_to_NE(void *src, uint32 nelements); 47 | void Endian_A16_BE_to_NE(void *src, uint32 nelements); 48 | void Endian_A32_LE_to_NE(void *src, uint32 nelements); 49 | void Endian_A64_LE_to_NE(void *src, uint32 nelements); 50 | 51 | void Endian_V_LE_to_NE(void *src, uint32 bytesize); 52 | void Endian_V_NE_to_LE(void *src, uint32 bytesize); 53 | 54 | void FlipByteOrder(uint8 *src, uint32 count); 55 | 56 | // The following functions can encode/decode to unaligned addresses. 57 | 58 | static INLINE void MDFN_en16lsb(uint8 *buf, uint16 morp) 59 | { 60 | buf[0]=(uint8)(morp&0xFF); 61 | buf[1]=morp>>8; 62 | } 63 | 64 | static INLINE void MDFN_en24lsb(uint8 *buf, uint32 morp) 65 | { 66 | buf[0]=(uint8)morp&0xFF; 67 | buf[1]=morp>>8; 68 | buf[2]=morp>>16; 69 | } 70 | 71 | 72 | static INLINE void MDFN_en32lsb(uint8 *buf, uint32 morp) 73 | { 74 | buf[0]=(uint8)morp&0xFF; 75 | buf[1]=morp>>8; 76 | buf[2]=morp>>16; 77 | buf[3]=morp>>24; 78 | } 79 | 80 | static INLINE void MDFN_en64lsb(uint8 *buf, uint64 morp) 81 | { 82 | buf[0]=(uint8)(morp >> 0); 83 | buf[1]=(uint8)(morp >> 8); 84 | buf[2]=(uint8)(morp >> 16); 85 | buf[3]=(uint8)(morp >> 24); 86 | buf[4]=(uint8)(morp >> 32); 87 | buf[5]=(uint8)(morp >> 40); 88 | buf[6]=(uint8)(morp >> 48); 89 | buf[7]=morp >> 56; 90 | } 91 | 92 | 93 | // Overloaded functions, yay. 94 | static INLINE void MDFN_enlsb(uint16 * buf, uint16 value) 95 | { 96 | MDFN_en16lsb((uint8 *)buf, value); 97 | } 98 | 99 | static INLINE void MDFN_enlsb(uint32 * buf, uint32 value) 100 | { 101 | MDFN_en32lsb((uint8 *)buf, value); 102 | } 103 | 104 | static INLINE void MDFN_enlsb(uint64 * buf, uint64 value) 105 | { 106 | MDFN_en64lsb((uint8 *)buf, value); 107 | } 108 | 109 | 110 | static INLINE uint16 MDFN_de16lsb(const uint8 *morp) 111 | { 112 | return(morp[0] | (morp[1] << 8)); 113 | } 114 | 115 | 116 | static INLINE uint32 MDFN_de24lsb(const uint8 *morp) 117 | { 118 | return(morp[0]|(morp[1]<<8)|(morp[2]<<16)); 119 | } 120 | 121 | static INLINE uint32 MDFN_de32lsb(const uint8 *morp) 122 | { 123 | return(morp[0]|(morp[1]<<8)|(morp[2]<<16)|(morp[3]<<24)); 124 | } 125 | 126 | static INLINE uint64 MDFN_de64lsb(const uint8 *morp) 127 | { 128 | uint64 ret = 0; 129 | 130 | ret |= morp[0]; 131 | ret |= morp[1] << 8; 132 | ret |= morp[2] << 16; 133 | ret |= morp[3] << 24; 134 | ret |= (uint64)morp[4] << 32; 135 | ret |= (uint64)morp[5] << 40; 136 | ret |= (uint64)morp[6] << 48; 137 | ret |= (uint64)morp[7] << 56; 138 | 139 | return(ret); 140 | } 141 | 142 | static INLINE uint16 MDFN_delsb(const uint16 *buf) 143 | { 144 | return(MDFN_de16lsb((uint8 *)buf)); 145 | } 146 | 147 | static INLINE uint32 MDFN_delsb(const uint32 *buf) 148 | { 149 | return(MDFN_de32lsb((uint8 *)buf)); 150 | } 151 | 152 | static INLINE uint64 MDFN_delsb(const uint64 *buf) 153 | { 154 | return(MDFN_de64lsb((uint8 *)buf)); 155 | } 156 | 157 | static INLINE uint16 MDFN_de16msb(const uint8 *morp) 158 | { 159 | return(morp[1] | (morp[0] << 8)); 160 | } 161 | 162 | static INLINE uint32 MDFN_de32msb(const uint8 *morp) 163 | { 164 | return(morp[3]|(morp[2]<<8)|(morp[1]<<16)|(morp[0]<<24)); 165 | } 166 | 167 | #endif 168 | -------------------------------------------------------------------------------- /mednafen/src/error.cpp: -------------------------------------------------------------------------------- 1 | /* Mednafen - Multi-system Emulator 2 | * 3 | * This program is free software; you can redistribute it and/or modify 4 | * it under the terms of the GNU General Public License as published by 5 | * the Free Software Foundation; either version 2 of the License, or 6 | * (at your option) any later version. 7 | * 8 | * This program is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with this program; if not, write to the Free Software 15 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 16 | */ 17 | 18 | #include "mednafen.h" 19 | #include "error.h" 20 | #include 21 | #include 22 | #include 23 | 24 | MDFN_Error::MDFN_Error(int errno_code_new, const char *format, ...) 25 | { 26 | errno_code = errno_code_new; 27 | 28 | va_list ap; 29 | va_start(ap, format); 30 | error_message = trio_vaprintf(format, ap); 31 | va_end(ap); 32 | } 33 | 34 | MDFN_Error::~MDFN_Error() 35 | { 36 | if(error_message) 37 | { 38 | free(error_message); 39 | error_message = NULL; 40 | } 41 | } 42 | 43 | MDFN_Error::MDFN_Error(const MDFN_Error &ze_error) 44 | { 45 | if(ze_error.error_message) 46 | error_message = strdup(ze_error.error_message); 47 | } 48 | 49 | const char * MDFN_Error::GetErrorMessage(void) 50 | { 51 | return(error_message); 52 | } 53 | 54 | int MDFN_Error::GetErrno(void) 55 | { 56 | return(errno_code); 57 | } 58 | 59 | 60 | void ErrnoHolder::SetErrno(int the_errno) 61 | { 62 | local_errno = the_errno; 63 | 64 | if(the_errno == 0) 65 | local_strerror[0] = 0; 66 | else 67 | { 68 | #ifdef HAVE_STRERROR_R 69 | 70 | #if (_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) && ! _GNU_SOURCE // XSI version: 71 | 72 | if(strerror_r(the_errno, local_strerror, 256) == -1) 73 | strncpy(local_strerror, "ERROR IN strerror_r()!!!", 255); 74 | 75 | #else // GNU version: 76 | 77 | char *retv = NULL; 78 | if((retv = strerror_r(the_errno, local_strerror, 256)) == NULL) 79 | strncpy(local_strerror, "ERROR IN strerror_r()!!!", 256); 80 | else if(retv != local_strerror) 81 | strncpy(local_strerror, retv, 255); 82 | #endif 83 | 84 | #else // No strerror_r :( 85 | 86 | strncpy(local_strerror, strerror(the_errno), 255); 87 | 88 | #endif 89 | 90 | local_strerror[255] = 0; 91 | } 92 | } 93 | 94 | -------------------------------------------------------------------------------- /mednafen/src/error.h: -------------------------------------------------------------------------------- 1 | #ifndef __MDFN_ERROR_H 2 | #define __MDFN_ERROR_H 3 | 4 | #include 5 | #include 6 | 7 | #ifdef __cplusplus 8 | class MDFN_Error 9 | { 10 | public: 11 | 12 | MDFN_Error(int errno_code_new, const char *format, ...); 13 | ~MDFN_Error(); 14 | 15 | MDFN_Error(const MDFN_Error &ze_error); 16 | 17 | const char *GetErrorMessage(void); 18 | int GetErrno(void); 19 | 20 | private: 21 | 22 | int errno_code; 23 | char *error_message; 24 | }; 25 | 26 | class ErrnoHolder 27 | { 28 | public: 29 | 30 | ErrnoHolder() 31 | { 32 | //SetErrno(0); 33 | local_errno = 0; 34 | local_strerror[0] = 0; 35 | } 36 | 37 | ErrnoHolder(int the_errno) 38 | { 39 | SetErrno(the_errno); 40 | } 41 | 42 | inline int Errno(void) 43 | { 44 | return(local_errno); 45 | } 46 | 47 | const char *StrError(void) 48 | { 49 | return(local_strerror); 50 | } 51 | 52 | void operator=(int the_errno) 53 | { 54 | SetErrno(the_errno); 55 | } 56 | 57 | private: 58 | 59 | void SetErrno(int the_errno); 60 | 61 | int local_errno; 62 | char local_strerror[256]; 63 | }; 64 | 65 | #endif 66 | 67 | #endif 68 | -------------------------------------------------------------------------------- /mednafen/src/file.h: -------------------------------------------------------------------------------- 1 | #ifndef MDFN_FILE_H 2 | #define MDFN_FILE_H 3 | 4 | #include 5 | #include "git.h" 6 | 7 | #define MDFNFILE_EC_NOTFOUND 1 8 | #define MDFNFILE_EC_OTHER 2 9 | 10 | class MDFNFILE 11 | { 12 | public: 13 | 14 | MDFNFILE(); 15 | ~MDFNFILE(); 16 | 17 | bool Open(const char *path, const FileExtensionSpecStruct *known_ext, const char *purpose = NULL, const bool suppress_notfound_pe = FALSE); 18 | INLINE bool Open(const std::string &path, const FileExtensionSpecStruct *known_ext, const char *purpose = NULL, const bool suppress_notfound_pe = FALSE) 19 | { 20 | return(Open(path.c_str(), known_ext, purpose, suppress_notfound_pe)); 21 | } 22 | 23 | bool ApplyIPS(MDFNFILE *); 24 | bool Close(void); 25 | 26 | const int64 &size; 27 | const uint8 * const &data; 28 | const char * const &ext; 29 | 30 | // Currently, only valid with Open() 31 | inline const int GetErrorCode(int *get_errno = NULL) 32 | { 33 | if(get_errno) 34 | *get_errno = local_errno; 35 | 36 | return(error_code); 37 | } 38 | 39 | inline const int64 Size(void) 40 | { 41 | return(f_size); 42 | } 43 | 44 | inline const uint8 *Data(void) 45 | { 46 | return(f_data); 47 | } 48 | 49 | uint64 fread(void *ptr, size_t size, size_t nmemb); 50 | int fseek(int64 offset, int whence); 51 | 52 | inline uint64 ftell(void) 53 | { 54 | return(location); 55 | } 56 | 57 | inline void rewind(void) 58 | { 59 | location = 0; 60 | } 61 | 62 | int read32le(uint32 *Bufo); 63 | int read16le(uint16 *Bufo); 64 | 65 | inline int fgetc(void) 66 | { 67 | if(location < f_size) 68 | return f_data[location++]; 69 | 70 | return EOF; 71 | } 72 | 73 | inline int fisarchive(void) 74 | { 75 | return(0); 76 | } 77 | 78 | char *fgets(char *s, int size); 79 | 80 | private: 81 | 82 | uint8 *f_data; 83 | int64 f_size; 84 | char *f_ext; 85 | 86 | int error_code; 87 | int local_errno; 88 | 89 | int64 location; 90 | 91 | #ifdef HAVE_MMAP 92 | bool is_mmap; 93 | #endif 94 | 95 | bool MakeMemWrap(void *tz, int type); 96 | }; 97 | 98 | #if 0 99 | MDFNFILE *MDFN_fopen(const char *path, const char *ipsfn, const char *mode, const FileExtensionSpecStruct *known_ext); 100 | int MDFN_fclose(MDFNFILE*); 101 | uint64 MDFN_fread(void *ptr, size_t size, size_t nmemb, MDFNFILE*); 102 | uint64 MDFN_fwrite(void *ptr, size_t size, size_t nmemb, MDFNFILE*); 103 | int MDFN_fseek(MDFNFILE*, int64 offset, int whence); 104 | uint64 MDFN_ftell(MDFNFILE*); 105 | void MDFN_rewind(MDFNFILE*); 106 | int MDFN_read32le(uint32 *Bufo, MDFNFILE*); 107 | int MDFN_read16le(uint16 *Bufo, MDFNFILE*); 108 | int MDFN_fgetc(MDFNFILE*); 109 | uint64 MDFN_fgetsize(MDFNFILE*); 110 | int MDFN_fisarchive(MDFNFILE*); 111 | char *MDFN_fgets(char *s, int size, MDFNFILE *); 112 | #endif 113 | 114 | class PtrLengthPair 115 | { 116 | public: 117 | 118 | inline PtrLengthPair(const void *new_data, const uint64 new_length) 119 | { 120 | data = new_data; 121 | length = new_length; 122 | } 123 | 124 | ~PtrLengthPair() 125 | { 126 | 127 | } 128 | 129 | INLINE const void *GetData(void) const 130 | { 131 | return(data); 132 | } 133 | 134 | INLINE uint64 GetLength(void) const 135 | { 136 | return(length); 137 | } 138 | 139 | private: 140 | const void *data; 141 | uint64 length; 142 | }; 143 | 144 | #include 145 | 146 | // These functions should be used for data like save states and non-volatile backup memory. 147 | // Until(if, even) we add LoadFromFile functions, for reading the files these functions generate, just use gzopen(), gzread(), etc. 148 | // "compress" is set to the zlib compression level. 0 disables compression entirely, and dumps the file without a gzip header or footer. 149 | // (Note: There is a setting that will force compress to 0 in the internal DumpToFile logic, for hackers who don't want to ungzip save files.) 150 | 151 | bool MDFN_DumpToFile(const char *filename, int compress, const void *data, const uint64 length); 152 | bool MDFN_DumpToFile(const char *filename, int compress, const std::vector &pearpairs); 153 | 154 | #endif 155 | -------------------------------------------------------------------------------- /mednafen/src/general.h: -------------------------------------------------------------------------------- 1 | #ifndef _GENERAL_H 2 | #define _GENERAL_H 3 | 4 | #include 5 | 6 | extern uint32 MDFN_RoundUpPow2(uint32); 7 | 8 | void GetFileBase(const char *f); 9 | 10 | std::string MDFN_MakeFName(int type, int id1, const char *cd1); 11 | char *MDFN_RemoveControlChars(char *str); 12 | 13 | void MDFN_ltrim(char *string); 14 | void MDFN_rtrim(char *string); 15 | void MDFN_trim(char *string); 16 | 17 | typedef enum 18 | { 19 | MDFNMKF_STATE = 0, 20 | MDFNMKF_SNAP, 21 | MDFNMKF_SAV, 22 | MDFNMKF_CHEAT, 23 | MDFNMKF_PALETTE, 24 | MDFNMKF_IPS, 25 | MDFNMKF_MOVIE, 26 | MDFNMKF_AUX, 27 | MDFNMKF_SNAP_DAT, 28 | MDFNMKF_CHEAT_TMP, 29 | MDFNMKF_FIRMWARE 30 | } MakeFName_Type; 31 | 32 | std::string MDFN_MakeFName(MakeFName_Type type, int id1, const char *cd1); 33 | 34 | const char * GetFNComponent(const char *str); 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /mednafen/src/hw_cpu/v810/fpu-new/mednafen-gcc.h: -------------------------------------------------------------------------------- 1 | #ifdef HAVE_CONFIG_H 2 | #include 3 | #endif 4 | 5 | #include 6 | 7 | /*---------------------------------------------------------------------------- 8 | | One of the macros `BIGENDIAN' or `LITTLEENDIAN' must be defined. 9 | *----------------------------------------------------------------------------*/ 10 | #ifdef LSB_FIRST 11 | #define LITTLEENDIAN 12 | #else 13 | #define BIGENDIAN 14 | #endif 15 | 16 | /*---------------------------------------------------------------------------- 17 | | The macro `BITS64' can be defined to indicate that 64-bit integer types are 18 | | supported by the compiler. 19 | *----------------------------------------------------------------------------*/ 20 | #define BITS64 21 | 22 | /*---------------------------------------------------------------------------- 23 | | Each of the following `typedef's defines the most convenient type that holds 24 | | integers of at least as many bits as specified. For example, `uint8' should 25 | | be the most convenient type that can hold unsigned integers of as many as 26 | | 8 bits. The `flag' type must be able to hold either a 0 or 1. For most 27 | | implementations of C, `flag', `uint8', and `int8' should all be `typedef'ed 28 | | to the same as `int'. 29 | *----------------------------------------------------------------------------*/ 30 | typedef char flag; 31 | typedef uint8_t uint8; 32 | typedef int8_t int8; 33 | typedef uint16_t uint16; 34 | typedef int16_t int16; 35 | typedef uint32_t uint32; 36 | typedef int32_t int32; 37 | 38 | #ifdef BITS64 39 | typedef uint64_t uint64; 40 | typedef int64_t int64; 41 | #endif 42 | 43 | /*---------------------------------------------------------------------------- 44 | | Each of the following `typedef's defines a type that holds integers 45 | | of _exactly_ the number of bits specified. For instance, for most 46 | | implementation of C, `bits16' and `sbits16' should be `typedef'ed to 47 | | `unsigned short int' and `signed short int' (or `short int'), respectively. 48 | *----------------------------------------------------------------------------*/ 49 | typedef uint8_t bits8; 50 | typedef int8_t sbits8; 51 | typedef uint16_t bits16; 52 | typedef int16_t sbits16; 53 | typedef uint32_t bits32; 54 | typedef int32_t sbits32; 55 | #ifdef BITS64 56 | typedef uint64_t bits64; 57 | typedef int64_t sbits64; 58 | #endif 59 | 60 | #ifdef BITS64 61 | /*---------------------------------------------------------------------------- 62 | | The `LIT64' macro takes as its argument a textual integer literal and 63 | | if necessary ``marks'' the literal as having a 64-bit integer type. 64 | | For example, the GNU C Compiler (`gcc') requires that 64-bit literals be 65 | | appended with the letters `LL' standing for `long long', which is `gcc's 66 | | name for the 64-bit integer type. Some compilers may allow `LIT64' to be 67 | | defined as the identity macro: `#define LIT64( a ) a'. 68 | *----------------------------------------------------------------------------*/ 69 | #define LIT64( a ) a##LL 70 | #endif 71 | 72 | /*---------------------------------------------------------------------------- 73 | | The macro `INLINE' can be used before functions that should be inlined. If 74 | | a compiler does not support explicit inlining, this macro should be defined 75 | | to be `static'. 76 | *----------------------------------------------------------------------------*/ 77 | #define INLINE extern inline 78 | 79 | -------------------------------------------------------------------------------- /mednafen/src/hw_cpu/v810/fpu-new/milieu.h: -------------------------------------------------------------------------------- 1 | 2 | /*============================================================================ 3 | 4 | This C header file is part of the SoftFloat IEC/IEEE Floating-point Arithmetic 5 | Package, Release 2b. 6 | 7 | Written by John R. Hauser. This work was made possible in part by the 8 | International Computer Science Institute, located at Suite 600, 1947 Center 9 | Street, Berkeley, California 94704. Funding was partially provided by the 10 | National Science Foundation under grant MIP-9311980. The original version 11 | of this code was written as part of a project to build a fixed-point vector 12 | processor in collaboration with the University of California at Berkeley, 13 | overseen by Profs. Nelson Morgan and John Wawrzynek. More information 14 | is available through the Web page `http://www.cs.berkeley.edu/~jhauser/ 15 | arithmetic/SoftFloat.html'. 16 | 17 | THIS SOFTWARE IS DISTRIBUTED AS IS, FOR FREE. Although reasonable effort has 18 | been made to avoid it, THIS SOFTWARE MAY CONTAIN FAULTS THAT WILL AT TIMES 19 | RESULT IN INCORRECT BEHAVIOR. USE OF THIS SOFTWARE IS RESTRICTED TO PERSONS 20 | AND ORGANIZATIONS WHO CAN AND WILL TAKE FULL RESPONSIBILITY FOR ALL LOSSES, 21 | COSTS, OR OTHER PROBLEMS THEY INCUR DUE TO THE SOFTWARE, AND WHO FURTHERMORE 22 | EFFECTIVELY INDEMNIFY JOHN HAUSER AND THE INTERNATIONAL COMPUTER SCIENCE 23 | INSTITUTE (possibly via similar legal warning) AGAINST ALL LOSSES, COSTS, OR 24 | OTHER PROBLEMS INCURRED BY THEIR CUSTOMERS AND CLIENTS DUE TO THE SOFTWARE. 25 | 26 | Derivative works are acceptable, even for commercial purposes, so long as 27 | (1) the source code for the derivative work includes prominent notice that 28 | the work is derivative, and (2) the source code includes prominent notice with 29 | these four paragraphs for those parts of this code that are retained. 30 | 31 | =============================================================================*/ 32 | 33 | /*---------------------------------------------------------------------------- 34 | | Include common integer types and flags. 35 | *----------------------------------------------------------------------------*/ 36 | #include "mednafen-gcc.h" 37 | 38 | /*---------------------------------------------------------------------------- 39 | | Symbolic Boolean literals. 40 | *----------------------------------------------------------------------------*/ 41 | enum { 42 | FALSE = 0, 43 | TRUE = 1 44 | }; 45 | 46 | -------------------------------------------------------------------------------- /mednafen/src/hw_cpu/v810/v810_cpuD.h: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////// 2 | // Defines for the V810 CPU debug 3 | 4 | #ifndef V810_CPU_D_H_ 5 | #define V810_CPU_D_H_ 6 | 7 | #include 8 | #include 9 | #include "v810_opt.h" 10 | 11 | // Dissasemble num lines of code starting at tPC (If tPC == -1 start at PC) 12 | void v810_dis(uint32 &PC, int num, char *, uint16 (*rhword)(uint32)); 13 | 14 | #endif 15 | 16 | -------------------------------------------------------------------------------- /mednafen/src/hw_cpu/v810/v810_do_am.h: -------------------------------------------------------------------------------- 1 | #define DO_MOV_AM(); DO_AM_I(); 2 | #define DO_ADD_AM(); DO_AM_I(); 3 | #define DO_SUB_AM(); DO_AM_I(); 4 | #define DO_CMP_AM(); DO_AM_I(); 5 | #define DO_SHL_AM(); DO_AM_I(); 6 | #define DO_SHR_AM(); DO_AM_I(); 7 | #define DO_JMP_AM(); DO_AM_I(); 8 | #define DO_SAR_AM(); DO_AM_I(); 9 | #define DO_MUL_AM(); DO_AM_I(); 10 | #define DO_DIV_AM(); DO_AM_I(); 11 | #define DO_MULU_AM(); DO_AM_I(); 12 | #define DO_DIVU_AM(); DO_AM_I(); 13 | #define DO_OR_AM(); DO_AM_I(); 14 | #define DO_AND_AM(); DO_AM_I(); 15 | #define DO_XOR_AM(); DO_AM_I(); 16 | #define DO_NOT_AM(); DO_AM_I(); 17 | #define DO_MOV_I_AM(); DO_AM_II(); 18 | #define DO_ADD_I_AM(); DO_AM_II(); 19 | #define DO_SETF_AM(); DO_AM_II(); 20 | #define DO_CMP_I_AM(); DO_AM_II(); 21 | #define DO_SHL_I_AM(); DO_AM_II(); 22 | #define DO_SHR_I_AM(); DO_AM_II(); 23 | #define DO_EI_AM(); DO_AM_II(); 24 | #define DO_SAR_I_AM(); DO_AM_II(); 25 | #define DO_TRAP_AM(); DO_AM_II(); 26 | #define DO_RETI_AM(); DO_AM_IX(); 27 | #define DO_HALT_AM(); DO_AM_IX(); 28 | #define DO_LDSR_AM(); DO_AM_II(); 29 | #define DO_STSR_AM(); DO_AM_II(); 30 | #define DO_DI_AM(); DO_AM_II(); 31 | #define DO_BSTR_AM(); DO_AM_BSTR(); 32 | #define DO_MOVEA_AM(); DO_AM_V(); 33 | #define DO_ADDI_AM(); DO_AM_V(); 34 | #define DO_JR_AM(); DO_AM_IV(); 35 | #define DO_JAL_AM(); DO_AM_IV(); 36 | #define DO_ORI_AM(); DO_AM_V(); 37 | #define DO_ANDI_AM(); DO_AM_V(); 38 | #define DO_XORI_AM(); DO_AM_V(); 39 | #define DO_MOVHI_AM(); DO_AM_V(); 40 | #define DO_LD_B_AM(); DO_AM_VIa(); 41 | #define DO_LD_H_AM(); DO_AM_VIa(); 42 | #define DO_LD_W_AM(); DO_AM_VIa(); 43 | #define DO_ST_B_AM(); DO_AM_VIb(); 44 | #define DO_ST_H_AM(); DO_AM_VIb(); 45 | #define DO_ST_W_AM(); DO_AM_VIb(); 46 | #define DO_IN_B_AM(); DO_AM_VIa(); 47 | #define DO_IN_H_AM(); DO_AM_VIa(); 48 | #define DO_CAXI_AM(); DO_AM_VIa(); 49 | #define DO_IN_W_AM(); DO_AM_VIa(); 50 | #define DO_OUT_B_AM(); DO_AM_VIb(); 51 | #define DO_OUT_H_AM(); DO_AM_VIb(); 52 | #define DO_FPP_AM(); DO_AM_FPP(); 53 | #define DO_OUT_W_AM(); DO_AM_VIb(); 54 | #define DO_BV_AM(); DO_AM_III(); 55 | #define DO_BL_AM(); DO_AM_III(); 56 | #define DO_BE_AM(); DO_AM_III(); 57 | #define DO_BNH_AM(); DO_AM_III(); 58 | #define DO_BN_AM(); DO_AM_III(); 59 | #define DO_BR_AM(); DO_AM_III(); 60 | #define DO_BLT_AM(); DO_AM_III(); 61 | #define DO_BLE_AM(); DO_AM_III(); 62 | #define DO_BNV_AM(); DO_AM_III(); 63 | #define DO_BNL_AM(); DO_AM_III(); 64 | #define DO_BNE_AM(); DO_AM_III(); 65 | #define DO_BH_AM(); DO_AM_III(); 66 | #define DO_BP_AM(); DO_AM_III(); 67 | #define DO_NOP_AM(); DO_AM_III(); 68 | #define DO_BGE_AM(); DO_AM_III(); 69 | #define DO_BGT_AM(); DO_AM_III(); 70 | 71 | 72 | #define DO_INVALID_AM(); DO_AM_UDEF(); 73 | -------------------------------------------------------------------------------- /mednafen/src/hw_cpu/v810/v810_op_table.inc: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /mednafen/src/hw_cpu/v810/v810_oploop.inc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/braindx/vbjin-ovr/d49106264b790ec35752bf492d6a824a7f452c10/mednafen/src/hw_cpu/v810/v810_oploop.inc -------------------------------------------------------------------------------- /mednafen/src/math_ops.cpp: -------------------------------------------------------------------------------- 1 | /* Mednafen - Multi-system Emulator 2 | * 3 | * This program is free software; you can redistribute it and/or modify 4 | * it under the terms of the GNU General Public License as published by 5 | * the Free Software Foundation; either version 2 of the License, or 6 | * (at your option) any later version. 7 | * 8 | * This program is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with this program; if not, write to the Free Software 15 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 16 | */ 17 | #include "mednafen.h" 18 | #include "math_ops.h" 19 | 20 | // Source: http://graphics.stanford.edu/~seander/bithacks.html#RoundUpPowerOf2 21 | // Rounds up to the nearest power of 2. 22 | uint32 round_up_pow2(uint32 v) 23 | { 24 | v--; 25 | v |= v >> 1; 26 | v |= v >> 2; 27 | v |= v >> 4; 28 | v |= v >> 8; 29 | v |= v >> 16; 30 | v++; 31 | 32 | v += (v == 0); 33 | 34 | return(v); 35 | } 36 | 37 | -------------------------------------------------------------------------------- /mednafen/src/math_ops.h: -------------------------------------------------------------------------------- 1 | #ifndef __MDFN_MATH_OPS_H 2 | #define __MDFN_MATH_OPS_H 3 | 4 | uint32 round_up_pow2(uint32 v); 5 | 6 | // Some compilers' optimizers and some platforms might fubar the generated code from these macros, 7 | // so some tests are run in...tests.cpp 8 | #define sign_8_to_s16(_value) ((int16)(int8)(_value)) 9 | #define sign_9_to_s16(_value) (((int16)((unsigned int)(_value) << 7)) >> 7) 10 | #define sign_10_to_s16(_value) (((int16)((uint32)(_value) << 6)) >> 6) 11 | #define sign_11_to_s16(_value) (((int16)((uint32)(_value) << 5)) >> 5) 12 | #define sign_12_to_s16(_value) (((int16)((uint32)(_value) << 4)) >> 4) 13 | #define sign_13_to_s16(_value) (((int16)((uint32)(_value) << 3)) >> 3) 14 | #define sign_14_to_s16(_value) (((int16)((uint32)(_value) << 2)) >> 2) 15 | #define sign_15_to_s16(_value) (((int16)((uint32)(_value) << 1)) >> 1) 16 | 17 | // This obviously won't convert higher-than-32 bit numbers to signed 32-bit ;) 18 | // Also, this shouldn't be used for 8-bit and 16-bit signed numbers, since you can 19 | // convert those faster with typecasts... 20 | #define sign_x_to_s32(_bits, _value) (((int32)((uint32)(_value) << (32 - _bits))) >> (32 - _bits)) 21 | 22 | 23 | #define INT_TO_BCD(A) (((A) / 10) * 16 + ((A) % 10)) // convert INT --> BCD 24 | #define BCD_TO_INT(B) (((B) / 16) * 10 + ((B) % 16)) // convert BCD --> INT 25 | 26 | #define INT16_TO_BCD(A) ((((((A) % 100) / 10) * 16 + ((A) % 10))) | (((((((A) / 100) % 100) / 10) * 16 + (((A) / 100) % 10))) << 8)) // convert INT16 --> BCD 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /mednafen/src/md5.h: -------------------------------------------------------------------------------- 1 | #ifndef _MD5_H 2 | #define _MD5_H 3 | 4 | #include 5 | 6 | class md5_context 7 | { 8 | public: 9 | md5_context(void); 10 | ~md5_context(void); 11 | 12 | static std::string asciistr(const uint8 digest[16], bool borked_order); 13 | std::string asciistr(void); 14 | void starts(void); 15 | void update(const uint8 *input, uint32 length); 16 | inline void update_u32_as_lsb(const uint32 input) 17 | { 18 | uint8 buf[4]; 19 | 20 | buf[0] = input >> 0; 21 | buf[1] = input >> 8; 22 | buf[2] = input >> 16; 23 | buf[3] = input >> 24; 24 | 25 | update(buf, 4); 26 | } 27 | 28 | inline void update_string(const char *string) 29 | { 30 | update((const uint8 *)string, strlen(string)); 31 | } 32 | void finish(uint8 digest[16]); 33 | 34 | private: 35 | void process(const uint8 data[64]); 36 | uint32 total[2]; 37 | uint32 state[4]; 38 | uint8 buffer[64]; 39 | }; 40 | 41 | #endif /* md5.h */ 42 | -------------------------------------------------------------------------------- /mednafen/src/mednafen.cpp: -------------------------------------------------------------------------------- 1 | #include "git.h" 2 | #include "settings.h" 3 | #include "assert.h" 4 | #include "general.h" 5 | MDFNGI * MDFNGameInfo; 6 | void MDFN_PrintError(const char *format, ...) 7 | { 8 | } 9 | 10 | MDFNGI *MDFNI_LoadGame(const char *force_module, const char *name) 11 | { 12 | MDFNFILE GameFile; 13 | //struct stat stat_buf; 14 | std::vector valid_iae; 15 | 16 | if(strlen(name) > 4 && (!strcasecmp(name + strlen(name) - 4, ".cue") || !strcasecmp(name + strlen(name) - 4, ".toc"))) 17 | { 18 | // return(MDFNI_LoadCD(force_module, name)); 19 | } 20 | 21 | // if(!stat(name, &stat_buf) && !S_ISREG(stat_buf.st_mode)) 22 | { 23 | // return(MDFNI_LoadCD(force_module, name)); 24 | } 25 | 26 | // MDFNI_CloseGame(); 27 | 28 | // LastSoundMultiplier = 1; 29 | 30 | MDFNGameInfo = NULL; 31 | 32 | MDFN_printf("Loading %s...\n",name); 33 | 34 | //MDFN_indent(1); 35 | 36 | GetFileBase(name); 37 | 38 | // if(MMPlay_Load(name) > 0) 39 | // { 40 | // MDFNGameInfo = &MMPlayGI; 41 | // goto SkipNormalLoad; 42 | // } 43 | #if 0 44 | // Construct a NULL-delimited list of known file extensions for MDFN_fopen() 45 | for(unsigned int i = 0; i < MDFNSystems.size(); i++) 46 | { 47 | const FileExtensionSpecStruct *curexts = MDFNSystems[i]->FileExtensions; 48 | 49 | // If we're forcing a module, only look for extensions corresponding to that module 50 | if(force_module && strcmp(MDFNSystems[i]->shortname, force_module)) 51 | continue; 52 | 53 | if(curexts) 54 | while(curexts->extension && curexts->description) 55 | { 56 | valid_iae.push_back(*curexts); 57 | curexts++; 58 | } 59 | } 60 | { 61 | FileExtensionSpecStruct tmpext = { NULL, NULL }; 62 | valid_iae.push_back(tmpext); 63 | } 64 | #endif 65 | if(!GameFile.Open(name, NULL, "game"))//&valid_iae[0] 66 | { 67 | MDFNGameInfo = NULL; 68 | return 0; 69 | } 70 | 71 | /* 72 | if(!LoadIPS(GameFile, MDFN_MakeFName(MDFNMKF_IPS, 0, 0).c_str())) 73 | { 74 | MDFNGameInfo = NULL; 75 | GameFile.Close(); 76 | return(0); 77 | } 78 | */ 79 | MDFNGameInfo = NULL; 80 | /* 81 | for(std::list::iterator it = MDFNSystemsPrio.begin(); it != MDFNSystemsPrio.end(); it++) //_unsigned int x = 0; x < MDFNSystems.size(); x++) 82 | { 83 | char tmpstr[256]; 84 | trio_snprintf(tmpstr, 256, "%s.enable", (*it)->shortname); 85 | 86 | if(force_module) 87 | { 88 | if(!(*it)->Load) 89 | continue; 90 | 91 | if(!strcmp(force_module, (*it)->shortname)) 92 | { 93 | MDFNGameInfo = *it; 94 | break; 95 | } 96 | } 97 | else 98 | { 99 | // Is module enabled? 100 | if(!MDFN_GetSettingB(tmpstr)) 101 | continue; 102 | 103 | if(!(*it)->Load || !(*it)->TestMagic) 104 | continue; 105 | 106 | if((*it)->TestMagic(name, &GameFile)) 107 | { 108 | MDFNGameInfo = *it; 109 | break; 110 | } 111 | } 112 | } 113 | */ 114 | extern MDFNGI EmulatedVB; 115 | MDFNGameInfo= &EmulatedVB; 116 | 117 | if(!MDFNGameInfo) 118 | { 119 | GameFile.Close(); 120 | 121 | MDFN_PrintError("Unrecognized file format. Sorry."); 122 | // MDFN_indent(-1); 123 | MDFNGameInfo = NULL; 124 | return 0; 125 | } 126 | 127 | MDFN_printf("Using module: %s(%s)\n\n", MDFNGameInfo->shortname, MDFNGameInfo->fullname); 128 | //MDFN_indent(1); 129 | 130 | assert(MDFNGameInfo->soundchan != 0); 131 | 132 | MDFNGameInfo->soundrate = 0; 133 | MDFNGameInfo->name = NULL; 134 | MDFNGameInfo->rotated = 0; 135 | 136 | if(MDFNGameInfo->Load(name, &GameFile) <= 0) 137 | { 138 | GameFile.Close(); 139 | // MDFN_indent(-2); 140 | MDFNGameInfo = NULL; 141 | return(0); 142 | } 143 | 144 | if(MDFNGameInfo->GameType != GMT_PLAYER) 145 | { 146 | // MDFN_LoadGameCheats(NULL); 147 | // MDFNMP_InstallReadPatches(); 148 | } 149 | 150 | //SkipNormalLoad: ; 151 | 152 | #ifdef WANT_DEBUGGER 153 | MDFNDBG_PostGameLoad(); 154 | #endif 155 | 156 | MDFNSS_CheckStates(); 157 | //MDFNMOV_CheckMovies(); 158 | 159 | MDFN_ResetMessages(); // Save state, status messages, etc. 160 | 161 | //MDFN_indent(-2); 162 | #if 0 163 | if(!MDFNGameInfo->name) 164 | { 165 | unsigned int x; 166 | char *tmp; 167 | 168 | MDFNGameInfo->name = (UTF8 *)strdup(GetFNComponent(name)); 169 | 170 | for(x=0;xname);x++) 171 | { 172 | if(MDFNGameInfo->name[x] == '_') 173 | MDFNGameInfo->name[x] = ' '; 174 | } 175 | if((tmp = strrchr((char *)MDFNGameInfo->name, '.'))) 176 | *tmp = 0; 177 | } 178 | #endif 179 | //VBlur_Init(); 180 | 181 | MDFN_StateEvilBegin(); 182 | 183 | return(MDFNGameInfo); 184 | } -------------------------------------------------------------------------------- /mednafen/src/mednafen.h: -------------------------------------------------------------------------------- 1 | #ifndef _MEDNAFEN_H 2 | 3 | #include "types.h" 4 | #include 5 | #include 6 | #include 7 | //#include "gettext.h" 8 | 9 | //#define _(String) gettext (String) 10 | 11 | //#include "math_ops.h" 12 | #include "git.h" 13 | 14 | extern MDFNGI *MDFNGameInfo; 15 | 16 | typedef struct { 17 | uint32 SndRate; 18 | } MDFNS; 19 | 20 | #include "settings.h" 21 | 22 | extern MDFNS FSettings; 23 | 24 | void MDFN_PrintError(const char *format, ...) ;//__attribute__ ((format (printf, 1, 2))); 25 | //void MDFN_printf(const char *format, ...) ;//__attribute__ ((format (printf, 1, 2))); 26 | void MDFN_DispMessage(const char *format, ...) ;//__attribute__ ((format (printf, 1, 2))); 27 | 28 | MDFNGI *MDFNI_LoadGame(const char *force_module, const char *name); 29 | 30 | class MDFNException 31 | { 32 | public: 33 | 34 | MDFNException(); 35 | ~MDFNException(); 36 | 37 | char TheMessage[1024]; 38 | 39 | void AddPre(const char *format, ...); 40 | void AddPost(const char *format, ...); 41 | }; 42 | 43 | 44 | void MDFN_LoadGameCheats(FILE *override); 45 | void MDFN_FlushGameCheats(int nosave); 46 | void MDFN_DoSimpleCommand(int cmd); 47 | void MDFN_QSimpleCommand(int cmd); 48 | 49 | #include "state.h" 50 | int MDFN_RawInputStateAction(StateMem *sm, int load, int data_only); 51 | 52 | //#include "mednafen-driver.h" 53 | 54 | #include "endian.h" 55 | //#include "memory.h" 56 | 57 | #define gettext_noop 58 | 59 | #define _MEDNAFEN_H 60 | #endif 61 | -------------------------------------------------------------------------------- /mednafen/src/memory.cpp: -------------------------------------------------------------------------------- 1 | /* Mednafen - Multi-system Emulator 2 | * 3 | * Copyright notice for this file: 4 | * Copyright (C) 2002 Xodnizel 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 | */ 20 | 21 | #include "mednafen.h" 22 | 23 | #include 24 | #include 25 | 26 | #include "memory.h" 27 | #include "general.h" 28 | 29 | void *MDFN_calloc_real(uint32 nmemb, uint32 size, const char *purpose, const char *_file, const int _line) 30 | { 31 | void *ret; 32 | 33 | ret = calloc(nmemb, size); 34 | 35 | if(!ret) 36 | { 37 | MDFN_PrintError("Error allocating(calloc) %u bytes for \"%s\" in %s(%d)!", size, purpose, _file, _line); 38 | return(0); 39 | } 40 | return ret; 41 | } 42 | 43 | void *MDFN_malloc_real(uint32 size, const char *purpose, const char *_file, const int _line) 44 | { 45 | void *ret; 46 | 47 | ret = malloc(size); 48 | 49 | if(!ret) 50 | { 51 | MDFN_PrintError("Error allocating(malloc) %u bytes for \"%s\" in %s(%d)!", size, purpose, _file, _line); 52 | return(0); 53 | } 54 | return ret; 55 | } 56 | 57 | void *MDFN_realloc_real(void *ptr, uint32 size, const char *purpose, const char *_file, const int _line) 58 | { 59 | void *ret; 60 | 61 | ret = realloc(ptr, size); 62 | 63 | if(!ret) 64 | { 65 | MDFN_PrintError("Error allocating(realloc) %u bytes for \"%s\" in %s(%d)!", size, purpose, _file, _line); 66 | return(0); 67 | } 68 | return ret; 69 | } 70 | 71 | void MDFN_free(void *ptr) 72 | { 73 | free(ptr); 74 | } 75 | 76 | -------------------------------------------------------------------------------- /mednafen/src/memory.h: -------------------------------------------------------------------------------- 1 | #ifndef _MDFN_MEMORY_H 2 | 3 | // These functions can be used from driver code or from internal Mednafen code. 4 | 5 | #define MDFN_malloc(size, purpose) MDFN_malloc_real(size, purpose, __FILE__, __LINE__) 6 | #define MDFN_calloc(nmemb, size, purpose) MDFN_calloc_real(nmemb, size, purpose, __FILE__, __LINE__) 7 | #define MDFN_realloc(ptr, size, purpose) MDFN_realloc_real(ptr, size, purpose, __FILE__, __LINE__) 8 | 9 | void *MDFN_malloc_real(uint32 size, const char *purpose, const char *_file, const int _line); 10 | void *MDFN_calloc_real(uint32 nmemb, uint32 size, const char *purpose, const char *_file, const int _line); 11 | void *MDFN_realloc_real(void *ptr, uint32 size, const char *purpose, const char *_file, const int _line); 12 | void MDFN_free(void *ptr); 13 | 14 | static INLINE void MDFN_FastU32MemsetM8(uint32 *array, uint32 value_32, unsigned int u32len) 15 | { 16 | #ifdef ARCH_X86 17 | uint32 dummy_output0, dummy_output1; 18 | 19 | #ifdef __x86_64__ 20 | asm volatile( 21 | "cld\n\t" 22 | "rep stosq\n\t" 23 | : "=D" (dummy_output0), "=c" (dummy_output1) 24 | : "a" (value_32 | ((uint64)value_32 << 32)), "D" (array), "c" (u32len >> 1) 25 | : "cc", "memory"); 26 | #else 27 | asm volatile( 28 | "cld\n\t" 29 | "rep stosl\n\t" 30 | : "=D" (dummy_output0), "=c" (dummy_output1) 31 | : "a" (value_32), "D" (array), "c" (u32len) 32 | : "cc", "memory"); 33 | 34 | #endif 35 | 36 | #else 37 | 38 | for(uint32 *ai = array; ai < array + u32len; ai += 2) 39 | { 40 | ai[0] = value_32; 41 | ai[1] = value_32; 42 | } 43 | 44 | #endif 45 | //printf("%08x %d\n", (int)(long long)array, u32len); 46 | } 47 | 48 | #define _MDFN_MEMORY_H 49 | #endif 50 | -------------------------------------------------------------------------------- /mednafen/src/mempatcher.h: -------------------------------------------------------------------------------- 1 | #ifndef __MDFN_MEMPATCHER_H 2 | #define __MDFN_MEMPATCHER_H 3 | 4 | //#include "mempatcher-driver.h" 5 | #include 6 | 7 | typedef struct __SUBCHEAT 8 | { 9 | uint32 addr; 10 | uint8 value; 11 | int compare; // < 0 on no compare 12 | } SUBCHEAT; 13 | 14 | extern std::vector SubCheats[8]; 15 | extern bool SubCheatsOn; 16 | 17 | bool MDFNMP_Init(uint32 ps, uint32 numpages); 18 | void MDFNMP_AddRAM(uint32 size, uint32 address, uint8 *RAM); 19 | void MDFNMP_Kill(void); 20 | 21 | 22 | void MDFNMP_InstallReadPatches(void); 23 | void MDFNMP_RemoveReadPatches(void); 24 | 25 | void MDFNMP_ApplyPeriodicCheats(void); 26 | 27 | //extern MDFNSetting MDFNMP_Settings[]; 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /mednafen/src/settings-common.h: -------------------------------------------------------------------------------- 1 | #ifndef _MDFN_SETTINGS_COMMON_H 2 | #define _MDFN_SETTINGS_COMMON_H 3 | typedef enum 4 | { 5 | // Actual base types 6 | MDFNST_INT = 0, // (signed), int8, int16, int32, int64(saved as) 7 | MDFNST_UINT, // uint8, uint16, uint32, uint64(saved as) 8 | MDFNST_BOOL, // bool. bool. bool! 9 | MDFNST_FLOAT, // float, double(saved as). 10 | MDFNST_STRING, 11 | MDFNST_ENUM, // Handled like a string, but validated against the enumeration list, and MDFN_GetSettingUI() returns the number in the enumeration list. 12 | MDFNST_BASE_MASK = 0xFFFF, 13 | 14 | // OR'd with base type to express additional information. 15 | MDFNST_EX_DRIVER = (1 << 16), // If this is not set, the setting is assumed to be internal. This...should probably be set automatically? 16 | MDFNST_EX_EMU_STATE = (1 << 17), // If the setting affects emulation from the point of view of the emulated program 17 | MDFNST_EX_UNTRUSTED_SAFE = (1 << 18) // If it's safe for an untrusted source to modify it, probably only used in conjunction with 18 | // MDFNST_EX_EMU_STATE and network play 19 | } MDFNSettingType; 20 | 21 | typedef struct 22 | { 23 | const char *string; 24 | int number; 25 | } MDFNSetting_EnumList; 26 | 27 | typedef struct 28 | { 29 | const char *name; 30 | const char *description; // Short 31 | MDFNSettingType type; 32 | const char *default_value; 33 | const char *minimum; 34 | const char *maximum; 35 | bool (*validate_func)(const char *name, const char *value); 36 | void (*ChangeNotification)(const char *name); 37 | const MDFNSetting_EnumList *enum_list; 38 | } MDFNSetting; 39 | 40 | typedef struct __MDFNCS 41 | { 42 | char *name; 43 | char *value; 44 | char *netplay_override; // "value" override for network play. 45 | 46 | const MDFNSetting *desc; 47 | void (*ChangeNotification)(const char *name); 48 | 49 | uint32 name_hash; 50 | } MDFNCS; 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /mednafen/src/settings-driver.h: -------------------------------------------------------------------------------- 1 | #ifndef _MDFN_SETTINGS_DRIVER_H 2 | #define _MDFN_SETTINGS_DRIVER_H 3 | 4 | #include "settings-common.h" 5 | 6 | bool MDFNI_SetSetting(const char *name, const char *value, bool NetplayOverride = FALSE); 7 | bool MDFNI_SetSettingB(const char *name, bool value); 8 | bool MDFNI_SetSettingUI(const char *name, uint64 value); 9 | 10 | #include 11 | 12 | const std::multimap *MDFNI_GetSettings(void); 13 | 14 | #endif 15 | -------------------------------------------------------------------------------- /mednafen/src/settings.h: -------------------------------------------------------------------------------- 1 | #ifndef MDFN_SETTINGS_H 2 | #define MDFN_SETTINGS_H 3 | 4 | #include 5 | 6 | #include "settings-common.h" 7 | 8 | bool MFDN_LoadSettings(const char *); 9 | bool MDFN_MergeSettings(const MDFNSetting *); 10 | bool MDFN_MergeSettings(const std::vector &); 11 | bool MDFN_SaveSettings(void); 12 | 13 | // This should assert() or something if the setting isn't found, since it would 14 | // be a totally tubular error! 15 | uint64 MDFN_GetSettingUI(const char *name); 16 | int64 MDFN_GetSettingI(const char *name); 17 | double MDFN_GetSettingF(const char *name); 18 | bool MDFN_GetSettingB(const char *name); 19 | std::string MDFN_GetSettingS(const char *name); 20 | #endif 21 | -------------------------------------------------------------------------------- /mednafen/src/sound.h: -------------------------------------------------------------------------------- 1 | #if 0 2 | 3 | class 4 | { 5 | public: 6 | 7 | MDFN_SoundBuffer(void); 8 | ~MDFN_SoundBuffer(); 9 | 10 | void Clear(void); 11 | 12 | void SetChannels(int ch); 13 | 14 | private: 15 | 16 | int channels; 17 | 18 | int32 Alloced; // Size of memory backing the buffer, in sound frames. 19 | int32 InBufferCount; // Number of sound frames currently in buffer. 20 | 21 | int16 *buffer; 22 | } MDFN_SoundBuffer; 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /mednafen/src/sound/Makefile.am: -------------------------------------------------------------------------------- 1 | AUTOMAKE_OPTIONS = subdir-objects 2 | DEFS = -DLOCALEDIR=\"$(datadir)/locale\" @DEFS@ @MATH_OPTIMIZER_FLAGS@ 3 | DEFAULT_INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/intl -I$(top_builddir)/include/blip 4 | 5 | noinst_LIBRARIES = libmdfnsound.a 6 | 7 | libmdfnsound_a_SOURCES = sound.cpp Blip_Buffer.cpp Stereo_Buffer.cpp Fir_Resampler.cpp wave.cpp 8 | -------------------------------------------------------------------------------- /mednafen/src/sound/Stereo_Buffer.cpp: -------------------------------------------------------------------------------- 1 | 2 | // Blip_Buffer 0.3.0. http://www.slack.net/~ant/nes-emu/ 3 | 4 | #include 5 | 6 | /* Library Copyright (C) 2004 Shay Green. Blip_Buffer is free software; 7 | you can redistribute it and/or modify it under the terms of the GNU 8 | General Public License as published by the Free Software Foundation; 9 | either version 2 of the License, or (at your option) any later version. 10 | Stereo_Buffer is distributed in the hope that it will be useful, but 11 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 12 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 13 | for more details. You should have received a copy of the GNU General 14 | Public License along with Stereo_Buffer; if not, write to the Free Software 15 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ 16 | 17 | Stereo_Buffer::Stereo_Buffer() { 18 | } 19 | 20 | Stereo_Buffer::~Stereo_Buffer() { 21 | } 22 | 23 | bool Stereo_Buffer::set_sample_rate( long rate, int msec ) 24 | { 25 | for ( int i = 0; i < buf_count; i++ ) { 26 | if ( bufs [i].set_sample_rate( rate, msec ) ) 27 | { 28 | return false; 29 | } 30 | } 31 | 32 | return true; 33 | } 34 | 35 | void Stereo_Buffer::clock_rate( long rate ) 36 | { 37 | for ( int i = 0; i < buf_count; i++ ) 38 | bufs [i].clock_rate( rate ); 39 | } 40 | 41 | void Stereo_Buffer::bass_freq( int bass ) 42 | { 43 | for ( unsigned i = 0; i < buf_count; i++ ) 44 | bufs [i].bass_freq( bass ); 45 | } 46 | 47 | void Stereo_Buffer::clear() 48 | { 49 | stereo_added = false; 50 | was_stereo = false; 51 | for ( int i = 0; i < buf_count; i++ ) 52 | bufs [i].clear(); 53 | } 54 | 55 | void Stereo_Buffer::end_frame( blip_time_t clock_count, bool stereo ) 56 | { 57 | for ( unsigned i = 0; i < buf_count; i++ ) 58 | { 59 | bufs [i].end_frame( clock_count ); 60 | } 61 | stereo_added |= stereo; 62 | } 63 | 64 | 65 | 66 | long Stereo_Buffer::read_samples( blip_sample_t* out, long max_samples ) 67 | { 68 | long count = bufs [0].samples_avail(); 69 | if ( count > max_samples / 2 ) 70 | count = max_samples / 2; 71 | if ( count ) 72 | { 73 | if ( stereo_added || was_stereo ) 74 | { 75 | mix_stereo( out, count ); 76 | 77 | bufs [0].remove_samples( count ); 78 | bufs [1].remove_samples( count ); 79 | bufs [2].remove_samples( count ); 80 | } 81 | else 82 | { 83 | mix_mono( out, count ); 84 | 85 | bufs [0].remove_samples( count ); 86 | 87 | bufs [1].remove_silence( count ); 88 | bufs [2].remove_silence( count ); 89 | } 90 | 91 | // to do: this might miss opportunities for optimization 92 | if ( !bufs [0].samples_avail() ) { 93 | was_stereo = stereo_added; 94 | stereo_added = false; 95 | } 96 | } 97 | 98 | return count * 2; 99 | } 100 | 101 | void Stereo_Buffer::mix_stereo( blip_sample_t* out, long count ) 102 | { 103 | Blip_Reader left; 104 | Blip_Reader right; 105 | Blip_Reader center; 106 | 107 | left.begin( bufs [1] ); 108 | right.begin( bufs [2] ); 109 | int bass = center.begin( bufs [0] ); 110 | 111 | while ( count-- ) 112 | { 113 | int c = center.read(); 114 | out [0] = c + left.read(); 115 | out [1] = c + right.read(); 116 | out += 2; 117 | 118 | center.next( bass ); 119 | left.next( bass ); 120 | right.next( bass ); 121 | } 122 | 123 | center.end( bufs [0] ); 124 | right.end( bufs [2] ); 125 | left.end( bufs [1] ); 126 | } 127 | 128 | void Stereo_Buffer::mix_stereo( float* out, long count ) 129 | { 130 | Blip_Reader left; 131 | Blip_Reader right; 132 | Blip_Reader center; 133 | 134 | left.begin( bufs [1] ); 135 | right.begin( bufs [2] ); 136 | int bass = center.begin( bufs [0] ); 137 | 138 | while ( count-- ) 139 | { 140 | int c = center.read(); 141 | out [0] = (float)(c + left.read()) / 32768; 142 | out [1] = (float)(c + right.read()) / 32768; 143 | out += 2; 144 | 145 | center.next( bass ); 146 | left.next( bass ); 147 | right.next( bass ); 148 | } 149 | 150 | center.end( bufs [0] ); 151 | right.end( bufs [2] ); 152 | left.end( bufs [1] ); 153 | } 154 | 155 | void Stereo_Buffer::mix_mono( blip_sample_t* out, long count ) 156 | { 157 | Blip_Reader in; 158 | int bass = in.begin( bufs [0] ); 159 | 160 | while ( count-- ) 161 | { 162 | int sample = in.read(); 163 | out [0] = sample; 164 | out [1] = sample; 165 | out += 2; 166 | in.next( bass ); 167 | } 168 | 169 | in.end( bufs [0] ); 170 | } 171 | 172 | void Stereo_Buffer::mix_mono( float* out, long count ) 173 | { 174 | Blip_Reader in; 175 | int bass = in.begin( bufs [0] ); 176 | 177 | while ( count-- ) 178 | { 179 | int sample = in.read(); 180 | out [0] = (float)(sample) / 32768; 181 | out [1] = (float)(sample) / 32768; 182 | out += 2; 183 | in.next( bass ); 184 | } 185 | 186 | in.end( bufs [0] ); 187 | } 188 | 189 | -------------------------------------------------------------------------------- /mednafen/src/sound/sound.cpp: -------------------------------------------------------------------------------- 1 | #include "../mednafen.h" 2 | #include "../sound.h" 3 | 4 | #if 0 5 | 6 | MDFN_SoundBuffer::MDFN_SoundBuffer(void) 7 | { 8 | Alloced = 0; 9 | FramesInBuffer = 0; 10 | Channels = 0; 11 | buffer = NULL; 12 | } 13 | 14 | void MDFN_SoundBuffer::Clear(void) 15 | { 16 | FramesInBuffer = 0; 17 | } 18 | 19 | void MDFN_SoundBuffer::SetChannels(int ch) 20 | { 21 | assert(ch == 1 || ch == 2); 22 | 23 | if(buffer && ch != Channels) 24 | { 25 | // If going from mono to stereo, half the 26 | if(ch == 2) 27 | Alloced >>= 1; 28 | else 29 | Alloced <<= 1; 30 | } 31 | Channels == ch; 32 | } 33 | 34 | int16 *MDFN_SoundBuffer::BeginWrite(int32 frames) 35 | { 36 | assert(Channels); 37 | 38 | if 39 | 40 | } 41 | #endif 42 | -------------------------------------------------------------------------------- /mednafen/src/state-common.h: -------------------------------------------------------------------------------- 1 | #ifndef __MDFN_STATE_COMMON_H 2 | #define __MDFN_STATE_COMMON_H 3 | 4 | typedef struct 5 | { 6 | int status[10]; 7 | int current; 8 | int current_movie; // For movies only, status(recording/playback) 9 | 10 | // The most recently-saved-to slot 11 | int recently_saved; 12 | 13 | // R, G, B, R, G, B, R, G, B, ... for w * h * 3 14 | uint8 *gfx; 15 | uint32 w, h; 16 | } StateStatusStruct; 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /mednafen/src/state-driver.h: -------------------------------------------------------------------------------- 1 | #ifndef __MDFN_STATE_DRIVER_H 2 | #define __MDFN_STATE_DRIVER_H 3 | 4 | #include "video.h" 5 | #include "state-common.h" 6 | 7 | void MDFNI_SelectState(int); 8 | 9 | /* "fname" overrides the default save state filename code if non-NULL. */ 10 | /* If suffix is set, just override the default suffix(nc0-nc9) */ 11 | void MDFNI_SaveState(const char *fname, const char *suffix, const MDFN_Surface *surface, const MDFN_Rect *DisplayRect, const MDFN_Rect *LineWidths); 12 | void MDFNI_LoadState(const char *fname, const char *suffix); 13 | void MDFNI_EnableStateRewind(int enable); 14 | 15 | 16 | void MDFND_SetStateStatus(StateStatusStruct *status); 17 | void MDFND_SetMovieStatus(StateStatusStruct *status); 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /mednafen/src/trio/Makefile.am: -------------------------------------------------------------------------------- 1 | AUTOMAKE_OPTIONS = subdir-objects 2 | DEFS = -DLOCALEDIR=\"$(datadir)/locale\" @DEFS@ @TRIO_CFLAGS@ 3 | DEFAULT_INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/intl 4 | 5 | noinst_LIBRARIES = libtrio.a 6 | libtrio_a_SOURCES = trio.c trionan.c triostr.c 7 | -------------------------------------------------------------------------------- /mednafen/src/vb/Makefile.am: -------------------------------------------------------------------------------- 1 | AUTOMAKE_OPTIONS = subdir-objects 2 | DEFS = -DLOCALEDIR=\"$(datadir)/locale\" @DEFS@ @MATH_OPTIMIZER_FLAGS@ -fno-strict-aliasing 3 | DEFAULT_INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/intl -I$(top_srcdir) -I$(top_srcdir)/src/hw_cpu 4 | 5 | noinst_LIBRARIES = libvb.a 6 | libvb_a_SOURCES = vb.cpp debug.cpp timer.cpp input.cpp vip.cpp vsu.cpp 7 | -------------------------------------------------------------------------------- /mednafen/src/vb/debug.h: -------------------------------------------------------------------------------- 1 | #ifndef __VB_DEBUG_H 2 | #define __VB_DEBUG_H 3 | 4 | namespace MDFN_IEN_VB 5 | { 6 | 7 | void VBDBG_FlushBreakPoints(int type); 8 | void VBDBG_AddBreakPoint(int type, unsigned int A1, unsigned int A2, bool logical); 9 | void VBDBG_Disassemble(uint32 &a, uint32 SpecialA, char *); 10 | 11 | uint32 VBDBG_MemPeek(uint32 A, unsigned int bsize, bool hl, bool logical); 12 | uint32 VBDBG_GetRegister(const std::string &name, std::string *special); 13 | void VBDBG_SetRegister(const std::string &name, uint32 value); 14 | 15 | void VBDBG_SetCPUCallback(void (*callb)(uint32 PC)); 16 | void VBDBG_SetBPCallback(void (*callb)(uint32 PC)); 17 | 18 | std::vector VBDBG_GetBranchTrace(void); 19 | 20 | void VBDBG_CheckBP(int type, uint32 address, unsigned int len); 21 | 22 | void VBDBG_SetLogFunc(void (*func)(const char *, const char *)); 23 | 24 | void VBDBG_DoLog(const char *type, const char *format, ...); 25 | 26 | 27 | extern bool VB_LoggingOn; 28 | 29 | bool VBDBG_Init(void); 30 | 31 | }; 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /mednafen/src/vb/input.h: -------------------------------------------------------------------------------- 1 | #ifndef __VB_INPUT_H 2 | #define __VB_INPUT_H 3 | 4 | namespace MDFN_IEN_VB 5 | { 6 | 7 | void VBINPUT_Init(void); 8 | void VBINPUT_SetInstantReadHack(bool); 9 | 10 | void VBINPUT_SetInput(int port, const char *type, void *ptr); 11 | 12 | uint8 VBINPUT_Read(v810_timestamp_t ×tamp, uint32 A); 13 | 14 | void VBINPUT_Write(v810_timestamp_t ×tamp, uint32 A, uint8 V); 15 | 16 | void VBINPUT_Frame(void); 17 | int VBINPUT_StateAction(StateMem *sm, int load, int data_only); 18 | 19 | int32 VBINPUT_Update(const int32 timestamp); 20 | void VBINPUT_ResetTS(void); 21 | 22 | 23 | void VBINPUT_Power(void); 24 | 25 | 26 | int VBINPUT_StateAction(StateMem *sm, int load, int data_only); 27 | 28 | } 29 | #endif 30 | -------------------------------------------------------------------------------- /mednafen/src/vb/timer.cpp: -------------------------------------------------------------------------------- 1 | /* Mednafen - Multi-system Emulator 2 | * 3 | * This program is free software; you can redistribute it and/or modify 4 | * it under the terms of the GNU General Public License as published by 5 | * the Free Software Foundation; either version 2 of the License, or 6 | * (at your option) any later version. 7 | * 8 | * This program is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with this program; if not, write to the Free Software 15 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 16 | */ 17 | 18 | #include "vb.h" 19 | #include "timer.h" 20 | 21 | namespace MDFN_IEN_VB 22 | { 23 | 24 | #define TC_TENABLE 0x01 25 | #define TC_ZSTAT 0x02 26 | #define TC_ZSTATCLR 0x04 27 | #define TC_TIMZINT 0x08 28 | #define TC_TCLKSEL 0x10 29 | 30 | static uint8 TimerControl; 31 | static uint16 TimerReloadValue; 32 | static uint16 TimerCounter; 33 | static int32 TimerDivider; 34 | static v810_timestamp_t TimerLastTS; 35 | static bool TimerStatus; 36 | static bool ReloadPending; 37 | 38 | v810_timestamp_t TIMER_Update(v810_timestamp_t timestamp) 39 | { 40 | int32 run_time = timestamp - TimerLastTS; 41 | 42 | if(TimerControl & TC_TENABLE) 43 | { 44 | TimerDivider -= run_time; 45 | while(TimerDivider <= 0) 46 | { 47 | //MDFN_DispMessage("TC: %d, %d\n", TimerCounter, TimerDivider); 48 | if(ReloadPending) 49 | { 50 | // puts("Yay"); 51 | TimerCounter = TimerReloadValue; 52 | ReloadPending = false; 53 | } 54 | else if(TimerCounter) 55 | TimerCounter--; 56 | 57 | if(!TimerCounter) //else 58 | { 59 | TimerCounter = TimerReloadValue; 60 | TimerStatus = true; 61 | 62 | //printf("IRQ: %d\n", timestamp); 63 | VBIRQ_Assert(VBIRQ_SOURCE_TIMER, TimerStatus && (TimerControl & TC_TIMZINT)); 64 | } 65 | TimerDivider += (TimerControl & TC_TCLKSEL) ? 500 : 2000; 66 | } 67 | } 68 | 69 | TimerLastTS = timestamp; 70 | 71 | return((TimerControl & TC_TENABLE) ? (timestamp + TimerDivider) : VB_EVENT_NONONO); 72 | } 73 | 74 | void TIMER_ResetTS(void) 75 | { 76 | TimerLastTS = 0; 77 | } 78 | 79 | uint8 TIMER_Read(const v810_timestamp_t ×tamp, uint32 A) 80 | { 81 | uint8 ret = 0; 82 | 83 | //if(A <= 0x1C) 84 | // printf("Read: %d, %08x\n", timestamp, A); 85 | TIMER_Update(timestamp); 86 | 87 | switch(A & 0xFF) 88 | { 89 | case 0x18: ret = (uint8)TimerCounter&0xFF; 90 | break; 91 | 92 | case 0x1C: ret = TimerCounter >> 8; 93 | break; 94 | 95 | case 0x20: ret = TimerControl | (0xE0 | TC_ZSTATCLR) | (TimerStatus ? TC_ZSTAT : 0); 96 | break; 97 | 98 | } 99 | 100 | return(ret); 101 | } 102 | 103 | void TIMER_Write(const v810_timestamp_t ×tamp, uint32 A, uint8 V) 104 | { 105 | if(A & 0x3) 106 | { 107 | puts("HWCtrl Bogus Write?"); 108 | return; 109 | } 110 | 111 | TIMER_Update(timestamp); 112 | 113 | //if((A & 0xFF) <= 0x1C) 114 | // printf("Write: %d, %08x %02x\n", timestamp, A, V); 115 | 116 | switch(A & 0xFF) 117 | { 118 | case 0x18: TimerReloadValue &= 0xFF00; 119 | TimerReloadValue |= V; 120 | ReloadPending = true; 121 | break; 122 | 123 | case 0x1C: TimerReloadValue &= 0x00FF; 124 | TimerReloadValue |= V << 8; 125 | ReloadPending = true; 126 | break; 127 | 128 | case 0x20: if(V & TC_ZSTATCLR) 129 | { 130 | if((TimerControl & TC_TENABLE) && TimerCounter == 0) 131 | puts("Faulty Z-Stat-Clr"); 132 | else 133 | { 134 | TimerStatus = false; 135 | } 136 | } 137 | if((V & TC_TENABLE) && !(TimerControl & TC_TENABLE)) 138 | { 139 | //TimerCounter = TimerReloadValue; 140 | TimerDivider = (V & TC_TCLKSEL) ? 500 : 2000; 141 | } 142 | TimerControl = V & (0x10 | 0x08 | 0x01); 143 | 144 | if(!(TimerControl & TC_TIMZINT)) 145 | TimerStatus = 0; 146 | 147 | VBIRQ_Assert(VBIRQ_SOURCE_TIMER, TimerStatus && (TimerControl & TC_TIMZINT)); 148 | 149 | if(TimerControl & TC_TENABLE) 150 | VB_SetEvent(VB_EVENT_TIMER, timestamp + TimerDivider); 151 | break; 152 | } 153 | } 154 | 155 | void TIMER_Power(void) 156 | { 157 | TimerLastTS = 0; 158 | 159 | TimerCounter = 0xFFFF; 160 | TimerReloadValue = 0xFFFF; 161 | TimerDivider = 2000; //2150; //2000; 162 | 163 | TimerStatus = false; 164 | TimerControl = 0; 165 | 166 | ReloadPending = false; 167 | 168 | VBIRQ_Assert(VBIRQ_SOURCE_TIMER, false); 169 | } 170 | 171 | int TIMER_StateAction(StateMem *sm, int load, int data_only) 172 | { 173 | SFORMAT StateRegs[] = 174 | { 175 | SFVAR(TimerCounter), 176 | SFVAR(TimerReloadValue), 177 | SFVAR(TimerDivider), 178 | SFVAR(TimerStatus), 179 | SFVAR(TimerControl), 180 | SFVAR(ReloadPending), 181 | SFEND 182 | }; 183 | 184 | int ret = MDFNSS_StateAction(sm, load, data_only, StateRegs, "TIMER"); 185 | 186 | if(load) 187 | { 188 | 189 | } 190 | 191 | return(ret); 192 | } 193 | 194 | 195 | } 196 | -------------------------------------------------------------------------------- /mednafen/src/vb/timer.h: -------------------------------------------------------------------------------- 1 | #ifndef __MDFN_VB_TIMER_H 2 | #define __MDFN_VB_TIMER_H 3 | 4 | namespace MDFN_IEN_VB 5 | { 6 | 7 | v810_timestamp_t TIMER_Update(v810_timestamp_t timestamp); 8 | void TIMER_ResetTS(void); 9 | uint8 TIMER_Read(const v810_timestamp_t ×tamp, uint32 A); 10 | void TIMER_Write(const v810_timestamp_t ×tamp, uint32 A, uint8 V); 11 | 12 | void TIMER_Power(void); 13 | 14 | int TIMER_StateAction(StateMem *sm, int load, int data_only); 15 | 16 | } 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /mednafen/src/vb/vb.h: -------------------------------------------------------------------------------- 1 | #ifndef __VB_VB_H 2 | #define __VB_VB_H 3 | 4 | #include 5 | #include 6 | #include "math_ops.h" 7 | 8 | namespace MDFN_IEN_VB 9 | { 10 | 11 | enum 12 | { 13 | VB3DMODE_ANAGLYPH = 0, 14 | VB3DMODE_CSCOPE = 1, 15 | VB3DMODE_SIDEBYSIDE = 2, 16 | VB3DMODE_OVERUNDER = 3, 17 | VB3DMODE_PBARRIER = 4, 18 | VB3DMODE_OVR = 5, 19 | VB3DMODE_OVR_IMMERSIVE = 6, 20 | }; 21 | 22 | #define VB_MASTER_CLOCK 20000000.0 23 | 24 | 25 | 26 | enum 27 | { 28 | VB_EVENT_VIP = 0, 29 | VB_EVENT_TIMER, 30 | VB_EVENT_INPUT, 31 | // VB_EVENT_COMM 32 | }; 33 | 34 | #define VB_EVENT_NONONO 0x7fffffff 35 | 36 | void VB_SetEvent(const int type, const v810_timestamp_t next_timestamp); 37 | 38 | 39 | #define VBIRQ_SOURCE_INPUT 0 40 | #define VBIRQ_SOURCE_TIMER 1 41 | #define VBIRQ_SOURCE_EXPANSION 2 42 | #define VBIRQ_SOURCE_COMM 3 43 | #define VBIRQ_SOURCE_VIP 4 44 | 45 | void VBIRQ_Assert(int source, bool assert); 46 | 47 | void VB_ExitLoop(void); 48 | 49 | 50 | uint8 MDFN_FASTCALL MemRead8(v810_timestamp_t ×tamp, uint32 A); 51 | uint16 MDFN_FASTCALL MemRead16(v810_timestamp_t ×tamp, uint32 A); 52 | void MDFN_FASTCALL MemWrite8(v810_timestamp_t ×tamp, uint32 A, uint8 V); 53 | void MDFN_FASTCALL MemWrite16(v810_timestamp_t ×tamp, uint32 A, uint16 V); 54 | 55 | 56 | void VB_Power(void); 57 | 58 | void SetMixVideoOutput(bool disabled); 59 | void SetSideBySidePixels(int pixels); 60 | void SetViewDisp(int display); 61 | uint32 GetSplitMode(); 62 | void SetSplitMode(uint32 mode); 63 | uint32 GetColorMode(); 64 | void SetColorMode(uint32 mode); 65 | 66 | void clearGPRAM(); 67 | 68 | uint8* getDRAM(); 69 | uint8* getWRAM(); 70 | 71 | } 72 | 73 | 74 | 75 | #endif 76 | -------------------------------------------------------------------------------- /mednafen/src/vb/vip.h: -------------------------------------------------------------------------------- 1 | #ifndef __VB_VIP_H 2 | #define __VB_VIP_H 3 | 4 | #include "git.h" 5 | 6 | namespace MDFN_IEN_VB 7 | { 8 | 9 | //bool VIP_Init(void); 10 | void VIP_Power(void); 11 | 12 | void VIP_Set3DMode(uint32 mode); 13 | uint32 VIP_GetColorMode(); 14 | void VIP_SetColorMode(uint32 mode); 15 | void VIP_SetParallaxDisable(bool disabled); 16 | int VIP_GetSideBySidePixels(); 17 | void VIP_SetSideBySidePixels(int pixels); 18 | void VIP_SetViewDisp(int display); 19 | //void VIP_SetDefaultColor(uint32 default_color); 20 | void VIP_SetAnaglyphColors(uint32 lcolor, uint32 rcolor); // R << 16, G << 8, B << 0 21 | 22 | v810_timestamp_t MDFN_FASTCALL VIP_Update(const v810_timestamp_t timestamp); 23 | void VIP_ResetTS(void); 24 | 25 | void VIP_StartFrame(EmulateSpecStruct *espec); 26 | 27 | uint8 VIP_Read8(v810_timestamp_t ×tamp, uint32 A); 28 | uint16 VIP_Read16(v810_timestamp_t ×tamp, uint32 A); 29 | 30 | 31 | void VIP_Write8(v810_timestamp_t ×tamp, uint32 A, uint8 V); 32 | void VIP_Write16(v810_timestamp_t ×tamp, uint32 A, uint16 V); 33 | 34 | 35 | 36 | int VIP_StateAction(StateMem *sm, int load, int data_only); 37 | 38 | } 39 | #endif 40 | -------------------------------------------------------------------------------- /mednafen/src/vb/vsu.h: -------------------------------------------------------------------------------- 1 | #ifndef __VB_VSU_H 2 | #define __VB_VSU_H 3 | 4 | #include 5 | 6 | class VSU 7 | { 8 | public: 9 | 10 | VSU(Blip_Buffer *bb_l, Blip_Buffer *bb_r); 11 | ~VSU(); 12 | 13 | void Power(void); 14 | 15 | void Write(int32 timestamp, uint32 A, uint8 V); 16 | 17 | void EndFrame(int32 timestamp); 18 | 19 | int StateAction(StateMem *sm, int load, int data_only); 20 | 21 | private: 22 | 23 | void CalcCurrentOutput(int ch, int &left, int &right); 24 | 25 | void Update(int32 timestamp); 26 | 27 | uint8 IntlControl[6]; 28 | uint8 LeftLevel[6]; 29 | uint8 RightLevel[6]; 30 | uint16 Frequency[6]; 31 | uint16 EnvControl[6]; // Channel 5/6 extra functionality tacked on too. 32 | 33 | uint8 RAMAddress[6]; 34 | 35 | uint8 SweepControl; 36 | 37 | uint8 WaveData[5][0x20]; 38 | 39 | uint8 ModData[0x20]; 40 | 41 | // 42 | // 43 | // 44 | int32 EffFreq[6]; 45 | int32 Envelope[6]; 46 | 47 | int32 WavePos[6]; 48 | int32 ModWavePos; 49 | 50 | int32 LatcherClockDivider[6]; 51 | 52 | int32 FreqCounter[6]; 53 | int32 IntervalCounter[6]; 54 | int32 EnvelopeCounter[6]; 55 | int32 SweepModCounter; 56 | 57 | int32 EffectsClockDivider[6]; 58 | int32 IntervalClockDivider[6]; 59 | int32 EnvelopeClockDivider[6]; 60 | int32 SweepModClockDivider; 61 | 62 | int32 NoiseLatcherClockDivider; 63 | uint32 NoiseLatcher; 64 | 65 | uint32 lfsr; 66 | 67 | int32 last_output[6][2]; 68 | int32 last_ts; 69 | 70 | Blip_Buffer *sbuf[2]; 71 | Blip_Synth Synth; 72 | Blip_Synth NoiseSynth; 73 | }; 74 | 75 | #endif 76 | -------------------------------------------------------------------------------- /mednafen/src/video.h: -------------------------------------------------------------------------------- 1 | #ifndef __MDFN_VIDEO_H 2 | #define __MDFN_VIDEO_H 3 | 4 | #include "types.h" 5 | 6 | //#include "video/primitives.h" 7 | //#include "video/text.h" 8 | 9 | void MDFN_ResetMessages(void); 10 | void MDFN_InitFontData(void); 11 | void MDFN_DispMessage(const char *format, ...);// { }//__attribute__ ((format (printf, 1, 2))); 12 | 13 | int MDFN_InitVirtualVideo(void); 14 | void MDFN_KillVirtualVideo(void); 15 | 16 | enum 17 | { 18 | MDFN_COLORSPACE_RGB = 0, 19 | MDFN_COLORSPACE_YCbCr = 1, 20 | //MDFN_COLORSPACE_YUV = 2, // TODO 21 | }; 22 | 23 | class MDFN_PixelFormat //typedef struct 24 | { 25 | public: 26 | 27 | unsigned int bpp; // 8 or 32 only. 28 | unsigned int colorspace; 29 | 30 | union 31 | { 32 | uint8 Rshift; // Bit position of the lowest bit of the red component 33 | uint8 Yshift; 34 | }; 35 | 36 | union 37 | { 38 | uint8 Gshift; // [...] green component 39 | uint8 Ushift; 40 | uint8 Cbshift; 41 | }; 42 | 43 | union 44 | { 45 | uint8 Bshift; // [...] blue component 46 | uint8 Vshift; 47 | uint8 Crshift; 48 | }; 49 | 50 | uint8 Ashift; // [...] alpha component. 51 | 52 | // Creates a 32-bit value for the surface corresponding to the R/G/B/A color passed. 53 | INLINE uint32 MakeColor(uint8 r, uint8 g, uint8 b, uint8 a = 0) const 54 | { 55 | if(colorspace == MDFN_COLORSPACE_YCbCr) 56 | { 57 | uint32 y, u, v; 58 | 59 | y = 16 + ((r * 16842 + g * 33030 + b * 6422) >> 16); 60 | u = 128 + ((r * -9699 + g * -19071 + b * 28770) >> 16); 61 | v = 128 + ((r * 28770 + g * -24117 + b * -4653) >> 16); 62 | 63 | return((y << Yshift) | (u << Ushift) | (v << Vshift) | (a << Ashift)); 64 | } 65 | else 66 | return((r << Rshift) | (g << Gshift) | (b << Bshift) | (a << Ashift)); 67 | } 68 | 69 | // Gets the R/G/B/A values for the passed 32-bit surface pixel value 70 | INLINE void DecodeColor(uint32 value, int &r, int &g, int &b, int &a) const 71 | { 72 | if(colorspace == MDFN_COLORSPACE_YCbCr) 73 | { 74 | int32 y = (value >> Yshift) & 0xFF; 75 | int32 cb = (value >> Cbshift) & 0xFF; 76 | int32 cr = (value >> Crshift) & 0xFF; 77 | 78 | int32 r_tmp, g_tmp, b_tmp; 79 | 80 | r_tmp = g_tmp = b_tmp = 76284 * (y - 16); 81 | 82 | r_tmp = r_tmp + 104595 * (cr - 128); 83 | g_tmp = g_tmp - 53281 * (cr - 128) - 25690 * (cb - 128); 84 | b_tmp = b_tmp + 132186 * (cb - 128); 85 | 86 | r_tmp >>= 16; 87 | g_tmp >>= 16; 88 | b_tmp >>= 16; 89 | 90 | if(r_tmp < 0) r_tmp = 0; 91 | if(r_tmp > 255) r_tmp = 255; 92 | 93 | if(g_tmp < 0) g_tmp = 0; 94 | if(g_tmp > 255) g_tmp = 255; 95 | 96 | if(b_tmp < 0) b_tmp = 0; 97 | if(b_tmp > 255) b_tmp = 255; 98 | 99 | r = r_tmp; 100 | g = g_tmp; 101 | b = b_tmp; 102 | 103 | a = (value >> Ashift) & 0xFF; 104 | } 105 | else 106 | { 107 | r = (value >> Rshift) & 0xFF; 108 | g = (value >> Gshift) & 0xFF; 109 | b = (value >> Bshift) & 0xFF; 110 | a = (value >> Ashift) & 0xFF; 111 | } 112 | } 113 | 114 | }; // MDFN_PixelFormat; 115 | 116 | // Only supports 32-bit RGBA 117 | class MDFN_Surface //typedef struct 118 | { 119 | public: 120 | 121 | MDFN_Surface(uint32 *pixels, uint32 width, uint32 height, uint32 pitch32, unsigned int colorspace, 122 | uint8 rs, uint8 gs, uint8 bs, uint8 as); 123 | 124 | MDFN_Surface(uint8 *pixels, uint32 width, uint32 height, uint32 pitch8); 125 | 126 | ~MDFN_Surface(); 127 | 128 | 129 | union 130 | { 131 | uint32 *pixels; 132 | uint8 *pixels8; // For 8bpp mode 133 | }; 134 | 135 | uint32 *palette; // [256] 136 | 137 | bool pixels_is_external; 138 | 139 | // w, h, and pitch32 should always be > 0 140 | int32 w; 141 | int32 h; 142 | 143 | union 144 | { 145 | int32 pitch8; // for 8bpp mode 146 | int32 pitch32; // In pixels, not in bytes. 147 | }; 148 | 149 | MDFN_PixelFormat format; 150 | 151 | void Fill(uint8 r, uint8 g, uint8 b, uint8 a); 152 | void SetFormat(const MDFN_PixelFormat &new_format, bool convert); 153 | 154 | // Creates a 32-bit value for the surface corresponding to the R/G/B/A color passed. 155 | INLINE uint32 MakeColor(uint8 r, uint8 g, uint8 b, uint8 a = 0) const 156 | { 157 | return(format.MakeColor(r, g, b, a)); 158 | } 159 | 160 | // Gets the R/G/B/A values for the passed 32-bit surface pixel value 161 | INLINE void DecodeColor(uint32 value, int &r, int &g, int &b, int &a) const 162 | { 163 | format.DecodeColor(value, r, g, b, a); 164 | } 165 | 166 | INLINE void DecodeColor(uint32 value, int &r, int &g, int &b) const 167 | { 168 | int dummy_a; 169 | 170 | DecodeColor(value, r, g, b, dummy_a); 171 | } 172 | }; 173 | 174 | #endif 175 | -------------------------------------------------------------------------------- /mednafen/src/video/png.cpp: -------------------------------------------------------------------------------- 1 | /* Mednafen - Multi-system Emulator 2 | * 3 | * This program is free software; you can redistribute it and/or modify 4 | * it under the terms of the GNU General Public License as published by 5 | * the Free Software Foundation; either version 2 of the License, or 6 | * (at your option) any later version. 7 | * 8 | * This program is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with this program; if not, write to the Free Software 15 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 16 | */ 17 | 18 | #include "video-common.h" 19 | #include "memory.h" 20 | 21 | #include 22 | 23 | static int WritePNGChunk(FILE *fp, uint32 size, const char *type, const uint8 *data) 24 | { 25 | uint32 crc; 26 | 27 | uint8 tempo[4]; 28 | 29 | tempo[0]=size>>24; 30 | tempo[1]=size>>16; 31 | tempo[2]=size>>8; 32 | tempo[3]=size; 33 | 34 | if(fwrite(tempo,4,1,fp)!=1) 35 | return 0; 36 | if(fwrite(type,4,1,fp)!=1) 37 | return 0; 38 | 39 | if(size) 40 | if(fwrite(data,1,size,fp)!=size) 41 | return 0; 42 | 43 | crc = crc32(0,(uint8 *)type,4); 44 | if(size) 45 | crc = crc32(crc,data,size); 46 | 47 | tempo[0]=crc>>24; 48 | tempo[1]=crc>>16; 49 | tempo[2]=crc>>8; 50 | tempo[3]=crc; 51 | 52 | if(fwrite(tempo,4,1,fp)!=1) 53 | return 0; 54 | return 1; 55 | } 56 | 57 | int MDFN_SavePNGSnapshot(const char *fname, const MDFN_Surface *src, const MDFN_Rect *rect) 58 | { 59 | const uint32 *fb = src->pixels; 60 | const uint32 pitch = src->pitch32 * sizeof(uint32); 61 | 62 | int x, y; 63 | FILE *pp=NULL; 64 | uint8 *compmem = NULL; 65 | uLongf compmemsize = (uLongf)( (rect->h * (rect->w + 1) * 3 * 1.001 + 1) + 12 ); 66 | 67 | if(!(compmem=(uint8 *)MDFN_malloc(compmemsize, "PNG compression buffer"))) 68 | return 0; 69 | 70 | if(!(pp=fopen(fname, "wb"))) 71 | { 72 | return 0; 73 | } 74 | { 75 | static uint8 header[8]={137,80,78,71,13,10,26,10}; 76 | if(fwrite(header,8,1,pp)!=1) 77 | goto PNGerr; 78 | } 79 | 80 | { 81 | uint8 chunko[13]; 82 | 83 | chunko[0] = rect->w >> 24; // Width 84 | chunko[1] = rect->w >> 16; 85 | chunko[2] = rect->w >> 8; 86 | chunko[3] = rect->w; 87 | 88 | chunko[4] = rect->h >> 24; // Height 89 | chunko[5] = rect->h >> 16; 90 | chunko[6] = rect->h >> 8; 91 | chunko[7] = rect->h; 92 | 93 | chunko[8]=8; // 8 bits per sample(24 bits per pixel) 94 | chunko[9]=2; // Color type; RGB triplet 95 | chunko[10]=0; // compression: deflate 96 | chunko[11]=0; // Basic adapative filter set(though none are used). 97 | chunko[12]=0; // No interlace. 98 | 99 | if(!WritePNGChunk(pp,13,"IHDR",chunko)) 100 | goto PNGerr; 101 | } 102 | 103 | { 104 | uint8 *tmp_buffer; 105 | uint8 *tmp_inc; 106 | tmp_inc = tmp_buffer = (uint8 *)malloc((rect->w * 3 + 1) * rect->h); 107 | 108 | for(y=0;yh;y++) 109 | { 110 | *tmp_inc = 0; 111 | tmp_inc++; 112 | for(x=0;xw;x++) 113 | { 114 | int r,g,b; 115 | src->DecodeColor(*(uint32 *)((uint8 *)fb + (y + rect->y) * pitch + (x + rect->x) * 4), r, g, b); 116 | tmp_inc[0] = r; 117 | tmp_inc[1] = g; 118 | tmp_inc[2] = b; 119 | tmp_inc += 3; 120 | } 121 | } 122 | 123 | if(compress(compmem, &compmemsize, tmp_buffer, rect->h * (rect->w * 3 + 1))!=Z_OK) 124 | { 125 | if(tmp_buffer) free(tmp_buffer); 126 | goto PNGerr; 127 | } 128 | if(tmp_buffer) free(tmp_buffer); 129 | if(!WritePNGChunk(pp,compmemsize,"IDAT",compmem)) 130 | goto PNGerr; 131 | } 132 | if(!WritePNGChunk(pp,0,"IEND",0)) 133 | goto PNGerr; 134 | 135 | free(compmem); 136 | fclose(pp); 137 | 138 | return 1; 139 | 140 | PNGerr: 141 | if(compmem) 142 | free(compmem); 143 | if(pp) 144 | fclose(pp); 145 | return(0); 146 | } 147 | -------------------------------------------------------------------------------- /mednafen/src/video/png.h: -------------------------------------------------------------------------------- 1 | #ifndef __MDFN_PNG_H 2 | #define __MDFN_PNG_H 3 | 4 | #include "../video.h" 5 | 6 | int MDFN_SavePNGSnapshot(const char *fname, const MDFN_Surface *src, const MDFN_Rect *rect); 7 | 8 | #endif 9 | 10 | -------------------------------------------------------------------------------- /mednafen/src/video/video-common.h: -------------------------------------------------------------------------------- 1 | #include "../mednafen.h" 2 | #include "../video.h" 3 | #include "../general.h" 4 | #include "../state.h" 5 | //#include "../movie.h" 6 | //#include "../driver.h" 7 | 8 | -------------------------------------------------------------------------------- /memView.h: -------------------------------------------------------------------------------- 1 | //MemView dialog was copied and adapted from DeSmuME: http://sourceforge.net/projects/desmume/ 2 | //Authors: DeSmuME team 3 | 4 | /* Copyright (C) 2006 yopyop 5 | yopyop156@ifrance.com 6 | yopyop156.ifrance.com 7 | 8 | This file is part of DeSmuME 9 | 10 | DeSmuME is free software; you can redistribute it and/or modify 11 | it under the terms of the GNU General Public License as published by 12 | the Free Software Foundation; either version 2 of the License, or 13 | (at your option) any later version. 14 | 15 | DeSmuME is distributed in the hope that it will be useful, 16 | but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | GNU General Public License for more details. 19 | 20 | You should have received a copy of the GNU General Public License 21 | along with DeSmuME; if not, write to the Free Software 22 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 23 | */ 24 | 25 | #ifndef MEM_VIEW_H 26 | #define MEM_VIEW_H 27 | 28 | INT_PTR CALLBACK MemView_DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); 29 | LRESULT CALLBACK MemView_ViewBoxProc(HWND hCtl, UINT uMsg, WPARAM wParam, LPARAM lParam); 30 | 31 | class CMemView : public CToolWindow 32 | { 33 | public: 34 | CMemView(); 35 | ~CMemView(); 36 | 37 | HFONT font; 38 | 39 | u32 region; 40 | u32 address; 41 | u32 viewMode; 42 | 43 | BOOL sel; 44 | u32 selPart; 45 | u32 selAddress; 46 | u32 selNewVal; 47 | }; 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /movie.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/braindx/vbjin-ovr/d49106264b790ec35752bf492d6a824a7f452c10/movie.cpp -------------------------------------------------------------------------------- /oculus/LibOVR/Include/Extras/OVR_StereoProjection.h: -------------------------------------------------------------------------------- 1 | /************************************************************************************ 2 | 3 | Filename : OVR_StereoProjection.h 4 | Content : Stereo projection functions 5 | Created : November 30, 2013 6 | Authors : Tom Fosyth 7 | 8 | Copyright : Copyright 2014-2016 Oculus VR, LLC All Rights reserved. 9 | 10 | Licensed under the Oculus VR Rift SDK License Version 3.3 (the "License"); 11 | you may not use the Oculus VR Rift SDK except in compliance with the License, 12 | which is provided at the time of installation or download, or which 13 | otherwise accompanies this software in either electronic or hard copy form. 14 | 15 | You may obtain a copy of the License at 16 | 17 | http://www.oculusvr.com/licenses/LICENSE-3.3 18 | 19 | Unless required by applicable law or agreed to in writing, the Oculus VR SDK 20 | distributed under the License is distributed on an "AS IS" BASIS, 21 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | See the License for the specific language governing permissions and 23 | limitations under the License. 24 | 25 | *************************************************************************************/ 26 | 27 | #ifndef OVR_StereoProjection_h 28 | #define OVR_StereoProjection_h 29 | 30 | 31 | #include "Extras/OVR_Math.h" 32 | 33 | 34 | namespace OVR { 35 | 36 | 37 | //----------------------------------------------------------------------------------- 38 | // ***** Stereo Enumerations 39 | 40 | // StereoEye specifies which eye we are rendering for; it is used to 41 | // retrieve StereoEyeParams. 42 | enum StereoEye 43 | { 44 | StereoEye_Left, 45 | StereoEye_Right, 46 | StereoEye_Center 47 | }; 48 | 49 | 50 | 51 | //----------------------------------------------------------------------------------- 52 | // ***** Propjection functions 53 | 54 | Matrix4f CreateProjection ( bool rightHanded, bool isOpenGL, FovPort fov, StereoEye eye, 55 | float zNear = 0.01f, float zFar = 10000.0f, 56 | bool flipZ = false, bool farAtInfinity = false); 57 | 58 | Matrix4f CreateOrthoSubProjection ( bool rightHanded, StereoEye eyeType, 59 | float tanHalfFovX, float tanHalfFovY, 60 | float unitsX, float unitsY, float distanceFromCamera, 61 | float interpupillaryDistance, Matrix4f const &projection, 62 | float zNear = 0.0f, float zFar = 0.0f, 63 | bool flipZ = false, bool farAtInfinity = false); 64 | 65 | ScaleAndOffset2D CreateNDCScaleAndOffsetFromFov ( FovPort fov ); 66 | 67 | 68 | } //namespace OVR 69 | 70 | #endif // OVR_StereoProjection_h 71 | -------------------------------------------------------------------------------- /oculus/LibOVR/Include/OVR_CAPI_Audio.h: -------------------------------------------------------------------------------- 1 | /********************************************************************************//** 2 | \file OVR_CAPI_Audio.h 3 | \brief CAPI audio functions. 4 | \copyright Copyright 2015 Oculus VR, LLC. All Rights reserved. 5 | ************************************************************************************/ 6 | 7 | 8 | #ifndef OVR_CAPI_Audio_h 9 | #define OVR_CAPI_Audio_h 10 | 11 | #ifdef _WIN32 12 | #include 13 | #include "OVR_CAPI.h" 14 | #define OVR_AUDIO_MAX_DEVICE_STR_SIZE 128 15 | 16 | /// Gets the ID of the preferred VR audio output device. 17 | /// 18 | /// \param[out] deviceOutId The ID of the user's preferred VR audio device to use, which will be valid upon a successful return value, else it will be WAVE_MAPPER. 19 | /// 20 | /// \return Returns an ovrResult indicating success or failure. In the case of failure, use 21 | /// ovr_GetLastErrorInfo to get more information. 22 | /// 23 | OVR_PUBLIC_FUNCTION(ovrResult) ovr_GetAudioDeviceOutWaveId(UINT* deviceOutId); 24 | 25 | /// Gets the ID of the preferred VR audio input device. 26 | /// 27 | /// \param[out] deviceInId The ID of the user's preferred VR audio device to use, which will be valid upon a successful return value, else it will be WAVE_MAPPER. 28 | /// 29 | /// \return Returns an ovrResult indicating success or failure. In the case of failure, use 30 | /// ovr_GetLastErrorInfo to get more information. 31 | /// 32 | OVR_PUBLIC_FUNCTION(ovrResult) ovr_GetAudioDeviceInWaveId(UINT* deviceInId); 33 | 34 | 35 | /// Gets the GUID of the preferred VR audio device as a string. 36 | /// 37 | /// \param[out] deviceOutStrBuffer A buffer where the GUID string for the device will copied to. 38 | /// 39 | /// \return Returns an ovrResult indicating success or failure. In the case of failure, use 40 | /// ovr_GetLastErrorInfo to get more information. 41 | /// 42 | OVR_PUBLIC_FUNCTION(ovrResult) ovr_GetAudioDeviceOutGuidStr(WCHAR deviceOutStrBuffer[OVR_AUDIO_MAX_DEVICE_STR_SIZE]); 43 | 44 | 45 | /// Gets the GUID of the preferred VR audio device. 46 | /// 47 | /// \param[out] deviceOutGuid The GUID of the user's preferred VR audio device to use, which will be valid upon a successful return value, else it will be NULL. 48 | /// 49 | /// \return Returns an ovrResult indicating success or failure. In the case of failure, use 50 | /// ovr_GetLastErrorInfo to get more information. 51 | /// 52 | OVR_PUBLIC_FUNCTION(ovrResult) ovr_GetAudioDeviceOutGuid(GUID* deviceOutGuid); 53 | 54 | 55 | /// Gets the GUID of the preferred VR microphone device as a string. 56 | /// 57 | /// \param[out] deviceInStrBuffer A buffer where the GUID string for the device will copied to. 58 | /// 59 | /// \return Returns an ovrResult indicating success or failure. In the case of failure, use 60 | /// ovr_GetLastErrorInfo to get more information. 61 | /// 62 | OVR_PUBLIC_FUNCTION(ovrResult) ovr_GetAudioDeviceInGuidStr(WCHAR deviceInStrBuffer[OVR_AUDIO_MAX_DEVICE_STR_SIZE]); 63 | 64 | 65 | /// Gets the GUID of the preferred VR microphone device. 66 | /// 67 | /// \param[out] deviceInGuid The GUID of the user's preferred VR audio device to use, which will be valid upon a successful return value, else it will be NULL. 68 | /// 69 | /// \return Returns an ovrResult indicating success or failure. In the case of failure, use 70 | /// ovr_GetLastErrorInfo to get more information. 71 | /// 72 | OVR_PUBLIC_FUNCTION(ovrResult) ovr_GetAudioDeviceInGuid(GUID* deviceInGuid); 73 | 74 | #endif //OVR_OS_MS 75 | 76 | #endif // OVR_CAPI_Audio_h 77 | -------------------------------------------------------------------------------- /oculus/LibOVR/Include/OVR_CAPI_Keys.h: -------------------------------------------------------------------------------- 1 | /********************************************************************************//** 2 | \file OVR_CAPI.h 3 | \brief Keys for CAPI proprty function calls 4 | \copyright Copyright 2015 Oculus VR, LLC All Rights reserved. 5 | ************************************************************************************/ 6 | 7 | #ifndef OVR_CAPI_Keys_h 8 | #define OVR_CAPI_Keys_h 9 | 10 | #include "OVR_Version.h" 11 | 12 | 13 | 14 | #define OVR_KEY_USER "User" // string 15 | 16 | #define OVR_KEY_NAME "Name" // string 17 | 18 | #define OVR_KEY_GENDER "Gender" // string "Male", "Female", or "Unknown" 19 | #define OVR_DEFAULT_GENDER "Unknown" 20 | 21 | #define OVR_KEY_PLAYER_HEIGHT "PlayerHeight" // float meters 22 | #define OVR_DEFAULT_PLAYER_HEIGHT 1.778f 23 | 24 | #define OVR_KEY_EYE_HEIGHT "EyeHeight" // float meters 25 | #define OVR_DEFAULT_EYE_HEIGHT 1.675f 26 | 27 | #define OVR_KEY_NECK_TO_EYE_DISTANCE "NeckEyeDistance" // float[2] meters 28 | #define OVR_DEFAULT_NECK_TO_EYE_HORIZONTAL 0.0805f 29 | #define OVR_DEFAULT_NECK_TO_EYE_VERTICAL 0.075f 30 | 31 | 32 | #define OVR_KEY_EYE_TO_NOSE_DISTANCE "EyeToNoseDist" // float[2] meters 33 | 34 | 35 | 36 | 37 | 38 | #define OVR_PERF_HUD_MODE "PerfHudMode" // int, allowed values are defined in enum ovrPerfHudMode 39 | 40 | #define OVR_LAYER_HUD_MODE "LayerHudMode" // int, allowed values are defined in enum ovrLayerHudMode 41 | #define OVR_LAYER_HUD_CURRENT_LAYER "LayerHudCurrentLayer" // int, The layer to show 42 | #define OVR_LAYER_HUD_SHOW_ALL_LAYERS "LayerHudShowAll" // bool, Hide other layers when the hud is enabled 43 | 44 | #define OVR_DEBUG_HUD_STEREO_MODE "DebugHudStereoMode" // int, allowed values are defined in enum ovrDebugHudStereoMode 45 | #define OVR_DEBUG_HUD_STEREO_GUIDE_INFO_ENABLE "DebugHudStereoGuideInfoEnable" // bool 46 | #define OVR_DEBUG_HUD_STEREO_GUIDE_SIZE "DebugHudStereoGuideSize2f" // float[2] 47 | #define OVR_DEBUG_HUD_STEREO_GUIDE_POSITION "DebugHudStereoGuidePosition3f" // float[3] 48 | #define OVR_DEBUG_HUD_STEREO_GUIDE_YAWPITCHROLL "DebugHudStereoGuideYawPitchRoll3f" // float[3] 49 | #define OVR_DEBUG_HUD_STEREO_GUIDE_COLOR "DebugHudStereoGuideColor4f" // float[4] 50 | 51 | 52 | 53 | #endif // OVR_CAPI_Keys_h 54 | -------------------------------------------------------------------------------- /oculus/LibOVR/Include/OVR_Version.h: -------------------------------------------------------------------------------- 1 | /********************************************************************************//** 2 | \file OVR_Version.h 3 | \brief This header provides LibOVR version identification. 4 | \copyright Copyright 2014-2016 Oculus VR, LLC All Rights reserved. 5 | *************************************************************************************/ 6 | 7 | #ifndef OVR_Version_h 8 | #define OVR_Version_h 9 | 10 | 11 | 12 | /// Conventional string-ification macro. 13 | #if !defined(OVR_STRINGIZE) 14 | #define OVR_STRINGIZEIMPL(x) #x 15 | #define OVR_STRINGIZE(x) OVR_STRINGIZEIMPL(x) 16 | #endif 17 | 18 | 19 | // Master version numbers 20 | #define OVR_PRODUCT_VERSION 1 // Product version doesn't participate in semantic versioning. 21 | #define OVR_MAJOR_VERSION 1 // If you change these values then you need to also make sure to change LibOVR/Projects/Windows/LibOVR.props in parallel. 22 | #define OVR_MINOR_VERSION 3 // 23 | #define OVR_PATCH_VERSION 0 24 | #define OVR_BUILD_NUMBER 0 25 | 26 | // This is the ((product * 100) + major) version of the service that the DLL is compatible with. 27 | // When we backport changes to old versions of the DLL we update the old DLLs 28 | // to move this version number up to the latest version. 29 | // The DLL is responsible for checking that the service is the version it supports 30 | // and returning an appropriate error message if it has not been made compatible. 31 | #define OVR_DLL_COMPATIBLE_VERSION 101 32 | 33 | #define OVR_FEATURE_VERSION 0 34 | 35 | 36 | /// "Major.Minor.Patch" 37 | #if !defined(OVR_VERSION_STRING) 38 | #define OVR_VERSION_STRING OVR_STRINGIZE(OVR_MAJOR_VERSION.OVR_MINOR_VERSION.OVR_PATCH_VERSION) 39 | #endif 40 | 41 | 42 | /// "Major.Minor.Patch.Build" 43 | #if !defined(OVR_DETAILED_VERSION_STRING) 44 | #define OVR_DETAILED_VERSION_STRING OVR_STRINGIZE(OVR_MAJOR_VERSION.OVR_MINOR_VERSION.OVR_PATCH_VERSION.OVR_BUILD_NUMBER) 45 | #endif 46 | 47 | 48 | /// \brief file description for version info 49 | /// This appears in the user-visible file properties. It is intended to convey publicly 50 | /// available additional information such as feature builds. 51 | #if !defined(OVR_FILE_DESCRIPTION_STRING) 52 | #if defined(_DEBUG) 53 | #define OVR_FILE_DESCRIPTION_STRING "dev build debug" 54 | #else 55 | #define OVR_FILE_DESCRIPTION_STRING "dev build" 56 | #endif 57 | #endif 58 | 59 | 60 | #endif // OVR_Version_h 61 | -------------------------------------------------------------------------------- /oculus/LibOVR/Projects/Windows/ForceRebuild.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | echo static const char* OVR_FORCE_REBUILD_PRE = __TIMESTAMP__; /* DO NOT SOURCE CONTROL THIS FILE */ > "$(ProjectDir)OVR_ForceRebuildNoCheckin.h" 9 | 10 | 11 | 12 | 13 | Force a rebuild. Please do not check in the ForceRebuildNoCheckin.h file. 14 | 15 | 16 | echo static const char* OVR_FORCE_REBUILD_POST = __TIMESTAMP__; /* DO NOT SOURCE CONTROL THIS FILE */ > "$(ProjectDir)OVR_ForceRebuildNoCheckin.h" 17 | 18 | 19 | Force a rebuild. Please do not check in the ForceRebuildNoCheckin.h file. 20 | 21 | 22 | "$(ProjectDir)OVR_ForceRebuildNoCheckin.h" 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /oculus/LibOVR/Projects/Windows/LibOVR.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 1 6 | 1 7 | 3 8 | 0 9 | 0 10 | 11 | 12 | 13 | 14 | 15 | $(OVR_PRODUCT_VERSION) 16 | 17 | 18 | $(OVR_MAJOR_VERSION) 19 | 20 | 21 | $(OVR_MINOR_VERSION) 22 | 23 | 24 | $(OVR_PATCH_VERSION) 25 | 26 | 27 | $(OVR_BUILD_VERSION) 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /oculus/LibOVR/Projects/Windows/OVRRootPath.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | $(ProjectDir)../../../../ 6 | 7 | 8 | 9 | 10 | 11 | $(OVRSDKROOT) 12 | true 13 | 14 | 15 | -------------------------------------------------------------------------------- /oculus/LibOVR/Projects/Windows/VS2010/LibOVR.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {19aff241-4a7e-4895-92de-c834a9ebc8f1} 6 | 7 | 8 | 9 | 10 | Include 11 | 12 | 13 | Include 14 | 15 | 16 | Include 17 | 18 | 19 | Include 20 | 21 | 22 | Include 23 | 24 | 25 | Include 26 | 27 | 28 | Include 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /oculus/LibOVR/Projects/Windows/VS2012/LibOVR.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {19aff241-4a7e-4895-92de-c834a9ebc8f1} 6 | 7 | 8 | 9 | 10 | Include 11 | 12 | 13 | Include 14 | 15 | 16 | Include 17 | 18 | 19 | Include 20 | 21 | 22 | Include 23 | 24 | 25 | Include 26 | 27 | 28 | Include 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /oculus/LibOVR/Projects/Windows/VS2013/LibOVR.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {19aff241-4a7e-4895-92de-c834a9ebc8f1} 6 | 7 | 8 | 9 | 10 | Include 11 | 12 | 13 | Include 14 | 15 | 16 | Include 17 | 18 | 19 | Include 20 | 21 | 22 | Include 23 | 24 | 25 | Include 26 | 27 | 28 | Include 29 | 30 | 31 | Include 32 | 33 | 34 | Include 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /oculus/LibOVR/Projects/Windows/VS2015/LibOVR.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {19aff241-4a7e-4895-92de-c834a9ebc8f1} 6 | 7 | 8 | 9 | 10 | Include 11 | 12 | 13 | Include 14 | 15 | 16 | Include 17 | 18 | 19 | Include 20 | 21 | 22 | Include 23 | 24 | 25 | Include 26 | 27 | 28 | Include 29 | 30 | 31 | Include 32 | 33 | 34 | Include 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /oculus/LibOVR/Src/Resources/Windows/LibOVR.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/braindx/vbjin-ovr/d49106264b790ec35752bf492d6a824a7f452c10/oculus/LibOVR/Src/Resources/Windows/LibOVR.rc -------------------------------------------------------------------------------- /oculus/LibOVR/Src/Resources/Windows/Oculus.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/braindx/vbjin-ovr/d49106264b790ec35752bf492d6a824a7f452c10/oculus/LibOVR/Src/Resources/Windows/Oculus.ico -------------------------------------------------------------------------------- /oculus/LibOVR/Src/Resources/Windows/resource.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/braindx/vbjin-ovr/d49106264b790ec35752bf492d6a824a7f452c10/oculus/LibOVR/Src/Resources/Windows/resource.h -------------------------------------------------------------------------------- /pcejin.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include "utils\svnrev.h" 3 | #include "main.h" 4 | 5 | class Pcejin 6 | { 7 | public: 8 | 9 | Pcejin() : started(false), 10 | aspectRatio(true), 11 | romLoaded(false), 12 | frameAdvance(false), 13 | width(384), 14 | height(224), 15 | versionName(std::string("VBjin-ovr v") + std::string(SVN_REV_STR)), 16 | slow(false) { 17 | } 18 | 19 | bool aspectRatio; 20 | bool started; 21 | bool romLoaded; 22 | bool maximized; 23 | 24 | bool isLagFrame; 25 | int lagFrameCounter; 26 | char inputDisplayString[128]; 27 | int height; 28 | int width; 29 | int windowSize; 30 | 31 | std::string versionName; 32 | 33 | bool frameAdvance; 34 | bool fastForward; 35 | bool slow; 36 | 37 | u16 pads[5]; 38 | 39 | virtual void pause() { 40 | 41 | if(romLoaded) { 42 | started ^=1; 43 | 44 | if(started) 45 | soundDriver->resume(); 46 | else 47 | soundDriver->pause(); 48 | } 49 | } 50 | 51 | virtual void tempUnPause() { 52 | if(started) 53 | soundDriver->resume(); 54 | } 55 | }; 56 | 57 | extern Pcejin pcejin; 58 | -------------------------------------------------------------------------------- /prefix.h: -------------------------------------------------------------------------------- 1 | #ifdef _MSC_VER 2 | #include "types.h" 3 | #endif 4 | -------------------------------------------------------------------------------- /ramsearch.h: -------------------------------------------------------------------------------- 1 | //RamSearch dialog was copied and adapted from GENS11: http://code.google.com/p/gens-rerecording/ 2 | //Authors: Upthorn, Nitsuja, adelikat 3 | 4 | #ifndef RAM_SEARCH_H 5 | #define RAM_SEARCH_H 6 | 7 | 8 | //64k in Ram_68k[], 8k in Ram_Z80[] 9 | //#define _68K_RAM_SIZE 64*1024 10 | //#define Z80_RAM_SIZE 8*1024 11 | /*#define SRAM_SIZE (((SRAM_End - SRAM_Start) > 2) ? SRAM_End - SRAM_Start : 0) 12 | #define BRAM_SIZE ((8 << BRAM_Ex_Size) * 1024)*/ 13 | //#define GENESIS_RAM_SIZE (_68K_RAM_SIZE + Z80_RAM_SIZE) 14 | 15 | //_32X_Ram[] 16 | //#define _32X_RAM_SIZE 256*1024 17 | 18 | //512k in Ram_Prg, 256k in Ram_Word_1M and Ram_Word_2M 19 | //(docs say 6Mbit of ram, but I'm not sure what's used when) 20 | //#define SEGACD_RAM_PRG_SIZE 512*1024 21 | //#define SEGACD_1M_RAM_SIZE 256*1024 22 | //#define SEGACD_2M_RAM_SIZE 256*1024 23 | //#define SEGACD_RAM_SIZE (SEGACD_RAM_PRG_SIZE + SEGACD_2M_RAM_SIZE) 24 | 25 | #define MAX_RAM_SIZE (0x400000) 26 | 27 | extern char rs_type_size; 28 | extern int ResultCount; 29 | void InitRamSearch(bool soft); 30 | extern HWND RamSearchHWnd; 31 | LRESULT CALLBACK RamSearchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); 32 | unsigned int sizeConv(unsigned int index,char size, char *prevSize = &rs_type_size, bool usePrev = false); 33 | unsigned int GetRamValue(unsigned int Addr,char Size); 34 | void prune(char Search, char Operater, char Type, int Value, int OperatorParameter); 35 | void CompactAddrs(); 36 | void reset_address_info(); 37 | void signal_new_frame(); 38 | void signal_new_size(); 39 | void UpdateRamSearchTitleBar(int percent = 0); 40 | void Update_RAM_Search(); 41 | void SetRamSearchUndoType(HWND hDlg, int type); 42 | unsigned int ReadValueAtHardwareAddress(unsigned int address, unsigned int size); 43 | bool WriteValueAtHardwareRAMAddress(unsigned int address, unsigned int value, unsigned int size, bool hookless=false); 44 | bool IsHardwareRAMAddressValid(unsigned int address); 45 | extern int curr_ram_size; 46 | extern bool noMisalign; 47 | extern bool littleEndian; 48 | 49 | 50 | #endif 51 | 52 | -------------------------------------------------------------------------------- /ramwatch.h: -------------------------------------------------------------------------------- 1 | //RamWatch dialog was copied and adapted from GENS11: http://code.google.com/p/gens-rerecording/ 2 | //Authors: Upthorn, Nitsuja, adelikat 3 | 4 | #ifndef RAMWATCH_H 5 | #define RAMWATCH_H 6 | #include "windows.h" 7 | bool ResetWatches(); 8 | void OpenRWRecentFile(int memwRFileNumber); 9 | extern bool AutoRWLoad; 10 | extern bool RWSaveWindowPos; 11 | #define MAX_RECENT_WATCHES 5 12 | extern char rw_recent_files[MAX_RECENT_WATCHES][1024]; 13 | extern bool AskSave(); 14 | extern int ramw_x; 15 | extern int ramw_y; 16 | extern bool RWfileChanged; 17 | 18 | // AddressWatcher is self-contained now 19 | struct AddressWatcher 20 | { 21 | unsigned int Address; // hardware address 22 | char Size; 23 | char Type; 24 | char* comment; // NULL means no comment, non-NULL means allocated comment 25 | bool WrongEndian; 26 | unsigned int CurValue; 27 | }; 28 | #define MAX_WATCH_COUNT 256 29 | extern AddressWatcher rswatches[MAX_WATCH_COUNT]; 30 | extern int WatchCount; // number of valid items in rswatches 31 | 32 | extern char Watch_Dir[1024]; 33 | 34 | bool InsertWatch(const AddressWatcher& Watch, char *Comment); 35 | bool InsertWatch(const AddressWatcher& Watch, HWND parent=NULL); // asks user for comment 36 | void Update_RAM_Watch(); 37 | bool Load_Watches(bool clear, const char* filename); 38 | 39 | LRESULT CALLBACK RamWatchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); 40 | extern HWND RamWatchHWnd; 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /recentroms.h: -------------------------------------------------------------------------------- 1 | void UpdateRecentRoms(const char* filename); 2 | void RemoveRecentRom(std::string filename); 3 | void GetRecentRoms(); 4 | void SaveRecentRoms(); 5 | void ClearRecentRoms(); 6 | void OpenRecentROM(int listNum); 7 | 8 | #define IDM_RECENT_RESERVED0 65500 9 | #define IDM_RECENT_RESERVED1 65501 10 | 11 | extern HMENU recentromsmenu; -------------------------------------------------------------------------------- /replay.h: -------------------------------------------------------------------------------- 1 | void Replay_LoadMovie(); 2 | void MovieRecordTo(); 3 | -------------------------------------------------------------------------------- /targetver.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/braindx/vbjin-ovr/d49106264b790ec35752bf492d6a824a7f452c10/targetver.h -------------------------------------------------------------------------------- /throttle.cpp: -------------------------------------------------------------------------------- 1 | #include "types.h" 2 | #include "pcejin.h" 3 | #include 4 | #include "GPU_osd.h" 5 | 6 | int FastForward=0; 7 | static u64 tmethod,tfreq; 8 | static const u64 core_desiredfps =3294723;//~50.2 Calc: ((20000000 / (259 * 384 * 4)) * 65536) //Old: 3276800 9 | static u64 desiredfps = core_desiredfps; 10 | static u64 desiredFpsScaler = 256; 11 | 12 | void isSlow() { 13 | if(desiredfps < core_desiredfps) 14 | pcejin.slow = true; 15 | else 16 | pcejin.slow = false; 17 | } 18 | 19 | void IncreaseSpeed(void) { 20 | 21 | desiredFpsScaler*=2; 22 | desiredfps = core_desiredfps * desiredFpsScaler / 256; 23 | if(desiredfps > core_desiredfps) { 24 | desiredfps = core_desiredfps; 25 | desiredFpsScaler = 256; 26 | } 27 | isSlow(); 28 | printf("Throttle fps scaling increased to: %f\n",desiredFpsScaler/256.0); 29 | osd->addLine("Speed: %f\n",desiredFpsScaler/256.0); 30 | } 31 | 32 | void DecreaseSpeed(void) { 33 | 34 | desiredFpsScaler/=2; 35 | desiredfps = core_desiredfps * desiredFpsScaler / 256; 36 | if(desiredfps < 245760) { 37 | desiredfps = 245760; 38 | desiredFpsScaler = 16; 39 | } 40 | isSlow(); 41 | printf("Throttle fps scaling decreased to: %f\n",desiredFpsScaler/256.0); 42 | osd->addLine("Speed: %f\n",desiredFpsScaler/256.0); 43 | } 44 | 45 | static u64 GetCurTime(void) 46 | { 47 | if(tmethod) 48 | { 49 | u64 tmp; 50 | 51 | /* Practically, LARGE_INTEGER and u64 differ only by signness and name. */ 52 | QueryPerformanceCounter((LARGE_INTEGER*)&tmp); 53 | 54 | return(tmp); 55 | } 56 | else 57 | return((u64)GetTickCount()); 58 | 59 | } 60 | 61 | void InitSpeedThrottle(void) 62 | { 63 | tmethod=0; 64 | if(QueryPerformanceFrequency((LARGE_INTEGER*)&tfreq)) 65 | { 66 | tmethod=1; 67 | } 68 | else 69 | tfreq=1000; 70 | tfreq<<=16; /* Adjustment for fps returned from FCEUI_GetDesiredFPS(). */ 71 | } 72 | 73 | static bool behind=false; 74 | bool ThrottleIsBehind() { 75 | return behind; 76 | } 77 | 78 | int SpeedThrottle(void) 79 | { 80 | static u64 ttime,ltime; 81 | 82 | if(FastForward) 83 | return (0); 84 | 85 | behind = false; 86 | 87 | waiter: 88 | 89 | ttime=GetCurTime(); 90 | 91 | 92 | if( (ttime-ltime) < (tfreq/desiredfps) ) 93 | { 94 | u64 sleepy; 95 | sleepy=(tfreq/desiredfps)-(ttime-ltime); 96 | sleepy*=1000; 97 | if(tfreq>=65536) 98 | sleepy/=tfreq>>16; 99 | else 100 | sleepy=0; 101 | if(sleepy>100) 102 | { 103 | // block for a max of 100ms to 104 | // keep the gui responsive 105 | Sleep(100); 106 | return 1; 107 | } 108 | Sleep((DWORD)sleepy); 109 | goto waiter; 110 | } 111 | if( (ttime-ltime) >= (tfreq*4/desiredfps)) 112 | ltime=ttime; 113 | else 114 | { 115 | ltime+=tfreq/desiredfps; 116 | 117 | if( (ttime-ltime) >= (tfreq/desiredfps) ) // Oops, we're behind! 118 | { 119 | behind = true; 120 | return 0; 121 | } 122 | } 123 | return(0); 124 | } 125 | -------------------------------------------------------------------------------- /types.h: -------------------------------------------------------------------------------- 1 | //#include 2 | #include 3 | 4 | #ifndef TYPES_H 5 | #define TYPES_H 6 | 7 | /*typedef char int8_t; 8 | typedef short int16_t; 9 | typedef int int32_t; 10 | typedef __int64 int64_t; 11 | typedef unsigned char uint8_t; 12 | typedef unsigned short uint16_t; 13 | typedef unsigned int uint32_t; 14 | typedef unsigned __int64 uint64_t;*/ 15 | typedef int64_t int64; 16 | typedef uint64_t uint64; 17 | 18 | typedef int8_t int8; 19 | typedef int16_t int16; 20 | typedef int32_t int32; 21 | 22 | typedef uint8_t uint8; 23 | typedef uint16_t uint16; 24 | typedef uint32_t uint32; 25 | 26 | #define MDFN_FASTCALL 27 | #define INLINE __forceinline 28 | 29 | #pragma warning( disable: 4996 ) //disable "The POSIX name for this item is deprecated" 30 | #define strcasecmp _stricmp 31 | #define strncasecmp _strnicmp 32 | #define snprintf _snprintf 33 | #define fstat _fstat 34 | #define close _close 35 | #define open _open 36 | #define lseek _lseek 37 | #define read _read 38 | 39 | //WTF? Just who in the FUCK would do this? 40 | //Prevents VC2008 from compiling VBJin. Fix involved stripping _() tags from several items. 41 | //#define _ 42 | 43 | #define MDFN_printf printf 44 | 45 | typedef struct 46 | { 47 | int x, y, w, h; 48 | } MDFN_Rect; 49 | 50 | #endif 51 | 52 | #define TRUE 1 53 | #define FALSE 0 54 | 55 | #define MDFNNPCMD_RESET 0x01 56 | #define MDFNNPCMD_POWER 0x02 57 | 58 | #define dup _dup 59 | #define lseek _lseek 60 | #define stat _stat 61 | #define strtoull _strtoui64 62 | #define strtoll _strtoi64 63 | #define S_ISREG(x) 0 64 | 65 | //extern uint16 PadData; 66 | 67 | typedef unsigned char u8; 68 | typedef unsigned short u16; 69 | typedef unsigned int u32; 70 | 71 | typedef signed char s8; 72 | typedef signed short s16; 73 | typedef signed int s32; 74 | typedef unsigned __int64 u64; 75 | 76 | #define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0])) -------------------------------------------------------------------------------- /unixstuff.h: -------------------------------------------------------------------------------- 1 | #ifndef _UNIXSTUFF_H_ 2 | #define _UNIXSTUFF_H_ 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #define dup _dup 10 | #define lseek _lseek 11 | #define stat _stat 12 | #define strtoull _strtoui64 13 | #define strtoll _strtoi64 14 | #define S_ISREG(x) 0 15 | 16 | inline double round(double x) 17 | { 18 | double t; 19 | 20 | //alas, this isnt supported 21 | //if (!isfinite(x)) 22 | // return (x); 23 | 24 | if (x >= 0.0) { 25 | t = floor(x); 26 | if (t - x <= -0.5) 27 | t += 1.0; 28 | return (t); 29 | } else { 30 | t = floor(-x); 31 | if (t + x <= -0.5) 32 | t += 1.0; 33 | return (-t); 34 | } 35 | } 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /utils/SubWCRev.bat: -------------------------------------------------------------------------------- 1 | utils\SubWCRev.exe .\ ".\utils\svnrev_template.h" ".\utils\svnrev.h" 2 | exit 0 -------------------------------------------------------------------------------- /utils/SubWCRev.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/braindx/vbjin-ovr/d49106264b790ec35752bf492d6a824a7f452c10/utils/SubWCRev.exe -------------------------------------------------------------------------------- /utils/intl3_tsvn.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/braindx/vbjin-ovr/d49106264b790ec35752bf492d6a824a7f452c10/utils/intl3_tsvn.dll -------------------------------------------------------------------------------- /utils/libapr_tsvn.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/braindx/vbjin-ovr/d49106264b790ec35752bf492d6a824a7f452c10/utils/libapr_tsvn.dll -------------------------------------------------------------------------------- /utils/libaprutil_tsvn.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/braindx/vbjin-ovr/d49106264b790ec35752bf492d6a824a7f452c10/utils/libaprutil_tsvn.dll -------------------------------------------------------------------------------- /utils/readwrite.cpp: -------------------------------------------------------------------------------- 1 | /* readwrite.cpp 2 | * 3 | * Copyright (C) 2006-2008 Zeromus 4 | * 5 | * This file is part of DeSmuME 6 | * 7 | * DeSmuME is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 2 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * DeSmuME is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with DeSmuME; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | /* 22 | #include "readwrite.h" 23 | //#include "../core.h" 24 | #ifdef WIN32 25 | //#include "../windows/settings/settings.h" 26 | #endif 27 | 28 | #define LOCAL_LE 29 | 30 | # define LE_TO_LOCAL_16(x) ((((x)&0xff)<<8)|(((x)>>8)&0xff)) 31 | # define LE_TO_LOCAL_64(x) (x) 32 | 33 | //well. just for the sake of consistency 34 | int write8le(uint8 b, FILE *fp) 35 | { 36 | return((fwrite(&b,1,1,fp)<1)?0:1); 37 | } 38 | /* 39 | //well. just for the sake of consistency 40 | int write8le(uint8 b, std::ostream *os) 41 | { 42 | os->write((char*)&b,1); 43 | return 1; 44 | } 45 | 46 | //well. just for the sake of consistency 47 | int read8le(uint8 *Bufo, std::istream *is) 48 | { 49 | if(is->read((char*)Bufo,1).gcount() != 1) 50 | return 0; 51 | return 1; 52 | } 53 | 54 | ///writes a little endian 16bit value to the specified file 55 | int write16le(uint16 b, FILE *fp) 56 | { 57 | u8 s[2]; 58 | s[0]=b; 59 | s[1]=b>>8; 60 | return((fwrite(s,1,2,fp)<2)?0:2); 61 | } 62 | 63 | 64 | ///writes a little endian 16bit value to the specified file 65 | int write16le(u16 b, std::ostream *os) 66 | { 67 | u8 s[2]; 68 | s[0]=b; 69 | s[1]=b>>8; 70 | os->write((char*)&s,2); 71 | return 2; 72 | } 73 | 74 | ///writes a little endian 32bit value to the specified file 75 | int write32le(u32 b, FILE *fp) 76 | { 77 | u8 s[4]; 78 | s[0]=b; 79 | s[1]=b>>8; 80 | s[2]=b>>16; 81 | s[3]=b>>24; 82 | return((fwrite(s,1,4,fp)<4)?0:4); 83 | } 84 | 85 | int write32le(u32 b, std::ostream* os) 86 | { 87 | u8 s[4]; 88 | s[0]=b; 89 | s[1]=b>>8; 90 | s[2]=b>>16; 91 | s[3]=b>>24; 92 | os->write((char*)&s,4); 93 | return 4; 94 | } 95 | 96 | int write64le(u64 b, std::ostream* os) 97 | { 98 | u8 s[8]; 99 | s[0]=b; 100 | s[1]=b>>8; 101 | s[2]=b>>16; 102 | s[3]=b>>24; 103 | s[4]=b>>32; 104 | s[5]=b>>40; 105 | s[6]=b>>48; 106 | s[7]=b>>56; 107 | os->write((char*)&s,8); 108 | return 8; 109 | } 110 | 111 | 112 | ///reads a little endian 32bit value from the specified file 113 | int read32le(u32 *Bufo, FILE *fp) 114 | { 115 | u32 buf; 116 | if(fread(&buf,1,4,fp)<4) 117 | return 0; 118 | #ifdef LOCAL_LE 119 | *(u32*)Bufo=buf; 120 | #else 121 | *(u32*)Bufo=((buf&0xFF)<<24)|((buf&0xFF00)<<8)|((buf&0xFF0000)>>8)|((buf&0xFF000000)>>24); 122 | #endif 123 | return 1; 124 | } 125 | 126 | int read16le(u16 *Bufo, std::istream *is) 127 | { 128 | u16 buf; 129 | if(is->read((char*)&buf,2).gcount() != 2) 130 | return 0; 131 | #ifdef LOCAL_LE 132 | *Bufo=buf; 133 | #else 134 | *Bufo = LE_TO_LOCAL_16(buf); 135 | #endif 136 | return 1; 137 | } 138 | 139 | ///reads a little endian 64bit value from the specified file 140 | int read64le(u64 *Bufo, std::istream *is) 141 | { 142 | u64 buf; 143 | if(is->read((char*)&buf,8).gcount() != 8) 144 | return 0; 145 | #ifdef LOCAL_LE 146 | *Bufo=buf; 147 | #else 148 | *Bufo = LE_TO_LOCAL_64(buf); 149 | #endif 150 | return 1; 151 | } 152 | 153 | int read32le(u32 *Bufo, std::istream *is) 154 | { 155 | u32 buf; 156 | if(is->read((char*)&buf,4).gcount() != 4) 157 | return 0; 158 | #ifdef LOCAL_LE 159 | *(u32*)Bufo=buf; 160 | #else 161 | *(u32*)Bufo=((buf&0xFF)<<24)|((buf&0xFF00)<<8)|((buf&0xFF0000)>>8)|((buf&0xFF000000)>>24); 162 | #endif 163 | return 1; 164 | } 165 | */ 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | -------------------------------------------------------------------------------- /utils/readwrite.h: -------------------------------------------------------------------------------- 1 | #ifndef _READWRITE_H_ 2 | #define _READWRITE_H_ 3 | /* 4 | //#include "../core.h" 5 | #include 6 | #include 7 | #include "inttypes.h" 8 | #include "prefix.h" 9 | #include "unixstuff.h" 10 | 11 | //well. just for the sake of consistency 12 | int write8le(uint8 b, FILE *fp); 13 | int write8le(uint8 b, std::ostream *os); 14 | int write16le(uint16 b, FILE *fp); 15 | int write16le(uint16 b, std::ostream* os); 16 | int write32le(uint32 b, FILE *fp); 17 | int write32le(uint32 b, std::ostream* os); 18 | int write64le(uint64 b, std::ostream* os); 19 | int read64le(uint64 *Bufo, std::istream *is); 20 | int read32le(uint32 *Bufo, std::istream *is); 21 | inline int read32le(int *Bufo, std::istream *is) { return read32le((uint32*)Bufo,is); } 22 | int read32le(uint32 *Bufo, FILE *fp); 23 | int read16le(uint16 *Bufo, std::istream *is); 24 | //inline int read16le(s16 *Bufo, std::istream* is) { return read16le((uint16*)Bufo,is); } 25 | int read8le(uint8 *Bufo, std::istream *is); 26 | */ 27 | #endif 28 | -------------------------------------------------------------------------------- /utils/svnrev.h: -------------------------------------------------------------------------------- 1 | #define SVN_REV_STR "3.0" -------------------------------------------------------------------------------- /utils/svnrev_template.h: -------------------------------------------------------------------------------- 1 | #define SVN_REV $WCREV$ 2 | #define SVN_REV_STR "$WCREV$" -------------------------------------------------------------------------------- /utils/xstring.h: -------------------------------------------------------------------------------- 1 | //taken from fceux on 10/27/08 2 | 3 | #ifndef _STRINGUTIL_H_ 4 | #define _STRINGUTIL_H_ 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | #include "../types.h" 14 | 15 | 16 | //definitions for str_strip() flags 17 | #define STRIP_SP 0x01 // space 18 | #define STRIP_TAB 0x02 // tab 19 | #define STRIP_CR 0x04 // carriage return 20 | #define STRIP_LF 0x08 // line feed 21 | 22 | 23 | int str_ucase(char *str); 24 | int str_lcase(char *str); 25 | int str_ltrim(char *str, int flags); 26 | int str_rtrim(char *str, int flags); 27 | int str_strip(char *str, int flags); 28 | int chr_replace(char *str, char search, char replace); 29 | int str_replace(char *str, char *search, char *replace); 30 | 31 | std::string strsub(const std::string& str, int pos, int len); 32 | std::string strmid(const std::string& str, int pos, int len); 33 | std::string strleft(const std::string& str, int len); 34 | std::string strright(const std::string& str, int len); 35 | std::string toupper(const std::string& str); 36 | 37 | int HexStringToBytesLength(const std::string& str); 38 | int Base64StringToBytesLength(const std::string& str); 39 | std::string u32ToHexString(u32 val); 40 | std::string BytesToString(const void* data, int len); 41 | bool StringToBytes(const std::string& str, void* data, int len); 42 | 43 | std::vector tokenize_str(const std::string & str,const std::string & delims); 44 | void splitpath(const char* path, char* drv, char* dir, char* name, char* ext); 45 | 46 | uint16 FastStrToU16(char* s, bool& valid); 47 | char *U16ToDecStr(uint16 a); 48 | char *U32ToDecStr(uint32 a); 49 | char *U32ToDecStr(char* buf, uint32 a); 50 | char *U8ToDecStr(uint8 a); 51 | char *U8ToHexStr(uint8 a); 52 | char *U16ToHexStr(uint16 a); 53 | 54 | std::string stditoa(int n); 55 | 56 | std::string readNullTerminatedAscii(std::istream* is); 57 | 58 | //extracts a decimal uint from an istream 59 | template T templateIntegerDecFromIstream(std::istream* is) 60 | { 61 | unsigned int ret = 0; 62 | bool pre = true; 63 | 64 | for(;;) 65 | { 66 | int c = is->get(); 67 | if(c == -1) return ret; 68 | int d = c - '0'; 69 | if((d<0 || d>9)) 70 | { 71 | if(!pre) 72 | break; 73 | } 74 | else 75 | { 76 | pre = false; 77 | ret *= 10; 78 | ret += d; 79 | } 80 | } 81 | is->unget(); 82 | return ret; 83 | } 84 | 85 | inline u32 u32DecFromIstream(std::istream* is) { return templateIntegerDecFromIstream(is); } 86 | inline u64 u64DecFromIstream(std::istream* is) { return templateIntegerDecFromIstream(is); } 87 | 88 | //puts an optionally 0-padded decimal integer of type T into the ostream (0-padding is quicker) 89 | template void putdec(std::ostream* os, T dec) 90 | { 91 | char temp[DIGITS]; 92 | int ctr = 0; 93 | for(int i=0;iwrite(temp+DIGITS-ctr-1,ctr+1); 106 | else 107 | os->write(temp,DIGITS); 108 | } 109 | 110 | std::string mass_replace(const std::string &source, const std::string &victim, const std::string &replacement); 111 | 112 | std::wstring mbstowcs(std::string str); 113 | std::string wcstombs(std::wstring str); 114 | 115 | 116 | 117 | //TODO - dont we already have another function that can do this 118 | std::string getExtension(const char* input); 119 | 120 | 121 | #endif 122 | -------------------------------------------------------------------------------- /vc10_vbjin.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 11.00 3 | # Visual C++ Express 2010 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vc10_vbjin", "vc10_vbjin.vcxproj", "{68D67AC4-A96C-46CD-B5E1-D454CEAE76C8}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Win32 = Debug|Win32 9 | Release|Win32 = Release|Win32 10 | ReleaseFastBuild|Win32 = ReleaseFastBuild|Win32 11 | EndGlobalSection 12 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 13 | {68D67AC4-A96C-46CD-B5E1-D454CEAE76C8}.Debug|Win32.ActiveCfg = Debug|Win32 14 | {68D67AC4-A96C-46CD-B5E1-D454CEAE76C8}.Debug|Win32.Build.0 = Debug|Win32 15 | {68D67AC4-A96C-46CD-B5E1-D454CEAE76C8}.Release|Win32.ActiveCfg = Release|Win32 16 | {68D67AC4-A96C-46CD-B5E1-D454CEAE76C8}.Release|Win32.Build.0 = Release|Win32 17 | {68D67AC4-A96C-46CD-B5E1-D454CEAE76C8}.ReleaseFastBuild|Win32.ActiveCfg = ReleaseFastBuild|Win32 18 | {68D67AC4-A96C-46CD-B5E1-D454CEAE76C8}.ReleaseFastBuild|Win32.Build.0 = ReleaseFastBuild|Win32 19 | EndGlobalSection 20 | GlobalSection(SolutionProperties) = preSolution 21 | HideSolutionNode = FALSE 22 | EndGlobalSection 23 | EndGlobal 24 | -------------------------------------------------------------------------------- /waveout.cpp: -------------------------------------------------------------------------------- 1 | /* Ripped from FCEUX, and altered to work correctly with stereo settings */ 2 | #include 3 | #include 4 | 5 | #include "main.h" 6 | #include "waveout.h" 7 | 8 | static FILE *soundlog=0; 9 | static long wsize; 10 | 11 | /* Checking whether the file exists before wiping it out is left up to the 12 | reader..err...I mean, the driver code, if it feels so inclined(I don't feel 13 | so). 14 | */ 15 | void DRV_WriteWaveData(uint32 *Buffer, int Count) 16 | { 17 | if(!soundlog) return; 18 | 19 | uint32 *temp = (uint32*)alloca(Count*sizeof(uint32)); 20 | 21 | uint32 *dest; 22 | int x; 23 | 24 | dest=temp; 25 | x=Count; 26 | 27 | //mbg 7/28/06 - we appear to be guaranteeing little endian 28 | while(x--) 29 | { 30 | uint32 tmp=*Buffer; 31 | 32 | *(uint8 *)dest=(((uint32)tmp)&255); 33 | *(((uint8 *)dest)+1)=((((uint32)tmp)>>8)&255); 34 | *(((uint8 *)dest)+2)=((((uint32)tmp)>>16)&255); // For single channel, cast input to (uint16*) 35 | *(((uint8 *)dest)+3)=(((uint32)tmp)>>24); // comment out these lines, edit BeginWaveRecord 36 | dest++; 37 | Buffer++; 38 | } 39 | if(soundlog) 40 | wsize+=fwrite(temp,1,Count*sizeof(uint32),soundlog); 41 | } 42 | 43 | int DRV_EndWaveRecord() 44 | { 45 | long s; 46 | 47 | if(!soundlog) return 0; 48 | s=ftell(soundlog)-8; 49 | fseek(soundlog,4,SEEK_SET); 50 | fputc(s&0xFF,soundlog); 51 | fputc((s>>8)&0xFF,soundlog); 52 | fputc((s>>16)&0xFF,soundlog); 53 | fputc((s>>24)&0xFF,soundlog); 54 | 55 | fseek(soundlog,0x28,SEEK_SET); 56 | s=wsize; 57 | fputc(s&0xFF,soundlog); 58 | fputc((s>>8)&0xFF,soundlog); 59 | fputc((s>>16)&0xFF,soundlog); 60 | fputc((s>>24)&0xFF,soundlog); 61 | 62 | fclose(soundlog); 63 | soundlog=0; 64 | return 1; 65 | } 66 | 67 | 68 | bool DRV_BeginWaveRecord(const char *fn) 69 | { 70 | int r; 71 | 72 | if(!(soundlog=fopen(fn,"wb"))) 73 | return false; 74 | wsize=0; 75 | 76 | /* Write the header. */ 77 | fputs("RIFF",soundlog); 78 | fseek(soundlog,4,SEEK_CUR); // Skip size 79 | fputs("WAVEfmt ",soundlog); 80 | 81 | fputc(0x10,soundlog); 82 | fputc(0,soundlog); 83 | fputc(0,soundlog); 84 | fputc(0,soundlog); 85 | 86 | fputc(1,soundlog); // PCM 87 | fputc(0,soundlog); 88 | 89 | fputc(2,soundlog); // 1 = Monophonic, 2 = Stereo 90 | fputc(0,soundlog); 91 | 92 | r=44100; // Playback rate 93 | fputc(r&0xFF,soundlog); 94 | fputc((r>>8)&0xFF,soundlog); 95 | fputc((r>>16)&0xFF,soundlog); 96 | fputc((r>>24)&0xFF,soundlog); 97 | r*=4; // 2 = Mono, 4 = Stereo. Average Byte Rate. 98 | fputc(r&0xFF,soundlog); 99 | fputc((r>>8)&0xFF,soundlog); 100 | fputc((r>>16)&0xFF,soundlog); 101 | fputc((r>>24)&0xFF,soundlog); 102 | fputc(4,soundlog); // 2 = Mono, 4 = Stereo. BlockAlign: (NumChannels * SignificantBitsPerSample / 8) 103 | fputc(0,soundlog); 104 | fputc(16,soundlog); //SignificantBitsPerSample 105 | fputc(0,soundlog); 106 | 107 | fputs("data",soundlog); 108 | fseek(soundlog,4,SEEK_CUR); // Chunk data size skipped 109 | 110 | return true; 111 | } 112 | 113 | bool DRV_WaveRecordActive() 114 | { 115 | return (bool)(soundlog); 116 | } -------------------------------------------------------------------------------- /waveout.h: -------------------------------------------------------------------------------- 1 | //#include "types.h" 2 | 3 | void DRV_WriteWaveData(uint32 *Buffer, int Count); 4 | int DRV_EndWaveRecord(); 5 | bool DRV_BeginWaveRecord(const char *fn); 6 | bool DRV_WaveRecordActive(); -------------------------------------------------------------------------------- /zlib/zlib-2005-x32.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/braindx/vbjin-ovr/d49106264b790ec35752bf492d6a824a7f452c10/zlib/zlib-2005-x32.lib -------------------------------------------------------------------------------- /zlib/zlib-2005-x64.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/braindx/vbjin-ovr/d49106264b790ec35752bf492d6a824a7f452c10/zlib/zlib-2005-x64.lib -------------------------------------------------------------------------------- /zlib/zlib-2008-x32.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/braindx/vbjin-ovr/d49106264b790ec35752bf492d6a824a7f452c10/zlib/zlib-2008-x32.lib -------------------------------------------------------------------------------- /zlib/zlib-2008-x64.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/braindx/vbjin-ovr/d49106264b790ec35752bf492d6a824a7f452c10/zlib/zlib-2008-x64.lib --------------------------------------------------------------------------------