Mednafen is a portable, utilizing OpenGL and SDL, argument(command-line)-driven multi-system emulator. Mednafen has the ability to remap hotkey functions and virtual system inputs to a keyboard, a joystick, or both simultaneously. Save states are supported, as is real-time game rewinding. Screen snapshots may be taken, in the PNG file format, at the press of a button. Mednafen can record audiovisual movies in the QuickTime file format, with several different lossless codecs supported.
The following systems are supported(refer to the emulation module documentation for more details):
Mednafen is distributed under the terms of the GNU GPLv2.
Due to the threaded model of emulation used in Mednafen, and limitations of SDL, a joystick is preferred over a keyboard to play games, as the joystick will have slightly less latency, although the latency differences may not be perceptible to most people.
-- 1.21.2: -- April 2, 2018: Updated bundled copy of Tremor to address a security vulnerability. SS: Improved emulation of SCU DSP DMA to program RAM, per tests on a SS(still nowhere near perfect, the way it's implemented on hardware is kind of horrible, but it should work ok if games use it how it's meant to be used); fixes graphical glitches in "Shining Force III - Scenario 2", and perhaps in the other "Shining Force III" games as well. SS: Flush the prefetched SCU DSP instruction when PC is set via PPAF, instead of when END/ENDI executes or when execution is forcibly stopped, per tests on a SS. SS: Disallow SCU DSP LOP from being written in a looped single instruction unless it's the final iteration, per tests on a SS. SS: Allow SCU DSP LOP to underflow to 0xFFF with LPS and BTM, per tests on a SS.
-- 1.21.1: -- March 9, 2018: Enabling the automatic save state loading/saving feature will no longer cause an error to be outputted on game load if the save state does not exist. March 3, 2018: Added support for compiling and linking with external LZO instead of the bundled miniLZO. A CD image loading hint will now be appended to the ROM image too large error message in certain circumstances. February 25, 2018: PC-FX: Added a missing variable to save states. (Re)Added backwards-compatibility "video.driver" setting value aliases. February 24, 2018: NES: Misc minor fixes for a few bootleg mappers. NES: Added missing data to VS Unisystem save states. NES: Added missing variable to mapper 64 save states. NES: Added missing save state support to the mapper 22 code. NES: Fixed improper handling of an MMC1 variable in save states. February 22, 2018: Fixed handling of the "osd.state_display_time" setting to allow a value of "0" to work as expected.
-- 1.21.0-UNSTABLE: -- February 19, 2018: An attempt to run an instance of Mednafen while another instance is already running with the same base directory is now blocked during startup, via a lock file; note that this check occurs after stdout and stderr are potentially redirected to stdout.txt and stderr.txt on Windows. February 15, 2018: Changed the default value of setting "video.driver" from "opengl" to "default", removed the old "0" and "1" backwards-compatibility value aliases, renamed the "sdl" driver to "softfb"(without backwards-compat aliases), and made it so the setting's value will be reset to "default" after automatically importing settings from "mednafen-09x.cfg". On Windows, no longer exit on ALT+F4 while input is grabbed. Added settings "fps.autoenable", "fps.position", "fps.textcolor", and "fps.bgcolor". February 11, 2018: Removed reliance on malloc(), realloc(), and calloc() setting errno to ENOMEM on failure, since it's not the case on Windows XP, and possibly other platforms/operating systems too. February 9, 2018: ZIP files are now recognized by file extension instead of by magic(wizards). Replaced old minizip code with newly-written ZIP archive reading code. Replaced MDFN_PrintError() and MDFN_DispMessage() with MDFN_Notify(). February 6, 2018: Use versionsort() instead of alphasort() when scanning for js* joystick devices on Linux. February 1, 2018: Added settings "fps.scale" and "fps.font". January 31, 2018: On Windows, in-memory conversion of M3U and CUE files to UTF-8 will be attempted if they lack a UTF-8 BOM and contain byte sequences that are not valid UTF-8. On Windows, path/filename settings loaded from the old mednafen-09x.cfg(before being saved to mednafen.cfg on exit) will now be converted to UTF-8. January 29, 2018: Added support for pasting text into the cheat and netplay consoles. January 28, 2018: SS: Added Japanese keyboard emulation. SS: Improved VDP2 window Y coordinate evaluation emulation; fixes at least one background layer graphical glitch in "Radiant Silvergun"(at the start of stage 2C), and the graphical glitch near the end of the intro in "Snatcher". January 20, 2018: Altered calculations involving *.xscale(fs)/*.yscale(fs) settings to be more predictable given floating point nuances; any user using non-integer scaling values for these settings may need to adjust them to get the same result as in previous versions of Mednafen, however. Added setting "video.fs.display". January 18, 2018: SDL2(2.0.5+) is now used and required. Removed the "overlay" video driver. On Windows, error messages during startup will now be displayed in a popup message box. On Windows, Mednafen will now output text to a console if it's started from a console(e.g. cmd.exe or Cygwin), and if not, write to stdout.txt and stderr.txt like before. On Windows, Mednafen now uses Unicode variants of CRT and Win32 functions; this may require the user to convert their CUE sheets to UTF-8 if filenames use exotic(e.g. not directly typable on a standard US-layout keyboard) characters. For key bindings relating to the debugger and cheat management interface, the Right ALT key modifier will no longer be respected(only the Left ALT has any effect now), for internationalization reasons. The configuration file is back to "mednafen.cfg" instead of "mednafen-09x.cfg". If a 0.8.x "mednafen.cfg" is in the way, it will be renamed. If "mednafen.cfg" does not exist, or is from an old version of Mednafen, settings will initially be loaded from "mednafen-09x.cfg", but still saved to "mednafen.cfg" on exit(and loaded from "mednafen.cfg" from that point on). Reworked the input mapping setting format to be more human-readable(and editable). Details are in the documentation, in the "Advanced Usage" section. Old input mappings will be translated internally, except for keyboard mappings, due to incompatibilities between how SDL 1.2 and 2 handle keyboards. Added support for mapping joystick axes and buttons, mouse buttons, and keyboard keys to emulated mouse device relative motion for testing purposes(via manually editing the configuration file, as the in-emulator configuration process currently won't create such mappings). Added support for digital button input mappings that mix AND, ANDNOT, and OR-style operations together(previously it was either just AND or OR); refer to the documentation for more details. Note that the in-emulator configuration process won't create complex mappings that mix different boolean operations, but you can map combinations using simpler logic in-emulator, and then edit the configuration file to adjust the boolean operations used. January 15, 2018: SS: Fixed a bug that caused a crash if an error occurred early in the process of loading a game. Updated the configure script to disable gcc's mitigations for Spectre, in the event distributions configure their compilers to enable them by default. Stopped (erroneously) memset()'ing some MDFN_PixelFormat objects. January 12, 2018: Cleaned up the handling and reduced the size of axis-related inputs as communicated from the driver-side code to core Mednafen. PCE_FAST: Fixed fubared mouse emulation. December 28, 2017: Replaced usage of strcasecmp() and strncasecmp() with MDFN_strazicmp(), for consistent behavior across locales. Added MDFN_strazlower(), MDFN_strazupper(), MDFN_memazicmp(), and MDFN_strazicmp() functions. December 14, 2017: SS: Fixed a logic error in the BIOS sanity check code that caused it to throw a less helpful error message than intended in certain circumstances, and made the error messages related to BIOS file misconfiguration more verbose(and hopefully more helpful...). December 6, 2017: Fixed broken cheat file saving on MS Windows. November 12, 2017: Changed how some multidimensional arrays and arrays of structs are accessed, to try to avoid behavior that's probably undefined and may be a problem in the future. PC-FX: Fixed integer overflows that caused fatal division by zero when Mednafen's cheat functionality was used(a regression introduced around 0.9.39). SS: Stuck SCU DMA table arrays in a struct to avoid unspecified behavior in the SCU save state code.
-- 0.9.48: -- September 16, 2017: Set cheat's default endianness to that preferred by the system being emulated when manually adding a cheat that's not a cheat device code nor the result of a cheat search. September 15, 2017: SS: Fixed SCU DSP DMA from B-bus; fixes the periodic loud popping in Grandia's FMV. September 12, 2017: SS: Added a hack/kludge to allow bypassing of data cache on reads(such that the timing benefits of partial cache emulation are preserved, without cache coherency problems that partial cache emulation sometimes leads to with poorly programmed games), and added an internal database to enable it on select games; fixes graphical glitches and/or hangs in "Area 51 (USA and Europe)", "Clockwork Knight 2 (USA)", "DeJig - Lassen Art Collection", "Father Christmas", "Golden Axe The Duel", "Sega Saturn Choice Cuts", "Spot Goes to Hollywood (USA and Japan)", "Street Fighter Zero", "Street Fighter Zero 3", "Super Puzzle Fighter II Turbo", and "Virtual Volleyball". SS: Full cache emulation is now enabled for "Whizz"(by using an internal database), to resolve(or at least reduce) quasi-random hanging issues during startup. September 11, 2017: SS: Corrected an inaccuracy with CDB play repeat handling; fixes hang when trying to resume a suspended game in "Tactics Ogre". SS: Initialize VDP1 clipping and local coordinate registers only on power-on, and not on reset. September 7, 2017: SS: Fixed side-effect inaccuracies in the CDB Put Sector Data, Copy Sector Data, and Move Sector Data command emulation. September 6, 2017: Added configure option "--with-external-trio", for distribution packagers. SS: Added partial emulation of SH-2 external bus open bus behavior; fixes messed up colors in "Discworld 2". September 4, 2017: SS: Improved CDB Initialize command emulation; fixes crash in "Tenchi Muyou! Ryououki Gokuraku" when it tries to play an opening movie during startup. August 28, 2017: SS: Made CD seek overhead calculation less completely wrong; fixes graphics corruption in intro of "Batman Forever", and fixes hang in "Jung Rhythm" when trying to retry a failed stage.
-- 0.9.47: -- August 25, 2017: Lynx, MD, NGP, SMS: Added a few missing variables to save states. August 24, 2017: SS: Added save state support. Revamped save state helper macros and functions, to allow save-stating of variables in arrays of structs to be simpler. August 22, 2017: SS: Fixed BCR1 write protect, and added stub emulation of the other BSC registers. SS: Added incomplete stub Action Replay 4M Plus emulation(for experimentation); proper Action Replay support would require SH-2 UBC emulation, and that may be too costly performance wise. August 21, 2017: SS: Implemented very rough approximation of bus timing side effects when master SH-2 DMA is active(accurate handling of bus priorities and sharing would increase CPU requirements noticeably, but it may ultimately be necessary as a database-driven option for some stubborn games in the future). Fixes startup hangs in "Device Reign", "Real Sound", "Resident Evil", "SD Gundam G Century S", "Super Tempo", "Tennis Arena", "Tilk", "Yuukyuu Gensoukyoku", "Yuukyuu Gensoukyoku 2nd Album", "Yuukyuu Gensoukyoku ensemble", "Yuukyuu Gensoukyoku ensemble 2", "Yuukyuu no Kobako Official Collection", and "Zero4 Champ".
-- 0.9.46: -- August 10, 2017: Compile with explicit -fstrict-aliasing, for distributions/OSes that have configured gcc to not enable strict aliasing at -O2(and possibly other levels). Fixed a bug that could, under certain conditions, cause emulator OSD elements to not be updated in the time after entering frame advance mode and before a frame advance. August 7, 2017: Use a sorted std::vector instead of std::multimap to store current settings, to reduce memory usage. August 6, 2017: SS: Added ss.input.port*.3dpad.mode.defpos settings to control the default position of the digital/analog mode switch. August 5, 2017: Allow addresses above FFFF to be entered as the logical watch address in the debugger. August 4, 2017: SS: Added kludge to fix layer offset problem in "Daytona USA CCE". NES: The functionality controlled by setting "nes.fnscan" now recognizes "(F)" and "(France)" as PAL. NES: Added support for iNES mapper 40. July 11, 2017: Utilize _byteswap_*() functions in endian.h when compiling with Microsoft's C++ compiler. June 22, 2017: Fixed a couple of minor issues(log header formatting, and skipped logging of first instruction in step mode) with the debugger's undocumented trace log feature. NES: Corrected the period of PAL noise channel frequency setting 0x1. June 21, 2017: NES: Fixed a few square wave sound channel emulation bugs(wrong phase for duty setting 3, and failing to clock the period counter when the channel is silenced).
-- 0.9.45.1: -- June 5, 2017: SNES: Fixed an instance of possibly-undefined behavior. Silenced dumb warning spam relating to endian.h emitted by newer versions of gcc. June 4, 2017: Fixed garbled audio with the exclusive-mode WASAPI sound driver on some higher-end sound cards(regression introduced in 0.9.45 due to a mistake in changing the meaning of a macro field during development); may also fix garbled audio when using the new OpenBSD sound driver with certain sound cards.
-- 0.9.45: -- May 29, 2017: Tweaked netplay sound buffer underrun kludge code. The netplay server host and port being connected to are now printed to the netplay console at the beginning of a connection attempt. Netplay connection attempts to servers are now non-blocking. May 25, 2017: SS: Synchronize end of SMPC clock change commands to beginning of vsync instead of beginning of vblank, per tests on a SS. May 23, 2017: SS: Reworked how the VDP2 rendering thread waits, to make Saturn emulation usable with the default OpenBSD kernel. SS: Added emulation of the light gun("Stunner"/"Virtua Gun"). April 28, 2017: #include'd many commonly-used C and C++ standard library headers in types.h(and removed redundant #include statements from various header and source files), to reduce the probability of portability problems (due to neglecting to explicitly include a header file) when different standard C/C++ libraries behave differently in regards to what header files include what other header files. Added a sound output driver for OpenBSD's /dev/audio. Reworked the sound output format conversion code to be more versatile, April 25, 2017: NES: Wrote new "Barcode Battler II" emulation code to replace the old "Barcode World" code, based on quick testing with actual hardware(albeit the English version). April 24, 2017: SSFPlay: Added save state support.
-- 0.9.44.1: -- April 21, 2017: MD: Added a missing MDFN_FASTCALL, the absence of which broke 32-bit x86 builds(either at link time or run time). -- 0.9.44: -- April 19, 2017: PSX: Restructured the GPU emulation code and data a bit to get a minor performance boost. April 18, 2017: VB, PCE, WonderSwan, MD, GBA: Use fastcall calling convention(on 32-bit x86) in a few (more) places where it makes sense. April 16, 2017: SNES-Faust: Added setting "snes_faust.correct_aspect", default value of "1". SNES-Faust: Added PAL support. April 14, 2017: SNES-Faust: Made minor optimizations to the BG rendering code. April 9, 2017: Added command-line option "-which_medium", to specify which CD to start with when using multi-CD M3U sets. April 5, 2017: SNES: Fixed emulator hang when saving state in "Panic Bomber W". April 3, 2017: Added some simple scripts to cross-compile and package Mednafen for Windows. Added Windows cross-compiler toolchain setup notes. 32-bit Windows builds are now compiled with -march=i686 instead of -march=i586(shouldn't affect compatibility for official builds, since the toolchain and libraries were already effectively being compiled with -march=i686, which was not intended, but since nobody apparently complained... ;p). March 25, 2017: VB: Added support for custom palettes. VB: Reworked how LED on-state duration is translated into RGB values and added setting "vb.ledonscale"; the default value of "vb.ledonscale" is set such that the overall brightness will be lower than in previous versions of Mednafen, to reduce white crush, but the user can set it to a value of "1.9921875" to approximate the old brightness level. March 20, 2017: SNES: Made a couple of SDD1 registers readable; fixes "Tractor Beam" spell graphical glitches in "Star Ocean"(thanks to orbea). March 17, 2017: SS: Added support for a 16MiB RAM cart mapped into the A-bus CS1 area(for "Heart of Darkness" and homebrew). March 15, 2017: WonderSwan: Removed setting "wswan.rotateinput", and added a new device("gamepadraa") that can be selected on virtual input port 1 to automatically rotate inputs when the display is rotated. March 14, 2017: Reworked text drawing to not use an excessive number of potentially-large VLAs. Moved statements with important side effects outside of assert()s in settings.cpp. Replaced ancient Unicode conversion code with newly-developed code. March 7, 2017: SS: Prioritize SMPC command execution over VBlank handler execution, per (limited) tests on a SS. Fixes broken input in "Primal Rage"(a 0.9.43 regression).
-- 0.9.43: -- February 24, 2017: Reworked how input grabbing is handled. The new way uses only one key combo(CTRL+SHIFT+Menu), and will adapt its behavior based on any keyboards being selected on any virtual input ports or not(refer to the documentation for full details). A new setting is added, "command.toggle_grab", and two settings were removed, "command.toggle_grab_input" and "command.toggle_cidisable". Emulated keyboard(FKB, Tsushin, Saturn) key state is now only updated when input grabbing is toggled on. February 22, 2017: SS: Fixed SMPC read handling of an empty input port. SS: Implemented emulation of SMPC 0-byte port read mode. PSX: Reduced rumble latency by 1 frame. February 20, 2017: Reworked how keyboard key state is handled, to prevent extremely short button presses from being lost(like what can happen with the Pause key, or other keys when slow-forwarding is active). SS: Added 101-key US keyboard emulation. February 17, 2017: SS: Allow SMPC commands to be dual-issued; fixes hang in "F1 Challenge", and hangs/missing sound in "Magic Knight Rayearth". SS: Added emulation of the 6-Player Adaptor(multitap). February 15, 2017: SS: Added emulation of the Mission Stick and Dual Mission Sticks. February 13, 2017: SS: Added emulation of the steering wheel("Arcade Racer"), for use with "Virtua Racing", "High Velocity - Mountain Racing Challenge", "The Need for Speed", and other Saturn racing games that apparently lack 3D pad support.