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.
-- 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.
-- 0.9.42: -- February 7, 2017: SS: Ignore lower bit of VDP1 sprite draw command texture base address when drawing using color mode 5, per tests on a SS; fixes some of the graphical glitches in "All-Star Baseball 97". February 6, 2017: SS: Ignore writes to VDP1 registers via SCU DMA under certain conditions to approximate what happens on a SS; fixes hang in "GunBlaze-S". SS: Fixed handling of RSTCSR WOVF clearing, per tests on a SS. Also changed the semantics of RSTCSRM a bit to simplify things, might want to change WTCSRM, FTCSRM, etc. semantics too in the future for consistency... SS: Fixed handling of WTCSR OVF clearing, per tests on a SS. Updated tremor to revision 19427. Updated libogg to version 1.3.2. Fixed a bug that caused a crash if the user tried to select(via CTRL+SHIFT+[n]) a device on a non-existent virtual input port. February 5, 2017: SNES-Faust: Added multitap support. February 3, 2017: SS: Fixed a bug in the handling of M68K level 7 interrupts; fixes missing sound in "Arcade's Greatest Hits". February 1, 2017: SS: Suspend VDP1 command processing while an SCU DMA from SDRAM to VDP1 VRAM is active, to approximate how a SS behaves. Fixes FMV tearing in "Johnny Bazookatone", and fubared graphics in "Virtua Cop" and "Virtua Cop 2". January 31, 2017: SS: Fixed handling of clearing FTCSR bits, per tests on a SS. January 30, 2017: SS: Improved instruction timing(though still far from perfect); fixes speed problems in "Pocket Fighter", reduces the size of the flickering area in "Lunar"'s FMV, and fixes the crash that occurs immediately after gameplay starts in "Virtua Fighter" and "Virtua Fighter Remix". January 26, 2017: NES: Added support for iNES mapper 190. January 25, 2017: SS: Clear SCU internal pending interrupt bit upon the SCU's acceptance of the IRQ to send to the SH-2, instead of when the SH-2 fetches the vector, per tests on a SS.
-- 0.9.41: -- January 21, 2017: SS: Implemented disc change IRQ on disc eject. January 20, 2017: Replaced usage of trio_snprintf() to a fixed-size buffer for path construction in general.cpp with manual concatenation of std::string strings. January 18, 2017: Use _beginthreadex() instead of CreateThread() on Windows, to avoid a small memory leak. Now explicitly use 64-bit walltime functions on 32-bit Windows builds. January 17, 2017: PCE, PCE_FAST: Added a missing sound emulation variable to save states. January 16, 2017: SNES: Added setting "snes.h_blend", default value of "0", that when set to "1" will enable a horizontal blend/blur filter. January 15, 2017: PCE: Improved SuperGrafx window handling in 10MHz dot clock modes. GBA: Modified RTC emulation to not use standard C library walltime functions during emulation. Wrapped various time functions, and dropped the dependencies on SDL time functions, in Time.cpp/Time.h. January 14, 2017: WonderSwan: Fixed off-by-1 bugs in window coordinate evaluation, per tip from trap15. WonderSwan: Fixed copyright notice headers to not allow distribution under versions of the GPL other than version 2(an oversight from back when the Cygne code was added to Mednafen). WonderSwan: Applied sound and DMA emulation fixes from trap15; fixes rain sound effect in "Star Hearts". The changes did necessitate lowering the overall WonderSwan sound emulation volume a bit to prevent excessive clipping, however. January 12, 2017: SS: Fixed a logic error in the VDP2 rendering code; fixes battle scenes in "Grandia". January 10, 2017: SS: Removed a few bad entries in the internal region-correction database that were breaking the Korean releases of some games. January 9, 2017: PCE, PCE_FAST: Added support for auto-enabling SuperGrafx emulation with CDs when a mode 1 data track has the 16-byte magic "4D 65 64 6E 61 66 65 6E 74 AB 90 19 42 62 7D E6" at offset 0x86A(assuming 2048 bytes per sector), for homebrew and translations. January 7, 2017: SS: Added emulation of the SCSP 18-bit DAC enable bit; fixes low volume problem in "Daytona USA". SS: Fixed some bugs that broke emulation on big-endian platforms. January 5, 2017: Fixed an off-by-1 memory corruption bug in the debugger's memory editor relative bytestring search code. VB: Finally commented out some debug printf()s. January 1, 2017: Cleaned up code that passes video data from the game thread to the main thread, and replaced some volatile usage with atomics. December 31, 2016: Fixed a large memory leak that occurred when saving screenshots with SHIFT+F9. VB: Fixed a regression introduced in 0.9.39.2 that caused transient sound/note distortion on save state load. December 27, 2016: Moved TCP/IP networking code into the core of Mednafen, and added support for non-blocking connects, so the Saturn emulation module can eventually use it for modem emulation. December 25, 2016: Modified configure script to (hopefully) compile in the Saturn emulation module when building for PPC64 and AArch64 architectures(in addition to x86_64). December 21, 2016: Allow emulated digital button mappings to be used in AND mode(like command keys configured with SHIFT+F2) if the user manually prefixes the "/&&\ " magic string to the mapping setting string in the configuration file. Can be useful with emulated switches and mode toggle buttons, but the in-emulator input configuration process will need to be revamped before enabling this mode for a mapping can be done in a sane and more user-friendly manner. Rewrote round_up_pow2() in math_ops.h to use MDFN_log2, which in turn uses MDFN_lzcount*(), since the major CPUs that Mednafen is going to run on should have dedicated instructions to (at least indirectly) count leading zeroes. Also changed the semantics to return 0 on overflow instead of 1. December 20, 2016: SS: Now use leading-zero counting function from math_ops.h in the VDP2 rendering code, instead of using inline assembly. Reorganized the leading/trailing bit counting functions in math_ops.h, added 32-bit and 64-bit trailing-bit counting functions, and added faster variants where passing a 0 results in an undefined result. December 19, 2016: Print out the game key used after a connection is established with netplay, when the game key is not empty. SMS: Added settings "sms.slstart", "sms.slend", "sms.slstartp", and "sms.slendp". Added some checks to help prevent a black screen when the scanlines effect is enabled via a <system>.scanlines setting and the effective Y scale is too small(by forcing negative-value behavior in the case of interlaced video, or temporarily disabling the effect otherwise). December 18, 2016: PSX: The functionality controlled by the "psx.input.analog_mode_ct" setting no longer interferes with netplay. PSX: Added "psx.input.analog_mode_ct.compare" setting to control the combination of buttons used when the functionality controlled by the "psx.input.analog_mode_ct" setting is enabled. Modified build system to use $(localedir) instead of $(datadir)/locale for LOCALEDIR define. Updated miniLZO to version 2.09. December 14, 2016: SS: Added setting "ss.h_blend", default value of "0", that when set to "1" will enable a horizontal blend/blur filter(with a much noticeable effect on the Saturn video modes with a higher horizontal resolution). December 10, 2016: SS: Added setting "ss.h_overscan", default value of "1", to allow the user to show less of the screen on the left and right sides by setting it to "0". December 9, 2016: SS: Added setting "ss.correct_aspect", default value of "1", to allow the user to disable aspect ratio correction(not recommended, but whatever~). Added simple TV CRT-approximating OpenGL shader, "goat". December 8, 2016: Renamed settings "*.pixshader" to "*.shader". December 7, 2016: Check for and use -no-pie instead of just -nopie in the configure script, to fix build failures on at least one platform. December 6, 2016: Fixed half-source-pixel image offset bug in the "autoip", "ipxnoty", and "ipynotx" pixel shaders. Fixed altivec.h header detection regression in 0.9.39. October 7, 2016: Fixed a bug that caused input movie recording to produce broken recordings when done during netplay with an emulation module that uses mid-frame sync functionality.
-- 0.9.39.2: -- September 19, 2016: SMS: Sanitize some previously-missed variables in the save state loading code. September 18, 2016: MD: Fixed a bug that caused some YM2612 state to not be restored properly on save state load. MD, SMS, NGP: Fixed an old Z80 emulation bug with interrupt handling. Make an index of save state sections on save state load, to detect sections in a save state that are unused by the state loading code(for debugging). MD, PCE, PCE_FAST: Sanitize some previously-missed variables in the save state loading code. September 16, 2016: SS: Added PAL support. SS: Fixed vertical positioning brokenness with custom "ss.slstart" setting values with interlaced video. September 15, 2016: PC-FX, WonderSwan, NES, VB, PSX: Sanitize some previously-missed variables in the save state loading code. Fixed a use-after-free bug in the SDL sound output driver. NGP: Fixed several off-by-1 bugs in the address to ROM data translation function. September 11, 2016: Removed nonsensical unused frame advance loop in drivers/main.cpp leftover from 0.5.x. PCE_FAST: Fixed a bug that could cause a crash with large "pce_fast.ocmultiplier" setting values when running CD games. September 10, 2016: PCE_FAST: Skip 512-byte copier header if detected when loading a ROM image. PCE_FAST: Made some minor optimizations. PCE, PSX, PCE_FAST: Avoid UB by biasing uintptr_t values instead of pointers directly in the CPU core. September 1, 2016: GB: Corrected the layer names used with the layer toggling feature. August 26, 2016: SS: Fixed a potential problem with SH-2 DMA event rescheduling when bus lock is held, that probably wouldn't ever happen in practice. NES: Fixed several instances of missing initialization of on-cart WRAM. August 24, 2016: SS: Marked more functions with MDFN_COLD hint, and marked a few functions to be forcibly-inlined where it makes sense. August 23, 2016: SNES: Fixed an issue causing a compilation error on Mac OS X.
-- 0.9.39.1: -- August 22, 2016: SS: Settings "ss.dbg_mask" and "ss.dbg_exe_cdpath", and the functionality they control, are no longer available unless Mednafen has been compiled with "MDFN_SS_DEV_BUILD" defined(such as with -DMDFN_SS_DEV_BUILD=1 in CPPFLAGS env var passed to configure). SS: Replaced some instances of case ranges with more portable constructs. August 20, 2016: SS: Run VDP1 vblank erase at end of vblank, so we know how much time we have and thus how many entries in the framebuffer we'll be able to erase. Currently, the available time calculations are generous, allowing for a bit more erase than what's possible on a Saturn, but we can tighten it up in the future once it's fairly certain there aren't any more event scheduling accuracy issues. Fixes FMV subtitle text in "Panzer Dragoon". SS: Fixed a bug that caused VDP2 frames to be short by 1 to 3 CPU cycles. SS: Reschedule the SH-2 DMA event handler as necessary to prevent it from running when the SH-2 bus is locked. SS: Force the SH-2 DMA and SCU DMA event handlers to be rescheduled to SH7095_mem_timestamp time when necessary. SS: Check for pending events right before calling VDP1, VDP2, SMPC, and SCU regs read/write handlers, which may then call their own event update functions. August 17, 2016: Fixed an old bug that could cause a startup crash on Windows systems without XInput DLLs installed(e.g. some Windows XP systems). NES: Fixed a very old bug triggered when disabling(via CTRL+1) the background layer, that would cause sprite pixels to also be visually disabled too under certain circumstances. August 16, 2016: MD, PC-FX: Fixed several instances of left-shifting negative values. August 15, 2016: SS: Fixed a compilation error when compiling with the debugger disabled("--disable-debugger" passed to configure). Added configure options "--with-external-mpcdec" and "--with-external-tremor", for distribution packagers. SS, SNES-Faust: Fixed a few issues causing compilation errors on clang. SS: Tweaked how seek command pause works; fixes a lockup issue in "Astal". August 11, 2016: WonderSwan: Fixed a bad usage of "char" without an unsigned/signed qualifier. SS: Slow down SCU DMA to VDP2 VRAM under certain conditions. August 10, 2016: SS: Adjusted VDP1 polygon and line draw commands to behave as if SPD=1, ECD=1 when color mode >= 6; fixes missing graphics problem in "Hi-Octane". August 8, 2016: SS: Reworked SCU DMA's timekeeping and scheduling code to be more accurate; reduces the size of the flickering section of the FMV in "Lunar". SS: Fixed handling of CPU<->SMPC open bus. August 7, 2016: Relaxed the CloneCD Q subchannel sanity checks to allow a track number of 0xAA(leadout). August 6, 2016: SS: Implemented kludgy(incomplete) support for quasi-illegal window X start position values; fixes ground layer issues in the forest stage of Panzer Dragoon 2.
-- 0.9.38.7: -- September 30, 2015: Fixed several malformed trio_sscanf() format strings in regards to field width, that could cause stack buffer overflows in certain cases. September 29, 2015: PSX: Added skeleton BCzF/BCzT instruction emulation, and fixed handling of illegal CP0 instructions. September 25, 2015: PSX: Added emulation of CPU exception-handling bad address register. PSX: Implemented emulation of the Coprocessor Error field in the CAUSE register. PSX: Added emulation of CPU exception-handling branch target register. PSX: Fixed handling of CAUSE bits 30 and 31 when an exception occurs immediately after a branch instruction is executed. PSX: Fixed link address calculation for JAL, JALR, and B*AL instructions when they're executed in a branch delay slot. PSX: Corrected emulation of the quasi-illegal mirrors of the BGEZ*/BLTZ* type instructions. PSX: Added emulation of a pipeline quirk that occurs with back-to-back load instructions to the same register(previously only emulated with LWL and LWR). September 22, 2015: Fixed a bug in the debugger's disassembler that could break disassembly when a disassembled instruction wraps around the end of the CPU's program address space to the beginning. September 18, 2015: PCE: Removed experimental and unfinished hypothetical subtitle hardware emulation which had a few security-related problems. September 16, 2015: MD: Fixed registration of main RAM in the cheat engine to be mirrored properly. PCE: Fixed a bug that caused the debugger's disassembly and memory view to show a wrong value for the HES bootstrap register at $1D00. PCE: Fixed a bug that sometimes caused the "TIMV" register in the debugger to display "FFFFFFFF" instead of "FF". The date and time of the compilation of qtrecord.cpp are no longer written to recorded QuickTime movie files, to solve a minor privacy issue and a build reproducibility issue. PSX: Rewrote parts of the timer emulation code to fix several issues; fixes wrong music playback speed problem in "RPG Tsukuru 4".
-- 0.9.38.5: -- June 26, 2015: PSX: Generate a seek error when trying to read audio sectors(when the appropriate Mode bit isn't set), and generate a bad command error when executing ReadN/ReadS with a non-PS1 disc. Fixes a lockup in "Vib Ribbon" when trying to play with audio CDs. June 20, 2015: Altered SHA-1 and SHA-256 test code to work around a preprocessor-related bug in gcc. NES: Fixed a mapper 19 sound emulation bug; fixes music issues in the Japanese release of "Rolling Thunder". PSX: Replaced a GPU debug puts() with code that respects the psx.dbg_level setting. June 18, 2015: PC-FX: Corrected handling of width/height of 0xA for KING BG1-3, per tests on a PC-FX. Fixes a graphical glitch in "Sakuraigar Mode" in "Tyoushin Heiki Zeroigar". May 5, 2015: PSX: Added some debug messages to the memory card emulation code, outputted when setting psx.dbg_level is set to certain values. April 29, 2015: PCE, PCE_FAST: Corrected decimal-mode ADC and SBC behavior(especially for "illegal" input values), per tests on a HuC6280. April 22, 2015: Added a test to tests.cpp for gcc bug #60196(triggered with non-default optimization flags). April 19, 2015: Added a missing dependency statement to configure.ac, whose absence broke compilation with --disable-pce --enable-pcfx April 16, 2015: WonderSwan: Removed erroneous constraints that were preventing opposing X* and Y* buttons from being pressed simultaneously, and changed the names of the the X* and Y* buttons used during input configuration, per tip from trap15.