#

# General Documentation

Last updated January 2, 2024
Valid as of 1.32.0-UNSTABLE

Table of Contents:

- Introduction
  - Base Directory
- Core Features
  - Compressed Games
  - CD Emulation
    - Compact Disc Images
    - Multiple-CD Games
    - CD+G
    - PhotoCD Portfolio
- Security Issues
  - Save States
  - CD images and PSF(PSF1, GSF, etc.) Files
  - Network Play
- Using Mednafen
  - Key Assignments
  - Input Grabbing
  - Remapping Buttons and Keys
  - Command-line
  - Configuration Files
  - Global Settings Reference
  - Firmware/BIOS
  - Custom Palettes
  - Automatic IPS Patching
  - Screen Snapshots
- Advanced Usage
  - Minimizing video/audio/input Lag
    - Hardware Selection
    - Settings to Minimize Video Lag
    - Settings to Minimize Audio Lag
  - Input Mapping Settings Format
    - Keyboard
    - Mouse
    - Joystick
  - Environment Variables
- Troubleshooting and Common Solutions
  - No sound output on Linux.
  - Configuration file is a mess in Notepad in Windows.
- Emulation Module Documentation
  - Apple II/II+/IIe/Enhanced IIe [apple2]
  - Atari Lynx [lynx]
  - CD-DA Player [cdplay]
  - GameBoy (Color) [gb]
  - GameBoy Advance [gba]
  - Neo Geo Pocket (Color) [ngp]
  - Nintendo Entertainment System/Famicom [nes]
  - PC Engine (CD)/TurboGrafx 16 (CD)/SuperGrafx [pce]
  - PC Engine (CD)/TurboGrafx 16 (CD)/SuperGrafx [pce_fast]
  - PC-FX [pcfx]
  - Sega Arcade SCSP Sound Player [sasplay]
  - Sega Game Gear [gg]
  - Sega Genesis/MegaDrive [md]
  - Sega Master System [sms]
  - Sega Saturn [ss]
  - Sega Saturn Sound Format Player [ssfplay]
  - Sony PlayStation [psx]
  - Super Nintendo Entertainment System/Super Famicom [snes]
  - Super Nintendo Entertainment System/Super Famicom [snes_faust]
  - Virtual Boy [vb]
  - WonderSwan [wswan]
- Debugger
- Network Play
- Licenses, Copyright Notices, and Code Credits
  - libmpcdec
  - Tremor
  - MiniLZO
  - QuickLZ
  - Zstandard
  - trio
  - Speex Resampler
  - ffmpeg cputest
  - CD-ROM data correction code
  - CD-ROM L-EC generation code
  - Scale2x
  - hq2x, hq3x, hq4x
  - 2xSaI
  - SABR v3.0 Shader
  - nes_ntsc
  - Gb_Snd_Emu
  - Blip_Buffer
  - Sms_Snd_Emu(base for T6W28_Apu NGP code)
  - V810 Emulator
  - Fuse Z80 emulation code
  - VRC7 Sound Emulation
  - NEC V30MZ Emulator
  - NEC V30MZ disassembler(modified BOCHS x86 disassembler)
  - EMU2413(used in SMS emulation)
  - YM2612 Emulator
  - Sega Genesis SVP/SSP16 Emulator
  - PC2e (Used in portions of PC Engine CD emulation)
  - Handy
  - VisualBoyAdvance GameBoy and GBA code
  - NeoPop Neo Geo Pocket (Color) Code
  - Cygne
  - FCE Ultra
  - SMS Plus
  - Genesis Plus
  - Genesis Plus GX
  - libco
  - libFLAC
  - libogg
  - libiconv
  - SDL2
  - zlib

## Introduction

This main document covers general Mednafen usage, generally regardless of which system is being emulated. Documentation covering key assignments, settings, and related information for each system emulation module is linked to in the table of contents under "Emulation Module Documentation".

The term "movie" used in this documentation refers to save-state and recorded input stream stored in a file, generally usable only in Mednafen itself.
The terms "audio/video movie", "QuickTime movie", and variations thereof refer to audio and video data recorded and stored in a file, and usable with external programs.

### Base Directory

Mednafen's "base directory" is the directory under which Mednafen stores its data and looks for various auxiliary 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.

If none of the preceding conditions were met, then you're doomed, doomy doomy DOOMED, GOTO DOOM.

## Core Features

- 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 several compressed formats.
- Network play(utilizing an external dedicated server program).

### Compressed Games

In addition to supporting uncompressed games, Mednafen supports loading games from several different compressed file formats. For non-CD games, Mednafen supports loading from naked gzip- and Zstandard-compressed files, and ZIP archives. For CD-based games, Mednafen supports loading from ZIP archives, but only when CD image memory caching is enabled.

Supported ZIP archive compression methods:

- 0 - Stored
- 8 - Deflate
- 93 - Zstandard (note that the ZIP CRC32 value is not validated, for performance reasons)

### CD Emulation

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. The following formats/encodings are supported for audio files referenced by CUE sheets:

- Uncompressed PCM in AIFF/AIFC, AU/SND, W64, and WAV
- FLAC
- Ogg Vorbis
- Musepack

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, but fully read the setting description before enabling it.

#### Multiple-CD Games

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.

M3U files may also reference other M3U files, and ZIP archives containing M3U/CUE/TOC/CCD files(provided CD image memory caching is enabled).

Note: Preferably, your M3U file(s) should reference files that are in the same directory as the M3U file, otherwise you will likely need to alter the filesys.untrusted_fip_check setting.

Caution: Avoid using Mednafen's M3U-based multi-CD support to load discs belonging to different games and switching between games during emulation, especially when using Sega Saturn emulation, as that may interfere with the Saturn module's heavy use of internal databases.

#### CD+G

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).

#### PhotoCD Portfolio

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.

## Security Issues

This section discusses various known design flaws/choices, bugs, and limitations in Mednafen that have security implications.

### Save States

Causing Mednafen to lock-up, abort, or consume large amounts of CPU time via loading a specially-constructed save state is a trivial exercise. It is hypothetically possible to overflow some buffers on some emulated systems by clever manipulation of saved timekeeping variables. In combination with custom emulated machine code and state, it may therefore be possible to run arbitrary host code, compromising the host system. Therefore, loading save states from parties you have reason to distrust, or not trust, is advised against.

### CD images and PSF(PSF1, GSF, etc.) Files

