@clyde i have a custom solution for this since im running on ODROID with SDL2 and so if im not quitting the process soon enough im getting graphical glitches with on screen borders or other weird problems:
This is my solution by now - its not perfect since it can make problems when a rom cant load (then i have to restart the system) otherwise it works flawlessly on my ODROID with retropie:
Basically i have 2 scripts
runcommand-onstart.sh (mine did not exist since i installed retropie from the distro directly)
pkill fbi
pkill tail
# the image i want to load
loader="/etc/emulationstation/splashes/$1/launching.png"
if [-f "$loader"]; then
# if image is found - start fbi with the image and no timelimit, also start the check script in same directory
fbi -1 -t 0 -noverbose -a "$loader" </dev/tty &>/dev/null &
(/opt/retropie/configs/all/check.sh) &
fi
and the check.sh script:
# you have to enable retroarch logs - always log everything
input=/opt/retropie/configs/all/retroarch/logs/retroarch.log
timeout 15 tail -f $input | while read LOGLINE
# if any of this lines are seen - kill everything related to launchimages - in this case fbi and tail
# "Found display server" is the first command in the log before the emulator kicks in
do
if [[ $LOGLINE == *"Found display server"* ]]; then
pkill tail
pkill fbi
fi
if [[ $LOGLINE == *"Failed to load content"* ]]; then
pkill tail
pkill fbi
fi
if [[ $LOGLINE == *"Bus error"* ]]; then
pkill tail
pkill fbi
fi
done
So what this is doing:
it starts FBI forever and the check script checks the logs for "exit tokens" - if a exit token is hit every process related to the imageloading gets killed.
If the rom cant load before 15 seconds (timeout 15 - set this to the possible highest value) the process should get automatically killed.
works btw with the newest (current master in repo) mame-plus and mame emulators at my side. If you have "Enter Problems" - do what i said before - just add the clean commands for the tty additional to the pkill commands
maybe that idea/solution gives some ideas to you :)