diff options
Diffstat (limited to 'mods/mod_hakchi/hakchi/rootfs/bin/chmenu')
-rwxr-xr-x | mods/mod_hakchi/hakchi/rootfs/bin/chmenu | 27 |
1 files changed, 10 insertions, 17 deletions
diff --git a/mods/mod_hakchi/hakchi/rootfs/bin/chmenu b/mods/mod_hakchi/hakchi/rootfs/bin/chmenu index 3ad32b84..921709ca 100755 --- a/mods/mod_hakchi/hakchi/rootfs/bin/chmenu +++ b/mods/mod_hakchi/hakchi/rootfs/bin/chmenu @@ -2,34 +2,27 @@ source /etc/preinit script_init -state_file="$installpath/menu" +state_path="/var/saves/$modname" +state_file="$state_path/menu" [ -z "$1" ] && exit 1 [ -f "$state_file" ] && prev_code="$(cat "$state_file")" || prev_code="000" [ "$1" == "$prev_code" ] && exit 1 echo "Switching to menu $1" -if [ "$1" == "000" ]; then - targetpath="$rootfs$gamepath" -else - targetpath="$rootfs$gamepath/$1" +gameStorage="$(findGameStorage)" +targetpath="$gameStorage/$1" +if ! containsGames "$targetpath"; then + [ "$1" == "000" ] || exit 1 + targetpath="$gameStorage" + containsGames "$targetpath" || exit 1 fi -[ -d "$targetpath" ] || exit 1 +mkdir -p "$state_path" echo "$1" > "$state_file" echo "New directory: $targetpath" - -if [ "$1" != "000" ]; then - if [ -f "$rootfs$gamepath/title.fnt" ] && [ ! -f "$targetpath/title.fnt" ]; then - ln -s "$rootfs$gamepath/title.fnt" "$targetpath/title.fnt" - fi - if [ -f "$rootfs$gamepath/copyright.fnt" ] && [ ! -f "$targetpath/copyright.fnt" ]; then - ln -s "$rootfs$gamepath/copyright.fnt" "$targetpath/copyright.fnt" - fi -fi - uistop -overmount_games +overmount_games "$1" sleep 1 touch "/var/startmcp.flag" |