User Menu > Entry is not saved
-
If I go to the "User Menu" when starting a game and choose my own script, it will only be executed once.
The next time you start the same game, this entry is "forgotten" again.
How can I save the selection permanently?My plan:
Before every game I want to call up a certain Python script which controls servos (for 4/8 way joystick restrictor). -
@treki said in User Menu > Entry is not saved:
The next time you start the same game, this entry is "forgotten" again.
That's how the User menu works, it's meant to be run manually.
Before every game I want to call up a certain Python script which controls servos (for 4/8 way joystick restrictor).
Use the
onstart
runcommand support to run your script automatically.You can use the User Script as a toggle or configuration script to select/de-select/configure the restrictor settings for the game, while the
onstart
script checks the game and runs the appropriate commands. -
-
@treki said in User Menu > Entry is not saved:
For example, I want game A (MAME) to call the script X.sh, game B (MAME) to call the script Y.sh.
You can modify your main script and take this into account or - as I said - use your User Script as a toggle/configuration:
- when User script option Y for game A is selected save the 'Y' and the game A values to a configuration file, in a simple format.
- onstart script starts, checks if the game A is in the configuration file and which script should call, then calls it.
-
@mitu
I have now managed to get the test script to read the following data.- mame-libretro
- lr-mame2016
- /home/pi/RetroPie/roms/mame-libretro/galaga.zip
- /opt/retropie/emulators/retroarch/bin/retroarch -L /opt/retropie/libretrocores/lr-mame2016/mamearcade2016_libretro.so --config /opt/retropie/configs/mame-libretro/retroarch.cfg "/home/pi/RetroPie/roms/mame-libretro/galaga.zip"
Test script:
system=$1 emulator=$2 path=$3 commandline=$4 echo $system > /home/pi/test.txt echo $emulator >> /home/pi/test.txt echo $path >> /home/pi/test.txt echo $commandline >> /home/pi/test.txt
Where do I enter the option Y for the game and how do I read this option into my script?
E.g:
if type = Y then ./script1.sh
if type = X then ./script2.shEdit:
Now I have a solution.
My script:############################################################### # 4 oder 8 Wege Joystick von runcommand-onstart.sh aufgerufen # # (C) 2021 treki # ############################################################### # Namen der 4-Wege Games in /home/pi/4way.games eintragen #system=$1 #emulator=$2 #path=$3 commandline=$4 echo $commandline > /home/pi/game.name.txt #Name des 4-Wege ROMs in diesem File, welches in 4way.games geschrieben werden muss var=$(echo $commandline | grep -o -f /home/pi/4way.games) if [ -z "$var" ] then echo "8-Wege Joystick" > /home/pi/test.txt else echo "4-Wege Joystick" > /home/pi/test.txt fi
In the file /home/pi/4way.games are the names (.zip) of 4-way games.
My 4way.games file looks like this:asteroid1 astdelux bzonec pbobble2u dkong dkong3b dkongjrb fantsia2 galaga galaxian mspacman pacman pengo phoenixt popeyebl qbert qixb spacedx supertnk tankfrce atetrisa tetrisp tron4 uniwars
Entry in /opt/retropie/configs/all/runcommand-onstart.sh :
bash "/home/pi/4or8way.sh" "$@"
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.