2014-05-14 20:38:48 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
GAME_TYPE="MKWIIMM"
|
|
|
|
GAME_NAME="Mario Kart Wiimm"
|
2016-05-16 22:21:18 +02:00
|
|
|
DOWNLOAD_LINK="http://download.wiimm.de/wiimmfi/patcher/mkw-wiimmfi-patcher-v3.7z"
|
2016-08-05 15:57:18 +02:00
|
|
|
WBFS_MASK="RMC[PUJ]01"
|
2014-05-14 20:38:48 +02:00
|
|
|
|
|
|
|
show_notes () {
|
|
|
|
|
|
|
|
echo -e \
|
|
|
|
"************************************************
|
2015-04-11 22:02:29 +02:00
|
|
|
${GAME_NAME}
|
2014-05-14 20:38:48 +02:00
|
|
|
|
|
|
|
Custom Mario Kart Wii
|
|
|
|
|
|
|
|
Source: http://wiiki.wii-homebrew.com/Wiimms_Mario_Kart_Fun
|
|
|
|
Base Image: Mario Kart Wii (RMC?01)
|
|
|
|
Supported Versions: EUR, JAP, USA
|
|
|
|
************************************************"
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
download_wiimm () {
|
|
|
|
|
|
|
|
echo "Choose a Mario Kart Wiimm Distribution
|
|
|
|
|
|
|
|
ALL Build all distributions."
|
2016-08-04 20:28:09 +02:00
|
|
|
gawk -F \: 'NR>1 {print $1 "\t" $2}' < ${PATCHIMAGE_DATABASE_DIR}/mkwiimm.db
|
2014-05-14 20:38:48 +02:00
|
|
|
echo "
|
2015-04-11 21:37:38 +02:00
|
|
|
type in ALL or an ID (multiple separated by space)"
|
2014-05-14 20:38:48 +02:00
|
|
|
read ID
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2014-05-17 21:24:34 +02:00
|
|
|
wiimmfi () {
|
|
|
|
|
|
|
|
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}" &>/dev/null || ( echo "something went wrong downloading ${DOWNLOAD_LINK}" && exit 57 )
|
|
|
|
${UNP} mkw-wiimmfi-patcher.7z >/dev/null || ( echo "something went wrong extracting files" && exit 63 )
|
2014-05-17 21:24:34 +02:00
|
|
|
mv mkw-wiimmfi-patcher*/ wiimmfi-patcher
|
|
|
|
chmod +x wiimmfi-patcher/*.sh
|
2014-05-17 21:32:55 +02:00
|
|
|
cd wiimmfi-patcher/
|
2014-05-17 21:24:34 +02:00
|
|
|
|
|
|
|
ln -s "${1}" .
|
2016-05-16 22:21:18 +02:00
|
|
|
./patch-wiimmfi.sh >/dev/null || exit 51
|
2014-05-17 23:51:45 +02:00
|
|
|
echo "*** 8) storing game in ${PATCHIMAGE_GAME_DIR}/${1##*/}"
|
2014-05-17 21:43:49 +02:00
|
|
|
mv ./wiimmfi-images/${1##*/} "${PATCHIMAGE_GAME_DIR}"/
|
2014-05-17 21:24:34 +02:00
|
|
|
|
2014-05-17 21:32:55 +02:00
|
|
|
rm -rf ${HOME}/.patchimage/tools/*
|
2014-05-17 21:24:34 +02:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2016-05-18 19:39:46 +02:00
|
|
|
mkwiimm_distfiles () {
|
|
|
|
|
|
|
|
if [[ -f ${PATCHIMAGE_RIIVOLUTION_DIR}/${FILENAME} ]]; then
|
|
|
|
echo "*** 5) extracting mkwiimm files"
|
|
|
|
${UNP} ${PATCHIMAGE_RIIVOLUTION_DIR}/${FILENAME} >/dev/null || \
|
|
|
|
( echo "something went wrong extracting files" && exit 63 )
|
|
|
|
elif [[ -f ${PWD}/${FILENAME} ]]; then
|
|
|
|
echo "*** 5) extracting mkwiimm files"
|
|
|
|
${UNP} ${PWD}/${FILENAME} >/dev/null || \
|
|
|
|
( echo "something went wrong extracting files" && exit 63 )
|
|
|
|
else
|
|
|
|
echo "*** 5) downloading and extracting mkwiimm files"
|
|
|
|
wget -O ${PATCHIMAGE_RIIVOLUTION_DIR}/${FILENAME} ${DOWNLOAD} >/dev/null || \
|
|
|
|
( echo "something went wrong downloading ${DOWNLOAD}" && exit 57 )
|
|
|
|
${UNP} ${PATCHIMAGE_RIIVOLUTION_DIR}/${FILENAME} >/dev/null || \
|
|
|
|
( echo "something went wrong extracting files" && exit 63 )
|
|
|
|
fi
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
mkwiimm_build_olddist () {
|
|
|
|
|
|
|
|
if [[ ${MKWIIMM_MSG_LANG} && ${MKWIIMM_OWN_SAVE} ]]; then
|
|
|
|
echo "LANGUAGE=${MKWIIMM_MSG_LANG}
|
|
|
|
MSGLANG=${MKWIIMM_MSG_LANG}
|
|
|
|
ISOMODE=wbfs
|
|
|
|
SPLITISO=
|
|
|
|
PRIV_SAVEGAME=${MKWIIMM_OWN_SAVE}" > ${PWD}/config.def
|
|
|
|
echo "*** 6) creating >${DIST}< (can take some time)"
|
|
|
|
./create-image.sh -a --dest=${XD}/RMC${REG}${MY_ID}.wbfs >/dev/null || exit 51
|
|
|
|
else
|
|
|
|
echo "*** 6) creating >${DIST}< (can take some time)"
|
|
|
|
./create-image.sh --dest=${XD}/RMC${REG}${MY_ID}.wbfs || exit 51
|
|
|
|
fi
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
mkwiimm_build_newdist () {
|
|
|
|
|
|
|
|
if [[ ${MKWIIMM_MSG_LANG} && ${MKWIIMM_OWN_SAVE} && ${MKWIIMM_CTRENAME} && ${MKWIIMM_CTREORDER} ]]; then
|
|
|
|
echo "LANGUAGE=${MKWIIMM_MSG_LANG}
|
|
|
|
MSGLANG1=-
|
|
|
|
MSGLANG2=E
|
|
|
|
TRACKLANG=x,${MKWIIMM_MSG_LANG}
|
|
|
|
CTRENAME=${MKWIIMM_CTRENAME}
|
|
|
|
REORDER=${MKWIIMM_CTREORDER}
|
|
|
|
ISOMODE=wbfs
|
|
|
|
SPLITISO=
|
|
|
|
PRIV_SAVEGAME=${MKWIIMM_OWN_SAVE}" > ${PWD}/config.def
|
|
|
|
|
|
|
|
echo "*** 6) creating >${DIST}< (can take some time)"
|
|
|
|
./create-image.sh -a --dest=${XD}/RMC${REG}${MY_ID}.wbfs >/dev/null || exit 51
|
|
|
|
else
|
|
|
|
echo "*** 6) creating >${DIST}< (can take some time)"
|
|
|
|
./create-image.sh --dest=${XD}/RMC${REG}${MY_ID}.wbfs || exit 51
|
|
|
|
fi
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2014-05-14 20:38:48 +02:00
|
|
|
build_mkwiimm () {
|
|
|
|
|
2015-04-11 21:37:38 +02:00
|
|
|
MY_ID=${1}
|
2016-08-04 20:28:09 +02:00
|
|
|
DIST=$(gawk -F \: "/^${MY_ID}/"'{print $2}' < ${PATCHIMAGE_DATABASE_DIR}/mkwiimm.db)
|
|
|
|
DOWNLOAD=$(gawk -F \: "/^${MY_ID}/"'{print $3}' < ${PATCHIMAGE_DATABASE_DIR}/mkwiimm.db)
|
|
|
|
FILENAME=$(gawk -F \: "/^${MY_ID}/"'{split($3, a, "/") ; print a[3]}' < ${PATCHIMAGE_DATABASE_DIR}/mkwiimm.db)
|
2014-05-14 20:38:48 +02:00
|
|
|
|
|
|
|
if [[ ${FILENAME} != mkw* ]]; then
|
|
|
|
echo "wrong ID passed from user-input, exiting."
|
2014-05-19 21:54:00 +02:00
|
|
|
exit 75
|
2014-05-14 20:38:48 +02:00
|
|
|
fi
|
|
|
|
|
2014-05-14 21:03:38 +02:00
|
|
|
rm -rf ${FILENAME/.7z}
|
2016-05-18 19:39:46 +02:00
|
|
|
mkwiimm_distfiles
|
2014-05-14 20:38:48 +02:00
|
|
|
cd ${FILENAME/.7z}
|
2014-05-14 21:03:38 +02:00
|
|
|
|
2016-05-18 19:39:46 +02:00
|
|
|
REG=$(gawk '/^RMC/{print $3}' <(${WIT} ll ${IMAGE}))
|
2016-05-16 20:35:01 +02:00
|
|
|
|
2014-05-14 21:03:38 +02:00
|
|
|
case $REG in
|
|
|
|
PAL) REG=P ;;
|
|
|
|
NTSC-J) REG=J ;;
|
|
|
|
NTSC-U) REG=E ;;
|
|
|
|
esac
|
2016-05-18 19:39:46 +02:00
|
|
|
|
|
|
|
ln -s "${IMAGE}" .
|
2014-05-14 20:38:48 +02:00
|
|
|
chmod +x *.sh
|
|
|
|
|
2016-08-04 20:28:09 +02:00
|
|
|
if [[ ${MKWIIMM_OVERRIDE_SZS} == "TRUE" ]] && cp -r ${PATCHIMAGE_OVERRIDE_DIR}/* ${PWD}/bin/
|
2014-05-14 20:38:48 +02:00
|
|
|
|
2016-05-16 20:35:01 +02:00
|
|
|
if [[ ${MY_ID} -lt 27 ]]; then
|
2016-05-18 19:39:46 +02:00
|
|
|
mkwiimm_olddist
|
|
|
|
else mkwiimm_newdist
|
2014-05-14 21:08:06 +02:00
|
|
|
fi
|
2014-05-14 20:38:48 +02:00
|
|
|
|
2015-04-11 21:37:38 +02:00
|
|
|
if [[ ${MY_ID} -lt 23 ]]; then
|
2015-01-20 20:26:48 +01:00
|
|
|
echo "*** 7) patching >${DIST}< to use custom server"
|
2016-05-18 19:39:46 +02:00
|
|
|
wiimmfi ${XD}/RMC${REG}${MY_ID}.wbfs || (echo "something went wrong wiimmfi-ing ${XD}/RMC${REG}${MY_ID}.wbfs" && exit 69)
|
|
|
|
echo "*** 8) storing game"
|
|
|
|
else echo "*** 7) storing game"
|
2015-04-11 21:37:38 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
cd ${XD}
|
|
|
|
|
|
|
|
echo " ${DIST} saved as ${PATCHIMAGE_GAME_DIR}/RMC${REG}${MY_ID}.wbfs"
|
|
|
|
mv RMC${REG}${MY_ID}.wbfs \
|
2015-04-11 22:02:29 +02:00
|
|
|
${PATCHIMAGE_GAME_DIR}/RMC${REG}${MY_ID}.wbfs || exit 51
|
2015-01-20 20:26:48 +01:00
|
|
|
|
2015-04-11 21:37:38 +02:00
|
|
|
if [[ ${MY_ID} -lt 23 ]]; then
|
2015-01-20 20:26:48 +01:00
|
|
|
echo "*** 9) cleaning up workdir"
|
|
|
|
else
|
2015-04-11 21:37:38 +02:00
|
|
|
echo "*** 8) cleaning up workdir"
|
2015-01-20 20:26:48 +01:00
|
|
|
fi
|
2016-05-18 19:39:46 +02:00
|
|
|
|
2014-05-14 20:38:48 +02:00
|
|
|
rm -rf ${FILENAME/.7z}
|
|
|
|
|
|
|
|
if [[ ${PATCHIMAGE_COVER_DOWNLOAD} == TRUE ]]; then
|
2014-05-17 22:01:15 +02:00
|
|
|
echo -e "*** Z) download_covers\n"
|
2015-04-11 21:37:38 +02:00
|
|
|
download_covers RMC${REG}${MY_ID}
|
2014-05-14 20:38:48 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
patch_wiimm () {
|
|
|
|
|
2015-04-11 22:02:29 +02:00
|
|
|
XD=${PWD}
|
2014-05-14 20:38:48 +02:00
|
|
|
if [[ ${ID} == ALL ]]; then
|
2016-05-16 20:35:01 +02:00
|
|
|
for ID in {06..31}; do
|
2014-05-14 20:38:48 +02:00
|
|
|
build_mkwiimm ${ID}
|
|
|
|
done
|
|
|
|
else
|
2015-04-11 21:37:38 +02:00
|
|
|
for game in ${ID[@]}; do
|
|
|
|
build_mkwiimm ${game}
|
|
|
|
done
|
2014-05-14 20:38:48 +02:00
|
|
|
fi
|
|
|
|
}
|