patchimage/script.d/mkwii/mkwiimm_fonts.sh

91 lines
1.9 KiB
Bash
Raw Normal View History

2014-05-18 07:51:09 +02:00
#!/bin/bash
GAME_TYPE="WII_GENERIC"
2016-08-05 21:09:04 +02:00
GAMENAME="Mario Kart Wiimm"
2014-05-18 07:51:09 +02:00
FSZS="files/Scene/UI/Font.szs"
WBFS_MASK="RMC[PUJ]01"
2014-05-18 07:51:09 +02:00
show_notes () {
echo -e \
"************************************************
2016-08-05 21:09:04 +02:00
${GAMENAME}
2014-05-18 07:51:09 +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
************************************************"
}
check_input_image_special () {
ask_input_image_mkwiimm
echo -e "type ALL or RMC???.wbfs:\n"
2014-05-18 07:51:09 +02:00
read ID
if [[ -f ${PWD}/${ID} ]]; then
GAMEDIR=${PWD}
elif [[ -f ${PATCHIMAGE_WBFS_DIR}/${ID} ]]; then
GAMEDIR=${PATCHIMAGE_WBFS_DIR}
else echo "invalid user input."
2014-05-19 21:54:00 +02:00
exit 75
2014-05-18 07:51:09 +02:00
fi
}
download_wiimm () {
echo "Choose a font to use
orig Original Mario Kart Wii Font"
gawk -F \: '{print $1 "\t\t" $2}' < ${PATCHIMAGE_DATABASE_DIR}/mkwiimm_fonts.db
2014-05-18 07:51:09 +02:00
echo -e "\ntype ???.szs or orig"
read FONT
if [[ ${FONT} != orig ]]; then
if [[ ! -f ${PATCHIMAGE_DATA_DIR}/mkwiimm_fonts/${FONT} ]]; then
echo "Font ${FONT} unknown"
exit 75
2014-05-18 07:51:09 +02:00
fi
fi
}
build_mkwiimm () {
rm -rf workdir
echo "*** 5) extracting image"
2014-05-19 21:54:00 +02:00
${WIT} extract ${IMAGE%/*}/${ID} workdir -q || exit 51
2014-05-18 07:51:09 +02:00
if [[ ! -f "${PATCHIMAGE_RIIVOLUTION_DIR}"/Font.szs_${ID/.*} ]]; then
echo "*** 6) this is the first run, so backing up font.szs
(in ${PATCHIMAGE_RIIVOLUTION_DIR}) for future customizations"
cp workdir/${FSZS} "${PATCHIMAGE_RIIVOLUTION_DIR}"/Font.szs_${ID/.*}
else
echo "*** 6) restoring original common.szs"
cp "${PATCHIMAGE_RIIVOLUTION_DIR}"/Font.szs_${ID/.*} workdir/${FSZS}
fi
echo "*** 7) replacing font"
cp "${PATCHIMAGE_DATA_DIR}"/mkwiimm_fonts/${FONT} workdir/${FSZS}
2014-05-18 07:51:09 +02:00
echo "*** 8) rebuilding game"
echo " (storing game in ${PATCHIMAGE_GAME_DIR}/${ID})"
${WIT} cp -o -q -B workdir ${PATCHIMAGE_GAME_DIR}/${ID} || exit 51
rm -rf workdir
}
pi_action () {
2014-05-18 07:51:09 +02:00
download_wiimm
2014-05-18 07:51:09 +02:00
build_mkwiimm
}