2014-05-17 10:07:26 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
2016-08-06 19:46:07 +02:00
|
|
|
GAME_TYPE="GENERIC"
|
2016-08-05 21:09:04 +02:00
|
|
|
GAMENAME="Mario Kart Wiimm"
|
2014-05-17 10:07:26 +02:00
|
|
|
CSZS="files/Race/Common.szs"
|
|
|
|
CSZD="files/Race/Common.d"
|
|
|
|
|
|
|
|
show_notes () {
|
|
|
|
|
|
|
|
echo -e \
|
|
|
|
"************************************************
|
2016-08-05 21:09:04 +02:00
|
|
|
${GAMENAME}
|
2014-05-17 10:07:26 +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 () {
|
|
|
|
|
2016-08-05 15:57:18 +02:00
|
|
|
ask_input_image_mkwiimm
|
2016-08-05 21:28:30 +02:00
|
|
|
echo -e "type RMC???.wbfs:\n"
|
2016-08-23 18:19:26 +02:00
|
|
|
read -er ID
|
2014-05-17 10:07:26 +02:00
|
|
|
|
2016-08-05 15:57:18 +02:00
|
|
|
if [[ -f ${PWD}/${ID} ]]; then
|
2016-08-05 21:28:30 +02:00
|
|
|
GAMEDIR="${PWD}"
|
2016-08-05 15:57:18 +02:00
|
|
|
elif [[ -f ${PATCHIMAGE_WBFS_DIR}/${ID} ]]; then
|
2016-08-05 21:28:30 +02:00
|
|
|
GAMEDIR="${PATCHIMAGE_WBFS_DIR}"
|
2016-08-05 15:57:18 +02:00
|
|
|
else echo "invalid user input."
|
|
|
|
exit 75
|
2014-05-17 10:07:26 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
items=( "ballon.brres:Balloon (Battle Object)"
|
|
|
|
"big_kinoko.brres:Mega Mushroom (Item)"
|
|
|
|
"bomb.brres:Bob-omb (Item)"
|
|
|
|
"gesso.brres:Blooper (Item)"
|
|
|
|
"kart_killer.brres:Bullet Bill (In Use)"
|
|
|
|
"item_killer.brres:Bullet Bill (Item, when dropped)"
|
|
|
|
"jugem_reverse.brres:Lakitus Wrong Way Sign"
|
|
|
|
"jugemu.brres:Lakitu"
|
|
|
|
"jugemu_signal.brres:Lakitus Countdown Lights"
|
|
|
|
"kinoko.brres:Super Mushroom (Item) "
|
|
|
|
"koura_green.brres:Green Shell (Item)"
|
|
|
|
"koura_red.brres:Red Shell (Item)"
|
|
|
|
"kumo.brres:Thundercloud (Item)"
|
|
|
|
"kinoko_p.brres:Golden Mushroom (Item, when dropped)"
|
|
|
|
"pow_bloc.brres:Pow Block (Item, when dropped)"
|
|
|
|
"pow_bloc_plane.brres:Pow Block (Item, in use) "
|
|
|
|
"thunder.brres:Lightning (Item, When dropped)"
|
|
|
|
"togezo_koura.brres:Spiny Shell (Item)" )
|
|
|
|
|
|
|
|
ask_items () {
|
|
|
|
|
|
|
|
if [[ -f ${HOME}/.patchimage.choice ]]; then
|
|
|
|
echo "Your choices from last time can be re-used."
|
|
|
|
echo "y (yes) or n (no)"
|
2016-08-23 18:19:26 +02:00
|
|
|
read -er choice
|
2014-05-17 10:07:26 +02:00
|
|
|
|
2016-08-05 21:28:30 +02:00
|
|
|
[[ ${choice} == y ]] && source "${HOME}"/.patchimage.choice
|
2014-05-17 10:07:26 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ ${choosenitems[@]} == "" ]]; then
|
|
|
|
|
|
|
|
for item in "${items[@]}"; do
|
|
|
|
slot=${item/:*}
|
|
|
|
desc=${item/*:}
|
|
|
|
|
|
|
|
echo -e "\n\nChoose item for ${desc}
|
|
|
|
|
|
|
|
orig Original item"
|
|
|
|
|
2016-08-05 21:28:30 +02:00
|
|
|
gawk -F : "/${slot}/"'{print $1 "\t" $3}' < "${PATCHIMAGE_DATABASE_DIR}"/mkwiimm_items.db
|
2014-05-17 10:07:26 +02:00
|
|
|
echo -e "\ntype orig or ???.brres"
|
2016-08-23 18:19:26 +02:00
|
|
|
read -er slotid
|
2014-05-17 10:07:26 +02:00
|
|
|
echo "<<<<<<>>>>>>"
|
|
|
|
choosenitems=( ${choosenitems[@]} ${slot}:${slotid} )
|
|
|
|
done
|
|
|
|
|
2016-08-05 21:28:30 +02:00
|
|
|
echo "${choosenitems[@]}"
|
|
|
|
echo "choosenitems=( ${choosenitems[*]} )" > "${HOME}"/.patchimage.choice
|
2014-05-17 10:07:26 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
download_items () {
|
|
|
|
|
2016-08-05 21:28:30 +02:00
|
|
|
for item in "${choosenitems[@]}"; do
|
2014-05-17 10:07:26 +02:00
|
|
|
id=${item/*:}
|
2016-08-04 20:42:52 +02:00
|
|
|
if [[ ! -f ${PATCHIMAGE_DATA_DIR}/mkwiimm_items/${id} ]]; then
|
|
|
|
echo "unknown Item ${item}"
|
|
|
|
exit 75
|
2014-05-17 10:07:26 +02:00
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
download_wiimm () {
|
|
|
|
|
|
|
|
ask_items
|
|
|
|
download_items
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
build_mkwiimm () {
|
|
|
|
|
|
|
|
rm -rf workdir
|
|
|
|
echo "*** 5) extracting image"
|
2016-08-05 21:28:30 +02:00
|
|
|
"${WIT}" extract "${GAMEDIR}"/"${ID}" workdir -q || exit 51
|
2014-05-17 10:07:26 +02:00
|
|
|
|
2014-05-18 07:03:07 +02:00
|
|
|
if [[ ! -f "${PATCHIMAGE_RIIVOLUTION_DIR}"/Common.szs_${ID/.*} ]]; then
|
|
|
|
echo "*** 6) this is the first run, so backing up common.szs
|
|
|
|
(in ${PATCHIMAGE_RIIVOLUTION_DIR}) for future customizations"
|
2016-08-05 21:28:30 +02:00
|
|
|
cp workdir/"${CSZS}" "${PATCHIMAGE_RIIVOLUTION_DIR}"/Common.szs_"${ID/.*}"
|
2014-05-18 07:03:07 +02:00
|
|
|
else
|
|
|
|
echo "*** 6) restoring original common.szs"
|
2016-08-05 21:28:30 +02:00
|
|
|
cp "${PATCHIMAGE_RIIVOLUTION_DIR}"/Common.szs_"${ID/.*}" workdir/"${CSZS}"
|
2014-05-18 07:03:07 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
echo "*** 7) replacing items"
|
2016-08-05 21:28:30 +02:00
|
|
|
rm -rf workdir/"${CSZD}"
|
|
|
|
"${SZS}" extract workdir/"${CSZS}" -q || \
|
|
|
|
( echo "szs caught an error extracting common.szs" && exit 51 )
|
|
|
|
for item in "${choosenitems[@]}"; do
|
2014-05-18 12:24:30 +02:00
|
|
|
slot=${item/:*}
|
|
|
|
newi=${item/*:}
|
2016-08-05 21:28:30 +02:00
|
|
|
cp "${PATCHIMAGE_DATA_DIR}"/mkwiimm_items/"${newi}" \
|
|
|
|
workdir/"${CSZD}"/"${slot}"
|
2014-05-17 10:07:26 +02:00
|
|
|
done
|
2016-08-05 21:28:30 +02:00
|
|
|
"${SZS}" create -o workdir/"${CSZD}" -q || \
|
2014-05-19 21:54:00 +02:00
|
|
|
( echo "szs caught an error rebuilding common.szs" && exit 51 )
|
2016-08-05 21:28:30 +02:00
|
|
|
rm -rf workdir/"${CSZD}"
|
2014-05-17 10:07:26 +02:00
|
|
|
|
2014-05-18 07:03:07 +02:00
|
|
|
echo "*** 8) rebuilding game"
|
2014-05-17 10:07:26 +02:00
|
|
|
echo " (storing game in ${PATCHIMAGE_GAME_DIR}/${ID})"
|
2016-08-05 21:28:30 +02:00
|
|
|
"${WIT}" cp -o -q -B workdir "${PATCHIMAGE_GAME_DIR}"/"${ID}" || exit 51
|
2014-05-17 10:07:26 +02:00
|
|
|
|
|
|
|
rm -rf workdir
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2016-08-05 15:57:18 +02:00
|
|
|
pi_action () {
|
2014-05-17 10:07:26 +02:00
|
|
|
|
2016-08-05 15:57:18 +02:00
|
|
|
download_wiimm
|
2014-05-17 10:07:26 +02:00
|
|
|
build_mkwiimm
|
|
|
|
|
|
|
|
}
|