Opening StartX with a script, and then running a program
-
Raspberry Pi 4b+
Retropie version 4.7.19I have a weird scenario I am trying to execute and I am running into problems. My goal is to run a script from the emulationstation menu, which executes OutFox (formerly known as StepMania). To run OutFox, the startx desktop must be open, otherwise nothing happens. I have everything set up where I only need to run a command line argument of
OutFox
and everything will work as long as I am in the desktop environment.
I am trying a run this shell script:
startx -- vt1 -keeptty -nocursor & (sleep 10 ; OutFox)
The desktop environment loads, but the OutFox command either doesn't run or doesn't work. If I open a terminal in the now opened desktop environment, and run the command
OutFox
the game will open properly. Does anyone know why it doesn't work when running the command from the shell script? I've tried a lot of different variations of the script and nothing seems to work.
-
@Fiddla01 I can't say I'm too familiar with Outfox/Stepmania in terms of running it, but I have messed with scriptmodules that involve
startx
before, so I can try to offer advice!I generally find
xinit
works better for whenever something requiresstartx
to run, as it has arguments that let you execute arbitrary commands. For example, take this command from my (probably out of date) Gnash script for running Flash games:xinit -e 'gnash --hwaccel vaapi --hide-menubar %ROM%'
However, some programs tend to be a bit more tempermental. IKEMEN GO in particular took me quite a while to work out a string of commands that worked (
xinit
by itself wouldn't run it at all, so I had to resort to running a very smallxterm
with a similar execute argument), and even then I had to resort to making an actual script file to run viaports
in EmulationStation:#!/bin/bash export MESA_GL_VERSION_OVERRIDE=2.1 xset -dpms s off s noblank xterm -g 1x1+0-0 -e 'cd $md_inst && ./Ikemen_GO'
Perhaps the latter solution might work for you, using a Bash script to start up either
xinit
orstartx
, then automatically opening a terminal to run the game.I should note RetroPie actually has built-in functionality for running scripts from within
xinit
, like what's used for Minecraft Pi Edition:XINIT:$md_inst/Minecraft.sh
#!/bin/bash xset -dpms s off s noblank matchbox-window-manager & /usr/bin/minecraft-pi
Hope at least some of this info helps!
-
If you post where you are finding the program. Maybe a install script can be made for it. So it's way easier then trying so fo about the way you are trying it.
Just saying
Also maybe others would want it also
-
@SuperFromND Thanks!!! Your guidance led me to a solution.
Xinit was indeed the solution to my problems, and it actually ended up being very simple. I'll try to spell out everything that was done so anyone finding this thread can follow along the best they can.
OutFox/Stepmania works either from the startx or the xinit environments, but the following code is what allowed me to start the game from the emulationstation menu automatically. This is the contents of ~/RetroPie/roms/ports/OutFox.sh
#!/bin/bash xinit /opt/OutFox/OutFox -- vt1 -keeptty -nocursor
The second argument is the location of the executable for outfox (if you have stepmania it will be the path to the stepmania execuatable). The last arguments keep a no-permission error from occuring.
Once this file is in that location, there should be an OutFox option to choose on the ports screen, and it should load OutFox properly. Surprisingly I didn't have to change any configs anywhere else, it just seemed to work like this for me.
Here's a post that I mostly used to get OutFox setup (there are plenty of other good tutorials for this too): https://www.reddit.com/r/Stepmania/comments/psd1hm/raspberry_pi_4_stepmania_outfox_53_guide/
I'm obviously a novice when it comes to this so I'm sure there's better ways of doing this, but this works for me so I'm happy.
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.