HowTo enable 6-button input Sega Genesis\Mega Drive in mednafen

Mednafen is a popular game console emulator, especially Sega Genesis and Sega Mega Drive. It contains many emulation engines, which allows us to play games from different old consoles, even Sony Playstation. Its addition, a GUI package called Mednaffe, makes it easy to configure a lot of consoles at once. But, unfortunately, mednaffe still doesn’t give access to many settings. It includes a choice of the gamepad type (3-buttons, 4-buttons, 6-buttons).

By default, 3-button gamepad is used, so how to get a 6-button?

At the end of this article describes a graphical way!

Enable 6-button gamepad in mednafen

First, open our mednafen config, in Linux by default it is located in:


Then let’s open this file and find the following lines:

;Input device for Virtual Port 1
md.input.port1 gamepad

Here it says that a gamepad (3-button) is connected to port 1. To enable 6-button, we need to replace it with gamepad6:

;Input device for Virtual Port 1
md.input.port1 gamepad6

This will make 6-button gamepad on our port 1.

It is recommended to change gamepad on port 2 also to 6-button, otherwise in some games I had bugs with gamepad control.

All we need to do is edit this line:

;Input device for Virtual Port 2
md.input.port2 gamepad

Deal with it as with the first one, just change the type of gamepad to gamepad6.

After we save our changes, they will take effect immediately. So, our first gamepad and the second one in mednafen on Sega Genesis and Mega Drive will now become 6-button.

HowTo configure X-,Y-,Z- control buttons, which are missing in mednaffe settings?

X,Y,Z is missing in mednaffe
As you can see, X,Y,Z buttons are missing.

Well, this is really crazy. I couldn’t find an easy way. So, all buttons are stored in the following format, for example A-button:

;md, Virtual Port 1, 6-Button Gamepad: A
md.input.port1.gamepad6.a keyboard 0x0 89

This is A-button value (89) for the first 6-button controller (Port 1) in Sega Genesis\Mega Drive. We can find similar lines for all buttons in the config file.

We are interested in the latter value. This is the code of a keyboard button. In my case, 89 means 1(End) button on NumPad. So, 2(Down) button on NumPad is 90 and 3(PgDn) is 91. This is for my keyboard, for your keyboard the values may differ.

How to know this value? We can go to the graphical interface called mednaffe and customize visible buttons there (A, B , C buttons). Then open the config file and see changed values (A, B, C buttons). Then paste its temporal code (A, B, C) to desired button (X, Y, Z).

So, we can assign X button with A-button value:

;md, Virtual Port 1, 6-Button Gamepad: X
md.input.port1.gamepad6.x keyboard 0x0 89

That means our X button will correspond to button 1 (End) of the keyboard numpad. After that, we can change A-button value in mednaffe (GUI) to another.

Update! How to enable 6-button input and assign X, Y, Z buttons for Sega

I finally found how to do it without a headache. First we need to make 6-button gamepad ports.

Run any Sega game with mednafen or mednaffe.

When the game started press F1 mednafen help will appear:

mednafen shortcuts help
Press F1 to show mednafen help

As we see, we can configure ports. First we need to change the type of port. We need to make 6-button gamepad.

From help, for this purpose it is need to use Ctrl + SHIFT + [Port number] shortcut. For example, to configure port 1 type use Ctrl + SHIFT + 1. Press it as many times until we see “6-button gamepad” as in the image below:

6-button gamepad selected on port 1
Press Ctrl+Shift+1 combination until you see this message

Second, we need to assign buttons. For example, to configure the first port use ALT+SHIFT+1 shortcut.

Close the help and make ALT+SHIFT+1:

Configuring A, B, C, X, Y, Z and rapid buttons in mednafen for Sega MegaDrive / Genesis
At the bottom of the screen we can see tips. It will help us to assign all our gamepad buttons

The questions about the buttons arises twice. The second question is something like to confirm changes for current button. So, if you’re missclicked then the third question (3) will help you (it is on image above, questions marked as (1), (2), (3)…).