I want to make the following bash script a bit more user friendly so that when ever a retroarch supported rom is selected the appropriate retroarch core will run the game.
Consider the following (incomplete, but) working code:
#!/bin/bash
config="$HOME/.config/retroarch/retroarch.cfg"
core_nes="$HOME/.config/retroarch/cores/mesen_libretro.so"
FILE=zenity --file-selection --filename="$HOME/.config/retroarch/roms/" --file-filter=" "*"" --title="Select a Game"
retroarch -L “$core_nes” “$FILE” --fullscreen --config="$config"`
Now that code works for just nes roms but I want to add a bit of code that after the user has selected a rom (zenity part - a file explorer window will open to a path called roms, within that folder will be rom directories - Ex: Nintendo/nes/snes/gb etc…), the correct retroarch core will load and run the game.
It currently works for nes roms only, so I believe I will need a case statement to store the retroarch cores and then an if statement that basically goes like:
Psuedo code:
If $FILE variable (in the zenity part of the ) has a .nes extension then the retroarch launch codte will launch the nes core, if the $FILE variable has a .snes extension, then the retroarch launch code will launch the snes core etc…
Can some brilliant individual please help me accomplish this, or something along those lines so it will be a possible to run any retroarch core and rom from a bash script, and not have to open several different windows (prevent a crash) to launch a core when the correct file is loaded?