2013-06-13 20:12:19 +02:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
2013-06-15 19:25:15 +02:00
|
|
|
# create wbfs image from riivolution patch
|
2013-06-13 20:12:19 +02:00
|
|
|
#
|
|
|
|
# Christopher Roy Bratusek <nano@tuxfamily.org>
|
|
|
|
#
|
|
|
|
# License: GPL v3
|
|
|
|
|
2013-08-06 23:53:43 +02:00
|
|
|
if [[ -d ${PWD}/script.d ]]; then
|
2014-05-13 18:20:28 +02:00
|
|
|
PATCHIMAGE_SCRIPT_DIR=${PWD}/script.d
|
|
|
|
PATCHIMAGE_PATCH_DIR=${PWD}/patches
|
|
|
|
PATCHIMAGE_TOOLS_DIR=${PWD}/tools
|
2013-08-06 23:53:43 +02:00
|
|
|
else
|
|
|
|
PATCHIMAGE_SCRIPT_DIR=/usr/share/patchimage/script.d
|
|
|
|
PATCHIMAGE_PATCH_DIR=/usr/share/patchimage/patches
|
|
|
|
PATCHIMAGE_TOOLS_DIR=/usr/share/patchimage/tools
|
|
|
|
fi
|
|
|
|
|
2013-10-12 10:37:29 +02:00
|
|
|
PATCHIMAGE_RIIVOLUTION_DIR=${PWD}
|
|
|
|
PATCHIMAGE_WBFS_DIR=${PWD}
|
|
|
|
PATCHIMAGE_AUDIO_DIR=${PWD}
|
2014-05-11 21:57:19 +02:00
|
|
|
PATCHIMAGE_GAME_DIR=${PWD}
|
|
|
|
PATCHIMAGE_COVER_DIR=${PWD}
|
2013-10-12 10:37:29 +02:00
|
|
|
|
|
|
|
if [[ -e $HOME/.patchimage.rc ]]; then
|
|
|
|
source $HOME/.patchimage.rc
|
|
|
|
fi
|
|
|
|
|
2013-08-06 23:53:43 +02:00
|
|
|
source ${PATCHIMAGE_SCRIPT_DIR}/common.sh
|
2013-10-12 10:37:29 +02:00
|
|
|
check_directories
|
|
|
|
|
2013-06-15 19:58:07 +02:00
|
|
|
setup_tools
|
2013-06-13 20:12:19 +02:00
|
|
|
|
2013-06-15 19:25:15 +02:00
|
|
|
optparse "${@}"
|
2013-06-13 20:12:19 +02:00
|
|
|
|
2013-06-15 19:25:15 +02:00
|
|
|
if [[ ! ${GAME} ]]; then
|
|
|
|
ask_game
|
2013-06-13 20:12:19 +02:00
|
|
|
fi
|
|
|
|
|
2013-06-15 19:25:15 +02:00
|
|
|
case ${GAME} in
|
2013-06-13 20:12:19 +02:00
|
|
|
|
2013-06-20 21:22:39 +02:00
|
|
|
a | A | NewerSMB | NewerSMBW )
|
2013-08-06 23:53:43 +02:00
|
|
|
source ${PATCHIMAGE_SCRIPT_DIR}/newersmb.sh
|
2013-06-15 19:25:15 +02:00
|
|
|
;;
|
2013-06-13 20:12:19 +02:00
|
|
|
|
2013-06-20 21:22:39 +02:00
|
|
|
b | B | NewerSummerSun )
|
2013-08-06 23:53:43 +02:00
|
|
|
source ${PATCHIMAGE_SCRIPT_DIR}/newersummersun.sh
|
2013-06-15 19:58:07 +02:00
|
|
|
;;
|
|
|
|
|
2013-06-20 21:22:39 +02:00
|
|
|
c | C | ASMBW | AnotherSMBW )
|
2013-08-06 23:53:43 +02:00
|
|
|
source ${PATCHIMAGE_SCRIPT_DIR}/anothersmb.sh
|
2013-06-20 21:03:40 +02:00
|
|
|
;;
|
|
|
|
|
2013-06-20 21:22:39 +02:00
|
|
|
d | D | HolidaySpecial | "Newer: Holiday Special" )
|
2013-08-06 23:53:43 +02:00
|
|
|
source ${PATCHIMAGE_SCRIPT_DIR}/newerholiday.sh
|
2013-06-20 21:22:39 +02:00
|
|
|
;;
|
|
|
|
|
2013-07-03 17:30:30 +02:00
|
|
|
e | E | Cannon | "Cannon SMBW" )
|
2013-08-06 23:53:43 +02:00
|
|
|
source ${PATCHIMAGE_SCRIPT_DIR}/cannon.sh
|
2013-07-03 17:30:30 +02:00
|
|
|
;;
|
2013-06-22 19:30:30 +02:00
|
|
|
|
2013-07-02 20:20:20 +02:00
|
|
|
f | F | ESBW | "Epic Super Bowser World" )
|
2013-08-06 23:53:43 +02:00
|
|
|
source ${PATCHIMAGE_SCRIPT_DIR}/epicbowserworld.sh
|
2013-07-02 20:20:20 +02:00
|
|
|
;;
|
|
|
|
|
2013-07-03 16:44:26 +02:00
|
|
|
g | G | Koopa | "Koopa Country" )
|
2013-08-06 23:53:43 +02:00
|
|
|
source ${PATCHIMAGE_SCRIPT_DIR}/koopacountry.sh
|
2013-07-03 16:44:26 +02:00
|
|
|
;;
|
|
|
|
|
2013-08-06 09:34:30 +02:00
|
|
|
h | H | NSMBW4 | "New Super Mario Bros. 4" )
|
2013-08-06 23:53:43 +02:00
|
|
|
source ${PATCHIMAGE_SCRIPT_DIR}/nsmbw4.sh
|
2013-07-07 09:42:41 +02:00
|
|
|
;;
|
|
|
|
|
|
|
|
i | I | Retro | "Retro Remix" )
|
2013-08-06 23:53:43 +02:00
|
|
|
source ${PATCHIMAGE_SCRIPT_DIR}/retroremix.sh
|
2013-07-06 18:25:11 +02:00
|
|
|
;;
|
|
|
|
|
2013-08-06 09:17:05 +02:00
|
|
|
j | J | WinterMoon | "Super Mario: Mushroom Adventure PLUS - Winter Moon" )
|
2013-08-06 23:53:43 +02:00
|
|
|
source ${PATCHIMAGE_SCRIPT_DIR}/wintermoon.sh
|
2013-08-06 09:17:05 +02:00
|
|
|
;;
|
|
|
|
|
2013-08-06 09:34:30 +02:00
|
|
|
k | K | NSMBW3 | "NSMBW3: The Final Levels" )
|
2013-08-06 23:53:43 +02:00
|
|
|
source ${PATCHIMAGE_SCRIPT_DIR}/nsmbw3.sh
|
2013-08-06 09:34:30 +02:00
|
|
|
;;
|
|
|
|
|
2013-09-26 19:58:37 +02:00
|
|
|
l | L | SMV | "Super Mario Vacation" )
|
|
|
|
source ${PATCHIMAGE_SCRIPT_DIR}/summervacation.sh
|
|
|
|
;;
|
|
|
|
|
2013-10-12 10:37:29 +02:00
|
|
|
m | M | ASLM | "Awesomer Super Luigi Mini" )
|
|
|
|
source ${PATCHIMAGE_SCRIPT_DIR}/awesomersuperluigi.sh
|
|
|
|
;;
|
|
|
|
|
2014-05-11 19:49:57 +02:00
|
|
|
n | N | Wiimmfi )
|
2014-05-11 19:26:58 +02:00
|
|
|
source ${PATCHIMAGE_SCRIPT_DIR}/wiimmfi.sh
|
|
|
|
;;
|
|
|
|
|
2014-05-13 17:49:00 +02:00
|
|
|
o | O | Wiimmpatch )
|
|
|
|
source ${PATCHIMAGE_SCRIPT_DIR}/wiimmfi_generic.sh
|
|
|
|
;;
|
|
|
|
|
2014-05-13 19:32:54 +02:00
|
|
|
p | P | Sykland )
|
|
|
|
source ${PATCHIMAGE_SCRIPT_DIR}/skyland.sh
|
|
|
|
;;
|
|
|
|
|
2013-07-03 16:44:26 +02:00
|
|
|
1 | ParallelWorlds | "The Legend of Zelda: Parallel Worlds" )
|
2013-08-06 23:53:43 +02:00
|
|
|
source ${PATCHIMAGE_SCRIPT_DIR}/parallelworlds.sh
|
2013-06-22 19:02:37 +02:00
|
|
|
;;
|
|
|
|
|
2013-06-15 19:25:15 +02:00
|
|
|
* )
|
|
|
|
echo -e "specified Game ${GAME} not recognized"
|
2013-10-12 10:37:29 +02:00
|
|
|
exit 9
|
2013-06-15 19:25:15 +02:00
|
|
|
;;
|
2013-06-13 20:12:19 +02:00
|
|
|
|
2013-06-15 19:25:15 +02:00
|
|
|
esac
|
2013-06-13 20:12:19 +02:00
|
|
|
|
2013-06-21 19:29:17 +02:00
|
|
|
case ${GAME_TYPE} in
|
|
|
|
"RIIVOLUTION" )
|
|
|
|
show_notes
|
2013-07-04 21:30:08 +02:00
|
|
|
rm -rf ${WORKDIR}
|
2014-05-11 21:57:19 +02:00
|
|
|
if [[ ${PATCHIMAGE_SOUNDTRACK_DOWNLOAD} == TRUE ]]; then
|
|
|
|
echo -e "\n*** A) download_soundtrack"
|
2013-10-12 10:37:29 +02:00
|
|
|
download_soundtrack
|
2014-05-11 21:57:19 +02:00
|
|
|
if [[ ${ONLY_SOUNDTRACK} == TRUE ]]; then
|
|
|
|
exit 0
|
|
|
|
fi
|
2013-10-12 10:37:29 +02:00
|
|
|
fi
|
2014-05-11 21:57:19 +02:00
|
|
|
|
2013-10-12 10:37:29 +02:00
|
|
|
echo -e "\n*** 1) check_input_image"
|
2013-06-21 19:29:17 +02:00
|
|
|
check_input_image
|
2013-10-12 10:37:29 +02:00
|
|
|
echo "*** 2) check_input_image_special"
|
2013-06-21 19:29:17 +02:00
|
|
|
check_input_image_special
|
2013-10-12 10:37:29 +02:00
|
|
|
echo "*** 3) check_riivolution_patch"
|
2013-06-21 19:29:17 +02:00
|
|
|
check_riivolution_patch
|
|
|
|
|
2013-10-12 10:37:29 +02:00
|
|
|
echo "*** 4) extract game"
|
|
|
|
${WIT} extract ${IMAGE} ${WORKDIR} --psel=DATA -q || exit 51
|
2013-06-21 19:29:17 +02:00
|
|
|
|
2013-10-12 10:37:29 +02:00
|
|
|
echo "*** 5) detect_game_version"
|
2013-06-21 19:29:17 +02:00
|
|
|
detect_game_version
|
2013-07-04 21:30:08 +02:00
|
|
|
rm -f ${GAMEID}.wbfs ${CUSTOMID}.wbfs
|
2013-10-12 10:37:29 +02:00
|
|
|
echo "*** 6) place_files"
|
|
|
|
place_files || exit 45
|
2013-07-01 22:36:09 +02:00
|
|
|
|
2013-10-12 10:37:29 +02:00
|
|
|
echo "*** 7) download_banner"
|
2013-07-01 22:23:32 +02:00
|
|
|
download_banner
|
2013-10-12 10:37:29 +02:00
|
|
|
echo "*** 8) apply_banner"
|
2013-07-01 22:23:32 +02:00
|
|
|
apply_banner
|
2013-06-21 19:29:17 +02:00
|
|
|
|
2013-10-12 10:37:29 +02:00
|
|
|
echo "*** 9) dolpatch"
|
2013-07-01 22:36:09 +02:00
|
|
|
dolpatch
|
2013-06-21 19:29:17 +02:00
|
|
|
|
|
|
|
if [[ ${CUSTOMID} ]]; then
|
2014-05-11 21:57:19 +02:00
|
|
|
GAMEID=${CUSTOMID}
|
2013-06-21 19:29:17 +02:00
|
|
|
fi
|
2013-07-07 22:36:04 +02:00
|
|
|
|
|
|
|
if [[ ${PATCHIMAGE_SHARE_SAVE} == "TRUE" ]]; then
|
|
|
|
TMD_OPTS=""
|
|
|
|
else
|
|
|
|
TMD_OPTS="--tt-id=K"
|
|
|
|
fi
|
|
|
|
|
2013-10-12 10:37:29 +02:00
|
|
|
echo "*** 10) rebuild game"
|
|
|
|
${WIT} cp -q -B ${WORKDIR} ${GAMEID}.wbfs --disc-id=${GAMEID} ${TMD_OPTS} --name "${GAMENAME}" || exit 51
|
2013-07-07 08:38:25 +02:00
|
|
|
|
2013-10-12 10:37:29 +02:00
|
|
|
if [[ -d ${PATCHIMAGE_WBFS_DIR} && ${PATCHIMAGE_WBFS_DIR} != ${PWD} ]]; then
|
|
|
|
echo "*** 11) store game"
|
2013-07-07 22:36:04 +02:00
|
|
|
mv ${GAMEID}.wbfs "${PATCHIMAGE_WBFS_DIR}"/
|
|
|
|
fi
|
|
|
|
|
2013-10-12 10:37:29 +02:00
|
|
|
echo "*** 12) remove workdir"
|
2014-05-13 18:20:28 +02:00
|
|
|
rm -rf ${WORKDIR}
|
2013-10-12 10:37:29 +02:00
|
|
|
|
|
|
|
echo -e "\n >>> ${GAMENAME} saved as: ${PATCHIMAGE_WBFS_DIR}/${GAMEID}.wbfs\n"
|
2013-07-07 22:36:04 +02:00
|
|
|
|
2014-05-11 21:57:19 +02:00
|
|
|
if [[ ${PATCHIMAGE_COVER_DOWNLOAD} == TRUE ]]; then
|
|
|
|
echo -e "\n*** Z) download_covers"
|
|
|
|
download_covers ${GAMEID}
|
|
|
|
fi
|
|
|
|
|
2013-06-21 19:29:17 +02:00
|
|
|
;;
|
2013-06-22 19:02:37 +02:00
|
|
|
|
2014-05-11 19:26:58 +02:00
|
|
|
"MKWIIMM")
|
|
|
|
show_notes
|
2014-05-11 21:57:19 +02:00
|
|
|
|
2014-05-11 19:26:58 +02:00
|
|
|
echo -e "\n*** 1) check_input_image"
|
|
|
|
check_input_image
|
|
|
|
echo -e "\n*** 2) check_input_image_special"
|
|
|
|
check_input_image_special
|
|
|
|
echo -e "\n*** 3) download_wiimm"
|
|
|
|
download_wiimm
|
|
|
|
echo -e "\n*** 4) patch_wiimm"
|
|
|
|
patch_wiimm
|
|
|
|
;;
|
|
|
|
|
2013-06-22 19:02:37 +02:00
|
|
|
"IPS" )
|
|
|
|
show_notes
|
|
|
|
check_input_rom
|
|
|
|
|
2013-06-22 19:15:29 +02:00
|
|
|
if [[ -f ${PATCH} ]]; then
|
|
|
|
ext=${ROM/*.}
|
|
|
|
cp "${ROM}" "${GAMENAME}.${ext}"
|
2013-10-12 10:37:29 +02:00
|
|
|
${IPS} a "${PATCH}" "${GAMENAME}.${ext}" || exit 51
|
2013-06-22 19:15:29 +02:00
|
|
|
else
|
|
|
|
echo -e "error: patch (${PATCH}) could not be found"
|
|
|
|
fi
|
2013-06-22 19:02:37 +02:00
|
|
|
;;
|
2013-06-21 19:29:17 +02:00
|
|
|
esac
|