• 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.
  • R
    RetroFloppy08
    last edited by 8 Nov 2022, 14:39

    This may be some hard-coded thing, but using my own script instead of runcommand.sh doesn't work. This may be my own fault, but first I get "Permission Denied", then after adding sudo bash to the command in es_systems.cfg it gives me "command not found" which I am stumped by. Is it something with the script? Can it not find the file? If someone could point me in the right direction, it would be greatly appreciated.

    Here is the script itself:

    #!/bin/bash
    if [[ %ROM% == *.chd ]]
    then
    sudo bash /opt/retropie/supplementary/runcommand/runcommand.sh 0 _SYS_ psx %ROM%
    fi

    And here's the system entry:

    <system>
      <name>Load From Game Disc</name>
      <path>/mnt/disc</path>
      <extension>.cue .cbn .chd .img .iso .m3u .mdf .pbp .toc .z .znx .zip .CUE .CBN .CHD .IMG .ISO .M3U .MDF .PBP .TOC .Z .ZNX .ZIP</extension>
      <command>/opt/retropie/supplementary/runcommand/loadfromdisc.sh %ROM%</command>
      <theme>disc</theme>
    </system>
    

    Currently using a Raspberry Pi 400, with a USB cable I bought from Amazon and a charging brick, running Retropie 4.8, with a USB DVD drive and a PDP Nintendo Switch controller. No log file.

    S 1 Reply Last reply 8 Nov 2022, 19:50 Reply Quote 0
    • S
      sleve_mcdichael @RetroFloppy08
      last edited by sleve_mcdichael 11 Aug 2022, 19:50 8 Nov 2022, 19:50

      @RetroFloppy08 your custom script doesn't understand the %ROM% parameter. Try:

      #!/bin/bash
      if [[ $1 == *.chd ]]
      then
      /opt/retropie/supplementary/runcommand/runcommand.sh 0 _SYS_ psx $1
      fi

      ...if that doesn't work, it might not like the wildcard in your test string. I would use something like this to strip everything but the extension and test against that:

      #!/bin/bash
      rom="$1"
      ext="${rom##*.}"
      if [[ "$ext" == "chd" ]]; then
      /opt/retropie/supplementary/runcommand/runcommand.sh 0 _SYS_ psx "$rom"
      fi
      R 3 Replies Last reply 8 Nov 2022, 21:09 Reply Quote 0
      • R
        RetroFloppy08 @sleve_mcdichael
        last edited by 8 Nov 2022, 21:09

        @sleve_mcdichael Just to clarify: do these scripts account for the actual selected ROM?

        1 Reply Last reply Reply Quote 0
        • R
          RetroFloppy08 @sleve_mcdichael
          last edited by 9 Nov 2022, 01:29

          @sleve_mcdichael Taking a look at the script, it seems as if I can set a %rom% parameter so $1 can be the chosen file. Is that correct?

          1 Reply Last reply Reply Quote 0
          • R
            RetroFloppy08 @sleve_mcdichael
            last edited by 9 Nov 2022, 01:32

            @sleve_mcdichael Using the second script, no errors are outputted, however it doesn't load the game.

            S 1 Reply Last reply 9 Nov 2022, 02:23 Reply Quote 0
            • S
              sleve_mcdichael @RetroFloppy08
              last edited by 9 Nov 2022, 02:23

              @RetroFloppy08 can I ask, what's the end goal here?

              R 2 Replies Last reply 9 Nov 2022, 03:17 Reply Quote 0
              • R
                RetroFloppy08 @sleve_mcdichael
                last edited by 9 Nov 2022, 03:17

                @sleve_mcdichael Detecting specific file types and loading the emulator associated with it. CHD files I have reserved for PSX games.

                F 1 Reply Last reply 10 Nov 2022, 13:37 Reply Quote 0
                • R
                  RetroFloppy08 @sleve_mcdichael
                  last edited by 10 Nov 2022, 13:16

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

                  F S 2 Replies Last reply 10 Nov 2022, 13:56 Reply Quote 0
                  • F
                    Folly @RetroFloppy08
                    last edited by Folly 11 Oct 2022, 13:48 10 Nov 2022, 13:37

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

                    @sleve_mcdichael Detecting specific file types and loading the emulator associated with it. CHD files I have reserved for PSX games.

                    You mean only load PSX .CHD filetypes directly from the CLI, with your script, without using emulationstation, right ?

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

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

                      You can reduce it to :

                      #!/bin/bash
                      [[ $1 == *.chd ]] && /opt/retropie/supplementary/runcommand/runcommand.sh 0 _SYS_ psx $1

                      Save it as a file, for example : loadpsx.sh
                      Then do :
                      bash loadpsx.sh /home/pi/RetroPie/roms/psx/game.chd
                      I think runcommand.sh needs the full path.

                      If you want to reduce it to, lets say : bash loadpsx.sh game.chd
                      Then you have to add the path in the script.

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

                        @Folly When I click on a ROM in the system I specified to use the script, I want it to determine what runcommand command is appropriate based on the extension, and give the command. I have reserved .chd files for PSX, as those files aren't specific to one system.

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

                          @RetroFloppy08 Furthermore, if the check for a PSX game (as an example) fails, it moves on to checking for another system (eg. SNES) and so on and so forth.

                          R F 2 Replies Last reply 10 Nov 2022, 14:11 Reply Quote 0
                          • R
                            RetroFloppy08 @RetroFloppy08
                            last edited by 10 Nov 2022, 14:11

                            @RetroFloppy08 The main reason i'm attempting this is because of a project i've been working on that aims to get game disc support on RetroPie. I've worked out mounting and loading the contents of the disc, and remounting it after a swap, but so far the only system properly supported is PSX, as there exists no pre-made way to detect file types and run the corresponding emulator.

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

                              @RetroFloppy08

                              Ok, I read your post.
                              Really not sure what you are trying to do here.
                              Basically you want to detect filetype and the run the appropriate runcommand.

                              Perhaps this is something to look at (read lines 66-83) :
                              https://github.com/FollyMaddy/RetroPie-Share/blob/main/00-scriptmodules-00/emulators/b-em-allegro4.sh
                              On the extentsion it detects whether it's a tape or a disk and loads the appropriate commands.

                              Looks like this is somewhat you want to do.

                              R 2 Replies Last reply 10 Nov 2022, 14:21 Reply Quote 0
                              • R
                                RetroFloppy08 @Folly
                                last edited by 10 Nov 2022, 14:21

                                @Folly Basically:

                                -User selects ROM from EmulationStation
                                -Custom script runs in place of runcommand.sh (thanks, es_systems.cfg)
                                -Custom script detects file extension, then uses runcommand.sh to load the correct emulator

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

                                  @RetroFloppy08

                                  Well look at my earlier post.

                                  It runs that multiload.sh with the runcommand.sh and then the multiload.sh script does the rest without using runcommand.sh.

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

                                    @Folly Looking at the link, it's not exactly what i'm looking for. I shouldn't need too much code, just some if else statements.

                                    F R 2 Replies Last reply 10 Nov 2022, 14:26 Reply Quote 0
                                    • F
                                      Folly @RetroFloppy08
                                      last edited by 10 Nov 2022, 14:26

                                      @RetroFloppy08

                                      And did you try the suggestions earlier in the thread ?

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

                                        @RetroFloppy08 Of course, I would need some kind of way to load the ROM's filename in question. That's the problem i'm facing currently.

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

                                          @RetroFloppy08

                                          From the CLI or from emulationstation ?

                                          R 1 Reply Last reply 10 Nov 2022, 14:32 Reply Quote 0
                                          20 out of 36
                                          • First post
                                            20/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