• Recent
  • Tags
  • Popular
  • Home
  • Docs
  • Register
  • Login
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

Using custom script that is not runcommand.sh does not work

Scheduled Pinned Locked Moved Help and Support
scripting
36 Posts 3 Posters 3.7k 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.
  • F
    Folly @RetroFloppy08
    last edited by 10 Nov 2022, 14:40

    @RetroFloppy08

    You need somehow to add an other system that will load the .chd file and redirects it to your bash script which will detect the extension and then uses the correct runcommand.

    R 1 Reply Last reply 10 Nov 2022, 14:44 Reply Quote 0
    • R
      RetroFloppy08 @Folly
      last edited by 10 Nov 2022, 14:44

      @Folly That's what I've done. I made a seperate system reserved for loading games from the disc. It also uses the custom script.

      F 1 Reply Last reply 10 Nov 2022, 14:46 Reply Quote 0
      • F
        Folly @RetroFloppy08
        last edited by 10 Nov 2022, 14:46

        @RetroFloppy08

        So what is your custom system name then ?
        And how did you configure it ?

        R 1 Reply Last reply 10 Nov 2022, 14:51 Reply Quote 0
        • R
          RetroFloppy08 @Folly
          last edited by 10 Nov 2022, 14:51

          @Folly If you look at the initial post, you can see the system entry.

          F 1 Reply Last reply 10 Nov 2022, 14:56 Reply Quote 0
          • F
            Folly @RetroFloppy08
            last edited by Folly 11 Oct 2022, 14:59 10 Nov 2022, 14:56

            @RetroFloppy08

            Is that all you added ?
            You will need to add much more to get it working.

            So you have 2 choices.
            Make a module-script like the example I gave you earlier , or do all the setting manually.
            You can have a look here on how to do it manually :
            https://retropie.org.uk/forum/topic/28462/tutorial-handheld-and-plug-play-systems-with-mame

            And replace mame or emulator with your script and no need to use some retroarch.cfg.

            R 1 Reply Last reply 10 Nov 2022, 15:02 Reply Quote 0
            • R
              RetroFloppy08 @Folly
              last edited by 10 Nov 2022, 15:02

              @Folly Hmm. Seems like I've got a lot of work to do. I'll let you know how it goes.

              F 1 Reply Last reply 10 Nov 2022, 15:04 Reply Quote 0
              • F
                Folly @RetroFloppy08
                last edited by 10 Nov 2022, 15:04

                @RetroFloppy08

                Can you filter all the nonsense and pick the correct things for yourself ?

                R 1 Reply Last reply 10 Nov 2022, 15:06 Reply Quote 0
                • R
                  RetroFloppy08 @Folly
                  last edited by 10 Nov 2022, 15:06

                  @Folly I can certainly try. I'm seeing some key things already, for example lines at the end that use the %ROM% argument to load a file from EmulationStation.

                  F 1 Reply Last reply 10 Nov 2022, 15:08 Reply Quote 0
                  • F
                    Folly @RetroFloppy08
                    last edited by 10 Nov 2022, 15:08

                    @RetroFloppy08

                    Ok, good luck.

                    Try this first, otherwise I recommend you to make a module-script.
                    Once you know how, then it's the easiest way.

                    R 1 Reply Last reply 10 Nov 2022, 15:19 Reply Quote 0
                    • R
                      RetroFloppy08 @Folly
                      last edited by 10 Nov 2022, 15:19

                      @Folly 03194593-0046-4323-8de9-8c6338d71ef9-image.png These are the lines I have narrowed down. I have a feeling they're wrong, so if they are, please tell me.

                      F 1 Reply Last reply 10 Nov 2022, 16:49 Reply Quote 0
                      • S
                        sleve_mcdichael @RetroFloppy08
                        last edited by 10 Nov 2022, 16:04

                        @RetroFloppy08 said in Using custom script that is not runcommand.sh does not work:

                        @sleve_mcdichael What argument am I supposed to attach to the command to load the filename?

                        %ROM% in the <command> string is used by EmulationStation and is replaced by the actual rom file you've selected. So for example if your <commamd> is bash /test/script.sh %ROM% and you select the game "Foorio in Foo Land" for the "Foo Bar Entertainment System" then ES is going to run:

                        bash /test/script.sh "/home/pi/RetroPie/roms/fbes/Foorio in Foo Land (USA, Zanzibar) (Rev B).foo"
                        

                        Your script will then need to parse this as $1 or, "first argument."

                        I wonder if the spaces are maybe tripping it up. Try wrapping $1 in quotes, like "$1":

                        [[ "$1" == *.chd ]] && /opt/retropie/supplementary/runcommand/runcommand.sh 0 _SYS_ psx "$1"
                        

                        ...or try "$*" ("all arguments") instead of "$1" (first argument) (still in quotes).

                        1 Reply Last reply Reply Quote 0
                        • F
                          Folly @RetroFloppy08
                          last edited by Folly 11 Oct 2022, 16:54 10 Nov 2022, 16:49

                          @RetroFloppy08 said in Using custom script that is not runcommand.sh does not work:

                          @Folly 03194593-0046-4323-8de9-8c6338d71ef9-image.png These are the lines I have narrowed down. I have a feeling they're wrong, so if they are, please tell me.

                          Not sure what you are doing with this.
                          My script works, but not for your purpose.
                          The module-script is just an example, if you want to use it you to completely rewrite it for your needs.

                          My advise was to make a custom system manually first.
                          If that doesn't work we can talk about making a module-script.

                          R 1 Reply Last reply 11 Nov 2022, 22:42 Reply Quote 0
                          • R
                            RetroFloppy08 @Folly
                            last edited by 11 Nov 2022, 22:42

                            @Folly I've actually gotten the script to work. I reworked how the if statement is processed, and it works like a charm. Instead of isolating the extension (as initially suggested by @sleve_mcdichael) I instead told the program to read the last 4 characters of the filename. It works now, all I need to do is make more discs with different files, and add some else if statements. I'll post the script once it's finished.

                            F 1 Reply Last reply 12 Nov 2022, 07:59 Reply Quote 0
                            • F
                              Folly @RetroFloppy08
                              last edited by 12 Nov 2022, 07:59

                              @RetroFloppy08

                              Good work !
                              Curious what you made ;-)

                              R 1 Reply Last reply 13 Nov 2022, 00:17 Reply Quote 0
                              • R
                                RetroFloppy08 @Folly
                                last edited by 13 Nov 2022, 00:17

                                @Folly @sleve_mcdichael Alright, it's done. I present to you the script to load games based off of their filenames. This is the version I have, and it works very well. The selection is limited, but the good news is you can select for yourself what file types are supported. Have fun!

                                #!/bin/bash
                                rom="$1"
                                if [ "${1: -4}" == ".chd" ]
                                then
                                /opt/retropie/supplementary/runcommand/runcommand.sh 0 _SYS_ psx "$1"
                                elif [ "${1: -4}" == ".bin" ] || [ "${1: -3}" == ".md" ]
                                then
                                /opt/retropie/supplementary/runcommand/runcommand.sh 0 _SYS_ megadrive "$1"
                                elif [ "${1: -4}" == ".nes" ]
                                then
                                /opt/retropie/supplementary/runcommand/runcommand.sh 0 _SYS_ nes "$1"
                                elif [ "${1: -4}" == ".smc" ] || [ "${1: -4}" == ".sfc" ]
                                then
                                /opt/retropie/supplementary/runcommand/runcommand.sh 0 _SYS_ snes "$1"
                                elif [ "${1: -4}" == ".z64" ]
                                then
                                /opt/retropie/supplementary/runcommand/runcommand.sh 0 _SYS_ n64 "$1"
                                elif [ "${1: -4}" == ".gba" ]
                                then
                                /opt/retropie/supplementary/runcommand/runcommand.sh 0 _SYS_ gba "$1"
                                elif [ "${1: -4}" == ".zip" ]
                                then
                                /opt/retropie/supplementary/runcommand/runcommand.sh 0 _SYS_ mame-libretro "$1"
                                elif [ "${1: -3}" == ".gb" ]
                                then
                                /opt/retropie/supplementary/runcommand/runcommand.sh 0 _SYS_ gb "$1"
                                elif [ "${1: -4}" == ".gbc" ]
                                then
                                /opt/retropie/supplementary/runcommand/runcommand.sh 0 _SYS_ gbc "$1"
                                elif [ "${1: -4}" == ".fds" ]
                                then
                                /opt/retropie/supplementary/runcommand/runcommand.sh 0 _SYS_ fds "$1"
                                elif [ "${1: -4}" == ".nds" ]
                                then
                                /opt/retropie/supplementary/runcommand/runcommand.sh 0 _SYS_ nds "$1"
                                fi
                                1 Reply Last reply Reply Quote 2
                                36 out of 36
                                • First post
                                  36/36
                                  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.

                                  This community forum collects and processes your personal information.
                                  consent.not_received