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

    Redirecting Runcommand

    Scheduled Pinned Locked Moved Help and Support
    runcommandonstartsnesshell script
    8 Posts 3 Posters 1.2k 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.
    • B
      BoxDrop
      last edited by BoxDrop

      Is there a way to modify Runcommand's launch parameters within the runcommand-onstart script? Specifically, to modify the path parameter ($3) to point to a different location? Alternatively, is there a way to prevent runcommand from starting from within runcommand-onstart, and then invoke it again using different parameters?

      I ask because I have some dummy roms in my SNES main folder. When one of those roms is launched, I'd like onstart to detect it and change the path to a different folder completely outside of the snes system folder, where the actual rom is being stored. I've looked into having snes launch specific shell scripts and also into using symbolic links, and neither meets my needs.

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

        @boxdrop What's your use case ? Why can't you copy the ROMs in the SNES folder to be run as normal ?

        B 1 Reply Last reply Reply Quote 0
        • B
          BoxDrop @mitu
          last edited by BoxDrop

          @mitu They're msu patched roms that need their own folders with additional files. I dislike having to go into (or even seeing) those additional folders in the snes gamelist.

          Edit: I'm doing some digging and seeing potential in the runcustom script method that is shown here, so that might be a good alternative if onstart doesn't have the ability to do this on its own.

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

            @boxdrop I think you're best bet is to create a custom system - as you found in the topic you referenced - and write a script wrapper over the Runcommand, where you can control how to run it.

            1 Reply Last reply Reply Quote 0
            • C
              cloudlink
              last edited by

              Could you just use a symlink to the rom? It's like a shortcut file.

              ln -s /folderorfile/link/will/point/to /name/of/the/link

              B 1 Reply Last reply Reply Quote 0
              • B
                BoxDrop @cloudlink
                last edited by

                @cloudlink I don't think so, though admittedly I haven't tried it. The emulator will look for the files at the path where runcommand tells it the rom is, and probably won't even see that the rom is symlinked.

                1 Reply Last reply Reply Quote 0
                • B
                  BoxDrop
                  last edited by

                  Okay, I'm running with the custom system idea. I've written up my first bash script for that purpose. Is there a bash guru who can take a look at it and let me know if it looks all right, or if there is a cleaner way to handle it?

                  "#!/usr/bin/env bash
                  
                  if [[ $1 = "/home/pi/RetroPie/roms/snes/act2_msu1.sfc" ]]
                  then
                  	rom="/home/pi/RetroPie/roms/msu/Act Raiser 2 MSU v1 Kurrono, Conn 2018-03-25/act2_msu1.sfc"
                  elif [[ $1 = "/home/pi/RetroPie/roms/snes/actraiser_msu1.sfc" ]]
                  then
                  	rom="/home/pi/RetroPie/roms/msu/Actraiser - Abyss Rebirth OST, MSU v1 Darkshock/actraiser_msu1.sfc"
                  elif [[ $1 = "/home/pi/RetroPie/roms/snes/axe_msu1.sfc" ]]
                  then
                  	rom="/home/pi/RetroPie/roms/msu/Axelay MSU v1 PepilloPEV 2018-04-01/axe_msu1.sfc"
                  elif [[ $1 = "/home/pi/RetroPie/roms/snes/chrono_msu.smc" ]]
                  then
                  	rom="/home/pi/RetroPie/roms/msu/Chrono Trigger Remastered+FMV Beta v1.1 Resume FLAC Dracula9AntiChapel, Darkshock, Qwertymodo Audio Fix/chrono_msu.smc"
                  elif [[ $1 = "/home/pi/RetroPie/roms/snes/dc_msu1.sfc" ]]
                  then
                  	rom="/home/pi/RetroPie/roms/msu/Demon Crest Remastered ArcadeTV MIDI MSU v1 RedScorpion, ArcadeTV, Conn 2018-03-23/dc_msu1.sfc"
                  elif [[ $1 = "/home/pi/RetroPie/roms/snes/drs_msu1.sfc" ]]
                  then
                  	rom="/home/pi/RetroPie/roms/msu/Death and Return of Superman MSU v2 Conn, Kurrono 2017-11-3/drs_msu1.sfc"
                  elif [[ $1 = "/home/pi/RetroPie/roms/snes/ewj2-msu1.sfc" ]]
                  then
                  	rom="/home/pi/RetroPie/roms/msu/Earthworm Jim 2 Sega Saturn OST MSU v1.1 PepilloPEV 2018-04-01/ewj2-msu1.sfc"
                  elif [[ $1 = "/home/pi/RetroPie/roms/snes/ff3.sfc" ]]
                  then
                  	rom="/home/pi/RetroPie/roms/msu/Final Fantasy VI Balance and Ruin - Covarr, Qwertymodo Audio Fix/ff3.sfc"
                  elif [[ $1 = "/home/pi/RetroPie/roms/snes/g3-msu1.sfc" ]]
                  then
                  	rom="/home/pi/RetroPie/roms/msu/Gradius MSU Kurrono Kai Mix MSU v1.4b PepilloPEV, Conn/g3-msu1.sfc"
                  elif [[ $1 = "/home/pi/RetroPie/roms/snes/iog_msu1.sfc" ]]
                  then
                  	rom="/home/pi/RetroPie/roms/msu/Illusion of Gaia MSU Conn v1 2018-01-31/iog_msu1.sfc"
                  elif [[ $1 = "/home/pi/RetroPie/roms/snes/jm_msu1.sfc" ]]
                  then
                  	rom="/home/pi/RetroPie/roms/msu/Joe and Mac MSU v1 Kurrono/jm_msu1.sfc"
                  elif [[ $1 = "/home/pi/RetroPie/roms/snes/lk_msu1.sfc" ]]
                  then
                  	rom="/home/pi/RetroPie/roms/msu/Lion King Film OST v2 kurrono 2018-03-24/lk_msu1.sfc"
                  elif [[ $1 = "/home/pi/RetroPie/roms/snes/lmn_msu1.sfc" ]]
                  then
                  	rom="/home/pi/RetroPie/roms/msu/Legend of the Mystical Ninja MSU v1 Kurrono, Conn/lmn_msu1.sfc"
                  elif [[ $1 = "/home/pi/RetroPie/roms/snes/mm-msu1.sfc" ]]
                  then
                  	rom="/home/pi/RetroPie/roms/msu/Mickey Mania Sega Saturn OST MSU v1 PepilloPEV 2018-04-01/mm-msu1.sfc"
                  elif [[ $1 = "/home/pi/RetroPie/roms/snes/pf_msu1.sfc" ]]
                  then
                  	rom="/home/pi/RetroPie/roms/msu/Pilotwings MSU v4 Kurrono 2017-12-30/pf_msu1.sfc"
                  elif [[ $1 = "/home/pi/RetroPie/roms/snes/pw_msu1.sfc" ]]
                  then
                  	rom="/home/pi/RetroPie/roms/msu/Pitfall MSU v1 Kurrono, pepilloPev, Conn 2018-03-22/pw_msu1.sfc"
                  else
                  	rom="$1"
                  fi
                  
                  /opt/retropie/supplementary/runcommand/runcommand.sh 0 _SYS_ snes "$rom"
                  
                  1 Reply Last reply Reply Quote 0
                  • mituM
                    mitu Global Moderator
                    last edited by

                    I'd probably rewrite it like

                    #!/usr/bin/env bash
                    
                    ROMDIR=/home/pi/RetroPie/roms/snes
                    MSUROMDIR=/home/pi/RetroPie/roms/msu
                    
                    rom=$1
                    
                    if [[ $rom == *"act2_msu1.sfc" ]]; then
                            rom="${MSUROMDIR}/Act Raiser 2 MSU v1 Kurrono, Conn 2018-03-25/act2_msu1.sfc"
                    fi
                    
                    if [[ $rom =~ *"actraiser_msu1.sfc" ]]; then
                            rom="${MSUROMDIR}/Actraiser - Abyss Rebirth OST, MSU v1 Darkshock/actraiser_msu1.sfc"
                    fi
                    
                    # and all other roms...
                    
                    
                    /opt/retropie/supplementary/runcommand/runcommand.sh 0 _SYS_ snes "$rom"
                    
                    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.