patchimage/script.d/mkwii/wiimmfi.sh

87 lines
1.9 KiB
Bash
Raw Normal View History

2014-05-11 19:28:08 +02:00
#!/bin/bash
2016-05-16 22:12:44 +02:00
DOWNLOAD_LINK="http://download.wiimm.de/wiimmfi/patcher/mkw-wiimmfi-patcher-v3.7z"
GAME_TYPE="WII_GENERIC"
2016-08-05 21:09:04 +02:00
GAMENAME="Mario Kart Wiimmfi"
2014-05-11 19:28:08 +02:00
show_notes () {
echo -e \
"************************************************
${GAMENAME}
Patches Mario Kart Wii to use Wiimm's custom server
Source: http://wiiki.wii-homebrew.com/Wiimmfi-Patcher
Base Image: Mario Kart Wii (RMC?01)
Supported Versions: EUR, JAP, USA
************************************************"
}
check_input_image_special () {
ask_input_image_mkwiimm
2014-05-11 21:57:19 +02:00
echo -e "type ALL or RMC???.wbfs:\n"
read ID
2014-05-11 19:28:08 +02:00
if [[ -f ${PWD}/${ID} ]]; then
GAMEDIR=${PWD}
elif [[ -f ${PATCHIMAGE_WBFS_DIR}/${ID} ]]; then
GAMEDIR=${PATCHIMAGE_WBFS_DIR}
else echo "invalid user input."
exit 75
fi
2014-05-11 19:28:08 +02:00
}
download_wiimm () {
mkdir -p "${HOME}/.patchimage/tools/"
cd ${HOME}/.patchimage/tools
rm -rf wiimmfi-patcher/ *.7z*
2014-05-19 21:54:00 +02:00
wget "${DOWNLOAD_LINK}" || ( echo "something went wrong downloading ${DOWNLOAD_LINK}" && exit 57 )
${UNP} mkw-wiimmfi-patcher.7z >/dev/null ( echo "something went wrong unpacking files" && exit 63 )
2014-05-11 19:28:08 +02:00
mv mkw-wiimmfi-patcher*/ wiimmfi-patcher
chmod +x wiimmfi-patcher/*.sh
rm *.7z
}
patch_wiimm () {
cd ${HOME}/.patchimage/tools/wiimmfi-patcher/
2014-05-11 21:57:19 +02:00
if [[ ${ID} == ALL ]]; then
for image in ${IMAGE%/*}/RMC???.{iso,wbfs}; do
if [[ -e ${image} ]]; then
ln -s "${image}" .
2014-05-11 21:57:19 +02:00
fi
done
2016-05-16 22:21:18 +02:00
./patch-wiimmfi.sh >/dev/null || \
2014-05-19 21:54:00 +02:00
( echo "wiimmfi-ing the images failed." && exit 69 )
mv -v ./wiimmfi-images/* "${PATCHIMAGE_GAME_DIR}"/
2014-05-11 21:57:19 +02:00
else
2014-05-13 17:49:00 +02:00
if [[ ! -f ${IMAGE%/*}/${ID} ]]; then
echo "unvalid game passed from user-input. exit"
2014-05-19 21:54:00 +02:00
exit 75
2014-05-13 17:49:00 +02:00
fi
ln -s ${IMAGE%/*}/${ID} .
2016-05-16 22:21:18 +02:00
./patch-wiimmfi.sh >/dev/null || \
2014-05-19 21:54:00 +02:00
( echo "wiimmfi-ing the image failed." && exit 69 )
2014-05-11 21:57:19 +02:00
mv -v ./wiimmfi-images/${ID} "${PATCHIMAGE_GAME_DIR}"/
fi
2014-05-11 19:28:08 +02:00
rm -rf ${HOME}/.patchimage/tools/wiimfi-patcher/
}
pi_action () {
download_wiimm
patch_wiimm
}