CUE and TOC, and PSF(PSF1, GSF, etc.) files can reference arbitrary files for inclusion and parsing. Inclusion of device files may cause odd system behavior, particularly if you are running Mednafen as root(which you shouldn't be!) on a UN*X system, or cause Mednafen to lockup or abort. In combination with save states, screen snapshots, and audio/video recordings, this file inclusion presents the possibility of leaking of private local information; for example, if an attacker supplies a CD image or PSF rip that you subsequently run, and can convince you to save a state or screenshot and send it back, or to connect to a network play server(in which save states are automatically utilized), the attacker may then have access to local private data from your system. The setting filesys.untrusted_fip_check, when set to 1(the default), will enable checks that mitigate this potential problem.

### Network Play

Mednafen's network play automatically utilizes save states to synchronize state among newly connected players, and thereafter at connected players' command. Hence, any security issues relating to save states apply to network play as well.

Additionally, network problems, or a malicious network play server or player, may cause Mednafen to lock up or consume large amounts of CPU time processing received data.

## Using Mednafen

### Key Assignments

All default key mappings are by scancode, so you'll need to press the keys corresponding to the appropriate positions on the standard U.S keyboard layout.

Key(s): | Action: | Configuration String:
--- | --- | ---
F1 | Toggle in-game quick help screen. | toggle_help
F5 | Save state. | save_state
F7 | Load state. | load_state
0-9 | Select save state slot. | "0" through "9"
- | Decrement selected save state slot. | state_slot_dec
= | Increment selected save state slot. | state_slot_inc
ALT + S | Toggle 600-frame save-state rewinding functionality, disabled by default. | toggle_state_rewind
SHIFT + F5 | Record movie. | save_movie
SHIFT + F7 | Play movie. | load_movie
SHIFT + 0-9 | Select movie slot. | "m0" through "m9"
LALT + C | Toggle cheat console. Note: Will not respond to RALT/AltGr even if remapped. | togglecheatview
ALT + T | Toggle cheats active. | togglecheatactive
T | Enable network play console input. | togglenetview
Escape | Close netplay console/text popup. | close_popup
LALT + D | Toggle debugger. Note: Will not respond to RALT/AltGr even if remapped. | toggle_debugger
Key(s): | Action: | Configuration String:
` | Fast-forward. | fast_forward
\ | Slow-forward. | slow_forward
ALT + A | Enter frame advance mode, or advance the frame if already in it. | advance_frame
ALT + R | Exit frame advance mode. | run_normal
Pause | Pause/Unpause. | pause
SHIFT + F1 | Toggle frames-per-second display(from top to bottom, the display format is: virtual, rendered, blitted). | toggle_fps_view
Backspace | Rewind emulation, if save-state rewinding functionality is enabled, up to 600 frames. | state_rewind
F9 | Save (rawish) screen snapshot. | take_snapshot
SHIFT + F9 | Save screen snapshot, taken after all scaling and special filters/shaders are applied. | take_scaled_snapshot
ALT + O | Rotate the screen | rotate_screen
ALT + Enter | Toggle fullscreen mode. | toggle_fs
CTRL + 1 through Ctrl + 9 | Toggle layer. | "tl1" through "tl9"
Key(s): | Action: | Configuration String:
F3 | Detect analog buttons on physical joysticks/gamepads(for use with the input configuration process). | input_config_abd
ALT + SHIFT + [n] | Configure buttons for emulated device on input port n(1-8). | input_confign
CTRL + SHIFT + [n] | Select input device on input port n(1-8). Note: Many games do not expect input devices to change while the game is running, and thus may require a hard reset. | device_selectn
F2 | Activate in-game input configuration process for a command key. | input_configc
SHIFT + F2 | Like F2, but after configuration completes, to activate the configured command key will require all buttons configured to it to be in a pressed state simultaneously to trigger the action. Note that keyboard modifier keys(CTRL, ALT, SHIFT) are still treated as modifiers and not discrete keys. Especially useful in conjunction with the ckdelay setting. | input_configc_am
SHIFT + F3 | Reinitialize physical joysticks/gamepads. Note that this will also cause Mednafen to forget about any analog buttons detected by previously pressing F3. | reinit_joysticks
CTRL + SHIFT + Menu | Toggle input grabbing(for emulated mice and keyboards). | toggle_grab
Key(s): | Action: | Configuration String:
SHIFT + F6 | Select drive. | select_drive
F6 | Select medium(CD, floppy disk, etc.) for selected drive. | select_disk
F8 | Insert/Eject medium(CD, floppy disk, etc.) for selected drive. | insert_eject_disk
F8 | Insert Coin | insert_coin
F10 | Reset. | reset
F11 | Hard reset(toggle power switch). | power
F12 | Exit. | exit

### Input Grabbing

Keyboard and mouse input can be grabbed(from the OS/window manager) by pressing CTRL+SHIFT+Menu(default mapping), and disabled by pressing the same again.

Emulated keyboards will only function when input grabbing is enabled. When input grabbing is enabled, and at least one emulated keyboard that has an emulated key mapped to a host keyboard key is enabled, all(except for the input grab toggling mapping) other host keyboard input mappings will see all keyboard keys as being unpressed. In other words, this disables hotkeys/command keys(unless the user has mapped them to a non-keyboard device), and the keyboard mappings of any non-keyboard emulated devices.

Emulated mice mapped to the system mouse will only function properly when input grabbing is enabled or when in a fullscreen video mode, the debugger is inactive, and no other emulated input devices that rely on absolute mouse coordinates(e.g. lightguns) are active and mapped to the system mouse.

The setting "input.grab.strategy" controls when and if OS input is actually grabbed when input grabbing is toggled on within Mednafen.

### Remapping Buttons and Keys

You may configure a virtual(emulated) input device by using special command keys in Mednafen while a game is running.

Caution: Users of XBox 360-type/compatible controllers on operating systems other than Microsoft Windows(e.g. Linux), or users of other controllers with analog buttons, should complete the following process before attempting any configuration that will map a physical analog button to a virtual input. Failure to complete this process under the aforementioned conditions which necessitate it will result in the input configuration functionality becoming confused, and the resulting input mappings will be wonky.

> Twirl all sticks and D-pads, move all throttles to maximum then center(and leave them there), and press all analog buttons on any physical gamepads/joysticks with analog buttons you want to use in the input configuration process, then press F3. Then, configure input as normal. The detected analog buttons will be recognized during input configuration until Mednafen exits; if you exit Mednafen and restart, and want to configure input devices again, you'll need to repeat the twirling-pressing-F3 process again).

All joystick throttles should be set to their center position before configuring inputs. To register a "press" with a throttle control during the input configuration process, move it to the maximum or minimum position as appropriate, then back to the center position.

To configure the virtual device on input port 1, press ALT+SHIFT+1. For the virtual device on input port 2, press ALT+SHIFT+2. Etc.

After pressing the appropriate command key or command key combination, a message will be displayed at the bottom of the screen similar to "GamePad #1: A (1)". At this time, you would press the physical joystick or keyboard button you want to map to button "A" on the first virtual gamepad. After you push the button, you should see something like "GamePad #1: A (2)". If you want to map any other physical buttons to virtual button "A", press them now. Otherwise, press the physical joystick or keyboard button you pressed before, and you will move on to the configuration of the next virtual button("B").

To configure a command key, press F2, and then the command key whose mapping you wish to change. The process is similar to that for a virtual input device.

### Command-line

Mednafen supports options passed on the command line. Options are taken in the form of "-option value". Some options are valueless.

In addition to the options listed in the table below, any setting listed in the "Settings" section of this document and any system emulation module sub-document can be set by prefixing it with a hyphen(-), followed by the value, such as: -nes.slstart 8

Option: | Value Type: | Description:
--- | --- | ---
-force_module x | string | Force usage of specified emulation module.
-which_medium x | integer | Start with specified disk/CD(numbered from 0) inserted. For ejected, pass -1.
-connect | (n/a) | Trigger to connect to remote host after the game is loaded.
-soundrecord x | string | Record sound output to the specified filename in the MS WAV format.
-qtrecord x | string | Record video and audio output to the specified filename in the QuickTime format.
-ovconfig x | string | Load global override settings from specified file.

### Configuration Files

Mednafen loads/saves its settings from/to a primary configuration file, named "mednafen.cfg", under the Mednafen base directory. This file is created and written to when Mednafen shuts down.

When the command-line option "-ovconfig" is used, global override settings will be loaded from the specified file. Note that settings loaded from the per-module and per-game override configuration files, as described below, will override any global override settings.

Mednafen automatically loads override settings from optional per-module override configuration files, also located directly under the Mednafen base directory. The general pattern for the naming of these user-created files is "<system>.cfg"; e.g. "nes.cfg", "pce.cfg", "gba.cfg", "psx.cfg", etc. This allows for overriding global settings on a per-module basis.

Per-game override configuration files are also supported. They should be placed in the pgconfig directory under the Mednafen base directory. Name these files like <FileBase>.<system>.cfg; e.g. "Lieutenant Spoon's Sing-a-Tune (USA).psx.cfg".

The aforementioned global, per-module, and per-game configuration override files will NOT be written to by Mednafen, and they will generally not alter the contents of the primary configuration file, unless a user action occurs that causes new setting values to be generated based on the current active setting value(such as toggling full-screen mode inside the emulator, for instance). Some settings currently cannot be overridden properly by per-module and per-game override files:

- cd.image_memcache
- filesys.untrusted_fip_check
- <system>.enable

### Global Settings Reference

Caution: Any settings that change emulation behavior as seen from the emulated game are shown with the setting name bolded in the table. One should be conscious of these settings if one has changed them from the default values when using network play or movies, as they can cause desychronizations if not set the same among hosts(or between the recording emulator and the playing emulator).

Setting: | Value Type: | Possible Values: | Default Value: | Description:
--- | --- | --- | --- | ---
affinity.cd | integer | 0x0000000000000000 through 0xFFFFFFFFFFFFFFFF | 0 | CD read threads CPU affinity mask. Set to 0 to disable changing affinity.
affinity.emu | integer | 0x0000000000000000 through 0xFFFFFFFFFFFFFFFF | 0 | Main emulation thread CPU affinity mask. Set to 0 to disable changing affinity.
affinity.video | integer | 0x0000000000000000 through 0xFFFFFFFFFFFFFFFF | 0 | Video blitting thread CPU affinity mask. Set to 0 to disable changing affinity.
autosave | boolean | 0 1 | 0 | Automatically load/save state on game load/close. Automatically save and load save states when a game is closed or loaded, respectively.

cd.image_memcache

boolean

0
1

0

Cache entire CD images in memory.

Reads the entire CD image(s) into memory at startup(which will cause a small delay). Can help obviate emulation hiccups due to emulated CD access. May cause more harm than good on low memory systems, systems with swap enabled, and/or when the disc images in question are on a fast SSD.
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.

cd.m3u.disc_limit | integer | 1 through 999 | 25 | M3U total number of disc images limit.
cd.m3u.recursion_limit | integer | 0 through 99 | 9 | M3U recursion limit. A value of 0 effectively disables recursive loading of M3U files.
cheats | boolean | 0 1 | 1 | Enable cheats.
debugger.autostepmode | boolean | 0 1 | 0 | Automatically go into the debugger's step mode after a game is loaded.
ffnosound | boolean | 0 1 | 0 | Silence sound output when fast-forwarding.
ffspeed | real | 0.25 through 15 | 4 | Fast-forwarding speed multiplier.
fftoggle | boolean | 0 1 | 0 | Treat the fast-forward button as a toggle.
filesys.fname_movie | string |  | %f.%M%p.%x | Format string for movie filename. See fname_format.txt for more information. Edit at your own risk.
filesys.fname_sav | string |  | %f.%M%x | Format string for save games filename. WARNING: %x should always be included, otherwise you run the risk of overwriting save data for games that create multiple save data files. See fname_format.txt for more information. Edit at your own risk.
filesys.fname_savbackup | string |  | %f.%m%z%p.%x | Format string for save game backups filename. WARNING: %x and %p should always be included. See fname_format.txt for more information. Edit at your own risk.
filesys.fname_snap | string |  | %f-%p.%x | Format string for screen snapshot filenames. WARNING: %x or %p should always be included, otherwise there will be a conflict between the numeric counter text file and the image data file. See fname_format.txt for more information. Edit at your own risk.
filesys.fname_state | string |  | %f.%M%X | Format string for state filename. See fname_format.txt for more information. Edit at your own risk.
filesys.path_cheat | string |  | cheats | Path to directory for cheats.
filesys.path_firmware | string |  | firmware | Path to directory for firmware.
filesys.path_movie | string |  | mcm | Path to directory for movies.
filesys.path_palette | string |  | palettes | Path to directory for custom palettes.
filesys.path_pgconfig | string |  | pgconfig | Path to directory for per-game configuration override files.
filesys.path_sav | string |  | sav | Path to directory for save games and nonvolatile memory. WARNING: Do not set this path to a directory that contains Famicom Disk System disk images, or you will corrupt them when you load an FDS game and exit Mednafen.
filesys.path_savbackup | string |  | b | Path to directory for backups of save games and nonvolatile memory.
filesys.path_snap | string |  | snaps | Path to directory for screen snapshots.
filesys.path_state | string |  | mcs | Path to directory for save states.
filesys.state_comp_level | integer | -1 through 9 | 6 | Save state file compression level. gzip/deflate compression level for save states saved to files. -1 will disable gzip compression and wrapping entirely.

filesys.untrusted_fip_check

boolean

0
1

1

Enable untrusted file-inclusion path security check.

When this setting is set to "1", the default, paths to files referenced from files like CUE sheets and PSF rips are checked for certain characters that can be used in directory traversal, and if found, loading is aborted. Set it to "0" if you want to allow constructs like absolute paths in CUE sheets, but only if you understand the security implications of doing so(see "Security Issues" section in the documentation).

fps.autoenable | boolean | 0 1 | 0 | Automatically enable FPS display on startup.
fps.bgcolor | integer | 0x00000000 through 0xFFFFFFFF | 0x80000000 | FPS display background color. 0xAARRGGBB

fps.font

enum

5x7
6x9
6x12
6x13
9x18

5x7

FPS display font.

- 5x7 - 5x7
- 6x9 - 6x9
- 6x12 - 6x12
- 6x13 - 6x13. CJK support.
- 9x18 - 9x18; CJK support.

fps.position

enum

upper_left
upper_right
upper_center
center

upper_left

FPS display position.

- upper_left - Upper left.
- upper_right - Upper right.
- upper_center - Upper center.
- center - Center.

fps.scale | integer | 0 through 32 | 1 | FPS display scale factor. A value of 0 enables auto-scaling.
fps.textcolor | integer | 0x00000000 through 0xFFFFFFFF | 0xFFFFFFFF | FPS display text color. 0xAARRGGBB
input.autofirefreq | integer | 0 through 1000 | 3 | Auto-fire frequency. Auto-fire frequency = GameSystemFrameRateHz / (value + 1)
input.ckdelay | integer | 0 through 99999 | 0 | Dangerous key action delay. The length of time, in milliseconds, that a button/key corresponding to a "dangerous" command like power, reset, exit, etc. must be pressed before the command is executed.

input.grab.strategy

enum

auto
full
kb_auto
mouse_auto

full

Input grabbing strategy.

Selects the conditions for and extent of system keyboard and mouse grabbing when input grabbing is toggled on.
Note that regardless of this setting, system keyboard grabbing is temporarily disabled while in the cheat interface, debugger, or netplay console text entry.

- auto - Auto.
  Grab the system mouse only when an emulated mouse or other device that requires relative ball motion is active, and grab the system keyboard only when an emulated keyboard is active.
- full - Full.
  Grab the system mouse and keyboard regardless of whether or not an emulated keyboard or mouse/ball device is active.
- kb_auto - Keyboard auto, mouse regardless of emulated devices.
- mouse_auto - Mouse auto, keyboard regardless of emulated devices.

input.joystick.axis_threshold | real | 0 through 100 | 75 | Analog axis binary press detection threshold. Threshold for detecting a digital-like "button" press on analog axis, in percent.
input.joystick.global_focus | boolean | 0 1 | 1 | Update physical joystick(s) internal state in Mednafen even when Mednafen lacks OS focus.

netplay.console.font

enum

5x7
6x9
6x12
6x13
9x18

9x18

Font for netplay chat console.

- 5x7 - 5x7
- 6x9 - 6x9
- 6x12 - 6x12
- 6x13 - 6x13. CJK support.
- 9x18 - 9x18; CJK support.

netplay.console.lines | integer | 5 through 64 | 5 | Height of chat console, in lines.
netplay.console.scale | integer | 0 through 16 | 1 | Netplay chat console text scale factor. A value of 0 enables auto-scaling.
netplay.gamekey | string |  |  | Key to hash with the MD5 hash of the game.
netplay.host | string |  | netplay.fobby.net | Server hostname.
netplay.localplayers | integer | 0 through 16 | 1 | Local player count. Number of local players for network play. This number is advisory to the server, and the server may assign fewer players if the number of players requested is higher than the number of controllers currently available.
netplay.nick | string |  |  | Nickname. Nickname to use for network play chat.
netplay.password | string |  |  | Server password. Password to connect to the netplay server.
netplay.port | integer | 1 through 65535 | 4046 | Server port.
nothrottle | boolean | 0 1 | 0 | Disable speed throttling when sound is disabled.
osd.alpha_blend | boolean | 0 1 | 1 | Enable alpha blending for OSD elements.
osd.message_display_time | integer | 0 through 15000 | 2500 | Length of time, in milliseconds, to display internal status and error messages Time lengths less than 100ms are recommended against unless you understand you may miss important non-fatal error messages, and that the input configuration process may become unusable.
osd.state_display_time | integer | 0 through 15000 | 2000 | Length of time, in milliseconds, to display the save state or the movie selector after selecting a state or movie.
qtrecord.h_double_threshold | integer | 0 through 1073741824 | 256 | Double the raw image's height if it's below this threshold.

qtrecord.vcodec

enum

raw
cscd
png

cscd

Video codec to use.

- raw - Raw
  A fast codec, computationally, but will cause enormous file size and may exceed your storage medium's sustained write rate.
- cscd - CamStudio Screen Codec
  A good balance between performance and compression ratio.
- png - PNG
  Has a better compression ratio than "cscd", but is much more CPU intensive. Use for compatibility with official QuickTime in cases where you have insufficient disk space for "raw".

qtrecord.w_double_threshold | integer | 0 through 1073741824 | 384 | Double the raw image's width if it's below this threshold.
sfspeed | real | 0.25 through 15 | 0.75 | SLOW-forwarding speed multiplier.
sftoggle | boolean | 0 1 | 0 | Treat the SLOW-forward button as a toggle.
sound | boolean | 0 1 | 1 | Enable sound output.
sound.buffer_time | integer | 0 through 1000 | 0 | Desired buffer size in milliseconds(ms). The default value of 0 enables automatic buffer size selection.
sound.device | string |  | default | Select sound output device. When using ALSA sound output under Linux, the "sound.device" setting "default" is Mednafen's default, IE "hw:0", not ALSA's "default". If you want to use ALSA's "default", use "sexyal-literal-default".

sound.driver

enum

default
alsa
openbsd
oss
wasapish
dsound
wasapi
sdl
jack

default

Select sound driver.

The following choices are possible, sorted by preference, high to low, when "default" driver is used, but dependent on being compiled in.

- default - Default
  Selects the default sound driver.
- alsa - ALSA
  The default for Linux(if available).
- openbsd - OpenBSD Audio
  The default for OpenBSD.
- oss - Open Sound System
  The default for non-Linux UN*X/POSIX/BSD(other than OpenBSD) systems, or anywhere ALSA is unavailable. If the ALSA driver gives you problems, you can try using this one instead.
  If you are using OSSv4 or newer, you should edit "/usr/lib/oss/conf/osscore.conf", uncomment the max_intrate= line, and change the value from 100(default) to 1000(or higher if you know what you're doing), and restart OSS. Otherwise, performance will be poor, and the sound buffer size in Mednafen will be orders of magnitude larger than specified.
  If the sound buffer size is still excessively larger than what is specified via the "sound.buffer_time" setting, you can try setting "sound.period_time" to 2666, and as a last resort, 5333, to work around a design flaw/limitation/choice in the OSS API and OSS implementation.
- wasapish - WASAPI(Shared Mode)
  The default when it's available(running on Microsoft Windows Vista and newer).
- dsound - DirectSound
  The default for Microsoft Windows XP and older.
- wasapi - WASAPI(Exclusive Mode)
  Experimental exclusive-mode WASAPI driver, usable on Windows Vista and newer. Use it for lower-latency sound. May not work properly on all sound cards.
- sdl - Simple Directmedia Layer
  This driver is not recommended, but it serves as a backup driver if the others aren't available. Its performance is generally sub-par, requiring higher latency or faster CPUs/SMP for glitch-free playback, except where the OS provides a sound callback API itself, such as with Mac OS X and BeOS.
- jack - JACK
  The latency reported during startup is for the local sound buffer only and does not include server-side latency. Please note that video card drivers(in the kernel or X), and hardware-accelerated OpenGL, may interfere with jackd's ability to effectively run with realtime response.

sound.period_time | integer | 0 through 100000 | 0 | Desired period size in microseconds(μs). Currently only affects OSS, ALSA, WASAPI(exclusive mode), and SDL output. A value of 0 defers to the default in the driver code in SexyAL. Note: This is not the "sound buffer size" setting, that would be "sound.buffer_time".
sound.rate | integer | 22050 through 192000 | 48000 | Specifies the sound playback rate, in sound frames per second("Hz").
sound.volume | integer | 0 through 150 | 100 | Sound volume level, in percent. Setting this volume control higher than the default of "100" may severely distort the sound.
srwframes | integer | 10 through 99999 | 600 | Number of frames to keep states for when state rewinding is enabled. Caution: Setting this to a large value may cause excessive RAM usage in some circumstances, such as with games that stream large volumes of data off of CDs.
video.blit_timesync | boolean | 0 1 | 1 | Enable time synchronization(waiting) for frame blitting. Disable to reduce latency, at the cost of potentially increased video "juddering", with the maximum reduction in latency being about 1 video frame's time. Will work best with emulated systems that are not very computationally expensive to emulate, combined with running on a relatively fast CPU.

video.cursorvis

enum

hidden
visible

hidden

Preferred window manager cursor visibility.

The cursor will still be forcibly hidden in relative mouse mode(used automatically when emulating a mouse input device in fullscreen mode or in windowed mode and input grabbing is toggled on), and forcibly shown in the debugger.

- hidden - Hidden
- visible - Visible

video.deinterlacer

enum

weave
bob
bob_offset
blend
blend_rg

weave

Deinterlacer to use for interlaced video.

- weave - Good for low-motion video; can be used in conjunction with negative "<system>.scanlines" setting values.
- bob - Good for causing a headache. All glory to Bob.
- bob_offset - Good for high-motion video, but is a bit flickery; reduces the subjective vertical resolution.
- blend - Blend fields together; reduces vertical and temporal resolution.
- blend_rg - Like the "blend" deinterlacer, but the blending is done in a manner that respects gamma, reducing unwanted brightness changes, at the cost of increased CPU usage.

video.disable_composition | boolean | 0 1 | 1 | Attempt to disable desktop composition. Currently, this setting only has an effect on Windows Vista and Windows 7(and probably the equivalent server versions as well).

video.driver

enum

default
opengl
softfb

default

Video output driver.

- default - Default
  Selects the default video driver. Currently, this is OpenGL for all platforms, but may change in the future if better platform-specific drivers are added.
- opengl - OpenGL
  All video-related Mednafen features are available with this video driver.
- softfb - Software Blitting to Framebuffer
  Slower with lower-quality scaling than OpenGL, but if you don't have hardware-accelerated OpenGL rendering, it will probably be faster than software OpenGL rendering. Bilinear interpolation not available. OpenGL shaders do not work with this output method, of course.

video.force_bbclear | boolean | 0 1 | 0 | Force backbuffer clear before drawing. Enabling may result in a noticeable negative impact on performance with the "softfb" video driver, and with the "opengl" video driver on underpowered GPUs.
video.frameskip | boolean | 0 1 | 1 | Enable frameskip during emulation rendering. Disable for rendering code performance testing.
video.fs | boolean | 0 1 | 0 | Enable fullscreen mode.
video.fs.display | integer | -1 through 32767 | -1 | Display to use with fullscreen mode. Specify -1 to use the display on which the center of the window lies in windowed mode.

video.glformat

enum

auto
truecolor
hicolor
rgb565
rgb555

auto

Preferred source data pixel format for emulated video.

Using hicolor(RGB555/RGB565) formats may boost performance, but at the cost of color fidelity. Noticeability of color degradation depends on the emulated system and features, such as custom palettes or NTSC blitter, being used. When hicolor format support is not available for the emulation module or special scaler being used, Mednafen will automatically fall back to using a truecolor format. Examine Mednafen's startup output to see the actual OpenGL texture formats being used.

- auto - Auto
  Currently the same as "truecolor", but may automatically select deeper color formats in the future.
- truecolor - Truecolor, 16M colors
  RGB, 8 bits per color component.
- hicolor - Hicolor, 32K/64K colors
  RGB565 or RGB555, with priority given to RGB565.
- rgb565 - RGB565, 64K colors
- rgb555 - RGB555, 32K colors

video.glvsync | boolean | 0 1 | 1 | Attempt to synchronize OpenGL page flips to vertical retrace period.

Setting: | Value Type: | Possible Values: | Default Value: | Description:
--- | --- | --- | --- | ---
<system>.enable | boolean | 0 1 | 1 | Enable (automatic) usage of this module.

<system>.scanlines

integer

-100 through 100

0

Enable scanlines with specified opacity.

Opacity is specified in %; IE a value of "100" will give entirely black scanlines.
Negative values are the same as positive values for non-interlaced video, but for interlaced video will cause the scanlines to be overlaid over the previous(if the "video.deinterlacer" setting is set to "weave", the default) field's lines.

<system>.shader

enum

none
autoip
autoipsharper
scale2x
sabr
ipsharper
ipxnoty
ipynotx
ipxnotysharper
ipynotxsharper
goat

none

Enable specified OpenGL shader.

Obviously, this will only work with the OpenGL "video.driver" setting, and only on cards and OpenGL implementations that support shaders, otherwise you will get a black screen, or Mednafen may display an error message when starting up. When a shader is enabled, the "<system>.videoip" setting is ignored.

- none - None/Disabled
- autoip - Auto Interpolation
  Will automatically interpolate on each axis if the corresponding effective scaling factor is not an integer.
- autoipsharper - Sharper Auto Interpolation
  Same as "autoip", but when interpolation is done, it is done in a manner that will reduce blurriness if possible.
- scale2x - Scale2x
- sabr - SABR v3.0
  GPU-intensive.
- ipsharper - Sharper bilinear interpolation.
- ipxnoty - Linear interpolation on X axis only.
- ipynotx - Linear interpolation on Y axis only.
- ipxnotysharper - Sharper version of "ipxnoty".
- ipynotxsharper - Sharper version of "ipynotx".
- goat - Simple approximation of a color TV CRT look.
  Intended for fullscreen modes with a vertical resolution of around 1000 to 1500 pixels. Doesn't simulate halation and electron beam energy distribution nuances.

<system>.shader.goat.fprog

boolean

0
1

0

Force interlaced video to be treated as progressive.

When disabled, the default, the "video.deinterlacer" setting is effectively ignored with respect to what appears on the screen, unless it's set to "blend" or "blend_rg". When enabled, it may be prudent to disable the scanlines effect controlled by the "<system>.shader.goat.slen" setting, or else the scanline effect may look objectionable.

<system>.shader.goat.hdiv | real | -2.00 through 2.00 | 0.50 | Constant RGB horizontal divergence.

<system>.shader.goat.pat

enum

goatron
borg
slenderman

goatron

Mask pattern.

- goatron - Goatron
  Brightest.
- borg - Borg
  Darkest.
- slenderman - Slenderman
  Spookiest?

<system>.shader.goat.slen | boolean | 0 1 | 1 | Enable scanlines effect.
<system>.shader.goat.tp | real | 0.00 through 1.00 | 0.50 | Transparency of otherwise-opaque mask areas.
<system>.shader.goat.vdiv | real | -2.00 through 2.00 | 0.50 | Constant RGB vertical divergence.

<system>.special

enum

none
hq2x
hq3x
hq4x
scale2x
scale3x
scale4x
2xsai
super2xsai
supereagle
nn2x
nn3x
nn4x
nny2x
nny3x
nny4x

none

Enable specified special video scaler.

The destination rectangle is NOT altered by this setting, so if you have xscale and yscale set to "2", and try to use a 3x scaling filter like hq3x, the image is not going to look that great. The nearest-neighbor scalers are intended for use with bilinear interpolation enabled, for a sharper image, though the "autoipsharper" shader may provide better results.

- none - None/Disabled
- hq2x - hq2x
- hq3x - hq3x
- hq4x - hq4x
- scale2x - scale2x
- scale3x - scale3x
- scale4x - scale4x
- 2xsai - 2xSaI
- super2xsai - Super 2xSaI
- supereagle - Super Eagle
- nn2x - Nearest-neighbor 2x
- nn3x - Nearest-neighbor 3x
- nn4x - Nearest-neighbor 4x
- nny2x - Nearest-neighbor 2x, y axis only
- nny3x - Nearest-neighbor 3x, y axis only
- nny4x - Nearest-neighbor 4x, y axis only

<system>.stretch

enum

0
full
aspect
aspect_int
aspect_mult2

aspect_mult2

Stretch to fill screen.

- 0 - Disabled
- full - Full
  Full-screen stretch, disregarding aspect ratio.
- aspect - Aspect Preserve
  Full-screen stretch as far as the aspect ratio(in this sense, the equivalent xscalefs == yscalefs) can be maintained.
- aspect_int - Aspect Preserve + Integer Scale
  Full-screen stretch, same as "aspect" except that the equivalent xscalefs and yscalefs are rounded down to the nearest integer.
- aspect_mult2 - Aspect Preserve + Integer Multiple-of-2 Scale
  Full-screen stretch, same as "aspect_int", but rounds down to the nearest multiple of 2.

<system>.tblur | boolean | 0 1 | 0 | Enable video temporal blur(50/50 previous/current frame by default).
<system>.tblur.accum | boolean | 0 1 | 0 | Accumulate color data rather than discarding it.
<system>.tblur.accum.amount | real | 0 through 100 | 50 | Blur amount in accumulation mode, specified in percentage of accumulation buffer to mix with the current frame.

<system>.videoip

enum

0
1
x
y

(variable)

Enable (bi)linear interpolation.

- 0 - Disabled
- 1 - Bilinear
- x - Linear (X)
  Interpolation only on the X axis.
- y - Linear (Y)
  Interpolation only on the Y axis.

<system>.xres | integer | 0 through 65536 | 0 | Full-screen horizontal resolution. A value of "0" will cause the current desktop horizontal resolution to be used.
<system>.xscale | real | 0.01 through 256 | (variable) | Scaling factor for the X axis in windowed mode.
<system>.xscalefs | real | 0.01 through 256 | 1.000000 | Scaling factor for the X axis in fullscreen mode. For this setting to have any effect, the "<system>.stretch" setting must be set to "0".
<system>.yres | integer | 0 through 65536 | 0 | Full-screen vertical resolution. A value of "0" will cause the current desktop vertical resolution to be used.
<system>.yscale | real | 0.01 through 256 | (variable) | Scaling factor for the Y axis in windowed mode.
<system>.yscalefs | real | 0.01 through 256 | 1.000000 | Scaling factor for the Y axis in fullscreen mode. For this setting to have any effect, the "<system>.stretch" setting must be set to "0".

<system>.forcemono

- cdplay
- demo
- gb
- gba
- gg
- lynx
- md
- ngp
- pce
- pce_fast
- pcfx
- psx
- sasplay
- sms
- snes
- snes_faust
- ss
- ssfplay
- vb
- wswan

boolean

0
1

0

Force monophonic sound output.

<system>.debugger.disfontsize

- md
- nes
- pce
- pcfx
- psx
- ss
- vb
- wswan

enum

5x7
6x9
6x12
6x13
9x18

5x7

Disassembly font size.

Note: Setting the font size to larger than the default may cause text overlap in the debugger.

- 5x7 - 5x7
- 6x9 - 6x9
- 6x12 - 6x12
- 6x13 - 6x13. CJK support.
- 9x18 - 9x18; CJK support.

<system>.debugger.memcharenc

- md
- nes
- pce
- pcfx
- psx
- ss
- vb
- wswan

string

(variable)

Character encoding for the debugger's memory editor.

### Firmware/BIOS

Some emulation modules require firmware/BIOS images to function. If a firmware path is non-absolute(doesn't begin with C:\ or / or similar), Mednafen will try to load the file relative to the "firmware" directory under the Mednafen base directory. If it doesn't find it there, it will be loaded relative to the Mednafen base directory itself. Of course, if the "path_firmware" setting is set to a custom value, the firmware files will be searched relative to that path.

### Custom Palettes

Custom palettes for a system should generally(with caveats; refer to the table near the end of this section) be named <system>.pal, IE "snes.pal", "pce.pal", etc., and placed in the "palettes" directory beneath the Mednafen base directory.

Per-game custom palettes are also supported, and should be named as <FileBase>.pal or <FileBase>.<MD5 Hash>.pal, IE "Mega Man 4.pal" or "Mega Man 4.db45eb9413964295adb8d1da961807cc.pal".

Each entry in a custom palette file consists of 3 8-bit color components; Red, Green, Blue, in that order.

Not all emulated systems support custom palettes. Refer to the following list:

System Module: | Global Filename: | Description:
--- | --- | ---
apple2 | apple2.pal | RGB mode 16-color(or 32-color for TFR) palette. The presence of a custom palette will automatically enable RGB video mode if an RGB mode is not already selected via the "apple2.video.mode" setting. If the palette has 32 color entries, the text fringe reduction variant of an RGB mode is enabled. 16 or 32 RGB triplets
gb | gb.pal | GameBoy(mono) 4 or 8 or 12 RGB triplets
gbc.pal | GameBoy Color 15-bit BGR 32768 RGB triplets
gba | gba.pal | GBA 15-bit BGR 32768 RGB triplets
gg | gg.pal | GG 12-bit BGR 4096 RGB triplets
lynx | lynx.pal | Atari Lynx 12-bit BRG 4096 RGB triplets
nes | nes-pal.pal | PAL NES 64 or 512 RGB triplets
nes.pal | NTSC NES/Famicom 64 or 512 RGB triplets
rp2c04-0001.pal | Arcade RP2C04-0001 64 RGB triplets
rp2c04-0002.pal | Arcade RP2C04-0002 64 RGB triplets
rp2c04-0003.pal | Arcade RP2C04-0003 64 RGB triplets
rp2c04-0004.pal | Arcade RP2C04-0004 64 RGB triplets
rp2c0x.pal | Arcade RP2C03/RP2C05 64 RGB triplets
pce | pce.pal | PCE/TG16 9-bit GRB. If only 512 triplets are present, the remaining 512 greyscale colors will be calculated automatically. 512 or 1024 RGB triplets
pce_fast | pce_fast.pal | PCE/TG16 9-bit GRB. If only 512 triplets are present, the remaining 512 greyscale colors will be calculated automatically. 512 or 1024 RGB triplets
sms | sms.pal | SMS 6-bit BGR 64 RGB triplets
snes | snes.pal | SNES 15-bit BGR 32768 RGB triplets
vb | vb.pal | VB LED Active Time; 256 left, 256 right. If only 256 triplets are present, then they will be used for both left and right views. When the custom palette's right view colors are the same as the left view colors(either explicitly, or when using a 256-entry custom palette), and anaglyph 3D mode is active, then the custom palette will not be used. 256 or 512 RGB triplets

### Automatic IPS Patching

Place the IPS file in the same directory as the file to load, and name it <FullFileName>.ips.

            Examples:       Boat.nes - Boat.nes.ips
                            Boat.zip - Boat.zip.ips
                            Boat.nes.gz - Boat.nes.gz.ips
                            Boat     - Boat.ips

Some operating systems and environments will hide file extensions. Keep this in mind if you are having trouble.

Patching is applied in a file format-agnostic way; however, dynamic patching is not done with CD images, nor with firmware.

### Screen Snapshots

Raw(ish) screenshots can be taken by pressing the F9 key. Scaled and filtered WYSIWYG-style screenshots can be taken by pressing SHIFT + F9.

Screenshots are saved in the "snaps" directory under the Mednafen base directory, in the PNG file format. The default file naming is like <FileBase>-<Counter>.png, e.g. "Hyper Dyne LuigiFeet-0013.png", but it can be customized to an extent.

## Advanced Usage

### Minimizing video/audio/input Lag

This section is a work-in-progress, tips given may not cover all cases, latency reduction is a black art on modern PCs, etc etc.

Miscellaneous relevant external links:

- http://www.ouma.jp/ootake/delay-solution.html
- http://www.ouma.jp/ootake/delay-win7vista.html
- TFT Central - Input Lag Testing
- An investigation of the test process used to date for determining the response time of an LCD monitor, known as input lag
- Sub 1 frame HDTV/Monitor Input Lag Database
- http://www.tomshardware.com/reviews/s242hl-bid-u2412m-t24a550,3016-14.html
- http://www.tomshardware.com/reviews/ultrasharp-u2711-ds-277w-multisync-pa271w,2968-14.html

#### Hardware Selection

- Video Card:

  > Higher-performing discrete video cards are preferable, but anything with similar or better OpenGL performance to an NVidia GeForce 9500GT should be fine.

- Monitor:

  > Choose a monitor with the lowest input lag(AKA display lag), as well as as a low response time(though response time isn't as an important metric to consider, since it's usually acceptably small on modern end-user PC monitors). Unfortunately, monitor input/display lag is not typically specified by the manufacturer, and it can even vary between different revisions of the same "model".
  > A monitor capable of 120Hz vertical refresh rate operation, and that also has a low average input lag(<16ms), would be ideal.

  > Keep in mind that sometimes the "game mode" of a modern monitor(or TV) must be selected in order for minimum monitor input lag.

  > For the lowest possible video lag, however, obtain and use an old CRT monitor, and set up a video mode with a vertical refresh rate of at least 120Hz.

- Sound Card: (To be written)

#### Settings to Minimize Video Lag

Disabling vsync can also help to reduce keyboard and mouse input lag to a degree, due to the design of common GUI environments and SDL.

Mednafen setting name: | Value for maximum lag reduction:
--- | ---
video.driver | opengl
video.glvsync | 0
video.blit_timesync | 0

Operating System: Disable vsync and triple-buffering if enabled via your card driver's setting utility or control panel.

Operating System: Set the "max frames to render ahead"(NVidia) or "flip queue size"(AMD/ATI) to "0"(zero) in your video card driver's setting utility or control panel(mostly a Windows-specific tip; TODO: verify that it is relevant for OpenGL).

Operating System: Disable window/desktop compositor("Aero" on Windows Vista and newer).

Mednafen: Choose full-screen resolutions, via the x-resolution and y-resolution settings, that match your monitor's native resolution(assuming it has a native resolution).

Mednafen: Avoid using special video filters and scalers(hq2x, 2xsai, scale2x, temporal blur, etc.) in Mednafen. Mednafen's simple pixel shaders are ok, provided you have a decent video card as specified in the hardware selection section above.

#### Settings to Minimize Audio Lag

Mednafen: Select a sound driver that is closer to the actual hardware, such as "alsa" on Linux, "oss" on other UN*X platforms, and "wasapi" on Windows Vista and newer. If you choose to use "OSS", heed the advice regarding osscore.conf and max_intrate.

Mednafen: Select a sound device that is closest to the actual hardware; IE "hw:0", "hw:1", "hw:2", etc. on ALSA.
Avoid selecting a higher-level sound device that is routed through a sound server like PulseAudio!

Mednafen: Select a sound buffer size that is as small as possible without causing excessive crackling or speed issues(20ms should be a fairly safe setting with ALSA on a modern multi-core CPU system).

Mednafen: Optionally set the sound period size setting to 500(microseconds).
Note: The system sound card driver may not handle a value this small correctly, and may cause sound card or system malfunctions. Additionally, the system sound card driver may constrain the sound buffer size to an unusably small value.

Mednafen: Set the sound rate setting to your sound card's native playback rate, IE the rate which has the minimum amount of processing done to it before being passed to the DAC or digital output. This tends to be "192000" or "96000" on modern sound cards, "48000" on older(late 1990s, early 2000s), and "44100" on older still(early to mid 1990s). If you don't know, just leave it at the default of "48000".

Operating System: Disable 3D spatialization, equalizer, and other special effects via your sound card driver's setting utility or control panel, if applicable.

### Input Mapping Settings Format

The general format of an input mapping is: DEVICE_TYPE DEVICE_ID DEVICE_INPUT [SCALE] [LOGIC] [...]

DEVICE_TYPE is one of "keyboard", "mouse", or "joystick".

DEVICE_ID is the ID Mednafen uses for the device to differentiate it from other devices of the same type. Currently, only "0x0" is allowed for the "keyboard" and "mouse" DEVICE_TYPE. The IDs Mednafen uses for the "joystick" type are printed to stdout on startup, like so:

>      Initializing joysticks...
>       ID: 0x00030428400101000002000a00000000 - Gravis GamePad Pro USB
>       ID: 0x00030e8f000301100007000c00000000 - GreenAsia Inc.    USB Joystick
>       ID: 0x0003046dc21e20200008000b00000000 - Generic X-Box pad
>       ID: 0x0003045e003801100006000800000000 - Microsoft SideWinder Precision 2 Joystick
>       ID: 0x00030428400101000002000a00000001 - Gravis GamePad Pro USB
>       ID: 0x0003046dc21a01100002000a00000000 - Logitech Logitech(R) Precision(TM) Gamepad
>       ID: 0x0003045e020201000008000a00000000 - Microsoft X-Box pad v1 (US)
>       ID: 0x00140007000101000002000a00000000 - Microsoft SideWinder GamePad
>       ID: 0x00140007000101000002000a00000001 - Microsoft SideWinder GamePad
>       ID: 0x00140007000101000002000a00000002 - Microsoft SideWinder GamePad

DEVICE_INPUT is a string, without any whitespace inside, specific to the device type being used.

SCALE is an optional integer between 0-65535, representing a 4.12 fixed-point quantity used to scale analog(e.g. axis) inputs in most usage contexts. The default is 4096(equivalent to 1.0).

LOGIC is an optional string, "||" or "&&" or "&!", specifying a boolean operation, OR and AND and AND NOT respectively, used to join multiple physical input specifications together. Evaluated left to right, with "&&" and "&!" having the same higher precedence over "||". The exact behavior and semantics when used with a virtual input that expects an analog value is currently unspecified and may be subject to change, but will generally allow control from any of the specified physical inputs when they are manipulated individually.

#### Keyboard

SCANCODE[MODIFIER]...

Scancode: Numeric decimal value, 0 through 511, representing physical key position. Refer to the SDL2 scancode header file for a full list, or section 10 "Keyboard/Keypad Page (0x07)" of the USB HID Usage Tables document for a more basic list.

Modifiers: (only valid with command key mappings)

- +ctrl
- +alt
- +shift

#### Mouse

- (cursor|rel)_(x|y)(-|+|-+|+-)
- button_(left|middle|right|x1|x2|0| ... |31)

#### Joystick

When manually mapping the axes of an emulated lightgun to the axes of a physical lightgun that presents itself as a joystick device, use the optional "g" flag with "-+" polarity(e.g. "abs_0-+g").

- abs_(0| ... |1023)(-|+|-+|+-)[g]
- button_(0| ... |1023)

### Environment Variables

Mednafen-specific environment variables:
Name: | Description:
--- | ---
MEDNAFEN_HOME | Directly specifies Mednafen's base directory.
MEDNAFEN_ALLOWMULTI | When set to a non-zero integer, bypasses the protection against running multiple instances of Mednafen using the same base directory.
MEDNAFEN_NOPOPUPS | When set to a non-zero integer, on Microsoft Windows, disables popup error message dialog boxes.
MEDNAFEN_NOSTDREDIR | When set to a non-zero integer, on Microsoft Windows, disables the redirection of stdout and stderr to files "stdout.txt" and "stderr.txt" that normally occurs when Mednafen is not started from a console window.

## Troubleshooting and Common Solutions

When Mednafen encounters a fatal error, it will print details of the error to stdout and/or stderr before exiting. On the Microsoft Windows builds of Mednafen, when Mednafen is not being run from a console, stdout and stderr are redirected to files "stdout.txt" and "stderr.txt", respectively.

### No sound output on Linux.

Due to historical Linux distribution design decisions and problems with various software audio mixing solutions on Linux, Mednafen's ALSA output code attempts to output to device "hw:0" by default. This may cause problems if your sound card does not support hardware mixing of streams and your system is running another program that is monopolizing the sound device(like the PulseAudio server), or you have used multiple sound cards.

For the case of PulseAudio, you can utilize the pasuspender tool, or set the sound.device setting to "sexyal-literal-default" to try to use PulseAudio through ALSA(assuming your distribution has things configured properly); the use of pasuspender is the recommended option.

For the case of multiple sound cards, select a different "hw:?" device, where ? is an integer representing the device number/index(check the contents of file "/proc/asound/cards").

### Configuration file is a mess in Notepad in Windows.

Mednafen's settings file currently uses UN*X-style line breaks, which Notepad does not handle very well. Use Notepad++ instead.

## Licenses, Copyright Notices, and Code Credits

Mednafen makes use of much open-source code from other people, and could not be what it is without their work. Feel free to give them your thanks, but keep in mind most have nothing to do with the Mednafen project, so don't ask them questions regarding Mednafen unless appropriate in context.

### libmpcdec

>       Copyright (c) 2005-2009, The Musepack Development Team
>       All rights reserved.

>       Redistribution and use in source and binary forms, with or without
>       modification, are permitted provided that the following conditions are
>       met:

>       * Redistributions of source code must retain the above copyright
>       notice, this list of conditions and the following disclaimer.

>       * Redistributions in binary form must reproduce the above
>       copyright notice, this list of conditions and the following
>       disclaimer in the documentation and/or other materials provided
>       with the distribution.

>       * Neither the name of the The Musepack Development Team nor the
>       names of its contributors may be used to endorse or promote
>       products derived from this software without specific prior
>       written permission.

>       THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
>       "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
>       LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
>       A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
>       OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
>       SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
>       LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
>       DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
>       THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
>       (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
>       OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

### Tremor

>     Copyright (c) 2002, Xiph.org Foundation

>     Redistribution and use in source and binary forms, with or without
>     modification, are permitted provided that the following conditions
>     are met:

>     - Redistributions of source code must retain the above copyright
>     notice, this list of conditions and the following disclaimer.

>     - Redistributions in binary form must reproduce the above copyright
>     notice, this list of conditions and the following disclaimer in the
>     documentation and/or other materials provided with the distribution.

>     - Neither the name of the Xiph.org Foundation nor the names of its
>     contributors may be used to endorse or promote products derived from
>     this software without specific prior written permission.

>     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
>     ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
>     LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
>     A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION
>     OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
>     SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
>     LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
>     DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
>     THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
>     (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
>     OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

### MiniLZO

>        Copyright (C) 1996-2015 Markus Franz Xaver Johannes Oberhumer
>        All Rights Reserved.

>        The LZO library is free software; you can redistribute it and/or
>        modify it under the terms of the GNU General Public License as
>        published by the Free Software Foundation; either version 2 of
>        the License, or (at your option) any later version.

>        The LZO library is distributed in the hope that it will be useful,
>        but WITHOUT ANY WARRANTY; without even the implied warranty of
>        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
>        GNU General Public License for more details.

>        You should have received a copy of the GNU General Public License
>        along with the LZO library; see the file COPYING.
>        If not, write to the Free Software Foundation, Inc.,
>        51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

>        Markus F.X.J. Oberhumer
>        <markus@oberhumer.com>
>        http://www.oberhumer.com/opensource/lzo/

### QuickLZ

>     // QuickLZ data compression library
>     // Copyright (C) 2006-2008 Lasse Mikkel Reinhold
>     // lar@quicklz.com
>     //
>     // QuickLZ can be used for free under the GPL-1 or GPL-2 license (where anything
>     // released into public must be open source) or under a commercial license if such
>     // has been acquired (see http://www.quicklz.com/order.html). The commercial license
>     // does not cover derived or ported versions created by third parties under GPL.

### Zstandard

>     /*
>      * Copyright (c) Yann Collet, Facebook, Inc.
>      * All rights reserved.
>      *
>      * This source code is licensed under both the BSD-style license (found in the
>      * LICENSE file in the root directory of this source tree) and the GPLv2 (found
>      * in the COPYING file in the root directory of this source tree).
>      * You may select, at your option, one of the above-listed licenses.
>      */

### trio

>      * Copyright (C) 1998, 2009 Bjorn Reese and Daniel Stenberg.
>      * Copyright (C) 2001 Bjorn Reese <breese@users.sourceforge.net>
>      * Copyright (C) 2001 Bjorn Reese and Daniel Stenberg.
>      *
>      * Permission to use, copy, modify, and distribute this software for any
>      * purpose with or without fee is hereby granted, provided that the above
>      * copyright notice and this permission notice appear in all copies.
>      *
>      * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
>      * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
>      * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE AUTHORS AND
>      * CONTRIBUTORS ACCEPT NO RESPONSIBILITY IN ANY CONCEIVABLE MANNER.
>      *

### Speex Resampler

>     /* Copyright (C) 2007-2008 Jean-Marc Valin
>        Copyright (C) 2008      Thorvald Natvig

>        File: resample.c
>        Arbitrary resampling code

>        Redistribution and use in source and binary forms, with or without
>        modification, are permitted provided that the following conditions are
>        met:

>        1. Redistributions of source code must retain the above copyright notice,
>        this list of conditions and the following disclaimer.

>        2. Redistributions in binary form must reproduce the above copyright
>        notice, this list of conditions and the following disclaimer in the
>        documentation and/or other materials provided with the distribution.

>        3. The name of the author may not be used to endorse or promote products
>        derived from this software without specific prior written permission.

>        THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
>        IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
>        OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
>        DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
>        INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
>        (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
>        SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
>        HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
>        STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
>        ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
>        POSSIBILITY OF SUCH DAMAGE.
>     */

### ffmpeg cputest

>     /*
>      * CPU detection code, extracted from mmx.h
>      * (c)1997-99 by H. Dietz and R. Fisher
>      * Converted to C and improved by Fabrice Bellard.
>      *
>      * This file is part of FFmpeg.
>      *
>      * FFmpeg is free software; you can redistribute it and/or
>      * modify it under the terms of the GNU Lesser General Public
>      * License as published by the Free Software Foundation; either
>      * version 2.1 of the License, or (at your option) any later version.
>      *
>      * FFmpeg is distributed in the hope that it will be useful,
>      * but WITHOUT ANY WARRANTY; without even the implied warranty of
>      * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
>      * Lesser General Public License for more details.
>      *
>      * You should have received a copy of the GNU Lesser General Public
>      * License along with FFmpeg; if not, write to the Free Software
>      * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
>      */

### CD-ROM data correction code

>     /*  dvdisaster: Additional error correction for optical media.
>      *  Copyright (C) 2004-2007 Carsten Gnoerlich.
>      *  Project home page: http://www.dvdisaster.com
>      *  Email: carsten@dvdisaster.com  -or-  cgnoerlich@fsfe.org
>      *
>      *  The Reed-Solomon error correction draws a lot of inspiration - and even code -
>      *  from Phil Karn's excellent Reed-Solomon library: http://www.ka9q.net/code/fec/
>      *
>      *  This program is free software; you can redistribute it and/or modify
>      *  it under the terms of the GNU General Public License as published by
>      *  the Free Software Foundation; either version 2 of the License, or
>      *  (at your option) any later version.
>      *
>      *  This program is distributed in the hope that it will be useful,
>      *  but WITHOUT ANY WARRANTY; without even the implied warranty of
>      *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
>      *  GNU General Public License for more details.
>      *
>      *  You should have received a copy of the GNU General Public License
>      *  along with this program; if not, write to the Free Software
>      *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA,
>      *  or direct your browser at http://www.gnu.org.
>      */

### CD-ROM L-EC generation code

>     /*  cdrdao - write audio CD-Rs in disc-at-once mode
>      *
>      *  Copyright (C) 1998-2002 Andreas Mueller <andreas@daneb.de>
>      *
>      *  This program is free software; you can redistribute it and/or modify
>      *  it under the terms of the GNU General Public License as published by
>      *  the Free Software Foundation; either version 2 of the License, or
>      *  (at your option) any later version.
>      *
>      *  This program is distributed in the hope that it will be useful,
>      *  but WITHOUT ANY WARRANTY; without even the implied warranty of
>      *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
>      *  GNU General Public License for more details.
>      *
>      *  You should have received a copy of the GNU General Public License
>      *  along with this program; if not, write to the Free Software
>      *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
>      */

### Scale2x

>      * Copyright (C) 2001, 2002, 2003, 2004 Andrea Mazzoleni
>      *
>      * This program is free software; you can redistribute it and/or modify
>      * it under the terms of the GNU General Public License as published by
>      * the Free Software Foundation; either version 2 of the License, or
>      * (at your option) any later version.
>      *
>      * This program is distributed in the hope that it will be useful,
>      * but WITHOUT ANY WARRANTY; without even the implied warranty of
>      * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
>      * GNU General Public License for more details.
>      *
>      * You should have received a copy of the GNU General Public License
>      * along with this program; if not, write to the Free Software
>      * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

### hq2x, hq3x, hq4x

>     //Copyright (C) 2003 MaxSt ( maxst@hiend3d.com )

>     //This program is free software; you can redistribute it and/or
>     //modify it under the terms of the GNU Lesser General Public
>     //License as published by the Free Software Foundation; either
>     //version 2.1 of the License, or (at your option) any later version.
>     //
>     //This program is distributed in the hope that it will be useful,
>     //but WITHOUT ANY WARRANTY; without even the implied warranty of
>     //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
>     //Lesser General Public License for more details.
>     //
>     //You should have received a copy of the GNU Lesser General Public
>     //License along with this program; if not, write to the Free Software
>     //Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

### 2xSaI

>     /* 2xSaI
>      * Copyright (c) Derek Liauw Kie Fa, 1999-2002
>      *
>      * This program is free software; you can redistribute it and/or modify
>      * it under the terms of the GNU General Public License as published by
>      * the Free Software Foundation; either version 2 of the License, or
>      * (at your option) any later version.
>      *
>      * This program is distributed in the hope that it will be useful,
>      * but WITHOUT ANY WARRANTY; without even the implied warranty of
>      * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
>      * GNU General Public License for more details.
>      *
>      * You should have received a copy of the GNU General Public License
>      * along with this program; if not, write to the Free Software
>      * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
>      */
>     /* http://lists.fedoraproject.org/pipermail/legal/2009-October/000928.html */

### SABR v3.0 Shader

>             SABR v3.0 Shader
>             Joshua Street

>             Portions of this algorithm were taken from Hyllian's 5xBR v3.7c
>             shader.

>             This program is free software; you can redistribute it and/or
>             modify it under the terms of the GNU General Public License
>             as published by the Free Software Foundation; either version 2
>             of the License, or (at your option) any later version.

>             This program is distributed in the hope that it will be useful,
>             but WITHOUT ANY WARRANTY; without even the implied warranty of
>             MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
>             GNU General Public License for more details.

>             You should have received a copy of the GNU General Public License
>             along with this program; if not, write to the Free Software
>             Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

### nes_ntsc

>     /* Copyright (C) 2006 Shay Green. This module is free software; you
>     can redistribute it and/or modify it under the terms of the GNU Lesser
>     General Public License as published by the Free Software Foundation; either
>     version 2.1 of the License, or (at your option) any later version. This
>     module is distributed in the hope that it will be useful, but WITHOUT ANY
>     WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
>     FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
>     more details. You should have received a copy of the GNU Lesser General
>     Public License along with this module; if not, write to the Free Software
>     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */

### Gb_Snd_Emu

>     /* Library Copyright (C) 2003-2004 Shay Green. Gb_Snd_Emu is free
>     software; you can redistribute it and/or modify it under the terms of the
>     GNU General Public License as published by the Free Software Foundation;
>     either version 2 of the License, or (at your option) any later version.
>     Gb_Snd_Emu is distributed in the hope that it will be useful, but WITHOUT
>     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
>     FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
>     more details. You should have received a copy of the GNU General Public
>     License along with Gb_Snd_Emu; if not, write to the Free Software
>     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */

### Blip_Buffer

>     Copyright (C) 2003-2006 Shay Green. This module is free software; you
>     can redistribute it and/or modify it under the terms of the GNU Lesser
>     General Public License as published by the Free Software Foundation; either
>     version 2.1 of the License, or (at your option) any later version. This
>     module is distributed in the hope that it will be useful, but WITHOUT ANY
>     WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
>     FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
>     more details. You should have received a copy of the GNU Lesser General
>     Public License along with this module; if not, write to the Free Software
>     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

### Sms_Snd_Emu(base for T6W28_Apu NGP code)

>     Copyright (C) 2003-2006 Shay Green. This module is free software; you
>     can redistribute it and/or modify it under the terms of the GNU Lesser
>     General Public License as published by the Free Software Foundation; either
>     version 2.1 of the License, or (at your option) any later version. This
>     module is distributed in the hope that it will be useful, but WITHOUT ANY
>     WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
>     FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
>     more details. You should have received a copy of the GNU Lesser General
>     Public License along with this module; if not, write to the Free Software
>     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

### V810 Emulator

>      * Copyright (C) 2006 David Tucker
>      *
>      * This program is free software; you can redistribute it and/or modify
>      * it under the terms of the GNU General Public License as published by
>      * the Free Software Foundation; either version 2 of the License, or
>      * (at your option) any later version.
>      *
>      * This program is distributed in the hope that it will be useful,
>      * but WITHOUT ANY WARRANTY; without even the implied warranty of
>      * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
>      * GNU General Public License for more details.
>      *
>      * You should have received a copy of the GNU General Public License
>      * along with this program; if not, write to the Free Software
>      * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

### Fuse Z80 emulation code

>        Copyright (c) 1999-2005 Philip Kendall, Witold Filipczyk
>        Copyright (c) 1999-2011 Philip Kendall

>        This program is free software; you can redistribute it and/or modify
>        it under the terms of the GNU General Public License as published by
>        the Free Software Foundation; either version 2 of the License, or
>        (at your option) any later version.

>        This program is distributed in the hope that it will be useful,
>        but WITHOUT ANY WARRANTY; without even the implied warranty of
>        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
>        GNU General Public License for more details.

>        You should have received a copy of the GNU General Public License along
>        with this program; if not, write to the Free Software Foundation, Inc.,
>        51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

>        Author contact information:

>        E-mail: philip-fuse@shadowmagic.org.uk

### VRC7 Sound Emulation

>     /*
>     YM2413 emulator written by Mitsutaka Okazaki 2001

>     Permission is granted to anyone to use this software for any purpose,
>     including commercial applications. To alter this software and redistribute it freely,
>     if the origin of this software is not misrepresented.
>     */

### NEC V30MZ Emulator

>     /* This NEC V30MZ emulator may be used for purposes both commercial and noncommercial if you give the author, Bryan McPhail,
>        a small credit somewhere(such as in the documentation for an executable package).
>     */

### NEC V30MZ disassembler(modified BOCHS x86 disassembler)

> Caution: Bochs' code is under the LGPL, but it is unclear if "or (at your option) any later version." applies to the x86 disassembler code.

>     This library is free software; you can redistribute it and/or
>     modify it under the terms of the GNU Lesser General Public
>     License as published by the Free Software Foundation; either
>     version 2 of the License, or (at your option) any later version.

>     This library is distributed in the hope that it will be useful,
>     but WITHOUT ANY WARRANTY; without even the implied warranty of
>     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
>     Lesser General Public License for more details.

>     You should have received a copy of the GNU Lesser General Public
>     License along with this library; if not, write to the Free Software
>     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

### EMU2413(used in SMS emulation)

>       Copyright (C) Mitsutaka Okazaki 2004

>       This software is provided 'as-is', without any express or implied warranty.
>       In no event will the authors be held liable for any damages arising from
>       the use of this software.

>       Permission is granted to anyone to use this software for any purpose,
>       including commercial applications, and to alter it and redistribute it
>       freely, subject to the following restrictions:

>       1. The origin of this software must not be misrepresented; you must not
>          claim that you wrote the original software. If you use this software
>          in a product, an acknowledgment in the product documentation would be
>          appreciated but is not required.
>       2. Altered source versions must be plainly marked as such, and must not
>          be misrepresented as being the original software.
>       3. This notice may not be removed or altered from any source distribution.

### YM2612 Emulator

>     /* Copyright (C) 2002 St�phane Dallongeville (gens AT consolemul.com) */
>     /* Copyright (C) 2004-2006 Shay Green. This module is free software; you
>     can redistribute it and/or modify it under the terms of the GNU Lesser
>     General Public License as published by the Free Software Foundation; either
>     version 2.1 of the License, or (at your option) any later version. This
>     module is distributed in the hope that it will be useful, but WITHOUT ANY
>     WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
>     FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
>     details. You should have received a copy of the GNU Lesser General Public
>     License along with this module; if not, write to the Free Software Foundation,
>     Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */

### Sega Genesis SVP/SSP16 Emulator

>     /*
>      * basic, incomplete SSP160x (SSP1601?) interpreter
>      * with SVP memory controller emu
>      *
>      * Copyright (c) Gražvydas "notaz" Ignotas, 2008
>      *
>      * Redistribution and use in source and binary forms, with or without
>      * modification, are permitted provided that the following conditions are met:
>      *     * Redistributions of source code must retain the above copyright
>      *       notice, this list of conditions and the following disclaimer.
>      *     * Redistributions in binary form must reproduce the above copyright
>      *       notice, this list of conditions and the following disclaimer in the
>      *       documentation and/or other materials provided with the distribution.
>      *     * Neither the name of the organization nor the
>      *       names of its contributors may be used to endorse or promote products
>      *       derived from this software without specific prior written permission.
>      *
>      * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
>      * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
>      * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
>      * ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
>      * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
>      * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
>      * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
>      * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
>      * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
>      * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
>      */

### PC2e (Used in portions of PC Engine CD emulation)

>             Copyright (C) 2004 Ki

>         This program is free software; you can redistribute it and/or modify
>         it under the terms of the GNU General Public License as published by
>         the Free Software Foundation; either version 2 of the License, or
>         (at your option) any later version.

>         This program is distributed in the hope that it will be useful,
>         but WITHOUT ANY WARRANTY; without even the implied warranty of
>         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
>         GNU General Public License for more details.

### Handy

>     Copyright (c) 2004 K. Wilkins

>     This software is provided 'as-is', without any express or implied warranty.
>     In no event will the authors be held liable for any damages arising from
>     the use of this software.

>     Permission is granted to anyone to use this software for any purpose,
>     including commercial applications, and to alter it and redistribute it
>     freely, subject to the following restrictions:

>     1. The origin of this software must not be misrepresented; you must not
>        claim that you wrote the original software. If you use this software
>        in a product, an acknowledgment in the product documentation would be
>        appreciated but is not required.

>     2. Altered source versions must be plainly marked as such, and must not
>        be misrepresented as being the original software.

>     3. This notice may not be removed or altered from any source distribution.

### VisualBoyAdvance GameBoy and GBA code

>     // VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
>     // Copyright (C) 1999-2003 Forgotten
>     // Copyright (C) 2004-2006 Forgotten and the VBA development team

>     // This program is free software; you can redistribute it and/or modify
>     // it under the terms of the GNU General Public License as published by
>     // the Free Software Foundation; either version 2, or(at your option)
>     // any later version.
>     //
>     // This program is distributed in the hope that it will be useful,
>     // but WITHOUT ANY WARRANTY; without even the implied warranty of
>     // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
>     // GNU General Public License for more details.
>     //
>     // You should have received a copy of the GNU General Public License
>     // along with this program; if not, write to the Free Software Foundation,
>     // Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

### NeoPop Neo Geo Pocket (Color) Code

>     //---------------------------------------------------------------------------
>     // NEOPOP : Emulator as in Dreamland
>     //
>     // Copyright (c) 2001-2002 by neopop_uk
>     //---------------------------------------------------------------------------
>     //      This program is free software; you can redistribute it and/or modify
>     //      it under the terms of the GNU General Public License as published by
>     //      the Free Software Foundation; either version 2 of the License, or
>     //      (at your option) any later version. See also the license.txt file for
>     //      additional informations.

### Cygne

Cygne is distributed under the terms of the GNU GPL Version 2, 1991.
Copyright 2002 Dox, dox@space.pl.

### FCE Ultra

>     /* FCE Ultra - NES/Famicom Emulator
>      *
>      *  Copyright (C) 1998 BERO
>      *  Copyright (C) 2002 Xodnizel
>      *  Copyright (C) 2003 CaH4e3
>      *
>      * This program is free software; you can redistribute it and/or modify
>      * it under the terms of the GNU General Public License as published by
>      * the Free Software Foundation; either version 2 of the License, or
>      * (at your option) any later version.
>      *
>      * This program is distributed in the hope that it will be useful,
>      * but WITHOUT ANY WARRANTY; without even the implied warranty of
>      * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
>      * GNU General Public License for more details.
>      *
>      * You should have received a copy of the GNU General Public License
>      * along with this program; if not, write to the Free Software
>      * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
>      */

### SMS Plus

>         Copyright (C) 1998-2004  Charles MacDonald

>         This program is free software; you can redistribute it and/or modify
>         it under the terms of the GNU General Public License as published by
>         the Free Software Foundation; either version 2 of the License, or
>         (at your option) any later version.

>         This program is distributed in the hope that it will be useful,
>         but WITHOUT ANY WARRANTY; without even the implied warranty of
>         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
>         GNU General Public License for more details.

>         You should have received a copy of the GNU General Public License
>         along with this program; if not, write to the Free Software
>         Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

### Genesis Plus

>     /*
>         Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003  Charles Mac Donald

>         This program is free software; you can redistribute it and/or modify
>         it under the terms of the GNU General Public License as published by
>         the Free Software Foundation; either version 2 of the License, or
>         (at your option) any later version.

>         This program is distributed in the hope that it will be useful,
>         but WITHOUT ANY WARRANTY; without even the implied warranty of
>         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
>         GNU General Public License for more details.

>         You should have received a copy of the GNU General Public License
>         along with this program; if not, write to the Free Software
>         Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
>     */

### Genesis Plus GX

>      *
>      *  Copyright (C) 2007, 2008, 2009 EkeEke
>      *
>      * This program is free software; you can redistribute it and/or modify
>      * it under the terms of the GNU General Public License as published by
>      * the Free Software Foundation; either version 2 of the License, or
>      * (at your option) any later version.
>      *
>      * This program is distributed in the hope that it will be useful,
>      * but WITHOUT ANY WARRANTY; without even the implied warranty of
>      * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
>      * GNU General Public License for more details.
>      *
>      * You should have received a copy of the GNU General Public License
>      * along with this program; if not, write to the Free Software
>      * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

### libco

>     ISC License (ISC)

>     Copyright byuu and the higan team

>     Permission to use, copy, modify, and/or distribute this software for any
>     purpose with or without fee is hereby granted, provided that the above
>     copyright notice and this permission notice appear in all copies.

>     THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
>     REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
>     FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
>     INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
>     LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
>     OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
>     PERFORMANCE OF THIS SOFTWARE.

### libFLAC

>     Copyright (C) 2000-2009  Josh Coalson
>     Copyright (C) 2011-2016  Xiph.Org Foundation

>     Redistribution and use in source and binary forms, with or without
>     modification, are permitted provided that the following conditions
>     are met:

>     - Redistributions of source code must retain the above copyright
>     notice, this list of conditions and the following disclaimer.

>     - Redistributions in binary form must reproduce the above copyright
>     notice, this list of conditions and the following disclaimer in the
>     documentation and/or other materials provided with the distribution.

>     - Neither the name of the Xiph.org Foundation nor the names of its
>     contributors may be used to endorse or promote products derived from
>     this software without specific prior written permission.

>     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
>     ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
>     LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
>     A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR
>     CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
>     EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
>     PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
>     PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
>     LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
>     NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
>     SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

### libogg

>     Copyright (c) 2002, Xiph.org Foundation

>     Redistribution and use in source and binary forms, with or without
>     modification, are permitted provided that the following conditions
>     are met:

>     - Redistributions of source code must retain the above copyright
>     notice, this list of conditions and the following disclaimer.

>     - Redistributions in binary form must reproduce the above copyright
>     notice, this list of conditions and the following disclaimer in the
>     documentation and/or other materials provided with the distribution.

>     - Neither the name of the Xiph.org Foundation nor the names of its
>     contributors may be used to endorse or promote products derived from
>     this software without specific prior written permission.

>     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
>     ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
>     LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
>     A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION
>     OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
>     SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
>     LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
>     DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
>     THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
>     (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
>     OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

### libiconv

>      * The GNU LIBICONV Library is free software; you can redistribute it
>      * and/or modify it under the terms of the GNU Library General Public
>      * License as published by the Free Software Foundation; either version 2
>      * of the License, or (at your option) any later version.
>      *
>      * The GNU LIBICONV Library is distributed in the hope that it will be
>      * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
>      * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
>      * Library General Public License for more details.
>      *
>      * You should have received a copy of the GNU Library General Public
>      * License along with the GNU LIBICONV Library; see the file COPYING.LIB.
>      * If not, see <http://www.gnu.org/licenses/>.

### SDL2

>     Simple DirectMedia Layer
>     Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>

>     This software is provided 'as-is', without any express or implied
>     warranty.  In no event will the authors be held liable for any damages
>     arising from the use of this software.

>     Permission is granted to anyone to use this software for any purpose,
>     including commercial applications, and to alter it and redistribute it
>     freely, subject to the following restrictions:

>     1. The origin of this software must not be misrepresented; you must not
>        claim that you wrote the original software. If you use this software
>        in a product, an acknowledgment in the product documentation would be
>        appreciated but is not required.
>     2. Altered source versions must be plainly marked as such, and must not be
>        misrepresented as being the original software.
>     3. This notice may not be removed or altered from any source distribution.

### zlib

>     Copyright notice:

>      (C) 1995-2022 Jean-loup Gailly and Mark Adler

>       This software is provided 'as-is', without any express or implied
>       warranty.  In no event will the authors be held liable for any damages
>       arising from the use of this software.

>       Permission is granted to anyone to use this software for any purpose,
>       including commercial applications, and to alter it and redistribute it
>       freely, subject to the following restrictions:

>       1. The origin of this software must not be misrepresented; you must not
>          claim that you wrote the original software. If you use this software
>          in a product, an acknowledgment in the product documentation would be
>          appreciated but is not required.
>       2. Altered source versions must be plainly marked as such, and must not be
>          misrepresented as being the original software.
>       3. This notice may not be removed or altered from any source distribution.

>       Jean-loup Gailly        Mark Adler
>       jloup@gzip.org          madler@alumni.caltech.edu

>     If you use the zlib library in a product, we would appreciate *not* receiving
>     lengthy legal documents to sign.  The sources are provided for free but without
>     warranty of any kind.  The library has been entirely written by Jean-loup
>     Gailly and Mark Adler; it does not include third-party code.  We make all
>     contributions to and distributions of this project solely in our personal
>     capacity, and are not conveying any rights to any intellectual property of
>     any third parties.

>     If you redistribute modified sources, we would appreciate that you include in
>     the file ChangeLog history information documenting your changes.  Please read
>     the FAQ for more information on the distribution of modified source versions.