gmenu2x searches opks in /mnt/*/*opk; launcher now stored in /mnt/FunKey/Launchers/launcher.txt

This commit is contained in:
Vincent-FK 2021-01-11 12:07:40 +01:00
parent a77c5e67d9
commit 8a62ff605e
12 changed files with 72 additions and 45 deletions

View File

@ -11,7 +11,6 @@ fi
export PAGER='/bin/more'
export EDITOR='/usr/bin/nano'
export SDL_NOMOUSE=1
export MEDNAFEN_HOME=/tmp/funkey/.mednafen
# Source configuration files from /etc/profile.d
for i in /etc/profile.d/*.sh ; do

View File

@ -1 +1 @@
/
/mnt

View File

@ -19,8 +19,12 @@ alias l='ls $LS_OPTIONS -lA'
# alias mv='mv -i'
# Relocate HOME into the r/w partition
export HOME=/mnt/funkey
mkdir -p ${HOME}
export HOME=/mnt/FunKey
mkdir -p "${HOME}"
export MEDNAFEN_HOME=$HOME/.mednafen
mkdir -p "${MEDNAFEN_HOME}"
export GMENU2X_HOME="$HOME/.gmenu2x"
mkdir -p "${GMENU2X_HOME}"
# Resize the console to the terminal dimensions
resize() {

View File

@ -150,14 +150,11 @@ format_backing_store_partition () {
}
copy_files_to_store_partition () {
# Add file to force assembly tests
mount /mnt/ || die 18 "Cannot mount /mnt"
unzip -q -o /usr/local/share/mnt_freware_games.zip -d /mnt/
mkdir -p /mnt/apps
mkdir -p /mnt/Emulators
set +f
cp -f /usr/games/opk/*.opk /mnt/apps/
cp -f /usr/games/opk/*.opk /mnt/Emulators/
set -f
umount /mnt/ || die 20 "Cannot unmount /mnt"
return 0

View File

@ -0,0 +1,25 @@
#!/bin/sh
# Check args
if [ ${#} -ne 0 ]; then
echo "Usage: $(basename ${0})"
exit 1
fi
# Launcher File
LAUNCHER_FILE=$HOME/Launchers/launcher.txt
DEFAULT_LAUNCHER=retrofe
# Check that file exists
[ -f "$LAUNCHER_FILE" ] || set_launcher $DEFAULT_LAUNCHER >/dev/null 2>&1
# Check Launcher
launcher=$(cat "$LAUNCHER_FILE" | head -1)
# Check not empty
[ -z "$LAUNCHER_FILE" ] && launcher=$DEFAULT_LAUNCHER; set_launcher $launcher >/dev/null 2>&1
# Return launcher name
echo $launcher
exit 0

View File

@ -3,22 +3,16 @@
# Check number of args
if [ ${#} -ne 1 ]; then
echo "Usage: $(basename ${0}) launcher"
echo " launcher: retrofe, gmenu2x"
exit 1
fi
# Launcher File
LAUNCHER_FILE=$HOME/Launchers/launcher.txt
mkdir -p "$(dirname "$LAUNCHER_FILE")"
# Check Launcher
LAUNCHER=${1}
if [ ${LAUNCHER} == "gmenu2x" ]; then
echo "Setting default launcher: gmenu2x"
touch /mnt/gmenu2x
elif [ ${LAUNCHER} == "retrofe" ]; then
echo "Setting default launcher: retrofe"
rm -rf /mnt/gmenu2x
else
echo "Usage: $(basename ${0}) launcher"
echo " launcher: retrofe, gmenu2x"
exit 1
fi
NEW_LAUNCHER=${1}
echo "Setting launcher: ${NEW_LAUNCHER}"
echo ${NEW_LAUNCHER} > "$LAUNCHER_FILE"
exit 0

View File

@ -48,7 +48,8 @@ mount_share () {
fi
# Create the directory structure if required
(cd /mnt; mkdir -p "Atari lynx" "Game Boy" "Game Boy Color" "Game Boy Advance" "Game Gear" "Neo Geo Pocket" "NES" "PS1" "PS1/bios" "Sega Genesis" "Sega Master System" "SNES" "WonderSwan" "PCE-TurboGrafx")
#(cd /mnt; mkdir -p "Applications" "Emulators" "Games" "Atari lynx" "Game Boy" "Game Boy Color" "Game Boy Advance" "Game Gear" "Neo Geo Pocket" "NES" "PS1" "PS1/bios" "Sega Genesis" "Sega Master System" "SNES" "WonderSwan" "PCE-TurboGrafx")
(cd /mnt; mkdir -p "Emulators" "Atari lynx" "Game Boy" "Game Boy Color" "Game Boy Advance" "Game Gear" "Neo Geo Pocket" "NES" "PS1" "PS1/bios" "Sega Genesis" "Sega Master System" "SNES" "WonderSwan" "PCE-TurboGrafx")
# Check if there is a firmware update file
if [ -f /mnt/FunKey-*.fwu ]; then

View File

@ -18,8 +18,8 @@ fi
touch "${LOCK_FILE}"
# Increment name and save snapshot
SNAPSHOT_DIR=/mnt/funkey/snapshots
SNAPSHOT_EXT=PNG
SNAPSHOT_DIR=$HOME/snapshots
mkdir -p "${SNAPSHOT_DIR}"
last=$(cd ${SNAPSHOT_DIR}; ls IMG_*.${SNAPSHOT_EXT} 2> /dev/null | tail -1 | sed 's/^IMG_0*\([0-9]\+\)\.'${SNAPSHOT_EXT}'$/\1/')
let last=${last}+1

View File

@ -6,8 +6,7 @@
LOCK_FILE="/var/lock/launcher.lock"
INSTANT_PLAY_FILE="/mnt/instant_play"
PREVENT_LAUNCHER_FILE="/mnt/prevent_launcher"
GMENU2X_FILE="/mnt/gmenu2x"
GMENU2X_HOME="/mnt/funkey/.gmenu2x"
if [ -f "${LOCK_FILE}" ]; then
echo "${LOCK_FILE} already exists"
@ -15,12 +14,10 @@ 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}/"
mkdir -p "${GMENU2X_HOME}"
mkdir -p "/mnt/apps"
# Launch Previous Game if any
if [ -f "${INSTANT_PLAY_FILE}" ]; then
echo "Found Instant Play file, restarting previous game with command: "$(head -n 1 "${INSTANT_PLAY_FILE}")
@ -37,14 +34,20 @@ while true; do
echo "${PREVENT_LAUNCHER_FILE} file found, not starting launcher"
sleep 5
else
if [ -f "${GMENU2X_FILE}" ]; then
LAUNCHER=$(get_launcher)
if [ ${LAUNCHER} == "gmenu2x" ]; then
# Launch gmenu2x
gmenu2x&
else
elif [ ${LAUNCHER} == "retrofe" ]; then
# Launch Retrofe
retrofe&
else
DEFAULT_LAUNCHER=retrofe
echo "Not recognized launcher: $LAUNCHER, setting $DEFAULT_LAUNCHER"
set_launcher $DEFAULT_LAUNCHER
fi
# Record the PID into a file, wait for the
@ -54,9 +57,7 @@ while true; do
erase_pid
# Restart ampli audio if necessary
if [[ "$(volume_get)" -ne "0" ]]; then
start_audio_amp 1 >/dev/null 2>&1
fi
start_audio_amp 1 >/dev/null 2>&1
# In case retrofe quits with errors, clear graphic VT
termfix_all

View File

@ -3,7 +3,7 @@
# gmenu2x
#
#############################################################
GMENU2X_VERSION = 85402aa
GMENU2X_VERSION = ac40292
GMENU2X_SITE_METHOD = git
GMENU2X_SITE = https://github.com/FunKey-Project/gmenu2x.git
GMENU2X_LICENSE = GPL-2.0

View File

@ -12,19 +12,20 @@ fi
# Lock file (necessary since fbgrab must run in bg not to block the buttons while gaming)
LOCK_FILE="/var/lock/snap.lock"
if [ -f "${LOCK_FILE}" ]; then
#echo "${LOCK_FILE} already exists"
echo "${LOCK_FILE} already exists"
exit 1
fi
touch "${LOCK_FILE}"
# Increment name and save snapshot
SNAPSHOT_DIR=/mnt/funkey/snapshots
SNAPSHOT_EXT=PNG
SNAPSHOT_DIR=$HOME/snapshots
mkdir -p "${SNAPSHOT_DIR}"
last=$(cd ${SNAPSHOT_DIR}; ls IMG_*.PNG 2> /dev/null | tail -1 | sed 's/^IMG_0*\([0-9]\+\)\.PNG$/\1/')
last=$(cd ${SNAPSHOT_DIR}; ls IMG_*.${SNAPSHOT_EXT} 2> /dev/null | tail -1 | sed 's/^IMG_0*\([0-9]\+\)\.'${SNAPSHOT_EXT}'$/\1/')
let last=${last}+1
snapshot_file=$(printf "IMG_%04d.PNG" $last)
notif_set 2 " NEW SCREEENSHOT ${snapshot_file}"
fbgrab "${SNAPSHOT_DIR}/${snapshot_file}" &
snapshot_file=$(printf "IMG_%04d.${SNAPSHOT_EXT}" $last)
notif_set 2 " SCREEENSHOT ${snapshot_file}"
fbgrab "${SNAPSHOT_DIR}/${snapshot_file}" >/dev/null 2>&1 &
# Remove lock file
rm -f "${LOCK_FILE}"

View File

@ -20,16 +20,21 @@ while true; do
if [ ${perform} -eq 1 ]; then
# Compute stats
cpu=$(printf "%.1f\n" $(mpstat -P ALL $UPDATE_PERIOD 1 | tail -1 | awk '{print 100-$12}'))
ram_mem=$(printf "%.1f\n" $(free | grep Mem | awk '{print $3/$2 * 100.0}'))
ram_swap=$(printf "%.1f\n" $(free | grep Swap | awk '{print $3/$2 * 100.0}'))
cpu=$(printf "%.0f\n" $(mpstat -P ALL $UPDATE_PERIOD 1 | tail -1 | awk '{print 100-$12}'))
ram_mem=$(printf "%.0f\n" $(free | grep Mem | awk '{print $3/$2 * 100.0}'))
ram_swap=$(printf "%.0f\n" $(free | grep Swap | awk '{print $3/$2 * 100.0}'))
ip_addr=$(ifconfig usb0 | grep "inet " | awk -F'[: ]+' '{ print $4 }')
# Notif
if [ ${notif_dirty} -eq 1 ]; then
notif_clear
notif_dirty=0
else
notif_set 0 "CPU:${cpu}%% RAM:${ram_mem}%% SWAP:${ram_swap}%%"
if [ "x${ip_addr}" != "x" ]; then
notif_set 0 " CPU:${cpu}%% RAM:${ram_mem}%% SWAP:${ram_swap}%%^IP:${ip_addr}"
else
notif_set 0 " CPU:${cpu}%% RAM:${ram_mem}%% SWAP:${ram_swap}%%"
fi
fi
else
sleep ${UPDATE_PERIOD}