diff --git a/FunKey/board/funkey/rootfs-overlay/etc/profile b/FunKey/board/funkey/rootfs-overlay/etc/profile index 8a3692e..831311f 100755 --- a/FunKey/board/funkey/rootfs-overlay/etc/profile +++ b/FunKey/board/funkey/rootfs-overlay/etc/profile @@ -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 diff --git a/FunKey/board/funkey/rootfs-overlay/media b/FunKey/board/funkey/rootfs-overlay/media index 35ec3b9..cca5abd 120000 --- a/FunKey/board/funkey/rootfs-overlay/media +++ b/FunKey/board/funkey/rootfs-overlay/media @@ -1 +1 @@ -/ \ No newline at end of file +/mnt \ No newline at end of file diff --git a/FunKey/board/funkey/rootfs-overlay/root/.profile b/FunKey/board/funkey/rootfs-overlay/root/.profile index 174e981..cad4256 100755 --- a/FunKey/board/funkey/rootfs-overlay/root/.profile +++ b/FunKey/board/funkey/rootfs-overlay/root/.profile @@ -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() { diff --git a/FunKey/board/funkey/rootfs-overlay/usr/local/sbin/first_boot b/FunKey/board/funkey/rootfs-overlay/usr/local/sbin/first_boot index 63bc987..2366229 100755 --- a/FunKey/board/funkey/rootfs-overlay/usr/local/sbin/first_boot +++ b/FunKey/board/funkey/rootfs-overlay/usr/local/sbin/first_boot @@ -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 diff --git a/FunKey/board/funkey/rootfs-overlay/usr/local/sbin/get_launcher b/FunKey/board/funkey/rootfs-overlay/usr/local/sbin/get_launcher new file mode 100755 index 0000000..0911e80 --- /dev/null +++ b/FunKey/board/funkey/rootfs-overlay/usr/local/sbin/get_launcher @@ -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 diff --git a/FunKey/board/funkey/rootfs-overlay/usr/local/sbin/set_launcher b/FunKey/board/funkey/rootfs-overlay/usr/local/sbin/set_launcher index fe81515..1d20bd9 100755 --- a/FunKey/board/funkey/rootfs-overlay/usr/local/sbin/set_launcher +++ b/FunKey/board/funkey/rootfs-overlay/usr/local/sbin/set_launcher @@ -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 diff --git a/FunKey/board/funkey/rootfs-overlay/usr/local/sbin/share b/FunKey/board/funkey/rootfs-overlay/usr/local/sbin/share index 8e29850..f63d8a5 100755 --- a/FunKey/board/funkey/rootfs-overlay/usr/local/sbin/share +++ b/FunKey/board/funkey/rootfs-overlay/usr/local/sbin/share @@ -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 diff --git a/FunKey/board/funkey/rootfs-overlay/usr/local/sbin/snap b/FunKey/board/funkey/rootfs-overlay/usr/local/sbin/snap index 65a1e02..7a246a5 100755 --- a/FunKey/board/funkey/rootfs-overlay/usr/local/sbin/snap +++ b/FunKey/board/funkey/rootfs-overlay/usr/local/sbin/snap @@ -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 diff --git a/FunKey/board/funkey/rootfs-overlay/usr/local/sbin/start_launcher b/FunKey/board/funkey/rootfs-overlay/usr/local/sbin/start_launcher index 3a1f69a..579d482 100755 --- a/FunKey/board/funkey/rootfs-overlay/usr/local/sbin/start_launcher +++ b/FunKey/board/funkey/rootfs-overlay/usr/local/sbin/start_launcher @@ -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 diff --git a/FunKey/package/gmenu2x/gmenu2x.mk b/FunKey/package/gmenu2x/gmenu2x.mk index 0f1e5fe..0270dbc 100644 --- a/FunKey/package/gmenu2x/gmenu2x.mk +++ b/FunKey/package/gmenu2x/gmenu2x.mk @@ -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 diff --git a/Recovery/board/funkey/rootfs-overlay/usr/local/sbin/snap b/Recovery/board/funkey/rootfs-overlay/usr/local/sbin/snap index 4b8cc81..7a246a5 100755 --- a/Recovery/board/funkey/rootfs-overlay/usr/local/sbin/snap +++ b/Recovery/board/funkey/rootfs-overlay/usr/local/sbin/snap @@ -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}" diff --git a/Recovery/board/funkey/rootfs-overlay/usr/local/sbin/system_stats b/Recovery/board/funkey/rootfs-overlay/usr/local/sbin/system_stats index a6a091a..4e6ad97 100755 --- a/Recovery/board/funkey/rootfs-overlay/usr/local/sbin/system_stats +++ b/Recovery/board/funkey/rootfs-overlay/usr/local/sbin/system_stats @@ -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}