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

    Load NON-PC rom with a script?

    Scheduled Pinned Locked Moved Help and Support
    script requestshell scriptloading gamessnes
    24 Posts 3 Posters 2.0k 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.
    • mituM
      mitu Global Moderator @clockwork42
      last edited by

      @clockwork42 If you're looking for the exact command to start a ROM, you can look in emulators.cfg to see the complete command used. For instance, starting a SNES ROM using lr-snes as emulator is done by executing

      /opt/retropie/emulators/retroarch/bin/retroarch -L /opt/retropie/libretrocores/lr-snes9x/snes9x_libretro.so --config /opt/retropie/configs/snes/retroarch.cfg _ROM_PATH_
      

      Otherwise, I don't understand what's the question here.

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

        @mitu said in Load NON-PC rom with a script?:

        /opt/retropie/emulators/retroarch/bin/retroarch -L /opt/retropie/libretrocores/lr-snes9x/snes9x_libretro.so --config /opt/retropie/configs/snes/retroar

        I'm pretty sure that's all I was looking for. I didn't realize it was in the emulators.cfg file unless you said that before and I missed it. That should just about do it. Thanks again.

        I'll try doing what I need to do and if I run into any issues, I'll let you know here.

        — CB

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

          @mitu

          OK, I got most of the way there. I edited my es_systems.cfg to be sure *.sh files aren't hidden in the \snes\ directory.

          So I wrote an *.sh file to try to run the Chrono Trigger rom with lr_snes9x as we discussed. The file consists of just the code you wrote in your latest reply to me, excepting that I put my actual rom path instead of where you wrote _ROM_PATH_. However, the file will not boot. I get the gray box that you normally get before booting a rom (press a button to config), but it never actually loads.

          Here is the exact code of my present document, chrono_test.sh:

          /opt/retropie/emulators/retroarch/bin/retroarch -L /opt/retropie/libretrocores/lr-snes9x/snes9x_libretro.so --config /opt/retropie/configs/snes/retroarch.cfg /home/pi/RetroPie/roms/snes/Chrono Trigger/chrono_msu1.sfc
          

          I'm sure it's some kind of silly and easily-corrected error, but I have no idea where that error is. I know that the capitalization is correct. Perhaps it's the space in the "Chrono Trigger" file folder that's causing the issue?

          Once the game loads, I'll be good. Thanks again for your patience with me!

          — CB

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

            @clockwork42 said in Load NON-PC rom with a script?:

            Perhaps it's the space in the "Chrono Trigger" file folder that's causing the issue?

            Yes, you need to quote the ROM name:

            /opt/retropie/emulators/retroarch/bin/retroarch \
             -L /opt/retropie/libretrocores/lr-snes9x/snes9x_libretro.so \
             --config /opt/retropie/configs/snes/retroarch.cfg \
            "/home/pi/RetroPie/roms/snes/Chrono Trigger/chrono_msu1.sfc:
            
            C 1 Reply Last reply Reply Quote 0
            • C
              clockwork42 @mitu
              last edited by clockwork42

              @mitu

              I put in the code you listed, and it seems like snes9x loads, but the rom itself doesn't. I definitely make it into the emulator because I can use hotkey commands (e.g. fast-forward) and pull up the Retroarch menu, but it's just a black screen and nothing ever happens or loads.

              Also, I thought that the colon in your code after the rom path might have been a typo and meant to be a close-quotation, so I tried that, but it led to the same result. I also tried putting everything in a new path with no spaces in it. That didn't seem to change anything, and I'm sure the new path listed in the *.sh file is correct.

              To be clear, the code you copied above is the only code in my *.sh file, save for the adjusted path.

              We're definitely getting there. Thanks again for your help and patience.

              — CB

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

                @clockwork42 The colon : at the end is a mistake, it supposed to be a closed quote.

                /opt/retropie/emulators/retroarch/bin/retroarch \
                 -L /opt/retropie/libretrocores/lr-snes9x/snes9x_libretro.so \
                 --config /opt/retropie/configs/snes/retroarch.cfg \
                "/home/pi/RetroPie/roms/snes/Chrono Trigger/chrono_msu1.sfc"
                
                C 1 Reply Last reply Reply Quote 0
                • C
                  clockwork42 @mitu
                  last edited by

                  @mitu said in Load NON-PC rom with a script?:

                  /opt/retropie/emulators/retroarch/bin/retroarch
                  -L /opt/retropie/libretrocores/lr-snes9x/snes9x_libretro.so
                  --config /opt/retropie/configs/snes/retroarch.cfg
                  "/home/pi/RetroPie/roms/snes/Chrono Trigger/chrono_msu1.sfc"

                  I copied and pasted exactly this to my shell file, restarted the pi, and tried it. It still brings me to a black screen, but I can load the Retroarch menu and input any function assigned to hotkeys. The path you listed is correct, and the game loads fine if I click on it from the /snes/folder, so I have no idea what is keeping the script from fully loading the game.

                  — CB

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

                    @mitu
                    A slight correction because I realized I altered something.

                    I made a wholly new *.sh file and used your code as-is (with corrected quotations) just to be sure I didn't screw something up. Entering into Emulationstation, picking Super Nintendo, and then selecting the *.sh file has the following effect. It looks like it's loading a rom. I get the gray text box that says:

                    Launching chrono_test (lr-snes9x2010) ...
                    
                    Press a button to configure
                    
                    Errors are logged to /dev/shm/runcommand.log
                    

                    If I do not press a button quickly, this seems to freeze. The only way I know to escape this is to manually turn the Pi off and on again.

                    If I press a button quickly and configure it then to select lr_snes9x, I can get past the gray box and the emulator seems to load, but the game doesn't. THAT is what brings me to the black screen where Retroarch and hotkey options are enabled, but I otherwise cannot do anything.

                    Hope that helps diagnose the problems a bit better.

                    — CB

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

                      @clockwork42 My guess is that there's some ROM path quoting error at stake. Can you post your complete script, between code tags ?

                      C 1 Reply Last reply Reply Quote 0
                      • C
                        clockwork42 @mitu
                        last edited by

                        @mitu Code tags? First I'm hearing of that. That's probably the thing I'm missing.

                        My *.sh file contains literally only the exact commands you quoted above. I know nothing about writing *.sh files aside from what I've discussed with you in this thread.

                        — CB

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

                          @clockwork42 said in Load NON-PC rom with a script?:

                          @mitu Code tags? First I'm hearing of that. That's probably the thing I'm missing.

                          No, it's not. I was referring to the ``` you put in forum posts to make code blocks stand out, not to the actual script content.

                          C 1 Reply Last reply Reply Quote 0
                          • C
                            clockwork42 @mitu
                            last edited by clockwork42

                            @mitu said in Load NON-PC rom with a script?:

                            @clockwork42 said in Load NON-PC rom with a script?:

                            @mitu Code tags? First I'm hearing of that. That's probably the thing I'm missing.

                            No, it's not. I was referring to the ``` you put in forum posts to make code blocks stand out, not to the actual script content.

                            Oh, sorry. My misunderstanding. At any rate, my *.sh file reads exactly the following:

                            /opt/retropie/emulators/retroarch/bin/retroarch \
                             -L /opt/retropie/libretrocores/lr-snes9x/snes9x_libretro.so \
                             --config /opt/retropie/configs/snes/retroarch.cfg \
                            "/home/pi/RetroPie/roms/snes/Chrono Trigger/chrono_msu1.sfc"
                            

                            I triple-checked the path to be sure it's correct. To be clear, this is the code that seems to crash the loading process (where it's stuck on the gray box and I can't do anything).

                            Sorry again for the hassle. I appreciate your continued willingness to help.

                            — CB

                            J 1 Reply Last reply Reply Quote 0
                            • J
                              joelkolb @clockwork42
                              last edited by joelkolb

                              @clockwork42 I know this thread is a few months old but figured out how to do exactly what I believe you are trying to do and I wanted to post it in case you or anyone else is still looking like I was up until recently.

                              I separated MSU-1 into a distinct system from the rest of SNES called "snesmsu1". Here is what my "/roms/snesmsu1" folder looks like:

                              alt text

                              For this setup you would also need to make a folder called "snesmsu1" at "/opt/retropie/configs/snesmsu1". You could copy the "snes" folder from "configs" as a starting point. I removed all emulators from "emulators.cfg" except for lr-snes9x and replaced the reference to "snes" with "snesmsu1" so that it looks like this:

                              lr-snes9x = "/opt/retropie/emulators/retroarch/bin/retroarch -L /opt/retropie/libretrocores/lr-snes9x/snes9x_libretro.so --config /opt/retropie/configs/snesmsu1/retroarch.cfg %ROM%"
                              default = "lr-snes9x"
                              

                              I also edit "retroarch.cfg" replacing the reference to "snes" with "snesmsu1" so that it looks like this:

                              # Settings made here will only override settings in the global retroarch.cfg if placed above the #include line
                              
                              input_remapping_directory = "/opt/retropie/configs/snesmsu1/"
                              
                              #include "/opt/retropie/configs/all/retroarch.cfg"
                              

                              The crucial part that will make runcommand execute your 'rom.sh' files as scripts instead of trying to open them with the default emulator is the command node in your "es_systems.cfg" file. Here is what my system node for "snesmsu1" looks like, including the command:

                                <system>
                                  <name>snesmsu1</name>
                                  <fullname>Super Nintendo MSU1</fullname>
                                  <path>/home/pi/RetroPie/roms/snesmsu1</path>
                                  <extension>.sh .SH</extension>
                                  <command>bash %ROM%</command>
                                  <platform>snes</platform>
                                  <theme>snesmsu1</theme>
                                </system>
                              

                              With the above in your "es_systems.cfg" and a folder named snesmsu1 in your "roms" folder, you will have a separate section in EmulationStation for SNES MSU-1. You will also have to use a theme that has an "snesmsu1" section. Otherwise, you will have a blank, unthemed section for "snesmsu1".

                              Only '.sh' files in your "snesmsu1" folder will be displayed in this section in EmulationStation. Notice in my screenshot that the names of all the folders that contain the actual game files begin with a dot which makes them hidden in Linux so they aren't displayed in EmulationStaion. Your "gamelist.xml" file points to one of the '.sh' files in the "path" node for each game and then you can have all your metadata and media set up as well and everything will look pretty in EmulationStation.

                              Other than that, here is an example of what my 'Chrono Trigger (MSU-1).sh' looks like for launching the game:

                              #!/bin/bash
                              "/opt/retropie/supplementary/runcommand/runcommand.sh" 0 _SYS_ "snesmsu1" "/home/pi/RetroPie/roms/snesmsu1/.Chrono Trigger (MSU-1)/Chrono Trigger (MSU-1).sfc"
                              

                              Because of the different commands in "es_systems.cfg" for launching regular SNES ROMs vs. running shell scripts, you really do need to separate MSU-1 into a different system from regular SNES. Actually, you could combine them, but if you want to keep things organized as described then you would have to create a similar shell script for each regular SNES ROM as well. I prefer to have them separated for aesthetics, organization and ease of use.

                              With everything configured as I described, EmulationStation looks nice and tidy and so does my "/roms/snesmsu1" folder. I hope this helps.

                              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.