RetroPie forum home
    • Recent
    • Tags
    • Popular
    • Home
    • Docs
    • Register
    • Login
    Please do not post a support request without first reading and following the advice in https://retropie.org.uk/forum/topic/3/read-this-first

    Zdoom and Gampad Fully Working in MENU with NO KEYBOARD

    Scheduled Pinned Locked Moved Help and Support
    gamepadzdoomdoom
    49 Posts 20 Posters 9.6k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • RapidEdwin08R
      RapidEdwin08
      last edited by RapidEdwin08

      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

      STEPS:

      • 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 https://github.com/RetroPie/zdoom.git 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

      -Modifications:
      Move 'MKEY_Back' to DPAD/LTHUMB/JOYPOV1LEFT
      Move 'MKEY_Enter' to DPAD/LTHUMB/JOYPOV1
      RIGHT
      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;
      			break;
      
      		case KEY_JOY2:
      		case KEY_PAD_B:
      		case KEY_JOYAXIS1MINUS:
      			mkey = MKEY_Left;
      			break;
      

      Line 592:

      		case KEY_PAD_DPAD_LEFT:
      		case KEY_PAD_LTHUMB_LEFT:
      		case KEY_JOYPOV1_LEFT:
      			mkey = MKEY_Back;
      			break;
      
      		case KEY_PAD_DPAD_RIGHT:
      		case KEY_PAD_LTHUMB_RIGHT:
      		case KEY_JOYPOV1_RIGHT:
      			mkey = MKEY_Enter;
      			break;
      

      Line 580:

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

      -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;
      			break;
      
      		case KEY_PAD_DPAD_DOWN:
      		case KEY_PAD_LTHUMB_DOWN:
      		case KEY_JOYPOV1_DOWN:
      			mkey = MKEY_Down;
      			break;
      

      *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
        make

      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):
        'joy10=menu_main'
        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:
        #!/bin/bash
        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/RestoreZDoomINI.sh -OR- /retropiemenu/RestoreZDoomINI.sh

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

      That's It!

      • Unplug your Keyboard
      • Play Ancient Aliens Doom :)

      Raspberry Pi B, Pi B+, Pi2 B, Pi3 B, Pi3 B+, Pi Zero W, Pi4 (4GB/8GB), Pi5 (8GB/16GB), Pi Zero 2 W, GPi V1, minisforum GK50 / RetroPie 4.8.x

      A 1 Reply Last reply Reply Quote 3
      • A
        aFriendNamed5 @RapidEdwin08
        last edited by

        @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

        1 Reply Last reply Reply Quote 0
        • R
          rodhull
          last edited by rodhull

          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 retropie_setup.sh?

          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: https://retropie.org.uk/forum/topic/12341/brutal-doom-add-on-for-retropie-v0-1) 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...

          mituM 1 Reply Last reply Reply Quote 0
          • mituM
            mitu Global Moderator @rodhull
            last edited by

            @rodhull You can see how the source install is done from the RetroPie setup scriptmodule for zdoom - https://github.com/RetroPie/RetroPie-Setup/blob/master/scriptmodules/ports/zdoom.sh.

            1 Reply Last reply Reply Quote 0
            • R
              rodhull
              last edited by

              Yes, that shows how the source is compiled (from https://github.com/RetroPie/zdoom.git) 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 retropie_setup.sh script)?

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

              1 Reply Last reply Reply Quote 0
              • R
                rodhull
                last edited by rodhull

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

                $/opt/retropie/ports/zdoom/zdoom
                ZDoom <unknown version> - - SDL version
                Compiled on Feb 17 2018

                If I run the version I compiled today from https://github.com/RetroPie/zdoom.git, 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...

                mituM 1 Reply Last reply Reply Quote 0
                • mituM
                  mitu Global Moderator @rodhull
                  last edited by

                  @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:

                  [8221eb8c38954d4ab7e700810feacbf567191e49]

                  • 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
                  1 Reply Last reply Reply Quote 0
                  • R
                    rodhull
                    last edited by

                    OK - so now I'm confused - why does a binary compiled from https://github.com/RetroPie/zdoom.git 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 https://github.com/RetroPie/zdoom.git right now, you get a completely different binary to the one supplied by the retropie_setup.sh script - it behaves differently too (Brutal Doom works in the retropie_setup.sh binary, but does not with the freshly compiled version).

                    Binary version (from retropie_setup.sh):

                    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 https://github.com/RetroPie/zdoom.git (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 retropie_setup.sh provides?

                    1 Reply Last reply Reply Quote 0
                    • F
                      FelixofMars
                      last edited by FelixofMars

                      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 **

                      1 Reply Last reply Reply Quote 0
                      • A
                        ale120679
                        last edited by ale120679

                        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:
                        "joy10=menu_main"
                        Why there isn't anything as (for example):
                        joy11=menu_enter
                        joy12=menu_back
                        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.

                        1 Reply Last reply Reply Quote 0
                        • RetroS3xualR
                          RetroS3xual
                          last edited by RetroS3xual

                          @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 runcommand.sh 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 retropie-setup.sh 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.

                          1 Reply Last reply Reply Quote 0
                          • RetroS3xualR
                            RetroS3xual
                            last edited by RetroS3xual

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

                            First, after performing this step:
                            git clone https://github.com/RetroPie/zdoom.git 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!

                            P 1 Reply Last reply Reply Quote 2
                            • P
                              Protocultor
                              last edited by

                              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:

                              https://github.com/protocultor/zdoom/releases/tag/2.8.11

                              For those who want to see the changes, here they are:
                              https://github.com/protocultor/zdoom/commit/4b129d827233b8bb42ce64e8b74231b9906c0f78

                              ...and now I'm hoping to see these changes officially in RetroPie in the future:
                              https://github.com/RetroPie/zdoom/pull/2

                              1 Reply Last reply Reply Quote 2
                              • QuackwalksQ
                                Quackwalks
                                last edited by

                                Pretty excited for this.

                                1 Reply Last reply Reply Quote 0
                                • P
                                  Protocultor @RetroS3xual
                                  last edited by

                                  @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:

                                  https://github.com/protocultor/zdoom/releases/tag/2.8.12

                                  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:
                                  https://github.com/protocultor/zdoom/commit/74f3c8140710cd002c030c8c0f3100c2b24fc7d4
                                  It's a shame that nobody in the RetroPie team has seen the PR yet :(

                                  RionR RetroS3xualR Solid OneS 3 Replies Last reply Reply Quote 1
                                  • RionR
                                    Rion @Protocultor
                                    last edited by Rion

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

                                    FBNeo rom filtering
                                    Mame2003 Arcade Bezels
                                    Fba Arcade Bezels
                                    Fba NeoGeo Bezels

                                    BuZzB 1 Reply Last reply Reply Quote 0
                                    • BuZzB
                                      BuZz administrators @Rion
                                      last edited by

                                      @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!

                                      To help us help you - please make sure you read the sticky topics before posting - https://retropie.org.uk/forum/topic/3/read-this-first

                                      1 Reply Last reply Reply Quote 2
                                      • RetroS3xualR
                                        RetroS3xual @Protocultor
                                        last edited by RetroS3xual

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

                                        1 Reply Last reply Reply Quote 1
                                        • P
                                          Protocultor
                                          last edited by

                                          Thanks for the replies guys!

                                          1 Reply Last reply Reply Quote 1
                                          • R
                                            RetroFreak89
                                            last edited by

                                            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?

                                            1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post

                                            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.