From 3abd0bd5dd6174d47728d9b958c2c73c199bebf5 Mon Sep 17 00:00:00 2001 From: teamzebra Date: Sat, 14 Oct 2017 18:12:29 -0500 Subject: [PATCH] Hotfix to make this compatible with hakchi2 v2.21c+ --- .../bin/hybrid_nesc_kachikachi_wr | 35 +++++++++++++++++++ nesc_hybrid_system.hmod/install | 3 -- nesc_hybrid_system.hmod/uninstall | 2 +- .../java/com/teamzebra/snesclassic/Main.java | 5 +-- 4 files changed, 39 insertions(+), 6 deletions(-) create mode 100644 nesc_hybrid_system.hmod/bin/hybrid_nesc_kachikachi_wr diff --git a/nesc_hybrid_system.hmod/bin/hybrid_nesc_kachikachi_wr b/nesc_hybrid_system.hmod/bin/hybrid_nesc_kachikachi_wr new file mode 100644 index 0000000..3db8344 --- /dev/null +++ b/nesc_hybrid_system.hmod/bin/hybrid_nesc_kachikachi_wr @@ -0,0 +1,35 @@ +#!/bin/sh +# Wrapper for kachikachi +# You can add extra command line arguments to all games at once +# using "cfg_nes_extra_args" variable in p0000_config +# or disable epilepsy protection using "cfg_disable_armet=y" +# We need to lay down this file instead of using the one +# that hakchi provides, because hakchi updates all /bin scripts +# on each game sync and we need a different kachikachi path. + +source /etc/preinit +script_init + +filename="$(readlink -f "$1")" +filebase="$(basename "$filename")" +extension="${filebase##*.}" +tmppath="$temppath/rom" +if [ "$extension" == "7z" ]; then + rm -rf "$tmppath" + mkdir -p "$tmppath" + cd "$tmppath" + tiny7zx x "$filename" + filename="$tmppath/$(ls)" +fi +if [ "$extension" == "gz" ]; then + rm -rf "$tmppath" + mkdir -p "$tmppath" + gunzip -c > "$tmppath/$filebase" + filename="$tmppath/$filebase" +fi +shift + +args="$filename $@ $cfg_nes_extra_args" +[ "$cfg_disable_armet" == "y" ] && args="$(echo $args | sed 's/--enable-armet//g')" + +exec /bin/clover-kachikachi $args diff --git a/nesc_hybrid_system.hmod/install b/nesc_hybrid_system.hmod/install index d1ef756..d61853c 100644 --- a/nesc_hybrid_system.hmod/install +++ b/nesc_hybrid_system.hmod/install @@ -1,9 +1,6 @@ # copy over our custom files transfer_default -# fix up the clover-kachikachi-wr -sed -i 's@/usr/bin/clover-kachikachi@/bin/clover-kachikachi@g' $rootfs/bin/clover-kachikachi-wr - # set up the file permissions chmod +x $rootfs/bin/* diff --git a/nesc_hybrid_system.hmod/uninstall b/nesc_hybrid_system.hmod/uninstall index 3a2b0c9..b0b50c1 100644 --- a/nesc_hybrid_system.hmod/uninstall +++ b/nesc_hybrid_system.hmod/uninstall @@ -10,6 +10,7 @@ rm $rootfs/bin/ReedPlayer-Clover-nes rm $rootfs/bin/switch_to_nes rm $rootfs/bin/switch_to_nes_child rm $rootfs/bin/switch_to_snes +rm $rootfs/bin/hybrid_nesc_kachikachi_wr rm -r $rootfs/etc/share/applications/ rm -r $rootfs/etc/share/clover-mcp/ rm -r $rootfs/etc/share/clover-ui/ @@ -20,5 +21,4 @@ rm -r $rootfs/etc/share/reed-libs/ rm $rootfs/lib/liblzo2.so rm $rootfs/lib/liblzo2.so.2 rm $rootfs/lib/liblzo2.so.2.0.0 -rm -r $rootfs/usr/share/games/nes/ rm -r $rootfs/etc/nesgames/ diff --git a/src/main/java/com/teamzebra/snesclassic/Main.java b/src/main/java/com/teamzebra/snesclassic/Main.java index bc7fd25..4b9ec38 100644 --- a/src/main/java/com/teamzebra/snesclassic/Main.java +++ b/src/main/java/com/teamzebra/snesclassic/Main.java @@ -54,7 +54,7 @@ public class Main { * @throws IOException */ public static void main(String[] args) throws IOException { - System.out.println("SNES / NES Classic Hybrid Dual Boot Tool v0.2"); + System.out.println("SNES / NES Classic Hybrid Dual Boot Tool v0.3"); System.out.println("By TeamZebra: https://github.com/teamzebra/snesclassic.dualboot"); // verify that the bundled files for the resulting HMOD weren't deleted @@ -111,6 +111,7 @@ private static void verifyBundledHmodFiles() { verifyHmodEntityExists("bin/switch_to_nes"); verifyHmodEntityExists("bin/switch_to_snes"); verifyHmodEntityExists("bin/switch_to_nes_child"); + verifyHmodEntityExists("bin/hybrid_nesc_kachikachi_wr"); verifyHmodEntityExists("etc/nesgames/CLV-P-0SNES/CLV-P-0SNES.desktop"); verifyHmodEntityExists("etc/nesgames/CLV-P-0SNES/CLV-P-0SNES.png"); verifyHmodEntityExists("etc/nesgames/CLV-P-0SNES/CLV-P-0SNES_small.png"); @@ -336,7 +337,7 @@ private static void patchGameFilesInHmod() for (String gameCode : gamesList) { replaceStringsInFile(String.format("etc/nesgames/%1$s/%1$s.desktop", gameCode), ImmutableMap.of( "/usr/bin/clover-kachikachi", - "/bin/clover-kachikachi-wr", + "/bin/hybrid_nesc_kachikachi_wr", "/usr/share/games/nes/kachikachi", "/etc/nesgames" ));