Skip to content

Instantly share code, notes, and snippets.

@shauninman
Last active May 28, 2024 13:58
Show Gist options
  • Save shauninman/20d59da8621f79ff65ad561b7ed2b6f4 to your computer and use it in GitHub Desktop.
Save shauninman/20d59da8621f79ff65ad561b7ed2b6f4 to your computer and use it in GitHub Desktop.
MinUI single-game mode
#!/bin/sh
# edit ROM path (relative to root of SD card)
# and save to the /.userdata/<device> folder
ROM="/Roms/Game Boy (GB)/Dr. Mario (World).gb"
#######################################
#
# NO NEED TO EDIT BEYOND HERE UNESS YOU
# REALLY KNOW WHAT YOU'RE DOING...
#
#######################################
ROM_PATH="${SDCARD_PATH}${ROM}"
ROM_NAME=`basename "$ROM_PATH"`
EMU_TAG=`dirname "$ROM_PATH" | cut -d'(' -f2 | cut -d')' -f1`
# handle auto resume
RESUME_PATH="$SHARED_USERDATA_PATH/.minui/auto_resume.txt"
if [ -f "$RESUME_PATH" ]; then
REL_RESUME=`cat "$RESUME_PATH"`
rm -rf "$RESUME_PATH" && sync
if [ "$REL_RESUME" = "$ROM" ]; then
SLOT=9
fi
fi
# handle last used slot
if [ -z "$SLOT" ]; then
SLOT_PATH="$SHARED_USERDATA_PATH/.minui/$EMU_TAG/$ROM_NAME.txt"
if [ -f "$SLOT_PATH" ]; then
SLOT=`cat "$SLOT_PATH"`
fi
fi
# found a slot
if [ -n "$SLOT" ]; then
echo "$SLOT" > "/tmp/resume_slot.txt" && sync
fi
# check extra Emus first
EMU_PATH="$SDCARD_PATH/Emus/$PLATFORM/$EMU_TAG.pak/launch.sh"
if [ ! -f "$EMU_PATH" ]; then
# default to system Emus
EMU_PATH="$SYSTEM_PATH/paks/Emus/$EMU_TAG.pak/launch.sh"
fi
touch "/tmp/noui"
# launch the rom
"$EMU_PATH" "$ROM_PATH"
# no ui for you!
shutdown
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment