# Mednafen

# General Documentation

Last updated February 23, 2006
Valid as of Mednafen 0.5.0

Table of Contents:

Introduction
Core Features

- NES
  CPU
  PPU
  Palettes
  Sound
  Input
  Zapper
  File Formats/Expansion Hardware
  iNES Format
  UNIF
  Famicom Disk System
  Game Genie
  VS Unisystem

- Atari Lynx
- PC Engine/SuperGrafx
- Automatic IPS Patching

- Using Mednafen

- Key Assignments

- NES

VS Unisystem
Famicom Disk System
Barcode Readers
Game Pad
Power Pad
Family Keyboard
HyperShot Controller
Mahjong Controller
Quiz King Controller

- Atari Lynx
- GameBoy/GameBoy Color/GameBoy Advance
- PC Engine(Turbo Grafx 16)/SuperGrafx

Command line

- Cheat Guide
- Game-specific Emulation Hacks
- Credits

## Introduction

Mednafen is an NTSC and PAL NES and Famicom, GameBoy, GameBoy Color, GameBoy Advance, Atari Lynx, PC Engine, and SuperGrafx emulator for various platforms. It is primarily based off the last publicly released version of FCE Ultra, with code from VisualBoy Advance for GB(A) emulation, and Handy for Lynx emulation.

This document has been arranged to keep user interface details and emulation details as separate as possible, though this has not been accomplished entirely.

