instant_play save/load
Signed-off-by: Michel-FK <michel.stempin@funkey-project.com>
This commit is contained in:
parent
0d19c7a7f1
commit
ee49693543
|
@ -23,6 +23,7 @@ export HOME=/mnt/FunKey
|
|||
mkdir -p "${HOME}"
|
||||
export MEDNAFEN_HOME=$HOME/.mednafen
|
||||
mkdir -p "${MEDNAFEN_HOME}"
|
||||
cp -n "/usr/games/lynxboot.img" "/usr/games/mednafen-09x.cfg" "${MEDNAFEN_HOME}/"
|
||||
export GMENU2X_HOME="$HOME/.gmenu2x"
|
||||
mkdir -p "${GMENU2X_HOME}"
|
||||
|
||||
|
@ -55,6 +56,9 @@ brightness set $(brightness get) >/dev/null 2>&1
|
|||
# Start Assembly tests (blocking process)
|
||||
assembly_tests >/dev/null 2>&1
|
||||
|
||||
# Restart saved application/game if any
|
||||
instant_play load
|
||||
|
||||
# Start launcher
|
||||
echo "Start launcher"
|
||||
start_launcher >/dev/null 2>&1 &
|
||||
|
|
|
@ -3,29 +3,58 @@
|
|||
# Uncomment the following line to get debug info
|
||||
#set -x
|
||||
|
||||
# Check args
|
||||
if [ ${#} -eq 0 ]; then
|
||||
echo "Usage: $(basename ${0}) args..."
|
||||
SELF="$(basename ${0})"
|
||||
INSTANT_PLAY_FILE="/mnt/instant_play"
|
||||
RESUME_PLAY_FILE="/mnt/resume_play"
|
||||
|
||||
usage() {
|
||||
>&2 echo "Usage: ${SELF} load"
|
||||
>&2 echo " ${SELF} save application args..."
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Check number of arguments
|
||||
if [ ${#} -lt 1 ]; then
|
||||
usage
|
||||
fi
|
||||
|
||||
INSTANT_PLAY_FILE="/mnt/instant_play"
|
||||
case ${1} in
|
||||
load)
|
||||
if [ ${#} -ne 1 ]; then
|
||||
usage
|
||||
fi
|
||||
|
||||
# Launch Previous Game if any
|
||||
if [ -f "${INSTANT_PLAY_FILE}" ]; then
|
||||
keymap resume
|
||||
echo -n "Found Instant Play file, restarting previous game with command: "
|
||||
echo $(head -n 1 "${INSTANT_PLAY_FILE}")
|
||||
rm -f "${RESUME_PLAY_FILE}"
|
||||
mv "${INSTANT_PLAY_FILE}" "${RESUME_PLAY_FILE}"
|
||||
source "${RESUME_PLAY_FILE}"
|
||||
rm -f "${RESUME_PLAY_FILE}"
|
||||
keymap default
|
||||
termfix_all
|
||||
fi
|
||||
;;
|
||||
|
||||
save)
|
||||
if [ ${#} -lt 2 ]; then
|
||||
usage
|
||||
fi
|
||||
shift
|
||||
|
||||
# Write quick load file args
|
||||
echo -n "" > "${INSTANT_PLAY_FILE}"
|
||||
for arg in "$@"; do
|
||||
if $(echo "${arg}" | egrep -q '[[:space:]]'); then
|
||||
|
||||
# Add quotes around arguments containing spaces
|
||||
echo -n "\"${arg}\" " >> "${INSTANT_PLAY_FILE}"
|
||||
else
|
||||
echo -n "${arg} " >> "${INSTANT_PLAY_FILE}"
|
||||
fi
|
||||
# Add quotes around all arguments
|
||||
echo -n "'${arg}' " >> "${INSTANT_PLAY_FILE}"
|
||||
done
|
||||
|
||||
# Add the magic sauce to launch the process in background, record the
|
||||
# PID into a file, wait for the process to terminate and erase the
|
||||
# recorded PID
|
||||
# Add the magic sauce to launch the process in background,
|
||||
# record the PID into a file, wait for the process to
|
||||
# terminate and erase the recorded PID
|
||||
cat << EOF >> "${INSTANT_PLAY_FILE}"
|
||||
&
|
||||
record_pid \$!
|
||||
|
@ -35,3 +64,10 @@ EOF
|
|||
|
||||
# Now terminate gracefully
|
||||
exec shutdown_funkey
|
||||
;;
|
||||
|
||||
*)
|
||||
usage
|
||||
;;
|
||||
esac
|
||||
exit 0
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
#set -x
|
||||
|
||||
LOCK_FILE="/var/lock/launcher.lock"
|
||||
INSTANT_PLAY_FILE="/mnt/instant_play"
|
||||
RESUME_PLAY_FILE="/mnt/resume_play"
|
||||
PREVENT_LAUNCHER_FILE="/mnt/prevent_launcher"
|
||||
REBOOTING_FILE="/run/rebooting"
|
||||
|
||||
|
@ -16,22 +14,6 @@ if [ -f "${LOCK_FILE}" ]; then
|
|||
fi
|
||||
touch "${LOCK_FILE}"
|
||||
|
||||
# Sanity cmd: in case these files do not exist
|
||||
mkdir -p "${MEDNAFEN_HOME}"
|
||||
cp "/usr/games/lynxboot.img" "/usr/games/mednafen-09x.cfg" "${MEDNAFEN_HOME}/"
|
||||
|
||||
# Launch Previous Game if any
|
||||
if [ -f "${INSTANT_PLAY_FILE}" ]; then
|
||||
keymap resume
|
||||
echo "Found Instant Play file, restarting previous game with command: "$(head -n 1 "${INSTANT_PLAY_FILE}")
|
||||
rm -f "${RESUME_PLAY_FILE}"
|
||||
mv "${INSTANT_PLAY_FILE}" "${RESUME_PLAY_FILE}"
|
||||
source "${RESUME_PLAY_FILE}"
|
||||
rm -f "${RESUME_PLAY_FILE}"
|
||||
keymap default
|
||||
termfix_all
|
||||
fi
|
||||
|
||||
# Then loop to launch the launcher indefinitely
|
||||
while true; do
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#
|
||||
################################################################################
|
||||
|
||||
FCEUX_VERSION = 959126d
|
||||
FCEUX_VERSION = f089cec
|
||||
FCEUX_SITE_METHOD = git
|
||||
FCEUX_SITE = https://github.com/FunKey-Project/fceux.git
|
||||
FCEUX_LICENSE = GPL-2.0
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#
|
||||
################################################################################
|
||||
|
||||
PCSX_REARMED_VERSION = ce405c0
|
||||
PCSX_REARMED_VERSION = a2f9326
|
||||
PCSX_REARMED_SITE_METHOD = git
|
||||
PCSX_REARMED_SITE = https://github.com/FunKey-Project/pcsx_rearmed.git
|
||||
PCSX_REARMED_LICENSE = GPL-2.0
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#
|
||||
################################################################################
|
||||
|
||||
POCKETSNES_VERSION = 033eb1c
|
||||
POCKETSNES_VERSION = 5eb2635
|
||||
POCKETSNES_SITE_METHOD = git
|
||||
POCKETSNES_SITE = https://github.com/FunKey-Project/PocketSNES.git
|
||||
POCKETSNES_LICENSE = GPL-2.0
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
# gmenu2x
|
||||
#
|
||||
#############################################################
|
||||
GMENU2X_VERSION = 3e23dd2
|
||||
GMENU2X_VERSION = 837e097
|
||||
GMENU2X_SITE_METHOD = git
|
||||
GMENU2X_SITE = https://github.com/FunKey-Project/gmenu2x.git
|
||||
GMENU2X_LICENSE = GPL-2.0
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#
|
||||
################################################################################
|
||||
|
||||
GNUBOY_VERSION = f23d3e3
|
||||
GNUBOY_VERSION = a0d8d26
|
||||
GNUBOY_SITE_METHOD = git
|
||||
GNUBOY_SITE = https://github.com/FunKey-Project/gnuboy.git
|
||||
GNUBOY_LICENSE = GPL-2.0
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#
|
||||
################################################################################
|
||||
|
||||
GPSP_VERSION = 3e776a9
|
||||
GPSP_VERSION = b573bc6
|
||||
GPSP_SITE_METHOD = git
|
||||
GPSP_SITE = https://github.com/FunKey-Project/gpsp.git
|
||||
GPSP_LICENSE = GPL-2.0
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#
|
||||
################################################################################
|
||||
|
||||
MEDNAFEN_VERSION = f81201c
|
||||
MEDNAFEN_VERSION = d535dff
|
||||
MEDNAFEN_SITE_METHOD = git
|
||||
MEDNAFEN_SITE = https://github.com/FunKey-Project/mednafen-git.git
|
||||
MEDNAFEN_LICENSE = GPL-2.0+
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#
|
||||
################################################################################
|
||||
|
||||
PICODRIVE_VERSION = 0582aba
|
||||
PICODRIVE_VERSION = 59b9892
|
||||
PICODRIVE_SITE_METHOD = git
|
||||
PICODRIVE_SITE = https://github.com/FunKey-Project/picodrive.git
|
||||
PICODRIVE_LICENSE = MAME
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#
|
||||
################################################################################
|
||||
|
||||
RETROFE_VERSION = 7fc674e
|
||||
RETROFE_VERSION = 77ccbc2
|
||||
RETROFE_SITE_METHOD = git
|
||||
RETROFE_SITE = https://github.com/FunKey-Project/RetroFE.git
|
||||
RETROFE_DEPENDENCIES = gstreamer1 gst1-plugins-base sdl sdl_image sdl_mixer sdl_sound sdl_ttf libglib2 sqlite zlib
|
||||
|
|
Loading…
Reference in New Issue