Load NON-PC rom with a script?
-
The list of extensions shown in the gamelist is a per-system configuration - look in
/etc/emulationstation/es_systems.cfg
. For SNES, the.sh
extension is not taken into account, so files with these extension are 'hidden' in the list. If you want additional files to be shown (besides the ones already configured), you'll have to modify thees_systems.cfg
- it's detailed in the Docs.Anyway, if someone could provide me some help putting together basic script to call a SNES game rom and remind me how to make the emulationstation folder display that type of script file, that would be absolutely fantastic.
How are you running the MSU games ? Aren't they just regular ROMs ?
-
Thanks Mitu!
Yes, they are regular SNES roms. The only necessity is that they have to boot with plain lr-snes9x as the newer snes9x versions do not support MSU-1. I've set them to do this from each game's individual launch menu, but I don't know if that's important for the script.
Thanks!
— CB
-
lr-snes9x
IS the latest SNES9x version and the one supporting MSU games.
If you've already configured the ROMs to start withlr-snes9x
, isn't that what you wanted ? Why you need an extra launching script in this case ? -
@mitu Each MSU-enabled game has 40+ individual files that need to be placed in the exact same directory. If I want all of my games to be listed without folders in emulationstation, then I have to find a workaround.
I thought that if I could create a new folder in the roms directory (like /roms/snes-msu1/ or similar), I could store the game files in there, individually foldered and separated, while using scripts in the /roms/snes/ directory to load their games. That way, everything could be organized, but all the games would be listed in emulationstation without the need for folders (especially since emulationstation hides the other files, so each game folder would appear to have only one file in it).
Hope that helps!
— CB
P.S. -- My mistake about lr-snes9x. I thought the ones with the years were newer rather than older. Hence my having to install lr-snes9x manually.
-
Since
.msu
and.pcm
files are not valid SNES games extensions, can't you just copy them next to the patched.sfc
files, without a game folder ? Only the.sfc
file would be listed and no folders are necessary. -
That would in theory work out fine, aside from that the \snes\ directory would look insane if I ever needed to access the pi directly to find anything in there. Right now I've got at least a dozen MSU games, so it's probably somewhere in the realm of 600-800+ individual files. All of that in one folder is a daunting prospect for me.
That was the reason I was interested in the scripting. It just struck me as an elegant workaround to get the best of both worlds. I just have no idea what an appropriate script setup or the appropriate commands would be. I've tried to search here and elsewhere, but to no avail, hence posting. Anything you can point me to on that front would be greatly appreciated.
— CB
-
Well, the launcher used by RetroPie is called
runcommand
- see https://retropie.org.uk/docs/Runcommand/. It's responsible for knowing which emulator to run (and what parameters are needed) and much more.
Now,runcommand
is far too complex to modify it, but it provides a a way to run your particular emulator. For a system, the list of emulators available are listed in the system's configuration folder, in theemulators.cfg
file. For instance, for SNES, it's in\\retropie\configs\snes\emulators.cfg
.
You can add your own script - as an emulator - and in that script perform any actions you want (change folders, hide/unhide files, etc.).Let's say you want to launch a SNES game. You add your own script as an emulator in the
emulators.cfg
:lr-snes9x2002 = "/opt/retropie/emulators/retroarch/bin/retroarch -L /opt/retropie/libretrocores/lr-snes9x2002/snes9x2002_libretro.so --config /opt/retropie/configs/snes/retroarch.cfg %ROM%" lr-snes9x2005 = "/opt/retropie/emulators/retroarch/bin/retroarch -L /opt/retropie/libretrocores/lr-snes9x2005/snes9x2005_libretro.so --config /opt/retropie/configs/snes/retroarch.cfg %ROM%" lr-snes9x2010 = "/opt/retropie/emulators/retroarch/bin/retroarch -L /opt/retropie/libretrocores/lr-snes9x2010/snes9x2010_libretro.so --config /opt/retropie/configs/snes/retroarch.cfg %ROM%" default = "lr-snes9x" lr-snes9x = "/opt/retropie/emulators/retroarch/bin/retroarch -L /opt/retropie/libretrocores/lr-snes9x/snes9x_libretro.so --config /opt/retropie/configs/snes/retroarch.cfg %ROM%" # your own emulator snes9x-msu = "/home/pi/scripts/my_own_script.sh %ROM%"
In the
my_own_script.sh
file, you can perform any operations you want, then - at the end of the script - just call the real emulator start command:#!/usr/bin/env bash #... you own commands # start the real emulator /opt/retropie/emulators/retroarch/bin/retroarch -L /opt/retropie/libretrocores/lr-snes9x/snes9x_libretro.so --config /opt/retropie/configs/snes/retroarch.cfg "$1"
Once your script is ready - test it from the command line, outside of EmulationStation - it can be chosen from the Runcommand launch menu, just like you've chosen
lr-snes9x
for those MSU games. -
@mitu Thanks! That's definitely the sort of info I was looking for, but I'm not sure that I made my request totally clear. I'll try to keep it simple.
Let's say I don't change anything in the
emulators.cfg
file. Instead of messing with that, can I just hypothetically write amy_own_script.sh
file that has the script command equivalent of "Load X specific SNES rom with thelr_snes9x
emulator"? So every time I click that script or run it from the command line, it just loads one specifically designated game in snes9x?I wasn't intending to make a script that makes sure all msu games load with
lr_snes9x
. Rather, I was just trying to figure out how to make an individual script that upon activation simply loads one pre-specified SNES rom with that emulator.I hope that helps. I'm very sorry if this has been frustrating. That was absolutely not my intention. Thank you very much for your patience with my bizzare request.
— CB
-
@clockwork42 said in Load NON-PC rom with a script?:
I wasn't intending to make a script that makes sure all msu games load with lr_snes9x. Rather, I was just trying to figure out how to make an individual script that upon activation simply loads one pre-specified SNES rom with that emulator.
But this is exactly what
runcommand.sh
does - you can choose which emulator runs for each ROM. This association is saved after the first configuration, so you don't have to do it twice. You can remove the per-ROM emulator setting anytime by entering the Runcommand launch menu again (when launching a ROM) and removing the association. -
@mitu OK. Then that part I'm pretty good with. I've already set each of my MSU roms to open with snes9x by pushing a button when the game loads, going into the menu and making sure snes9x is the default for that rom.
So then the question becomes this: Is there a way to create a hypothetical
my_own_script.sh
that when accessed just loads a specific rom? I think at this point, that's all I need now. You explained how to load PC games that way to me some time ago, but I'm sure that the commands are drastically different for SNES roms since we don't have to worry about mounting drives, changing directories, and so on.Thanks again for your time.
— CB
-
@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 usinglr-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.
-
@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
-
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 withlr_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
-
@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:
-
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
-
@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"
-
@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
-
@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
-
@clockwork42 My guess is that there's some ROM path quoting error at stake. Can you post your complete script, between code tags ?
-
@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
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.