In several places references are made to the "base directory". If you are running a port on a UN*X-like system(Linux/*BSD/Mac OSX/SunOS/etc.), the base directory is "~/.mednafen", or in other words, "your home directory plus .mednafen". For all other ports(including DOS and MS Windows), the base directory is the directory that the executable is in.

Mednafen includes or links with the following software packages and programs, so give the developers lots of thanks sometime(NOTE they do not provide user support for Mednafen, so don't ask them questions about Mednafen)!

- Blip_Buffer - Used in Atari Lynx, GB/GBC/GBA, and PC Engine sound emulation code.
- FCE Ultra - NES/Famicom emulation.
- Fidlib - Low pass filter used in Atari Lynx emulation.
- Handy - Atari Lynx emulation.
- hq2x/hq3x/hq4x - Pretty real-time(kind of ;)) image magnification filter.
- libcdio - CD access routines used in PCE CD emulation.
- libogg+libvorbis Used for Ogg Vorbis playback with PCE CD emulation.
- libsndfile - Used for WAVE file playback with PCE CD emulation and WAVE file recording.
- miniLZO - Real-time (de)compression of save-states used in game rewinding.
- Scale2x - Pretty non-blurring real-time image magnification filter.
- SDL - System interfaces for video blitting, sound output, input, etc.
- SDL_net - Used in network play code.
- Trio - *printf replacement functions for portability.
- VisualBoy Advance - GameBoy, GameBoy Color, and GameBoy Advance emulation.
- zlib - General (de)compressor used with network play and PNG snapshot saving.

## Core Features

- Double-buffered video, enabled by default.
- Multi-threaded video blitting, allowing for a kind of software triple-buffering, and improving performance on SMP systems.
- Joystick support.
- Extremely versatile input configuration system; assign multiple physical buttons to a virtual button or action.
- Full-screen modes.
- Save states.
- Real-time game rewinding, up to 10 seconds.
- Screen snapshots, saved in PNG format.
- Loading games from gzip and (pk)zip compressed archives.

- ### NES

  - ### CPU

    - All 256, official and unofficial, 2A03 opcodes emulated.

  - ### PPU

    - 8x8 and 8x16 sprites.
    - Sprite hit emulation(including checking the bg color).
    - 8 sprite limit(and flag emulation).
    - Screen/Sprite disabling, with correct color replacement.
    - Color deemphasis(probably not 100% correct, more research is needed).
    - Strip colorburst bit emulated.
    - CPU-instruction granularity for special mid-scanline effects(mostly CHR switching, such as used in "Pirates!", "Marble Madness", and "Mother").

    - #### Palettes

      Mednafen has many palette features, including loading a custom palette to replace the default NES palette. The palette from an NTSC NES can also be generated on-the-fly.

      First, a note on on the format of external palettes; Palette files are expected to contain 64 8-bit RGB triplets(each in that order; red comes first in the triplet in the file, then green, then blue). Each 8-bit value represents brightness for that particular color. 0 is minimum, 255 is maximum.

      Palettes can be set on a per-game basis. To do this, put a palette file in the "gameinfo" directory with the same base filename as the game you wish to associate with and add the extension "pal". Examples:

                          File name:              Palette file name:
                           BigBad.nes              BigBad.pal
                           BigBad.zip              BigBad.pal
                           BigBad.Better.nes       BigBad.Better.pal

      With so many ways to choose a palette, figuring out which one will be active may be difficult. Here's a list of what palettes will be used, in order from highest priority to least priority(if a condition doesn't exist for a higher priority palette, the emulator will continue down its list of palettes).

      NSF Palette(for NSFs only)
      Palette loaded from the "gameinfo" directory.
      NTSC Color Emulation(only for NTSC NES games).
      VS Unisystem palette(if the game is a VS Unisystem game and a palette is available).
      Custom global palette.
      Default NES palette.

  - ### Sound

    All 5 internal sound channels are supported(2x rectangle, triangle, noise, and DMC/PCM). Sound channels are emulated with CPU instruction granularity.

    Sound data is generated at the NES' CPU clock rate(about 1.8MHz for the NTSC NES), and then resampled to the output sample rate.

    Besides the 5 internal NES sound channels, Mednafen emulates the extra sound capabilities of the Konami VRCVI, Konami VRCVII, Namco 106, Nintendo MMC5, and the Sunsoft FME-07 chips. The extra sound channel in the Famicom Disk System is also emulated, but the support for its FM capabilities is limited.

  - ### Input

    Mednafen emulates the standard NES gamepad, the Four-Score multiplayer adapter, the Zapper, the Power Pad, and the Arkanoid controller. The Famicom version of the Arkanoid controller, the "Space Shadow" gun, the Famicom 4-player adapter, the Family Keyboard, the HyperShot controller, the Mahjong controller, the Oeka Kids tablet, the Quiz King buzzers, the Family Trainer, and the Barcode World barcode reader are also emulated.

    #### Zapper

    Most Zapper NES games expect the Zapper to be plugged into port 2. and most VS Unisystem games expect the Zapper to be plugged into port 1.

    The left mouse button is the emulated trigger button for the Zapper. The right mouse button is also emulated as the trigger, but as long as you have the right mouse button held down, no color detection will take place, which is effectively like pulling the trigger while the Zapper is pointed away from the television screen. Note that you must hold the right button down for a short time to have the desired effect.

  - ### File Formats/Expansion Hardware

    Mednafen supports the iNES, FDS(raw and with a header), UNIF, and NSF file formats. FDS ROM images in the iNES format are not supported; it would be silly to do so and storing them in that format is nonsensical.

    Mednafen supports loading ROM/disk images from some types of compressed files. Mednafen can load data from both PKZIP-format files and gzip-format files. Only the "deflate" algorithm is supported, but this is the most widely used algorithm for these formats.

    All files in a PKZIP format archive will be scanned for the followings extensions: .nes, .fds, .nsf, .unf, .nez, .unif The first archived file to have one of these extensions will be loaded. If no archived file has one of these extensions, the first archived file will be loaded.

    #### iNES Format

    The battery-backed RAM, vertical/horizontal mirroring, four-screen name table layout, and 8-bit mapper number capabilities of the iNES format are supported. The 512-byte trainer capability is also supported, but it is deprecated. Common header corruption conditions are cleaned(let's go on a DiskDude hunt), though not all conditions can be automatically detected and fixed. In addition, a few common header inaccuracies for games are also corrected(detected by CRC32 value). Note that these fixes are not written back to the storage medium.

    Support for the recent VS System bit and "number of 8kB RAM banks" is not implemented. Too many iNES headers are corrupt where this new data is stored, causing problems for those games.

    The following table lists iNES-format "mappers" supported well in Mednafen.

    Number: | Description: | Game Examples:
    --- | --- | ---
    0 | No bankswitching | Donkey Kong, Mario Bros
    1 | Nintendo MMC1 | MegaMan 2, Final Fantasy
    2 | UNROM | MegaMan, Archon, 1944
    3 | CNROM | Spy Hunter, Gradius
    4 | Nintendo MMC3 | Super Mario Bros. 3, Recca, Final Fantasy 3
    5 | Nintendo MMC5 | Castlevania 3, Just Breed, Bandit Kings of Ancient China
    6 | FFE F4 Series(hacked, bootleg) |
    7 | AOROM | Battle Toads, Time Lord
    8 | FFE F3 Series(hacked, bootleg) |
    9 | Nintendo MMC2 | Punchout!
    10 | Nintendo MMC4 | Fire Emblem, Fire Emblem Gaiden
    11 | Color Dreams | Crystal Mines, Bible Adventures
    12 | ?? | Dragon Ball Z 5 ("bootleg" original)
    13 | CPROM | Videomation
    15 | Multi-cart(bootleg) | 100-in-1: Contra Function 16
    16 | Bandai ?? | Dragon Ball Z, SD Gundam Gaiden **EEPROM is not emulated
    17 | FFE F8 Series(hacked, bootleg) |
    18 | Jaleco SS806 | Pizza Pop, Plasma Ball
    19 | Namco 106 | Splatter House, Mappy Kids
    21 | Konami VRC4 2A | WaiWai World 2, Ganbare Goemon Gaiden 2
    22 | Konami VRC4 1B | Twinbee 3
    23 | Konami VRC2B | WaiWai World, Crisis Force
    24 | Konami VRC6 | Akumajou Densetsu
    25 | Konami VRC4 | Gradius 2, Bio Miracle:Boku tte Upa
    26 | Konami VRC6 A0-A1 Swap | Esper Dream 2, Madara
    32 | IREM G-101 | Image Fight 2, Perman
    33 | Taito TC0190/TC0350 | Don Doko Don
    34 | NINA-001 and BNROM | Impossible Mission 2, Deadly Towers, Bug Honey
    41 | Caltron 6-in-1 | Caltron 6-in-1
    42 | (bootleg) | Mario Baby
    44 | Multi-cart(bootleg) | Super HiK 7 in 1
    45 | Multi-cart(bootleg) | Super 1000000 in 1
    46 | Game Station | Rumble Station
    47 | NES-QJ | Nintendo World Cup/Super Spike V-Ball
    48 | Taito TC190V | Flintstones
    49 | Multi-cart(bootleg) | Super HiK 4 in 1
    51 | Multi-cart(bootleg) | 11 in 1 Ball Games
    52 | Multi-cart(bootleg) | Mario Party 7 in 1
    64 | Tengen RAMBO 1 | Klax, Rolling Thunder, Skull and Crossbones
    65 | IREM H-3001 | Daiku no Gensan 2
    66 | GNROM | SMB/Duck Hunt
    67 | Sunsoft ?? | Fantasy Zone 2
    68 | Sunsoft ?? | After Burner 2, Nantetta Baseball
    69 | Sunsoft FME-7 | Batman: Return of the Joker, Hebereke
    70 | ?? | Kamen Rider Club
    71 | Camerica | Fire Hawk, Linus Spacehead
    72 | Jaleco ?? | Pinball Quest
    73 | Konami VRC3 | Salamander
    74 | Taiwanese MMC3 CHR ROM w/ VRAM | Super Robot Wars 2
    75 | Jaleco SS8805/Konami VRC1 | Tetsuwan Atom, King Kong 2
    76 | Namco 109 | Megami Tensei
    77 | IREM ?? | Napoleon Senki
    78 | Irem 74HC161/32 | Holy Diver
    79 | NINA-06/NINA-03 | F15 City War, Krazy Kreatures, Tiles of Fate
    80 | Taito X-005 | Minelvation Saga
    82 | Taito ?? | Kyuukyoku Harikiri Stadium - Heisei Gannen Ban
    85 | Konami VRC7 | Lagrange Point
    86 | Jaleco JF-13 | More Pro Baseball
    87 | ?? | Argus
    88 | Namco 118 | Dragon Spirit
    89 | Sunsoft ?? | Mito Koumon
    90 | ?? | Super Mario World, Mortal Kombat 3, Tekken 2
    92 | Jaleco ?? | MOERO Pro Soccer
    93 | ?? | Fantasy Zone
    94 | ?? | Senjou no Ookami
    95 | Namco 118 | Dragon Buster
    96 | Bandai ?? | Oeka Kids
    97 | ?? | Kaiketsu Yanchamaru
    99 | VS System 8KB VROM Switch | VS SMB, VS Excite Bike
    105 | NES-EVENT | Nintendo World Championships
    107 | ?? | Magic Dragon
    112 | Asder | Sango Fighter, Hwang Di
    113 | MB-91 | Deathbots
    114 | ?? | The Lion King
    115 | ?? | Yuu Yuu Hakusho Final
    117 | ?? | San Guo Zhi 4
    118 | MMC3-TLSROM/TKSROM Board | Ys 3, Goal! 2, NES Play Action Football
    119 | MMC3-TQROM Board | High Speed, Pin*Bot
    133 | Sachen SA72008 | Jovial Race
    134 | Sachen 74LS374N | Olympic IQ
    135 | Sachen 8259A | Super Pang
    140 | Jaleco ?? | Bio Senshi Dan
    144 | AGCI 50282 | Death Race
    150 | Camerica BF9097 | FireHawk
    151 | Konami VS System Expansion | VS The Goonies, VS Gradius
    152 | ?? | Arkanoid 2, Saint Seiya Ougon Densetsu
    153 | Bandai ?? | Famicom Jump 2
    154 | Namco ?? | Devil Man
    155 | MMC1 w/o normal WRAM disable | The Money Game, Tatakae!! Rahmen Man
    156 | ?? | Buzz and Waldog
    157 | Bandai Datach ?? | Datach DBZ, Datach SD Gundam Wars, **EEPROM is not emulated
    158 | RAMBO 1 Derivative | Alien Syndrome
    160 | (same as mapper 90) | (same as mapper 90)
    180 | ?? | Crazy Climber
    182 | ?? | Super Donkey Kong
    184 | ?? | Wing of Madoola, The
    185 | CNROM w/ CHR ROM unmapping | Banana, Mighty Bomb Jack, Spy vs Spy(Japanese)
    189 | ?? | Thunder Warrior, Street Fighter 2 (Yoko)
    193 | Mega Soft | Fighting Hero
    206 | DEIROM | Karnov
    207 | Taito ?? | Fudou Myouou Den
    208 | ?? | Street Fighter IV (by Gouder)
    209 | (mapper 90 w/ name-table control mode enabled) | Shin Samurai Spirits 2, Power Rangers III
    210 | Namco ?? | Famista '92, Famista '93, Wagyan Land 2
    215 | Bootleg multi-cart ?? | Super\ 308\ 3-in-1\
    217 | Bootleg multi-cart ?? | Golden Card 6-in-1
    222 | Bootleg ?? | Dragon Ninja
    228 | Action 52 | Action 52, Cheetahmen 2
    232 | BIC-48 | Quattro Arcade, Quattro Sports
    234 | Multi-cart ?? | Maxi-15
    240 | ?? | Gen Ke Le Zhuan, Shen Huo Le Zhuan
    242 | ?? | Wai Xing Zhan Shi
    244 | ?? | Decathalon
    246 | ?? | Fong Shen Ban
    248 | ?? | Bao Qing Tian
    249 | Waixing ?? | ??
    250 | ?? | Time Diver Avenger

    #### UNIF

    Mednafen supports the following UNIF boards. The prefixes HVC-, NES-, BTL-, and BMC- are omitted, since they are currently ignored in Mednafen's UNIF loader.

    Group:
    Name: | Game Examples:
    --- | ---
    Bootleg:
    BioMiracleA | Mario Baby
    MARIO1-MALEE2 | Super Mario Bros. Malee 2
    NovelDiamond9999999in1 | Novel Diamond 999999 in 1
    Super24in1SC03 | Super 24 in 1
    Supervision16in1 | Supervision 16-in-1
    Unlicensed:
    NINA-06 | F-15 City War
    Sachen-8259A | Super Cartridge Version 1
    Sachen-8259B | Silver Eagle
    Sachen-74LS374N | Auto Upturn
    SA-016-1M | Master Chu and the Drunkard Hu
    SA-72007 | Sidewinder
    SA-72008 | Jovial Race
    SA-0036 | Mahjong 16
    SA-0037 | Mahjong Trap
    TC-U01-1.5M | Challenge of the Dragon
    8237 | Pocahontas Part 2
    MMC1:
    SAROM | Dragon Warrior
    SBROM | Dance Aerobics
    SCROM | Orb 3D
    SEROM | Boulderdash
    SGROM | Defender of the Crown
    SKROM | Dungeon Magic
    SLROM | Castlevania 2
    SL1ROM | Sky Shark
    SNROM | Shingen the Ruler
    SOROM | Nobunaga's Ambition
    MMC2:
    PEEOROM | Mike Tyson's Punch Out
    PNROM | Punch Out
    MMC3:
    TFROM | Legacy of the Wizard
    TGROM | Megaman 4
    TKROM | Kirby's Adventure
    TKSROM | Ys 3
    TLROM | Super Spike V'Ball
    TLSROM | Goal! 2
    TR1ROM | Gauntlet
    TQROM | Pinbot
    TSROM | Super Mario Bros. 3
    TVROM | Rad Racer 2
    MMC5:
    EKROM | Gemfire
    ELROM | Castlevania 3
    ETROM | Nobunaga's Ambition 2
    EWROM | Romance of the Three Kingdoms 2
    MMC6:
    HKROM | Star Tropics
    FME7:
    BTR | Batman: Return of the Joker
    Nintendo Discrete Logic:
    CNROM | Gotcha
    CPROM | Videomation
    GNROM | Super Mario Bros./Duck Hunt
    MHROM |
    NROM-128 | Mario Bros.
    NROM-256 | Super Mario Bros.
    RROM-128 |
    UNROM | Megaman

    #### Famicom Disk System

    You will need the FDS BIOS ROM image in the base Mednafen directory. It must be named "disksys.rom". Mednafen will not load FDS games without this file.

    Two types of FDS disk images are supported: disk images with the FWNES-style header, and disk images with no header. The number of sides on headerless disk images is calculated by the total file size, so don't put extraneous data at the end of the file.

    If a loaded disk image is written to during emulation, Mednafen will store the modified disk image in the save games directory, which is by default "sav" under the base directory.

    #### Game Genie

    The Game Genie ROM image is loaded from the path specified by the setting "nes.ggrom", or, if that string is not set, the file "gg.rom" in the base directory when Game Genie emulation is enabled.

    The ROM image may either be the 24592 byte iNES-format image, or the 4352 byte raw ROM image.

    #### VS Unisystem

    Mednafen currently only supports VS Unisystem ROM images in the iNES format. DIP switches and coin insertion are both emulated. The following games are supported, and have palettes provided(though not necessarily 100% accurate or complete):

    Battle City
    Castlevania
    Clu Clu Land
    Dr. Mario
    Duck Hunt
    Excitebike
    Excitebike (Japanese)
    Freedom Force
    Goonies, The
    Gradius
    Gumshoe
    Hogan's Alley
    Ice Climber
    Ladies Golf
    Mach Rider
    Mach Rider (Japanese)
    Mighty Bomb Jack (Japanese)
    Ninja Jajamaru Kun (Japanese)
    Pinball
    Pinball (Japanese)
    Platoon
    RBI Baseball
    Slalom
    Soccer
    Star Luster
    Stroke and Match Golf
    Stroke and Match Golf - Ladies
    Stroke and Match Golf (Japanese)
    Super Mario Bros.
    Super Sky Kid
    Super Xevious
    Tetris
    TKO Boxing
    Top Gun

- ### Atari Lynx

  Atari Lynx emulation requires the 512 Lynx boot ROM image, named as "lynxboot.img", and placed in the Mednafen base directory.

- ### PC Engine/SuperGrafx

  - All sprite sizes supported.
  - 16-sprites per line limit emulated.
  - Accurate HuC6280 flags emulation.
  - Dot-clock emulation for more accurate aspect ratios.
  - Very accurate and tonally-correct(thanks to Blip_Synth) PSG emulation.
  - Support for Street Fighter 2's HuCard hardware.
  - Support for Populous's backup RAM.

### Automatic IPS Patching

Place the IPS file in the same directory as the file to load, and name it filename.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 supported for all supported formats, but it will probably only be useful for fixed-position file formats.

## Using Mednafen

### Key Assignments

Key(s): | Action: | Configuration String:
--- | --- | ---
F5 | Save state. | save_state
F7 | Load state. | load_state
0-9 | Select save state slot. | "0" through "9"
Shift + F5 | Record movie. | save_movie
Shift + F7 | Play movie. | load_movie
Shift + 0-9 | Select movie slot. | "m0" through "m9"
ALT + A | Enter frame advance mode, if not already in it, and advance the frame. | advance_frame
ALT + R | Exit frame advance mode. | run_normal
F1 | Toggle 600-frame(~10 seconds on NES) save-state rewinding functionality, disabled by default. | state_rewind_toggle
Backspace | Rewind emulation, if save-state rewinding functionality is enabled, up to 600 frames. | state_rewind
F9 | Save screen snapshot. | take_snapshot
Alt + Enter | Toggle fullscreen mode. | toggle_fs
Ctrl + 1 through Ctrl + 9 | Toggle layer. | "tl1" through "tl9"
~ | Fast-forward. | fast_forward
F2 | Activate in-game input configuration process for a command key. | input_configc
F10 | Reset. | reset
F11 | Hard reset(toggle power switch). | power
F12 | Exit. | exit

#### NES

Key(s): | Action: | Configuration String:
--- | --- | ---
F3 | Activate in-game input configuration process for input port 1. | input_config1
Shift + F3 | Activate in-game input configuration process for input port 2. | input_config2
Alt + F3 | Activate in-game input configuration process for the Famicom expansion port. | input_configfc

#### VS Unisystem

Key: | Action: | Configuration String:
--- | --- | ---
F8 | Insert coin. | insert_coin
F6 | Show/Hide dip switches. | toggle_dipview
1-8 | Toggle dip switches(when dip switches are shown). | "1" through "8"

#### Famicom Disk System

Key: | Action: | Configuration String:
--- | --- | ---
F6 | Select disk and disk side. | select_disk
F8 | Eject or Insert disk. | insert_eject_disk

#### Barcode Readers

Key: | Action: | Configuration String:
--- | --- | ---
0-9 | Barcode digits(after activating barcode input). | "0" through "9"
F8 | Activate barcode input/scan barcode. | activate_barcode

#### Game Pad

Key: | Button on Emulated Gamepad:
--- | ---
Keypad 2 | B
Keypad 3 | A
Enter/Return | Start
Tab | Select
Z | Down
W | Up
A | Left
S | Right

#### Power Pad

Side B
O | P | [ | ]
K | L | ; | '
M | , | . | /

Side A
| P | [ |
K | L | ; | '
| , | . |

#### Family Keyboard

All emulated keys are mapped to the closest open key on the PC keyboard, with a few exceptions. The emulated "@" key is mapped to the "`"(grave) key, and the emulated "kana" key is mapped to the "Insert" key(in the 3x2 key block above the cursor keys).

To enable or disable Family Keyboard input, press the "Scroll Lock" key. When Family Keyboard input is enabled, Mednafen will also attempt to prevent any key presses from being passed to the GUI or system.

#### HyperShot Controller

| Run | Jump
Controller I | Q | W
Controller II | E | R

#### Mahjong Controller

Emulated Mahjong Controller: | A | B | C | D | E | F | G | H | I | J | K | L | M | N
PC Keyboard: | Q | W | E | R | T | A | S | D | F | G | H | J | K | L

Emulated Mahjong Controller: | SEL | ST | ? | ? | ? | ? | ?
PC Keyboard: | Z | X | C | V | B | N | M

#### Quiz King Controller

Emulated Buzzer: | 1 | 2 | 3 | 4 | 5 | 6
PC Keyboard: | Q | W | E | R | T | Y

#### Atari Lynx

Key(s): | Action: | Configuration String:
--- | --- | ---
F3 | Activate in-game input configuration process for Lynx pad. | input_config1
F8 | Rotate the screen | rotatescreen

Key: | Action/Button:
--- | ---
Keypad 2 | B
Keypad 3 | A
Keypad 4 & Enter/Return | Pause
Keypad 7 | Option 1
Keypad 1 | Option 2
W | Up
Z | Down
A | Left
S | Right

#### GameBoy/GameBoy Color/GameBoy Advance

Key(s): | Action: | Configuration String:
--- | --- | ---
F3 | Activate in-game input configuration process for GameBoy pad. | input_config1

Key: | Action/Button:
--- | ---
Keypad 2 | B
Keypad 3 | A
Enter/Return | Start
Tab | Select
Keypad 5 | Shoulder Left
Keypad 6 | Shoulder Right
W | Up
Z | Down
A | Left
S | Right

#### PC Engine(TurboGrafx 16)/SuperGrafx

Key(s): | Action: | Configuration String:
--- | --- | ---
F3 | Activate in-game input configuration process for gamepad 1. | input_config1
Shift+F3 | Activate in-game input configuration process for gamepad 2. | input_config2
F4 | Activate in-game input configuration process for gamepad 3. | input_config3
Shift+F4 | Activate in-game input configuration process for gamepad 4. | input_config4
Ctrl+Shift+F4 | Activate in-game input configuration process for gamepad 5. | input_config5

Key: | Action/Button:
--- | ---
Keypad 2 | II
Keypad 3 | I
Enter/Return | Run
Tab | Select
W | Up
Z | Down
A | Left
S | Right

### Command-line

Mednafen supports arguments passed on the command line. Arguments are taken in the form of "-parameter value". Some arguments are valueless. Arguments that have both a parameter and a value will be saved in the configuration file.

Caution: Any arguments that change emulation behavior as seen from the emulated game are shown with bold text 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).

Arguments listed in this table that contain <system> should have that string replaced with "nes", "pce", "gb", "gba", or "lynx".
Example: <system>.xscale becomes nes.xscale.

Argument: | Value Type: | Default value: | Description:
--- | --- | --- | ---
-loadcd x | string | n/a | Load and boot a CD for system "x"(only "pce" is valid). This argument modifies the usage of the filename component of the command-line. For example, "mednafen -loadcd pce /somewhere/over/the/rainbow/game.cue" will load the CUE sheet as the emulated CDROM. "mednafen -loadcd pce" will load from the default physical CDROM device.
-nes.fnscan x | boolean | 1 | If value is true, scan the NES ROM image filename for (U), (J), and (E), and set the emulated video system(NTSC/PAL) accordingly, with NTSC preferred. Warning:This option may break NES network play when enabled IF the players are using ROM images with different filenames.
-autosave x | boolean | 0 | Automatically save the game state when a game is closed and reload the state when the game is loaded again.
-dfmd5 x | boolean | 1 | Include the MD5 hash of the loaded game in the filenames of the data file(save states, SRAM backups) Mednafen creates.
-snapname x | boolean | 0 | If value is true, use an alternate naming scheme(file base and numeric) for screen snapshots.
-sound x | boolean | 1 | If value is true, enable sound emulation and output.
-soundrate x | integer | 48000 | Specifies the sound playback rate, in frames per second("Hz").
-soundvol x | integer | 100 | Sound volume.
-soundbufsize x | integer | 32(52 for Win32) | Specifies the desired size of the sound buffer, in milliseconds.
-autofirefreq x | integer | 3 | Set auto fire frequency to ~60Hz / (x + 1). Replace "60" with "50" for PAL games. A value of "0" disables the configured autofire buttons.
-ckconfig x | string(comma-delimited) |  | Configure mapping of physical buttons to commands. Values that are valid in the comma-delimited string include: save_state load_state save_movie load_movie cheats "0" through "9" "m0" through "m9" "tl1" through "tl9" take_snapshot hide_sprites hide_bg toggle_fs fast_forward insert_coin toggle_dipview select_disk insert_eject_disk activate_barcode toggle_fkb input_config1 input_config2 input_config3 input_config4 input_configfc state_rewind_toggle state_rewind rotatescreen reset power exit During configuration, pressing the same button twice in a row will cause configuration to move to the next command to configure. A maximum of 4 physical buttons may be assigned to one command.
-inputcfg x | string |  | Configure mapping of physical device inputs to a virtual device. Valid values(listed by system) are: NES gamepad1 gamepad2 gamepad3 gamepad4 powerpad1 powerpad2 ftrainer PC Engine pcegamepad1 pcegamepad2 pcegamepad3 pcegamepad4 pcegamepad5 During configuration, pressing the same button twice in a row will cause configuration to move to the next button on the virtual device. A maximum of 4 physical buttons may be assigned to one virtual button.
-nes.input1 x and -nes.input2 x | string | gamepad | Select input device for input port 1 or 2. Valid strings are "none", "gamepad", "zapper", "powerpada", and "powerpadb".
-nes.fcexp x | string | none | Select Famicom expansion port device. Valid strings are "none", "shadow", "arkanoid", "4player", and "fkb".
-nes.nofs x | boolean | 0 | If value is true, disable four-score emulation.
-nes.gg x | boolean | 0 | Enable NES Game Genie emulation.
-nes.ggrom x | string |  | Path to Game Genie ROM image.
-ffspeed x | integer | 2 | Specifies the speed multiplier to be used in fast-forward mode.
-fftoggle x | boolean | 0 | Treat the fast-forward button as a toggle.
-ffnosound | boolean | 0 | Silence sound output when fast-forwarding.
-nothrottle x | boolean | 0 | If value is true, disable the speed throttling that is used when sound emulation is disabled.
-nes.no8lim x | boolean | 0 | No 8-sprites-per-scanline limit option.
-nes.cpalette x | string | 0 | Load a custom global NES palette from file "x". To stop using a custom palette: mednafen -cpalette "" game.nes
-nes.ntsccol x | boolean | 0 | If value is true, enable automatic generation and use of an NTSC NES' colors.
-nes.pal x | boolean | 0 | If value is true, emulate a PAL NES. Otherwise emulate an NTSC NES.
-nes.clipsides x | boolean | 0 | If value is true, clip leftmost and rightmost 8 columns of pixels of the video output.
-nes.slstart x | integer | 8 | First scanline to be rendered in NTSC emulation mode(when PAL emulation is disabled).
-nes.slend x | integer | 231 | Last scanline to be rendered in NTSC emulation mode.
-nes.slstartp x | integer | 0 | First scanline to be rendered in PAL emulation mode.
-nes.slendp x | integer | 239 | Last scanline to be rendered in PAL emulation mode.
-pce.forcesgx x | boolean | 0 | Force SuperGrafx emulation.
-pce.ocmultiplier x | integer | 1 | CPU overclock multiplier.
-pce.nospritelimit x | boolean | 0 | No 16-sprites-per-scanline limit option.
-pce.cdbios x | string |  | Path to the CD BIOS
Argument: | Value Type: | Default value: | Description:
-connect |  |  | Trigger to connect to remote host after the game is loaded.
-nethost x | string |  | Set server's hostname to connect to during netplay.
-netport x | integer | 4046 | Set port number to connect to on remote host.
-netpassword x | string |  | The optional password used to connect to a netplay server.
-netlocalplayers x | integer | 1 | Set the number of local players on your system during netplay.
-netnick x | string |  | Set nickname used during chat when using netplay.
-vdriver x | integer | 0 | Select which video output "driver" to use. 0 = OpenGL + SDL 1 = SDL framebuffer Bilinear interpolation and Lynx screen rotation are not available with the "SDL framebuffer" driver.
-<system>.videoip x | boolean | 0 PCE: 1 | Use bilinear interpolation.
-<system>.scanlines x | integer | 0 | If non-zero, enable scanlines; scanline_brightness = 100% - (100% / x)
-<system>.special x | string | none | Use a special video scaling filter applied before OpenGL rasterization. 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, at high resolutions(such as 1280x1024; nn2x(or nny2x) + bilinear interpolation + fullscreen stretching at this resolution looks quite nice). none or 0 (disable special scaler) hq2x hq3x hq4x scale2x scale3x scale4x 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 x | boolean | 0 | Stretch to fill screen when in fullscreen mode.
-doublebuf x | boolean | 1 | Request double buffering(note that double buffering or sync-to-vblank may already be forcibly enabled by your video drivers).
-<system>.xscale (-<system>.xscalefs) / -<system>.yscale (-<system>.yscalefs) | real | NES: 2(2)/2(2) GB: 4(4)/4(4) GBA: 3(3)/3(3) Lynx: 4(4)/4(4) PCE: 3(3)/3(3) | Specify the scaling factor for each axis.
-<system>.xres x / -<system>.yres y | integer | NES: 640/480 GB: 800/600 GBA: 800/600 Lynx: 640/480 PCE: 1024/768 | Set the desired horizontal/vertical resolution when in fullscreen mode.
-fs | boolean | 0 | Full screen mode.

## Game-specific Emulation Hacks

Title: | Description: | Source code files affected:
--- | --- | ---
KickMaster | KickMaster relies on the low-level behavior of the MMC3(PPU A12 low->high transition) to work properly in certain parts. If an IRQ begins at the "normal" time on the last visible scanline(239), the game will crash after beating the second boss and retrieving the item. The hack is simple, to clock the IRQ counter twice on scanline 238. | src/nes/boards/mmc3.cpp
Shougi Meikan '92 Shougin Meikan '93 | The hack for these games is identical to the hack for KickMaster. | src/nes/boards/mmc3.cpp
Star Wars (PAL/European Version) | This game probably has the same(or similar) problem on Mednafen as KickMaster. The hack is to clock the IRQ counter twice on the "dummy" scanline(scanline before the first visible scanline). | src/nes/boards/mmc3.c

## Credits

Name: | Contribution(s):
--- | ---
\Firebug\ | High-level mapper information.
Andrea Mazzoleni | Scale2x/Scale3x scalers included in Mednafen.
Bero | Original FCE source code.
Brad Taylor | NES sound information.
Charles MacDonald | PC Engine technical information.
EFX | Testing.
Fredrik Olson | NES four-player adapter information.
Gilles Vollant | PKZIP file loading functions.
goroh | Various documents.
Info-ZIP | ZLIB
Jeremy Chadwick | General NES information.
kevtris | Low-level NES information and sound information.
Ki | Various technical information.
Mark Knibbs | Various NES information.
Marat Fayzullin | General NES information.
Matthew Conte | Sound information.
Maxim Stepin | hq2x and hq3x scalers included in Mednafen.
Mitsutaka | YM2413 emulator.
nori | FDS sound information.
Quietust | VRC7 sound translation code by The Quietust (quietust at ircN dort org).
rahga | Famicom four-player adapter information.
TheRedEye | ROM images, testing.
Xodnizel | FCE Ultra.
...and everyone whose name my mind has misplaced.