RetroPie Auto Startup Script

Have some feedback, questions, suggestions, or just fancy a chat? Pop it in here.
Post Reply
GaM3r2Xtreme
Posts: 10
Joined: Thu Jun 02, 2016 4:00 am

RetroPie Auto Startup Script

Post by GaM3r2Xtreme »

Hey guys,

When selecting RetroPie as the startup from dietpi-autostart, what script is being used and where is it located in order to call up emulationstation?

I'm looking to inject a few commands right before emulationstation begins in order to connect a few wii remotes via wminput.
User avatar
Fourdee
Site Admin
Posts: 2782
Joined: Tue Feb 06, 2007 1:36 pm

Re: RetroPie Auto Startup Script

Post by Fourdee »

GaM3r2Xtreme wrote:Hey guys,

When selecting RetroPie as the startup from dietpi-autostart, what script is being used and where is it located in order to call up emulationstation?

I'm looking to inject a few commands right before emulationstation begins in order to connect a few wii remotes via wminput.
Here she is :) https://github.com/Fourdee/DietPi/blob/ ... /login#L79

Code: Select all

/opt/retropie/supplementary/emulationstation/emulationstation
If you find our project or support useful, then we’d really appreciate it if you’d consider contributing to the project however you can.
Donating is the easiest – you can use PayPal or become a DietPi patron.
GaM3r2Xtreme
Posts: 10
Joined: Thu Jun 02, 2016 4:00 am

Re: RetroPie Auto Startup Script

Post by GaM3r2Xtreme »

That's what I'm talking about. Thanks!
GaM3r2Xtreme
Posts: 10
Joined: Thu Jun 02, 2016 4:00 am

Re: RetroPie Auto Startup Script

Post by GaM3r2Xtreme »

Hey Fourdee,

I hate to revive this thread, but the issue I just noticed involves the auto startup script.

Alright, so currently the autostart calls the emulationstation binary directly, which works nice until a user decides to use the Quit menu within emulationstation. The user would not be able to restart or shutdown the system nor restart emulationstation. All selections would lead to emulationstation closing out to the terminal.

My solution is this, instead of having the login script call the emulationstation binary directly like this:

Code: Select all

#RetroPie/Emulation station
elif (( $AUTO_START_INDEX == 3 )); then
    #emulationstation - can no longer be run as root
    /opt/retropie/supplementary/emulationstation/emulationstation
The emulationstation script should be called instead, which then calls the binary:

Code: Select all

/opt/retropie/supplementary/emulationstation/emulationstation.sh
The emulationstation.sh looks like this:

Code: Select all

#!/bin/sh

esdir="$(dirname $0)"
while true; do
    rm -f /tmp/es-restart /tmp/es-sysrestart /tmp/es-shutdown
    "$esdir/emulationstation" "$@"
    [ -f /tmp/es-restart ] && continue
    if [ -f /tmp/es-sysrestart ]; then
        rm -f /tmp/es-sysrestart
        sudo reboot
        break
    fi
    if [ -f /tmp/es-shutdown ]; then
        rm -f /tmp/es-shutdown
        sudo poweroff
        break
    fi
    break
done
I found that the emulationstation binary ends up creating a temp file acting like a flag for the shutdown/restart options. During the shutdown of emulationstation, one of the three files is created by the binary and then analyzed by the script.

I found this out with a little help from the Retropie community in the following thread and figured I should share the knowledge:
https://retropie.org.uk/forum/topic/483 ... own-script
User avatar
Fourdee
Site Admin
Posts: 2782
Joined: Tue Feb 06, 2007 1:36 pm

Re: RetroPie Auto Startup Script

Post by Fourdee »

GaM3r2Xtreme wrote: I found that the emulationstation binary ends up creating a temp file acting like a flag for the shutdown/restart options. During the shutdown of emulationstation, one of the three files is created by the binary and then analyzed by the script.

I found this out with a little help from the Retropie community in the following thread and figured I should share the knowledge:
https://retropie.org.uk/forum/topic/483 ... own-script
Hi,

Excellent, thank you for letting us know.

I'll update the login script to use /opt/retropie/supplementary/emulationstation/emulationstation.sh for v137.
If you find our project or support useful, then we’d really appreciate it if you’d consider contributing to the project however you can.
Donating is the easiest – you can use PayPal or become a DietPi patron.
loran
Posts: 8
Joined: Tue May 30, 2017 4:18 pm

Re: RetroPie Auto Startup Script

Post by loran »

Hello, I would like to ask if I select Retropie on autostart, is there an option to go back to retropie?
Post Reply