wackman/patches/10-segatools.sh
2025-11-01 01:47:21 +01:00

35 lines
1.6 KiB
Bash
Executable file

#!/bin/bash
airgap=${AIRGAP:-false}
set -e
if [ -z ${dir+x} ]; then echo "\$dir not set, skipping."; exit 22; else
if [ -f ../imagestore/misc/segatools.zip ]; then
mkdir -p $dir/segatools/{amfs,appdata,option}
unzip -p ../imagestore/misc/segatools.zip mercury.zip | bsdtar -xf- -C $dir/game/bin
else
if [ "$airgap" = false ]; then
wget https://gitea.tendokyu.moe/TeamTofuShop/segatools/releases/download/latest/segatools.zip -O ../imagestore/misc/segatools.zip
mkdir -p $dir/segatools/{amfs,appdata,option}
unzip -p ../imagestore/misc/segatools.zip mercury.zip | bsdtar -xf- -C $dir/game/bin
else
echo "ERROR: Missing following segatools.zip"
exit 2
fi
fi
fi
sed -i '/^\[vfs\]/,/^\[/ {
/^amfs=/c\amfs=..\\\\..\\\\segatools\\\\amfs
/^option=/c\option=..\\\\..\\\\segatools\\\\option
/^appdata=/c\appdata=..\\\\..\\\\segatools\\\\appdata
}' $dir/game/bin/segatools.ini
if [ -z ${PORT_AIME_READER:-} ]; then echo "\$Card reader binding not set, skipping."; else
echo "Card reader binding set, disabling card reader assembly emulation"
sed -i '/^\[aime\]/,/^enable=1/ s/^enable=1/enable=0/' $dir/game/bin/segatools.ini
fi
if [ -z ${PORT_CONSOLE_LEFT:-} ]; then echo "\$Left console binding not set, skipping."; else
if [ -z ${PORT_CONSOLE_RIGHT:-} ]; then echo "\$Right console binding not set, skipping."; else
echo "Console binding set, disabling mercuryio touch hooks"
sed -i '/^\[touch\]/,/^enable=1/ s/^enable=1/enable=0/' $dir/game/bin/segatools.ini
fi
fi