diff options
author | Alexey 'Cluster' Avdyukhin <clusterrr@clusterrr.com> | 2017-04-27 00:03:22 +0300 |
---|---|---|
committer | Alexey 'Cluster' Avdyukhin <clusterrr@clusterrr.com> | 2017-04-27 00:03:22 +0300 |
commit | 442af5cc3d7ffbd4e31fbb13132b9a44e38af694 (patch) | |
tree | d56b115f6a66712be665669cb086a0c4231b8418 /user_mods | |
parent | 020485c1b9c7ac5df70ea8c1951ec42a8012df55 (diff) |
Many minor fixes, new modules
Diffstat (limited to 'user_mods')
-rw-r--r-- | user_mods/password.hmod/S810password | 50 | ||||
-rw-r--r-- | user_mods/password.hmod/install | 7 | ||||
-rw-r--r-- | user_mods/password.hmod/password.raw.gz | bin | 0 -> 9577 bytes | |||
-rw-r--r-- | user_mods/password.hmod/password_fail.raw.gz | bin | 0 -> 7866 bytes | |||
-rw-r--r-- | user_mods/password.hmod/password_ok.raw.gz | bin | 0 -> 5174 bytes | |||
-rw-r--r-- | user_mods/password.hmod/readme.txt | 3 | ||||
-rw-r--r-- | user_mods/password.hmod/uninstall | 5 | ||||
-rw-r--r-- | user_mods/remove_thumbnails.hmod/install | 22 | ||||
-rw-r--r-- | user_mods/remove_thumbnails.hmod/readme.txt | 3 | ||||
-rw-r--r-- | user_mods/remove_thumbnails.hmod/uninstall | 7 |
10 files changed, 97 insertions, 0 deletions
diff --git a/user_mods/password.hmod/S810password b/user_mods/password.hmod/S810password new file mode 100644 index 00000000..baef6e35 --- /dev/null +++ b/user_mods/password.hmod/S810password @@ -0,0 +1,50 @@ +#!/bin/sh + +# Some constants +# Controller pseudo-file +clovercon=/dev/input/by-path/platform-twi.1-event-joystick +# Password pattern - it's Konami Code :) +password="c202 c202 c302 c302 c002 c102 c002 c102 3101 3001 3b01" +# Max tries +max_tries=30 + +# Init scripts are executed with "start" argument when system boots and with "stop" argument during shutdown +# So we need to check that it's boot state, not shutdown +[ -z "$1" ] || [ "$1" == "start" ] || exit 0 + +# Drawing "ENTER PASSWORD" image +gunzip -c /etc/password.raw.gz > /dev/fb0 + +# Endless loop +while [ true ]; do + # Wait while pseudo-file doesn't exists (controller is not connected or is not initialized yet) + while [ ! -e $clovercon ]; do usleep 100; done + # Reading buttons + buttons=$(cat $clovercon | hexdump -v -e '1/1 "%02x"' -n 32) + buttons=${buttons:20:4} + # Appending pressed button to "str" variable + str="$str $buttons" + # If "str" variable is longer than password string, cut it + # So we get only last presses + [ "${#str}" -gt "${#password}" ] && str="${str:$((${#str}-${#password})):${#password}}" + + # Is password correct? + if [ "$str" == "$password" ]; then + # Display "OK" image + gunzip -c /etc/password_ok.raw.gz > /dev/fb0 + # Exit and continue system loading + exit 0 + fi + + # Password is not correct yet, decrease tries counter + max_tries=$(($max_tries-1)) + # Is it zero? + if [ "$max_tries" == "0" ]; then + # Display "ACCESS DENIED" image + gunzip -c /etc/password_fail.raw.gz > /dev/fb0 + # Wait for three seconds + sleep 3 + # Shutdown system + poweroff + fi +done diff --git a/user_mods/password.hmod/install b/user_mods/password.hmod/install new file mode 100644 index 00000000..2f66861a --- /dev/null +++ b/user_mods/password.hmod/install @@ -0,0 +1,7 @@ +local script=S810password
+copy $script $rootfs/etc/init.d/
+chmod +x $rootfs/etc/init.d/$script
+copy password.raw.gz $rootfs/etc/
+copy password_ok.raw.gz $rootfs/etc/
+copy password_fail.raw.gz $rootfs/etc/
+return 1
diff --git a/user_mods/password.hmod/password.raw.gz b/user_mods/password.hmod/password.raw.gz Binary files differnew file mode 100644 index 00000000..afa6cc3b --- /dev/null +++ b/user_mods/password.hmod/password.raw.gz diff --git a/user_mods/password.hmod/password_fail.raw.gz b/user_mods/password.hmod/password_fail.raw.gz Binary files differnew file mode 100644 index 00000000..e60ba2d2 --- /dev/null +++ b/user_mods/password.hmod/password_fail.raw.gz diff --git a/user_mods/password.hmod/password_ok.raw.gz b/user_mods/password.hmod/password_ok.raw.gz Binary files differnew file mode 100644 index 00000000..c37c5860 --- /dev/null +++ b/user_mods/password.hmod/password_ok.raw.gz diff --git a/user_mods/password.hmod/readme.txt b/user_mods/password.hmod/readme.txt new file mode 100644 index 00000000..ebff0c8c --- /dev/null +++ b/user_mods/password.hmod/readme.txt @@ -0,0 +1,3 @@ +=== Password Protection Hack ===
+
+This module adds password protection to NES Mini. Default password is Konami Code :)
diff --git a/user_mods/password.hmod/uninstall b/user_mods/password.hmod/uninstall new file mode 100644 index 00000000..b5247786 --- /dev/null +++ b/user_mods/password.hmod/uninstall @@ -0,0 +1,5 @@ +local script=S810password
+rm $rootfs/etc/init.d/$script
+rm $rootfs/etc/password.raw.gz
+rm $rootfs/etc/password_ok.raw.gz
+rm $rootfs/etc/password_fail.raw.gz
diff --git a/user_mods/remove_thumbnails.hmod/install b/user_mods/remove_thumbnails.hmod/install new file mode 100644 index 00000000..6ecd1d93 --- /dev/null +++ b/user_mods/remove_thumbnails.hmod/install @@ -0,0 +1,22 @@ +# Lines started with "#" are ignored and can be used as comments
+# Next line defines "scnfile" variable with path to "sys_game_thumbnail.scn" file
+scnfile=/usr/share/clover-ui/resources/prefab/sys_game_thumbnail.scn
+# Same with nes.json file
+nesjson=/usr/share/clover-ui/resources/sprites/nes.json
+# This line defines "preinitfile" variable with pre-init file name
+preinitfile=p81a8_hide_thumnbnails
+# "restore" is hakchi function which copies original file to corresponding path in /var/lib/hakchi/rootfs
+restore $scnfile
+restore $nesjson
+# sed is GNU util to modify file, this command replaces "enabled:true" to "enabled:false"
+# Please note that we need to edit $rootfs$scnfile (writable file), not a just $scnfile (original read-only file)
+sed -i -e 's/"enabled":true/"enabled":false/g' $rootfs$scnfile
+# Same with nes.json file, most simple way is to replace coordinates sprite coords with zeros
+sed -i -e 's/\[93,861,12,8\]/\[0,0,0,0\]/g' $rootfs$nesjson
+sed -i -e 's/\[93,871,12,8\]/\[0,0,0,0\]/g' $rootfs$nesjson
+sed -i -e 's/\[107,861,12,8\]/\[0,0,0,0\]/g' $rootfs$nesjson
+# Create pre-init script and echo "overmount" command to it
+echo "overmount $scnfile" > $preinitpath/$preinitfile
+echo "overmount $nesjson" >> $preinitpath/$preinitfile
+# We should return 1 to prevent execution of automatic installer
+return 1
diff --git a/user_mods/remove_thumbnails.hmod/readme.txt b/user_mods/remove_thumbnails.hmod/readme.txt new file mode 100644 index 00000000..557d3552 --- /dev/null +++ b/user_mods/remove_thumbnails.hmod/readme.txt @@ -0,0 +1,3 @@ +=== No-thumbnails Hack ===
+
+This module removes thumbnails at the bottom of the screen.
diff --git a/user_mods/remove_thumbnails.hmod/uninstall b/user_mods/remove_thumbnails.hmod/uninstall new file mode 100644 index 00000000..5cb43d4c --- /dev/null +++ b/user_mods/remove_thumbnails.hmod/uninstall @@ -0,0 +1,7 @@ +# All we need is to delete created files, original file is safe and will be used again after reboot
+scnfile=/usr/share/clover-ui/resources/prefab/sys_game_thumbnail.scn
+nesjson=/usr/share/clover-ui/resources/sprites/nes.json
+preinitfile=p81a8_hide_thumnbnails
+rm -f $preinitfile
+rm -f $rootfs$scnfile
+rm -f $rootfs$nesjson
|