Auto rotate games with hotkey?
-
I recently built a mini arcade cab for my kids, and put 4 kids games (semi educational) on it. I have it boot to one game on startup using the autostart.sh, and when I exit that game, it starts up the emulation station. Being that my kids are too young to navigate that, I was thinking would it be possible to write a statement that loops through the same 4 games? So that way it boots to a game, then when hotkey’d out of that game, boot the next game and so on. I am not much of a programmer and could at maybe write something that would cycle through the games once, but not sure how to loop it.
And my apologies if this isn’t the right place for this type of question. I tried searching but I’m not getting anything. Could just be my phrasing.
-
@Chadmon10 building this for them was a great project and a lot of fun, but I wasn’t prepared for the amount of “can we play the other game” requests 😂
Like every few mins I felt like I had to go change the game. That’s what got me to thinking since this is just 4 games, I was hoping it would be possible to make a button they can use to push and cycle through the games, albeit slowly - since each game would have to load. Either way, step one for me is understanding how to write the statement/code then step 2 is making the button and mapping it. I should be able to handle step 2 on my own I think.
-
You can try to use the following script snippet in
autostart.sh
to add more games to be played and comment the EmulationStation start line. Obviously, replace the ROM and system names with real values, the code below is just an example# declare the system/game to be played. declare -A games=( ["nes"]="nes1.zip" ["snes"]="snes1 with spaces.zip" ) while true; do for g in "${!games[@]}"; do echo Playing $g game ${games[$g]} /opt/retropie/supplementary/runcommand/runcommand.sh 0 _SYS_ "$g" "$HOME/RetroPie/roms/$g/${games[$g]}" done done
This will play the added games indefinitely. Not sure how you handle shutting down the system - do you have a power button hooked ?
-
@mitu this is exactly what I was looking for! You’re awesome! Thanks for the help!!!!!
I do have a power switch, although I’m not too keen on just shutting it down improperly. I have scars from doing that in the past. A couple times they wouldn’t boot after and had to be reimaged. Now I do back up images once they are built to save time, but still a pain to do if can be avoided.
I may research and think over how I can create a button/key on the back that can put the system into a proper shutdown sequence.
Until then, I can actually ssh into it from my phone to sudo shutdown. But ideally I’d want to have a button I map to a keyboard key that when pressed and held 5 seconds it would do a sudo shutdown.
Any ideas or direction is always appreciated 🙂
-
@Chadmon10 wanted to add that I’m using retrogame to map my arcade controls directly to the gpio. So some keys are being used already.
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.