diff options
-rw-r--r-- | MainForm.cs | 28 | ||||
-rw-r--r-- | Properties/Resources.resx | 6 | ||||
-rw-r--r-- | SelectModsForm.cs | 1 | ||||
-rw-r--r-- | hakchi_gui.csproj | 30 | ||||
-rw-r--r-- | mods/hmods/copyleft.hmod | bin | 538 -> 543 bytes | |||
-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 |
15 files changed, 147 insertions, 15 deletions
diff --git a/MainForm.cs b/MainForm.cs index e836834c..880b29b4 100644 --- a/MainForm.cs +++ b/MainForm.cs @@ -216,18 +216,22 @@ namespace com.clusterrr.hakchi_gui {
ConfigIni.CustomFlashed = true; // Just in case of new installation
Clovershell.ExecuteSimple(string.Format("date -s \"{0:yyyy-MM-dd HH:mm:ss}\"", DateTime.UtcNow));
- var region = Clovershell.ExecuteSimple("cat /etc/clover/REGION", 500, true);
- Debug.WriteLine(string.Format("Detected region: {0}", region));
- if (region == "JPN")
- Invoke(new Action(delegate
- {
- famicomMiniToolStripMenuItem.PerformClick();
- }));
- if (region == "EUR_USA")
- Invoke(new Action(delegate
- {
- nESMiniToolStripMenuItem.PerformClick();
- }));
+ var customFirmware = Clovershell.ExecuteSimple("[ -d /var/lib/hakchi/firmware/ ] && [ -f /var/lib/hakchi/firmware/*.hsqs ] && echo YES || echo NO");
+ if (customFirmware == "NO")
+ {
+ var region = Clovershell.ExecuteSimple("cat /etc/clover/REGION", 500, true);
+ Debug.WriteLine(string.Format("Detected region: {0}", region));
+ if (region == "JPN")
+ Invoke(new Action(delegate
+ {
+ famicomMiniToolStripMenuItem.PerformClick();
+ }));
+ if (region == "EUR_USA")
+ Invoke(new Action(delegate
+ {
+ nESMiniToolStripMenuItem.PerformClick();
+ }));
+ }
WorkerForm.GetMemoryStats();
new Thread(RecalculateSelectedGamesThread).Start();
}
diff --git a/Properties/Resources.resx b/Properties/Resources.resx index 941cf5ac..9bb9ad2e 100644 --- a/Properties/Resources.resx +++ b/Properties/Resources.resx @@ -178,7 +178,7 @@ <value>Flashing original kernel...</value>
</data>
<data name="GamesSelected" xml:space="preserve">
- <value>games(s) selected</value>
+ <value>game(s) selected</value>
</data>
<data name="InvalidKernelHeader" xml:space="preserve">
<value>Invalid kernel header.</value>
@@ -494,10 +494,10 @@ <value>Installing mods...</value>
</data>
<data name="SelectModsInstall" xml:space="preserve">
- <value>Select the modules to install on your NES Mini.</value>
+ <value>Select the modules to install on your NES Mini</value>
</data>
<data name="SelectModsUninstall" xml:space="preserve">
- <value>Select the modules to remove from your NES Mini.</value>
+ <value>Select the modules to remove from your NES Mini</value>
</data>
<data name="UninstallingMods" xml:space="preserve">
<value>Uninstalling mods...</value>
diff --git a/SelectModsForm.cs b/SelectModsForm.cs index f77fcd9f..a1842937 100644 --- a/SelectModsForm.cs +++ b/SelectModsForm.cs @@ -52,6 +52,7 @@ namespace com.clusterrr.hakchi_gui readmeFiles = new string[] { "readme.txt", "readme.md", "readme" };
checkedListBoxMods.Items.Clear();
checkedListBoxMods.Items.AddRange(modsList.ToArray());
+ checkedListBoxMods.Sorted = true;
if (filesToAdd != null) AddMods(filesToAdd);
this.AllowDrop = allowDropMods;
}
diff --git a/hakchi_gui.csproj b/hakchi_gui.csproj index bfc781a8..2e4bcc78 100644 --- a/hakchi_gui.csproj +++ b/hakchi_gui.csproj @@ -1114,6 +1114,30 @@ <None Include="user_mods\music_hack.hmod\uninstall">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
+ <None Include="user_mods\password.hmod\install">
+ <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+ </None>
+ <None Include="user_mods\password.hmod\password.raw.gz">
+ <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+ </None>
+ <None Include="user_mods\password.hmod\password_fail.raw.gz">
+ <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+ </None>
+ <None Include="user_mods\password.hmod\password_ok.raw.gz">
+ <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+ </None>
+ <None Include="user_mods\password.hmod\S810password">
+ <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+ </None>
+ <None Include="user_mods\password.hmod\uninstall">
+ <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+ </None>
+ <None Include="user_mods\remove_thumbnails.hmod\install">
+ <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+ </None>
+ <None Include="user_mods\remove_thumbnails.hmod\uninstall">
+ <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+ </None>
</ItemGroup>
<ItemGroup>
<Content Include="data\GameGenieDB.xml">
@@ -1417,9 +1441,15 @@ <Content Include="user_mods\music_hack.hmod\readme.txt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
+ <Content Include="user_mods\password.hmod\readme.txt">
+ <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+ </Content>
<Content Include="user_mods\README.txt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
+ <Content Include="user_mods\remove_thumbnails.hmod\readme.txt">
+ <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+ </Content>
<None Include="folder_images\README.txt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
diff --git a/mods/hmods/copyleft.hmod b/mods/hmods/copyleft.hmod Binary files differindex a0a9c608..b0607809 100644 --- a/mods/hmods/copyleft.hmod +++ b/mods/hmods/copyleft.hmod 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
|