diff options
author | Alexey 'Cluster' Avdyukhin <clusterrr@clusterrr.com> | 2017-12-27 03:18:30 +0300 |
---|---|---|
committer | Alexey 'Cluster' Avdyukhin <clusterrr@clusterrr.com> | 2017-12-27 03:18:30 +0300 |
commit | c41e3404d439fd90a771cb8eb0c2082790a3b65d (patch) | |
tree | 77c442bb38041185f48d48840f1b0f06f65b022f | |
parent | 63599fdee93c35b414eba237236bd697bd36a482 (diff) |
-rw-r--r-- | mod/etc/filesystems | 37 | ||||
-rwxr-xr-x | mod/hakchi/rootfs/bin/chmenu | 4 | ||||
-rw-r--r-- | mod/hakchi/rootfs/etc/preinit.d/b0000_defines | 2 | ||||
-rw-r--r-- | mod/hakchi/rootfs/etc/preinit.d/b0010_functions | 63 | ||||
-rw-r--r-- | mod/hakchi/rootfs/etc/preinit.d/b0040_usb | 4 | ||||
-rw-r--r-- | mod/hakchi/rootfs/etc/preinit.d/p0000_config | 6 |
6 files changed, 69 insertions, 47 deletions
diff --git a/mod/etc/filesystems b/mod/etc/filesystems new file mode 100644 index 0000000..2b8cb98 --- /dev/null +++ b/mod/etc/filesystems @@ -0,0 +1,37 @@ +nodev sysfs +nodev rootfs +nodev bdev +nodev proc +nodev tmpfs +nodev devtmpfs +nodev binfmt_misc +nodev sockfs +nodev usbfs +nodev pipefs +nodev anon_inodefs +nodev rpc_pipefs +nodev configfs +nodev devpts + ext3 + ext2 + ext4 + cramfs + squashfs +nodev ramfs + vfat + msdos + iso9660 +nodev nfs +nodev nfs4 +nodev cifs +nodev autofs + fuseblk +nodev fuse +nodev fusectl +nodev overlayfs + udf +nodev mqueue +nodev functionfs +nodev oprofilefs + ntfs + exfat diff --git a/mod/hakchi/rootfs/bin/chmenu b/mod/hakchi/rootfs/bin/chmenu index d4bec37..cfb9340 100755 --- a/mod/hakchi/rootfs/bin/chmenu +++ b/mod/hakchi/rootfs/bin/chmenu @@ -3,7 +3,8 @@ source /etc/preinit script_init gameStorage="$installpath/games" -state_file="/var/saves/$modname/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" @@ -12,6 +13,7 @@ state_file="/var/saves/$modname/menu" echo "Switching to menu $1" targetpath="$gameStorage/$1" containsGames "$targetpath" || exit 1 +mkdir -p "$state_path" echo "$1" > "$state_file" echo "New directory: $targetpath" diff --git a/mod/hakchi/rootfs/etc/preinit.d/b0000_defines b/mod/hakchi/rootfs/etc/preinit.d/b0000_defines index 684054d..1d0a381 100644 --- a/mod/hakchi/rootfs/etc/preinit.d/b0000_defines +++ b/mod/hakchi/rootfs/etc/preinit.d/b0000_defines @@ -4,7 +4,7 @@ modpath="/$modname" installpath="$mountpoint/var/lib/$modname" firmwarepath="$installpath/firmware" rootfs="$installpath/rootfs" -squashfs="$installpath/squashfs" +squashfs="$mountpoint/var/squashfs" preinit="$rootfs/etc/preinit" preinitpath="$preinit.d" sftype="" diff --git a/mod/hakchi/rootfs/etc/preinit.d/b0010_functions b/mod/hakchi/rootfs/etc/preinit.d/b0010_functions index b3a2f9f..fdbfdfd 100644 --- a/mod/hakchi/rootfs/etc/preinit.d/b0010_functions +++ b/mod/hakchi/rootfs/etc/preinit.d/b0010_functions @@ -100,7 +100,7 @@ checkFirmware(){ } currentFirmware(){ - local firmware="$(losetup | awk '{print $3'})" + local firmware="$(losetup -a | awk '{print $3'})" if ! [ -z "$firmware" ]; then echo "$firmware" return 0 @@ -248,58 +248,40 @@ softwareCheck(){ repair_fonts(){ if [ "$sftype" == "nes" ]; then mkdir -p "$1" || return 1 - [ ! -f "$1/title.fnt" ] && (copy "$rootfs$gamepath/title.fnt" "$1" || copy "$squashfs$gamepath/title.fnt" "$1") - [ ! -f "$1/copyright.fnt" ] && (copy "$rootfs$gamepath/copyright.fnt" "$1" || copy "$squashfs$gamepath/copyright.fnt" "$1") + [ ! -f "$1/title.fnt" ] && (copy "$rootfs$gamepath/title.fnt" "$1/" || copy "$squashfs$gamepath/title.fnt" "$1/") + [ ! -f "$1/copyright.fnt" ] && (copy "$rootfs$gamepath/copyright.fnt" "$1/" || copy "$squashfs$gamepath/copyright.fnt" "$1/") fi } -repair_games(){ - [ -w "$1" ] || return 0 - local usesymlink='' - ln -s / "$1/symlinktest" 2>/dev/null && rm -f "$1/symlinktest" && usesymlink='y' - - ls -1 "$squashfs$gamepath" | grep CLV- | while read code - do - local gamedir="$1/$code" - local squashgamedir="$squashfs$gamepath/$code" - - [ -d "$gamedir" ] || continue - - if [ ! -f "$gamedir/$code.desktop" ]; then - cp "$squashgamedir/$code.desktop" "$gamedir/" - [ "$sftype" == "nes" ] && \ - sed -i -e 's#/usr/bin/clover-kachikachi#/bin/clover-kachikachi-wr#g' "$gamedir/$code.desktop" - [ "$sftype" == "snes" ] && \ - sed -i -e 's#/usr/bin/clover-canoe-shvc#/bin/clover-canoe-shvc-wr#g' "$gamedir/$code.desktop" - fi - - [ -d "$gamedir/autoplay/" ] && ([ "$(ls -A "$gamedir/autoplay/")" ] || rm -rf "$gamedir/autoplay/") - [ -d "$gamedir/pixelart/" ] && ([ "$(ls -A "$gamedir/pixelart/")" ] || rm -rf "$gamedir/pixelart/") - - find "$squashgamedir" -maxdepth 1 | sed -n '1!p' | while read squashfile - do - if [ "$usesymlink" == "y" ]; then - ln -s "${squashfile##$mountpoint}" "$gamedir/" > /dev/null 2>&1 - else - rsync -a --ignore-existing "$squashfile" "$gamedir/" > /dev/null 2>&1 - fi - done - done - sync - return 0 +multiboot_getcode(){ + local code="$sftype-$sfregion" + [ "$sftype-$sfregion" == "snes-eur" ] && code="snes-usa" + echo "$code" } overmount_games(){ + local mb_systemcode="$(multiboot_getcode)" local gameStorage="$installpath/games" - local state_file="$mountpoint/var/lib/clover/profiles/0/$modname/menu" + local firmware=$(currentFirmware) + if [ -d "$gameStorage/$mb_systemcode" ] || [ "$firmware" != "_nand_" ]; then + [ "$cfg_separate_games" == "y" ] && gameStorage=$gameStorage/$mb_systemcode + fi + local state_path="$mountpoint/var/lib/clover/profiles/0" + if [ "$cfg_separate_saves" == "y" ] && [ -z "$1" ] && [ "$firmware" != "_nand_" ]; then + local mb_state_path="$state_path/$mb_systemcode" + mkdir -p "$mb_state_path" + mount_bind "$mb_state_path" "$state_path" + fi + local state_file="$state_path/$modname/menu" local menu_code="$1" [ -z "$1" ] && menu_code="000" [ -z "$1" ] && [ -f "$state_file" ] && menu_code="$(cat "$state_file")" containsGames "$gameStorage/$menu_code" || menu_code="" + echo "system code: $mb_systemcode" echo "menu code: $menu_code" if containsGames "$gameStorage/$menu_code"; then - overmount "/../games/$menu_code" "$gamepath" && \ - repair_games "$gameStorage/$menu_code" && \ + mount_bind "$gameStorage/$menu_code" "$mountpoint/$gamepath" && \ + repair_fonts "$gameStorage/$menu_code" && \ linkGames "$gameStorage/$menu_code" && \ return 0 else @@ -372,7 +354,6 @@ showImage(){ return 0 } - playSound(){ local wavfile="$(eval echo "$1")" [ -f "$wavfile" ] || wavfile="$rootfs$1" diff --git a/mod/hakchi/rootfs/etc/preinit.d/b0040_usb b/mod/hakchi/rootfs/etc/preinit.d/b0040_usb index c70e667..29717cb 100644 --- a/mod/hakchi/rootfs/etc/preinit.d/b0040_usb +++ b/mod/hakchi/rootfs/etc/preinit.d/b0040_usb @@ -49,6 +49,7 @@ checkUsbStorage(){ mount -o $ro "$disk" "$mountpoint/media" || return 1 local saves="$modname/saves" + local mb_systemcode="$(multiboot_getcode)" if [ -d "$mountpoint/media/$saves" ] || [ -d "$mountpoint/media/$modname/transfer" ] || [ "$cfg_usb_rw" == "y" ]; then umount "$mountpoint/media" @@ -86,7 +87,8 @@ checkUsbGamepath(){ local games="$modname/games" local gameStorage="$installpath/games" - if containsGames "$mountpoint/media/$games" || containsGames "$mountpoint/media/$games/000"; then + local mb_systemcode="$(multiboot_getcode)" + if containsGames "$mountpoint/media/$games/$mb_systemcode" || containsGames "$mountpoint/media/$games/$mb_systemcode/000" || containsGames "$mountpoint/media/$games" || containsGames "$mountpoint/media/$games/000"; then if ! mkdir -p "$gameStorage"; then rm -rf "$gameStorage" mkdir -p "$gameStorage" || return 1 diff --git a/mod/hakchi/rootfs/etc/preinit.d/p0000_config b/mod/hakchi/rootfs/etc/preinit.d/p0000_config index f1a2b8c..d5e38be 100644 --- a/mod/hakchi/rootfs/etc/preinit.d/p0000_config +++ b/mod/hakchi/rootfs/etc/preinit.d/p0000_config @@ -1,5 +1,5 @@ cfg_boot_stock='n' -cfg_disable_armet='y' cfg_firmware='auto' -cfg_nes_extra_args='' -cfg_usb_host='y' +cfg_usb_host='n' +cfg_separate_games='y' +cfg_separate_saves='y' |