Please do not post a support request without first reading and following the advice in

Zdoom and Gampad Fully Working in MENU with NO KEYBOARD

  • Re: Zdoom and Gamepad

    I want to start off by Thanking the Community and Forums for the Support and Ideas
    I'd also like to give credit to the fact that this has already been achieved with the 'Universal Controller Calibration & Mapping Using xboxdrv' method

    This is an alternative to the 'Universal xboxdrv' method to get your Gamepad to Control the ZDoom MENU with NO KEYBOARD
    This method was Tested and Working on a pi3 running RetroPie4.3 with a Generic USB PSX Controller, and a Generic USB N64 Contoller

    -Issue: Gamepad works fine in GamePlay, But you can't Select anything in the ZDoom Menu with your gamepad, and always need a keyboard to Start/End the game
    It seems only the DPAD and AnalogLeftStick respond while in the ZDoom Menu using the Gamepad

    -Solution: Remap the ZDoom 'Enter' and 'Back' Menu Actions to Gamepad Buttons that already work
    We'll use the DPad Left/Right for Back/Enter, then Remap the AnalogLeftStick to Left/Right accordingly

    To do this, we need to get the ZDoom source files, modify the Menu Mappings, then Re-Compile it after
    This can be all be achieved using a PC with PuTTY, WinSCP, Notepad++, and a raspberryPi
    PuTTY for Remote Terminal on the pi
    WinSCP for file transfers and EZ Double-Click Edit of remote files on the pi
    Notepad++ for editing files


    • Install ZDoom from the RetroPie-Setup like normal if you haven't already

    • PuTTY into your pi to get to Terminal and Exit Emulation Station
      killall emulationstation

    • Get the latest zdoom source for retropie
      cd ~
      mkdir zdoom-joy-lr-menu
      cd zdoom-joy-lr-menu
      git clone retropie

    Modify the 'menu.cpp' file
    EDIT FILE: /home/pi/zdoom-joy-lr-menu/retropie/src/menu/menu.cpp
    *Recommend making a Bakup copy of menu.cpp for Reference

    Move 'MKEY_Enter' to DPAD/LTHUMB/JOYPOV1
    Move 'MKEY_RIGHT' to JOY1/PADA
    Move 'MKEY_LEFT' to JOY2/PADB
    Move 'JOYAXIS2PLUS' to JOY1/PADA which is now MKEY_RIGHT
    Move 'JOYAXIS2MINUS' to JOY2/PADB which is now MKEY_LEFT

    -If you need to coordinate the AnalogLeftStick L/R and U/D movements:
    SWAP JOYAXIS #'1's and JOYAXIS #'2's

    'menu.cpp' should look like this:
    Line 553:

    		case KEY_JOY1:
    		case KEY_PAD_A:
    		case KEY_JOYAXIS1PLUS:
    			mkey = MKEY_Right;
    		case KEY_JOY2:
    		case KEY_PAD_B:
    			mkey = MKEY_Left;

    Line 592:

    		case KEY_PAD_DPAD_LEFT:
    		case KEY_JOYPOV1_LEFT:
    			mkey = MKEY_Back;
    		case KEY_PAD_DPAD_RIGHT:
    		case KEY_JOYPOV1_RIGHT:
    			mkey = MKEY_Enter;

    Line 580:

    		case KEY_PAD_DPAD_UP:
    		case KEY_PAD_LTHUMB_UP:
    		case KEY_JOYPOV1_UP:
    			mkey = MKEY_Up;
    		case KEY_PAD_DPAD_DOWN:
    		case KEY_JOYAXIS2PLUS:
    		case KEY_JOYPOV1_DOWN:
    			mkey = MKEY_Down;

    -0ptional Step:
    If your Controller AnalogLeftStick is very sensitive, you might not want the U/D movements active while in the Menu
    To Remove them, just delete the JOYAXIS2 entries completely from 'MKEY_Up/MKEY_Down' sections Before the Build
    This will leave you with only L/R movements from the AnalogLeftStick for adjusting any ZDoom Slide Menu Settings smoothly

    'menu.cpp' should now look like this with 0ptional Step:
    Line 580:

    		case KEY_PAD_DPAD_UP:
    		case KEY_PAD_LTHUMB_UP:
    		case KEY_JOYPOV1_UP:
    			mkey = MKEY_Up;
    		case KEY_PAD_DPAD_DOWN:
    		case KEY_JOYPOV1_DOWN:
    			mkey = MKEY_Down;

    *Take care to retain the structure when removing the JOYAXIS2 lines
    I recommend using Notepad++

    • When ready, Re-Compile ZDoom with the modifed 'menu.cpp' in place
      cd /home/pi/zdoom-joy-lr-menu/retropie
      cmake . -DCMAKE_BUILD_TYPE=Release

    Build may take a while. Good time for coffee or beer break
    Around %44-%46 of the build you can check to see if the menu.cpp was processed OK
    If it fails, go back and check 'menu.cpp' for any errors or duplicates in the 'mkey' sections.
    When complete, we will replace the Default ZDoom files installed from the RetroPieSetup with the Newly Built 'zdoom' & 'zdoom.pk3' files

    • Make backup of Defalut ZDoom files if you haven't already
      sudo mv /opt/retropie/ports/zdoom/zdoom /opt/retropie/ports/zdoom/zdoom.BAK
      sudo mv /opt/retropie/ports/zdoom/zdoom.pk3 /opt/retropie/ports/zdoom/zdoom.pk3.BAK

    • Replace current ZDoom with modified 'zdoom' & 'zdoom.pk3' files
      sudo cp zdoom /opt/retropie/ports/zdoom/zdoom
      sudo cp zdoom.pk3 /opt/retropie/ports/zdoom/zdoom.pk3

    • Set the permissions of 'zdoom' & 'zdoom.pk3' files if needed
      sudo chmod 0755 /opt/retropie/ports/zdoom/zdoom
      sudo chmod 0644 /opt/retropie/ports/zdoom/zdoom.pk3

    -Reboot -> Open ZDoom -> Test the Gamepad in the Menu.

    • The Final Results should be:
      Controller DPad L/R are now Menu Back/Enter
      Contoller AnalogLeftStick L/R are now Menu Left/Right
      Controller DPad U/D are Menu Up/Down
      Controller AnalogLeftStick U/D are Menu Up/Down (if you didn't delete the mapping)
      JOY2/PADB and JOY1/PADA are now Menu Left/Right (if they work for you)

    -If you still need a Keyboard to Open the Main Menu:
    Manually Bind a Controller Button to call the Main Menu

    • EDIT FILE: /opt/retropie/configs/ports/doom/zdoom.ini
      Search for 'menu_main' -> Add/Adjust 'menu_main' as needed

    • EXAMPLE If your 'Start' button = (Button10):
      Add 'joy10=menu_main' to ALL x3 Bindings Sections:
      [Doom.Bindings], [Heretic.Bindings], [Hexen.Bindings]

    -0ptional Step:
    The 'joy10=menu_main' setting may be lost if you Restore to Default or Last Saved Config in the ZDoom Menu
    Once you get your Controller configured the way you like, I recommend creating a simple script to restore 'zdoom.ini' when/if needed

    • Example Script Contents:
      sudo cp /home/pi/MyPerfectZDoomConfig/zdoom.ini /opt/retropie/configs/ports/doom/zdoom.ini

    Put your script somewhere it can be executed easily with a gamepad like:
    /roms/ports/ -OR- /retropiemenu/

    • Make the script Executable and change permissions
      sudo chmod +X /home/pi/RetroPie/roms/ports/
      sudo chmod 0755 /home/pi/RetroPie/roms/ports/

    That's It!

    • Unplug your Keyboard
    • Play Ancient Aliens Doom :)

  • @rapidedwin08

    Hey, do you think you could share your recompiled zdoom files? I've tried everything but I cannot get zdoom to recompile after making these changes, keeps saying something about line 954 but there is no line 954 in the code!

    I'd be grateful if you could help

  • Does anyone know exactly which branch/version of source code the BINARY version of zdoom was compiled against that is provided currently when you install via

    Compiling from source allows controller buttons to work in the menu using the instructions above, but for some reason the source version doesn't allow Brutal Doom (v20bR3 as instructed here: to load.

    I can only seem to get Brutal Doom working when using the binary version.

    I've tried a few different previous versions of source code and they either don't compile properly or similarly (like the latest) don't work with Brutal Doom.

    I thought if I could get the precise branch/version of source that the current binary was compiled from and re-compile with these menu.cpp changes it could make things work...

  • Global Moderator

    @rodhull You can see how the source install is done from the RetroPie setup scriptmodule for zdoom -

  • Yes, that shows how the source is compiled (from and I have compiled the same source myself to edit the menu.cpp as above - but I was wondering which branch/release the latest binary was compiled from (as is provided by the script)?

    I suspect it's likely from a different branch/release to current since it behaves differently once installed.

  • To illustrate further, running the zdoom binary (as installed from the script as of 11th July 2018) from a console with no arguments results in:

    ZDoom <unknown version> - - SDL version
    Compiled on Feb 17 2018

    If I run the version I compiled today from, I get:

    $ ./zdoom
    ZDoom 2.9pre-2175-g4f21ff275 - 2016-12-29 11:44:07 +0100 - SDL version
    Compiled on Jul 11 2018

    So, there's no way of knowing which version the Retropie-provided binary really is, or what branch/release it comes from. If I knew then I could modify the source knowing it ought to still work as intended...

  • Global Moderator

    @rodhull said in Zdoom and Gampad Fully Working in MENU with NO KEYBOARD:

    ZDoom <unknown version> - - SDL version

    The binary is produced with the same script, so it's compiled from the same repository. You can check the history of the file and the reason for which it was forked:


    • fork is 2.8.0 with a small compile fix
    • versions 2.8.1 + seem to suffer from a collision detection issue
    • development has ceased, so we are going to stick with the last known working version

  • OK - so now I'm confused - why does a binary compiled from give 2.9pre-etc. as the version when the fork should have been frozen at 2.8.0 (with a small fix). It shouldn't even take it as far as version 2.8.1.

    I'll stand by what I said earlier - if you compile a version from right now, you get a completely different binary to the one supplied by the script - it behaves differently too (Brutal Doom works in the binary, but does not with the freshly compiled version).

    Binary version (from

    pi@retropie:/opt/retropie/ports/zdoom $ ls -la
    total 6032
    drwxr-xr-x 2 root root 4096 Feb 17 20:14 .
    drwxr-xr-x 3 root root 4096 Jul 11 14:39 ..
    -rwxr-xr-x 1 root root 5530844 Feb 17 20:14 zdoom
    -rw-r--r-- 1 root root 632552 Feb 17 20:14 zdoom.pk3

    Compiled version today from (with only those minute changes to menu.cpp from the OP):

    pi@retropie:~/zdoom_latest_git/bin $ ls -la
    total 6780
    drwxr-xr-x 2 pi pi 4096 Jul 11 18:12 .
    drwxr-xr-x 19 pi pi 4096 Jul 11 18:12 ..
    -rwxr-xr-x 1 pi pi 6160660 Jul 11 13:29 zdoom
    -rw-r--r-- 1 pi pi 768203 Jul 11 13:29 zdoom.pk3

    The binary and .pk3 are totally different in filesize (and behaviour if the compatibility with Brutal Doom is anything to go by) .

    Is there any way to compile from the exact same codebase that the "Install from binary" in provides?

  • This all works, apart from you cannot exit the game by using the menu. Even if you configure the menu_quit to another button, the menu displays but none of the buttons actually allow you to select to quit.

    Annoyingly as it's not supported by retroarch configuration, you cannot use the exit hotkeys either.

    So the only option is to hard reset the Pi or use a keyboard.

    Edit: So it does work, but you have to hammer the d-pad. I am starting to think the input sensitivity is too high as moving between options on the menu often skips. *
    In the end I have bound the "exit" console command to a button, just edit the zdoom.ini to contain something like joy16=exit **

  • Hi, it doesn't fit with Brutal Doom MOD installation.
    Have I to compile the Brutal Doom .pk3 file?

    Isn't there a simpler way to accomplish the task?

    In zdoom.ini file I can specify:
    Why there isn't anything as (for example):
    It would be a lot simpler!

    I don't understand why Zdoom has not this option, I've asked on their forum but still waiting for an answer.
    Let me know if someone has found a better way then recompile.

  • @rodhull I agree with you as I've just recently tried to get this running. The binary used in the script as of the day of this post WILL run Brutal Doom by making a simple change to the zdoom.ini file AutoLoad config. However, when I used the Menu controller fix and recompiled, I was unable to load Brutal Doom with the same zdoom.ini that was previously working. The following error is produced by the script:

    Script warning, "bd21RC8.pk3:player.txt"
    Invalid face '' for 'Doomer';

    If the latest commit to the repo is in fact what was used to build the binary installed via script, then the problem will be harder to fix. But I am suspicious of such a size change to the binary with only a few lines of code changed. I can start by digging through commits, but any additional info or help on this matter from the community would be appreciated.

    Edit: So I looked into it and yes, 2.8.0 appears to be the last working commit. So if that's the case, it was published on Feb 4, 2016. There is a commit on that day and is the possible "last working version" we're looking for.
    Commit hash: 56359b6f233f538b8cbcec093af93a19d66fabed
    I'll experiment with this as soon as I can and see if 1) it produces the same binary from the RetroPie script and 2) do the menu edits works with it. I will provide an update with steps if this works.

  • I got it working! And here's how I did it:

    First, after performing this step:
    git clone retropie

    execute this:

    cd retropie
    git checkout retropie

    Now make the edits provided in the original post.
    After running the cmake . -DCMAKE_BUILD_TYPE=Release step, do the following:

    • If you don't already have ccmake, execute sudo apt-get install cmake-curses-gui from the command line.
    • Run ccmake --> ccmake ./
    • In the GUI that launches, navigate down to NO_ASM and hit Enter to set it to ON
    • Press c to run the configure step, then q to exit

    Now continue from the make step from the original post, and everything should work!

  • Hello guys,

    I wanted to thank RapidEdwin08 and RetroS3xual for all the useful info. It allowed me to understand how ZDoom works, and gave me a start point for what I'm presenting now: gamepad buttons finally working in menus, without the need for "Enter" and "Esc" keys, and with "left" and "right" functioning as they should, so the game doesn't need a keyboard anymore. You can download the binaries here:

    For those who want to see the changes, here they are:

    ...and now I'm hoping to see these changes officially in RetroPie in the future:

  • Pretty excited for this.

  • @RetroS3xual I forgot to say: in the ccmake GUI, you can also enable NO_GTK. This made the executable 200kb smaller for me, with no side effects and able to run Brutal Doom v21 RC8.

    I released updated binaries:

    This will allow the "main menu" button to work after you've finished an episode. By default, it's joy9 (SELECT in the gamepads I've seen) but you can change it in the controls. The following is what made it work, and is included in the pull request:
    It's a shame that nobody in the RetroPie team has seen the PR yet :(

  • @Protocultor Have you tried to ring the Bell @BuZz ?

  • administrators

    @Rion I saw the PR. Just busy :-) I may merge PR to a new branch but my current priorities are getting new release out and I'm short on time etc :-)

    The PR is appreciated and will get reviewed in time. Cheers!

  • @Protocultor thank you so much for doing this! I downloaded your build and can say it's working great. :) I've only played a few levels of Brutal Doom (working) but I was able to navigate the menus with the buttons as expected and could proceed with the end-level screen. Looking forward to this being added on to the RetroPie-Setup script.

  • Thanks for the replies guys!

  • I dont want to change the subject but im working on a doom pi project im curious is zdoom the best performance source port to use on the pi?

Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.

Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.