Skip to content

Instantly share code, notes, and snippets.

@shannon
Last active March 12, 2020 18:40
Show Gist options
  • Select an option

  • Save shannon/a34b7e32e86d7cf0a9442417dda1da65 to your computer and use it in GitHub Desktop.

Select an option

Save shannon/a34b7e32e86d7cf0a9442417dda1da65 to your computer and use it in GitHub Desktop.
Lakka Present Mode (Cycle through playlist on boot)
#!/bin/sh
#present_mode.sh
nohup /storage/.config/present_mode_input.sh &
INPUT_PID=$!
while true
do
RA_RUNNING=`ps -A | grep retroarch | grep -v grep | wc -l`
if [ 1 == $RA_RUNNING ] ; then
echo "Retroach is running, starting present mode in 5 seconds"
sleep 5s
if [ -s /storage/.config/present_mode_input.log ]; then
echo "input detected, exiting"
break
fi
systemctl stop retroarch
while true
do
cat /storage/playlists/Present\ Mode.lpl | while read ROM; do
read NAME; read CORE; read CORE_NAME; read DB; read PLAYLIST;
TIME=$(echo "${NAME}" | cut -d "|" -f 2 | sed "s@ @@g")
echo "starting game: $NAME"
retroarch -L $CORE "$ROM" &
PID=$!
echo "started game: $PID"
sleep $TIME
if [ -s /storage/.config/present_mode_input.log ]; then
echo "input detected, exiting"
break 3
else
echo "no input detected, killing $PID"
kill -9 $PID
sleep 1s
fi
done
done
fi
done
systemctl start retroarch
kill -9 $INPUT_PID
/storage/roms/sda1-usb-Inateck_NS1066_0/Nintendo - Super Nintendo Entertainment System/Super Mario World (USA).sfc
Super Mario World (USA) | 34s
/tmp/cores/snes9x_libretro.so
Super Nintendo Entertainment System
DETECT
Present Mode.lpl
/storage/roms/sda1-usb-Inateck_NS1066_0/Sega - Mega Drive - Genesis/Sonic The Hedgehog 2 (World).zip
Sonic The Hedgehog 2 (World) | 54s
/tmp/cores/genesis_plus_gx_libretro.so
Genesis Plus GX
DETECT
Present Mode.lpl
/storage/roms/sda1-usb-Inateck_NS1066_0/Nintendo - Super Nintendo Entertainment System/Street Fighter II (USA).sfc
Street Fighter II (USA) | 65s
/tmp/cores/snes9x_libretro.so
Super Nintendo Entertainment System
DETECT
Present Mode.lpl
/storage/roms/sda1-usb-Inateck_NS1066_0/Nintendo - Super Nintendo Entertainment System/Teenage Mutant Ninja Turtles IV - Turtles in Time (USA).sfc
Teenage Mutant Ninja Turtles IV - Turtles in Time (USA) | 96s
/tmp/cores/snes9x_libretro.so
Super Nintendo Entertainment System
DETECT
Present Mode.lpl
/storage/roms/sda1-usb-Inateck_NS1066_0/Sega - Mega Drive - Genesis/Sonic The Hedgehog (USA, Europe).zip
Sonic The Hedgehog (USA, Europe) | 54s
/tmp/cores/genesis_plus_gx_libretro.so
Genesis Plus GX
DETECT
Present Mode.lpl
/storage/roms/sda1-usb-Inateck_NS1066_0/Nintendo - Nintendo Entertainment System/Zelda II - The Adventure of Link (USA).nes
Zelda II - The Adventure of Link (USA) | 69s
/tmp/cores/fceumm_libretro.so
Nintendo Entertainment System
DETECT
Present Mode.lpl
/storage/roms/sda1-usb-Inateck_NS1066_0/Nintendo - Nintendo Entertainment System/Double Dragon (USA).nes
Double Dragon (USA) | 66s
/tmp/cores/fceumm_libretro.so
Nintendo Entertainment System
DETECT
Present Mode.lpl
/storage/roms/sda1-usb-Inateck_NS1066_0/Nintendo - Nintendo Entertainment System/Legend of Zelda, The (USA).nes
Legend of Zelda, The (USA) | 82s
/tmp/cores/fceumm_libretro.so
Nintendo Entertainment System
DETECT
Present Mode.lpl
/storage/roms/sda1-usb-Inateck_NS1066_0/Sega - Mega Drive - Genesis/Sonic & Knuckles (World).zip
Sonic & Knuckles (World) | 58s
/tmp/cores/genesis_plus_gx_libretro.so
Genesis Plus GX
DETECT
Present Mode.lpl
/storage/roms/sda1-usb-Inateck_NS1066_0/Nintendo - Nintendo Entertainment System/Battletoads (USA).nes
Battletoads (USA) | 108s
/tmp/cores/fceumm_libretro.so
Nintendo Entertainment System
DETECT
Present Mode.lpl
/storage/roms/sda1-usb-Inateck_NS1066_0/Nintendo - Nintendo Entertainment System/Bubble Bobble (USA).nes
Bubble Bobble (USA) | 30s
/tmp/cores/fceumm_libretro.so
Nintendo Entertainment System
DETECT
Present Mode.lpl
/storage/roms/sda1-usb-Inateck_NS1066_0/Nintendo - Nintendo Entertainment System/Blaster Master (USA).nes
Blaster Master (USA) | 68s
/tmp/cores/fceumm_libretro.so
Nintendo Entertainment System
DETECT
Present Mode.lpl
/storage/roms/sda1-usb-Inateck_NS1066_0/Nintendo - Super Nintendo Entertainment System/Legend of Zelda, The - A Link to the Past (USA).sfc
Legend of Zelda, The - A Link to the Past (USA) | 159s
/tmp/cores/snes9x_libretro.so
Super Nintendo Entertainment System
DETECT
Present Mode.lpl
/storage/roms/sda1-usb-Inateck_NS1066_0/Sega - Mega Drive - Genesis/Sonic The Hedgehog 3 (USA).zip
Sonic The Hedgehog 3 (USA) | 54s
/tmp/cores/genesis_plus_gx_libretro.so
Genesis Plus GX
DETECT
Present Mode.lpl
#!/bin/sh
#present_mode_input.sh
echo > /storage/.config/present_mode_input.log
while true
do
FILES=/dev/input/by-id/*event*
for f in $FILES
do
cat $f > /storage/.config/present_mode_input.log &
sh -c "sleep 5s; kill $!" &
done
sleep 5s
if [ -s /storage/.config/present_mode_input.log ]; then
break
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment