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):
- Atari Lynx
- Neo Geo Pocket (Color)
- GameBoy (Color)
- GameBoy Advance
- Nintendo Entertainment System
- Super Nintendo Entertainment System/Super Famicom
- Virtual Boy
- PC Engine/TurboGrafx 16 (CD)
- Sega Game Gear
- Sega Genesis/Megadrive
- Sega Master System
- Sega Saturn (experimental, x86_64 only)
- Sony PlayStation
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.
How to configure joystick/keyboard?
You canchange the input configuration by manually editing macnafen.cfg after running Mednafen once,but this is not documented yet.
;nes, Port 1, Gamepad: A
nes.input.port1.gamepad.a joystick ce96ea6b9d7ca56a 00000001
;nes, Port 1, Gamepad: Rapid A
nes.input.port1.gamepad.rapid_a joystick ce96ea6b9d7ca56a 00000002
;nes, Port 1, Gamepad: B
nes.input.port1.gamepad.b joystick ce96ea6b9d7ca56a 00000000
;nes, Port 1, Gamepad: Rapid B
nes.input.port1.gamepad.rapid_b joystick ce96ea6b9d7ca56a 00000003
;nes, Port 1, Gamepad: SELECT
nes.input.port1.gamepad.select joystick ce96ea6b9d7ca56a 00000008
;nes, Port 1, Gamepad: START
nes.input.port1.gamepad.start joystick ce96ea6b9d7ca56a 00000009
;nes, Port 1, Gamepad: UP ↑
nes.input.port1.gamepad.up joystick ce96ea6b9d7ca56a 0000c001~joystick ce96ea6b9d7ca56a 0000c005
;nes, Port 1, Gamepad: DOWN ↓
nes.input.port1.gamepad.down joystick ce96ea6b9d7ca56a 00008001~joystick ce96ea6b9d7ca56a 00008005
;nes, Port 1, Gamepad: LEFT ←
nes.input.port1.gamepad.left joystick ce96ea6b9d7ca56a 0000c000~joystick ce96ea6b9d7ca56a 0000c004
;nes, Port 1, Gamepad: RIGHT →
nes.input.port1.gamepad.right joystick ce96ea6b9d7ca56a 00008000~joystick ce96ea6b9d7ca56a 00008004
The format is:
joystick <joyid(printed when Mednafen starts up> <buttonnum(hexadecimal)>
You can determine the regular buttons on your joystick/gamepad by running something like “jstest /dev/input/js0” or “jstest /dev/js0”. Axes numbers are logically OR’d against 0x8000. If the axis should be negative to trigger a virtual button press, it is also OR’d against 0x4000.
Keyboard numbers can be found in /usr/include/SDL/SDL_keysym.h
If you wish for more than one physical button to map to a virtual button, put a tilde(~) between the specifications.
Why do you disappear when you get hit in games?
When player sprites are hit, games will often toggle the visibility of the sprite on adjacent frames. So on Frame 1, player sprite is visible. On Frame 2, player sprite is invisible, and on Frame 3, player sprite is visible, and so on.
The NES displays at around 60 frames-per-second, and any deviation from this on the computer’s monitor will likely occasionally produce a dropped frame in the emulator. When this happens once in a while, or on an irregular interval, it will not cause the sprite to disappear entirely, but the flashing effect might be more choppy than normal. When it happens on a regular, frequent interval, such as every other frame being dropped, the player sprite will disappear entirely or be entirely visible for an unacceptable length of time.
On Windows, make sure that you have your video output device/card manufacturer’s drivers installed. Microsoft does not ship hardware-accelerated OpenGL drivers with Windows for some reason, so installing the vendor- or manufacturer-supplied drivers should help.
Base DirectoryMednafen’s “base directory” is the directory under which Mednafen stores its data and looks for various auxillary data by default. If the “HOME” environment variable is set, it will be suffixed with “/.mednafen” and used as the base directory(in other words ~/.mednafen, or $HOME/.mednafen). If the “MEDNAFEN_HOME” environment variable is set, it will be used as the base directory. If neither the “HOME” nor “MEDNAFEN_HOME” environment variable is set, and the current user has an entry in the password file, the corresponding home directory will be used as if it were the “HOME” environment variable.
On Microsoft Windows, these conditions are typically not met, in which case the directory the Mednafen executable(“mednafen.exe”) is in will be used as the base directory.
- Physical joystick/gamepad support.
- Versatile input configuration system; assign multiple physical buttons to a virtual button or action.
- Multiple graphics filters and scaling modes.
- Save states.
- Real-time game rewinding.
- Screen snapshots, saved in PNG format.
- QuickTime movie recording.
- MS WAV-format sound logging.
- Loading games from gzip and (pk)zip compressed archives.
- Network play(utilizing an external dedicated server program).
Mednafen can load CD-ROM games from a dumped copy of the disc, such as CUE+BIN. Physical CD support was removed in version 0.9.38.
Compact Disc Images
Mednafen supports “CUE” sheets, CloneCD “CCD/IMG/SUB”, and cdrdao “TOC” files; though only a very limited subset of the latter’s full capabilities is supported. Mednafen supports raw, simple storage formats supported bylibsndfile(MS WAV, AIFF/AIFC, AU/SND, etc.), and Ogg Vorbis and Musepack audio files referenced by CUE sheets. MP3 is not supported, and will not be supported.
The cdrdao “TOC” support in Mednafen includes support for “RW_RAW” subchannel data, needed for CD+G. Note that Mednafen assumes that the Q subchannel is also included in the RW_RAW data area in the disc image(even though the name “RW_RAW” would suggest it isn’t present, cdrdao seems to included it). If the Q subchannel data is missing from the RW_RAW data area in the disc image, Mednafen’s CD emulation will not work properly.
Since 0.8.4, Mednafen will perform simple data correction on disc images that contain EDC and L-EC data(2352-byte-per-sector “raw”). It calculates the real EDC, and if it doesn’t match the EDC recorded for that sector, it will evaluate the L-EC data to repair the data. If the data is unrepairable, an error message will be displayed.
This may cause problems with naive patches that don’t update the error-correction data(at least the 32-bit EDC, if that’s correct, the L-EC data will be ignored)!
Enabling the cd.image_memcache option is recommended in many situations; read the setting description for more details.
CAUTION: When using a 32-bit build of Mednafen on Windows or a 32-bit operating system, Mednafen may run out of address space(and error out, possibly in the middle of emulation) if this option is enabled when loading large disc sets(e.g. 3+ discs) via M3U files.
To play a game that consists of more than one CD, you will need to create an M3U file(plain-text, “.m3u” extension), and enter the filenames of the CUE/TOC/CCD files, one per line. Load the M3U file with Mednafen instead of the CUE/TOC/CCD files, and use the F6 and F8 keys to switch among the various discs available.
Note: Preferably, your M3U file(s) should reference CUE/TOC/CCD files that are in the same directory as the M3U file, otherwise you will likely need to alter the filesys.untrusted_fip_check setting.
Both the PC Engine (CD) and PC-FX emulation modules support CD+G playback; however, the PC-FX BIOS doesn’t appear to be as resilient when dealing with scratched discs/damaged data as the PC Engine CD BIOS is.
Note: CD+G graphics data is stored in the R-W subchannel data of discs. You must use a disc image format that includes this data(such as in the cdrdao TOC or CloneCD formats; CUE format definitely isn’t going to work).
The PC-FX emulation module supports low-resolution single-session Kodak “PhotoCD Portfolio” disc playback. Hardware features to support multi-session CDs are not fully emulated; they may or may not work.