2014-05-15 20:54:19 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
GAME_TYPE="WII_GENERIC"
|
2016-08-05 21:09:04 +02:00
|
|
|
GAMENAME="Kirby's Adventure Wii"
|
2016-08-05 15:57:18 +02:00
|
|
|
WBFS_MASK="SUK[PUJ]01"
|
|
|
|
PATH_HERO="files/g3d/step/chara/hero/"
|
2014-05-15 20:54:19 +02:00
|
|
|
|
|
|
|
show_notes () {
|
|
|
|
|
|
|
|
echo -e \
|
|
|
|
"************************************************
|
2016-08-05 21:09:04 +02:00
|
|
|
${GAMENAME}
|
2014-05-15 20:54:19 +02:00
|
|
|
|
|
|
|
Base Image: Kirby's Adventure Wii (SUK?01)
|
|
|
|
Supported Versions: EUR, JAP, USA
|
|
|
|
************************************************"
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2016-08-05 15:57:18 +02:00
|
|
|
check_input_image_special () {
|
|
|
|
|
|
|
|
check_input_image
|
|
|
|
|
|
|
|
}
|
2014-05-15 20:54:19 +02:00
|
|
|
|
2014-05-16 19:34:12 +02:00
|
|
|
exchange_kirby () {
|
|
|
|
|
2016-08-05 20:58:31 +02:00
|
|
|
cp workdir/"${PATH_HERO}"/kirby/base/"${1}".brres.cmp{,_tmp}
|
|
|
|
cp workdir/"${PATH_HERO}"/kirby/base/Pink.brres.cmp \
|
|
|
|
workdir/"${PATH_HERO}"/kirby/base/"${1}".brres.cmp
|
|
|
|
mv workdir/"${PATH_HERO}"/kirby/base/"${1}".brres.cmp_tmp \
|
|
|
|
workdir/"${PATH_HERO}"/kirby/base/Pink.brres.cmp
|
2014-05-16 19:34:12 +02:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
exchange_hero () {
|
|
|
|
|
2016-08-05 20:58:31 +02:00
|
|
|
cp workdir/"${PATH_HERO}"/"${1}"/base/Default.brres.cmp \
|
|
|
|
workdir/"${PATH_HERO}"/kirby/base/Pink.brres.cmp_temp
|
|
|
|
cp workdir/"${PATH_HERO}"/kirby/base/Pink.brres.cmp \
|
|
|
|
workdir/"${PATH_HERO}"/"${1}"/base/Default.brres.cmp
|
|
|
|
mv workdir/"${PATH_HERO}"/kirby/base/Pink.brres.cmp{_temp,}
|
|
|
|
for brres in workdir/"${PATH_HERO}"/"${1}"/normal/*.cmp ; do
|
|
|
|
xfile="${brres##*/}"
|
|
|
|
cp "${brres}" workdir/"${PATH_HERO}"/kirby/normal/"${xfile}"_temp
|
|
|
|
cp workdir/"${PATH_HERO}"/kirby/normal/"${xfile}" \
|
|
|
|
workdir/"${PATH_HERO}"/"${1}"/normal/
|
|
|
|
mv workdir/"${PATH_HERO}"/kirby/normal/"${xfile}"{_temp,}
|
2014-05-16 19:34:12 +02:00
|
|
|
done
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2014-05-15 20:54:19 +02:00
|
|
|
pi_action () {
|
|
|
|
|
|
|
|
echo "Choose character for first player
|
|
|
|
|
|
|
|
1 Kirby (blue)
|
|
|
|
2 Kirby (yellow)
|
|
|
|
3 Kirby (green)
|
|
|
|
|
|
|
|
*** options 4 to 6 may crash the game upon start ***
|
|
|
|
4 King DeDeDe
|
|
|
|
5 MetaKnight
|
|
|
|
6 WaddleDee
|
|
|
|
|
|
|
|
7 Restore to original
|
|
|
|
|
2016-08-05 20:58:31 +02:00
|
|
|
type in a number."
|
|
|
|
read -r ID
|
2014-05-15 20:54:19 +02:00
|
|
|
|
|
|
|
[[ ${ID} != [0-9] ]] && echo "invalid number provided from user-input." && exit 1
|
|
|
|
|
|
|
|
rm -rf workdir
|
|
|
|
|
2014-05-16 19:34:12 +02:00
|
|
|
echo -e "\n*** 3) extracting image"
|
2016-08-05 20:58:31 +02:00
|
|
|
"${WIT}" extract "${IMAGE}" --psel=data -d workdir -q || exit 51
|
2014-05-15 20:54:19 +02:00
|
|
|
|
2016-08-05 20:58:31 +02:00
|
|
|
if [[ ! -d ${PATCHIMAGE_RIIVOLUTION_DIR}/hero/ ]]; then
|
2014-05-16 19:34:12 +02:00
|
|
|
echo "*** 4) this is the first run, so backing up all characters
|
2014-05-15 20:54:19 +02:00
|
|
|
(in ${PATCHIMAGE_RIIVOLUTION_DIR}) for future customizations"
|
2016-08-05 20:58:31 +02:00
|
|
|
cp -r workdir/"${PATH_HERO}"/ "${PATCHIMAGE_RIIVOLUTION_DIR}"
|
2014-05-15 20:54:19 +02:00
|
|
|
else
|
2014-05-16 19:34:12 +02:00
|
|
|
echo "*** 4) restoring original characters"
|
2016-08-05 20:58:31 +02:00
|
|
|
cp -r "${PATCHIMAGE_RIIVOLUTION_DIR}"/hero/* workdir/"${PATH_HERO}"/
|
2014-05-15 20:54:19 +02:00
|
|
|
fi
|
|
|
|
|
2016-08-05 20:58:31 +02:00
|
|
|
REG=$(gawk '/^SUK/{print $3}' <("${WIT}" ll "${IMAGE}"))
|
2014-05-15 20:54:19 +02:00
|
|
|
|
2016-08-05 20:58:31 +02:00
|
|
|
case ${REG} in
|
2014-05-15 20:54:19 +02:00
|
|
|
PAL) REG=P ;;
|
|
|
|
NTSC-J) REG=J ;;
|
|
|
|
NTSC-U) REG=E ;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
[[ ${ID} != 7 ]] && echo "*** 5) exchanging characters"
|
|
|
|
case ${ID} in
|
2014-05-16 19:34:12 +02:00
|
|
|
1) exchange_kirby Blue ;;
|
|
|
|
2) exchange_kirby Yellow ;;
|
|
|
|
3) exchange_kirby Green ;;
|
|
|
|
4) exchange_hero dedede ;;
|
|
|
|
5) exchange_hero meta ;;
|
|
|
|
6) exchange_hero dee ;;
|
2014-05-15 20:54:19 +02:00
|
|
|
esac
|
|
|
|
|
2014-05-16 19:34:12 +02:00
|
|
|
echo "*** 6) rebuilding the game "
|
|
|
|
echo " (storing game in ${PATCHIMAGE_GAME_DIR}/SUK${REG}01.wbfs)"
|
2016-08-05 20:58:31 +02:00
|
|
|
"${WIT}" cp -o -q -B workdir "${PATCHIMAGE_GAME_DIR}"/SUK"${REG}"01.wbfs || exit 51
|
2014-05-15 20:54:19 +02:00
|
|
|
|
|
|
|
rm -rf workdir
|
|
|
|
|
|
|
|
}
|