corrections for instant play with opks

This commit is contained in:
Vincent-FK 2021-06-18 17:32:26 +02:00
parent 8cd07a9898
commit 0b5a4a30db
2 changed files with 27 additions and 13 deletions

View File

@ -34,22 +34,26 @@ load)
mount -t squashfs "${last_opk}" /opk
fi
# Remove unnecessary files
rm -f "${RESUME_PLAY_FILE}"
# 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}"
cat "${INSTANT_PLAY_FILE}"
mv "${INSTANT_PLAY_FILE}" "${RESUME_PLAY_FILE}"
source "${RESUME_PLAY_FILE}"
rm -f "${RESUME_PLAY_FILE}"
keymap default
termfix_all
fi
# Unmount last OPK, if any
if [ -r "${LAST_OPK_FILE}" ]; then
umount /opk
rm "${LAST_OPK_FILE}"
fi
keymap default
termfix_all
fi
;;
save)
@ -60,6 +64,15 @@ save)
# Write quick load file args
echo -n "" > "${INSTANT_PLAY_FILE}"
# First arg is prog name, forcing real path
printf "'" >> "${INSTANT_PLAY_FILE}"
bin_name=$(printf %s "$1" | sed "s/'/'\\\\''/g")
bin_path="$(pwd)"/"$(basename "$bin_name")"
echo -n "$bin_path" >> "${INSTANT_PLAY_FILE}"
shift
case $# in 0) break; esac
printf "' " >> "${INSTANT_PLAY_FILE}"
while :
do
printf "'" >> "${INSTANT_PLAY_FILE}"
@ -89,3 +102,4 @@ EOF
;;
esac
exit 0

View File

@ -57,10 +57,10 @@ powerdown_now() {
action="${1:-now}"
case "${action}" in
schedule)
if [ ${#} != 2 -o "${2}" -eq 0 ]; then
if [ ${#} != 2 -o "${2}" == "0" ]; then
usage
fi
schedule_powerdown
schedule_powerdown ${2}
;;
handle)