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

    Running ROM from shell ignores mapping [SOLVED]

    Scheduled Pinned Locked Moved Help and Support
    rfidnfcretroarchcontrollermapping
    11 Posts 4 Posters 1.3k 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.
    • R
      retroisbest
      last edited by retroisbest

      Pi Model or other hardware: 2B
      Power Supply used: Original pi power supply
      RetroPie Version Used: 4.4

      I'm currently invoking emulationstation to launch a rom from a shell command which gets ran from a python script, the rom launches correctly, unfortunately it ignores any controller mapping, the emulator used is retroarch.

      Here is the command in my python script

      subprocess.call("sudo openvt -c 1 -s -f /opt/retropie/supplementary/runcommand/runcommand.sh 0 SYS nes '/home/pi/RetroPie/roms/nes/Super Mario Bros..zip' &", shell=True)

      Which launches correctly but cannot exit the rom due to mappings not working, they do work in emulationstation and launching a ROM via the frontend does work in game.

      If i kill retroarch it returns me back to emulationstation.

      Any help would be much appreciated thankyou.

      rbakerR 1 Reply Last reply Reply Quote 0
      • rbakerR
        rbaker @retroisbest
        last edited by

        @retroisbest Hi, retroarch is not an emulator, it's a front end. There are 3 NES emulators that are "lr" - are you running the ones you think you are?

        R 1 Reply Last reply Reply Quote 0
        • R
          retroisbest @rbaker
          last edited by retroisbest

          @rbaker Im using retroarch core lr-fceumm which is default for NES
          ps -a only shows retroarch as the parentprocess as like you say its the frontend.

          After looking at the config for emulationstation for NES i think i need to pass the config parameter to override retroarch's default mappings

          Thanks for the prompt in the right direction though, will report back!

          UPDATE: Pretty sure the runcommand.sh passes the --config parameter for the input overrides

          rbakerR 1 Reply Last reply Reply Quote 0
          • rbakerR
            rbaker @retroisbest
            last edited by

            @retroisbest Didn't you set your retroarch mappings on first boot? If you are overriding them, what are you overriding them with?

            R 1 Reply Last reply Reply Quote 0
            • R
              retroisbest @rbaker
              last edited by

              @rbaker If i launch the game via emulationstation via my controller the controller mappings work in game
              if i launch the game via the shell command the controller mappings are ignored,
              emulationstation by default overides the retroarch default mappings with its own as seen in /opt/retropie/configs/nes /retroarch.cfg

              the emulators.cfg points to this path :

              lr-fceumm = "/opt/retropie/emulators/retroarch/bin/retroarch -L /opt/retropie/libretrocores/lr-fceumm/fceumm_libretro.so --config /opt/retropie/configs/nes/retroarch.cfg %ROM%"

              rbakerR mediamogulM mituM 3 Replies Last reply Reply Quote 0
              • rbakerR
                rbaker @retroisbest
                last edited by rbaker

                @retroisbest said in Running ROM from shell ignores mapping:

                controller mappings are ignored,

                Maybe it's to do with the hierarchy in the configs? You could try checking the override order according to https://github.com/RetroPie/RetroPie-Setup/wiki/RetroArch-Configuration#hardcoded-configurations

                1 Reply Last reply Reply Quote 0
                • mediamogulM
                  mediamogul Global Moderator @retroisbest
                  last edited by

                  @retroisbest said in Running ROM from shell ignores mapping:

                  emulationstation by default overides the retroarch default mappings with its own as seen in /opt/retropie/configs/nes /retroarch.cfg
                  the emulators.cfg points to this path :
                  lr-fceumm = "/opt/retropie/emulators/retroarch/bin/retroarch -L /opt/retropie/libretrocores/lr-fceumm/fceumm_libretro.so --config /opt/retropie/configs/nes/retroarch.cfg %ROM%"

                  Are you using this specific command yourself when trying to launch from the shell? If not, that's most likely the problem. Also, when doing so, keep in mind that %ROM% should be replaced with the full path to the ROM you want to launch.

                  RetroPie v4.5 • RPi3 Model B • 5.1V 2.5A PSU • 16GB SanDisk microSD • 512GB External Drive

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

                    @retroisbest said in Running ROM from shell ignores mapping:

                    @rbaker If i launch the game via emulationstation via my controller the controller mappings work in game
                    if i launch the game via the shell command the controller mappings are ignored,
                    emulationstation by default overides the retroarch default mappings with its own as seen in /opt/retropie/configs/nes /retroarch.cfg

                    There are no controller overrides in the /opt/retropie/configs/nes /retroarch.cfg file. The default file is almost empty. RetroArch uses the joypad auto-configure feature to configure auto-detect and configure the controller. When you configure a controller in Emulationstation, a joypad auto-configuration file is created in /opt/retropie/configs/all/retroarch-joypads and RetroArch looks there for the controller configuration.

                    the emulators.cfg points to this path :

                    lr-fceumm = "/opt/retropie/emulators/retroarch/bin/retroarch -L /opt/retropie/libretrocores/lr-fceumm/fceumm_libretro.so --config /opt/retropie/configs/nes/retroarch.cfg %ROM%"

                    Whay don't you use the launch command directly - as indicated by the Docs ? Your command is overly complicated and probably wrong - the sudo usage is unneeded and it's probably the reason why RetroArch cannot find its configuration file since RA is configured by the RetroPie scripts for the user (pi or whatever user has been used to perform the installation).

                    R 1 Reply Last reply Reply Quote 1
                    • R
                      retroisbest @mitu
                      last edited by retroisbest

                      @mitu thankyou, i did try the direct command with %ROM% substituted for my full path, the only issue I have is controller mapping works fine but when I exit emulation station does not run again as my RFID script takes explicit control and emulation station fails to launch, where as the over complicated path command I use relaunches emulation station when the game has quit, the controller mappings are just ignored.

                      You are correct about using the sudo command, the userspace will be incorrect so I'll try and use it without as well.

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

                        Ok,
                        After testing the sudo command is needed for the openvt to operate otherwise i get unable to open tty1 permission denied errors, if i use the direct command the python script i use for RFID tag detection gets explicit priority and does not advance back to emulationstation.

                        So close ......

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

                          This is my workaround:-

                          my /opt/retropie/configs/all/autostart.sh:-

                          python ~/MFRC522-python/rfidlaunch.py &
                          emulationstation

                          my rfidlaunch.py contains:
                          subprocess.call("/home/pi/nesmario.sh &" , shell=True)
                          when a corresponding RFID card is detected

                          this nesmario.sh
                          contains :
                          /opt/retropie/supplementary/runcommand/runcommand.sh 0 SYS nes '/home/pi/RetroPie/roms/nes/Super Mario Bros..zip'
                          emulationstation

                          this means my RFID script runs all the time, when the RFID card is detected in emulationstation it kills emulationstation, runs the rom as user pi and when the rom has quit relaunches emulationstation.

                          Thanks for all your help everybody

                          1 Reply Last reply Reply Quote 3
                          • 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.