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

    User Menu > Entry is not saved

    Scheduled Pinned Locked Moved Help and Support
    romstartupuser menu
    5 Posts 2 Posters 450 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.
    • T
      treki
      last edited by treki

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

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

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

        T 1 Reply Last reply Reply Quote 1
        • T
          treki @mitu
          last edited by

          @mitu
          Thank you.
          Now the same script is always executed for every game.
          For example, I want game A (MAME) to call the script X.sh, game B (MAME) to call the script Y.sh.
          The same for Dosbox.

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

            @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.
            T 1 Reply Last reply Reply Quote 1
            • T
              treki @mitu
              last edited by treki

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

              Edit:
              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" "$@"
              
              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.