Running ROM from shell ignores mapping [SOLVED]
-
Pi Model or other hardware: 2B
Power Supply used: Original pi power supply
RetroPie Version Used: 4.4I'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.
-
@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?
-
@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
-
@retroisbest Didn't you set your retroarch mappings on first boot? If you are overriding them, what are you overriding them with?
-
@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.cfgthe 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%"
-
@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
-
@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. -
@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.cfgThere 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). -
@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.
-
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 ......
-
This is my workaround:-
my /opt/retropie/configs/all/autostart.sh:-
python ~/MFRC522-python/rfidlaunch.py &
emulationstationmy rfidlaunch.py contains:
subprocess.call("/home/pi/nesmario.sh &" , shell=True)
when a corresponding RFID card is detectedthis nesmario.sh
contains :
/opt/retropie/supplementary/runcommand/runcommand.sh 0 SYS nes '/home/pi/RetroPie/roms/nes/Super Mario Bros..zip'
emulationstationthis 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
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.