From dbac5397e4639dfd6dfbc4910ddfec635000f750 Mon Sep 17 00:00:00 2001 From: Christopher Roy Bratusek Date: Wed, 3 Aug 2016 22:20:17 +0200 Subject: [PATCH] - make the script more robust against directories with spaces in their names - when downloading covers for Wii games fail, retry with the US cover - don't re-download covers that already exist - don't re-download soundtracks that already exist --- ChangeLog | 12 ++++++ README.GAMEIDS | 12 ++++-- patchimage.sh | 11 +++++- script.d/common.sh | 96 +++++++++++++++++++++++++++------------------- 4 files changed, 86 insertions(+), 45 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3a41bb5..4f3e30e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -11,6 +11,7 @@ v6.4.0: - when setting destination directory for created files, check if they are writeable, else fallback to ${HOME} - fix telling user path to Hans Files for all Pokemon game hacks +- make the script more robust against directories with spaces in their names ::configuration file changes - new configuration variable PATCHIMAGE_3DS_DIR, global directory @@ -26,8 +27,16 @@ v6.4.0: ::misc. changes - show full path for Hans Files for all games, instead of relative - only show path to Hans files if they exist +- when downloading covers for Wii games fail, retry with the US cover +- don't re-download covers that already exist +- don't re-download soundtracks that already exist ::game additions + +::::New Super Mario Bros. Wii +- add support for Revised Super Mario Bros. Wii + +::::Pokemon - add support for Pokemon Eternal X - choose between legal, rebalanced and insanity version - for legal and rebalanced, choose whether to nerf first gym leader @@ -39,6 +48,9 @@ v6.4.0: - add support for Pokemon Sinking Sapphire - provide custom Hans banner and launcher +::::Other +- add support for Bravely Second Uncensored + ::game changes and updates - update download link for Pokemon Rutile Ruby to v2.1 - update download link for Pokemon Star Sapphire to v2.1 diff --git a/README.GAMEIDS b/README.GAMEIDS index e0b887a..b0d1efe 100644 --- a/README.GAMEIDS +++ b/README.GAMEIDS @@ -4,14 +4,12 @@ GAMEIDS SLF?01 NSMBW3: The Final Levels SMN?01 Original New Super Mario Bros. Wii -SMN?02 ? SMN?03 Newer Super Mario Bros. Wii SMN?04 Canon Super Mario Bros. Wii SMN?05 Another Super Mario Bros. Wii SMN?06 Newer Summer Sun SMN?07 Newer Holiday Special SMN?08 Epic Super Bowser World -SMN?09 ? SMN?10 Koopa Country SMN?11 New Super Mario Bros. 4 SMN?12 Awesomer Super Luigi Mini @@ -20,6 +18,7 @@ SMN?41 Devil Mario Winter Special SMN?60 Remixed Super Mario Bros. Wii SMN?65 Ghostly Super Ghost Boos. Wii SMN?66 The Legend of Yoshi +SMN?69 Revised Super Mario Bros. Wii SMN?DU DarkUmbra Super Mario Bros: Anniversary Edition SMN?FL Newer: Falling Leaf SMN?MI Midi's Super Mario Bros Wii - Just A Little Adventure @@ -64,8 +63,8 @@ RMC?32 Wiimms MKW-Fun 2016-07 ### Kirby's Adventure Wii ### -SUK?01 Kirby's Adventure Wii (only exchanging first - player's character is supported) +SUK?01 Kirby's Adventure Wii + * exchange first player's character ### Pokemon ### @@ -82,6 +81,11 @@ SUK?01 Kirby's Adventure Wii (only exchanging first * Pokemon Star Sapphire * Pokemon Sinking Sapphire +### Bravely ### + +000400000017BB00 Bravely Second + * De-Censoring the game + ### Toyko Mirage Sessions #FE ### ASE?01 De-Censoring the game diff --git a/patchimage.sh b/patchimage.sh index dde6097..d3063d6 100755 --- a/patchimage.sh +++ b/patchimage.sh @@ -139,6 +139,10 @@ case ${GAME} in source ${PATCHIMAGE_SCRIPT_DIR}/ghostlysuperghostbooswii.sh ;; + NSMB26 | RevisedSuperMarioBrosWii ) + source ${PATCHIMAGE_SCRIPT_DIR}/revisedsupermariobroswii.sh + ;; + NSMB99 | NSMBWCharacters ) source ${PATCHIMAGE_SCRIPT_DIR}/nsmbw_characters.sh ;; @@ -207,6 +211,10 @@ case ${GAME} in source ${PATCHIMAGE_SCRIPT_DIR}/pokemonsinkingsapphire.sh ;; + BSECU | BravelySecondUncensored ) + source ${PATCHIMAGE_SCRIPT_DIR}/bravelyseconduncensored.sh + ;; + ZEL1 | ParallelWorlds | "The Legend of Zelda: Parallel Worlds" ) source ${PATCHIMAGE_SCRIPT_DIR}/parallelworlds.sh ;; @@ -274,8 +282,9 @@ case ${GAME_TYPE} in echo -e "\n >>> ${GAMENAME} saved as: ${PATCHIMAGE_GAME_DIR}/${GAMEID}.wbfs\n" if [[ ${PATCHIMAGE_COVER_DOWNLOAD} == TRUE ]]; then - echo -e "\n*** Z) download_covers" + echo -e "*** Z) download_covers" download_covers ${GAMEID} + echo -e "\nCovers downloaded to ${PATCHIMAGE_COVER_DIR}" fi ;; diff --git a/script.d/common.sh b/script.d/common.sh index 24661cf..2044582 100644 --- a/script.d/common.sh +++ b/script.d/common.sh @@ -12,15 +12,15 @@ setup_tools () { else SUFFIX=32 fi - WIT=${PATCHIMAGE_TOOLS_DIR}/wit.${SUFFIX} - PPF=${PATCHIMAGE_TOOLS_DIR}/applyppf3.${SUFFIX} - IPS=${PATCHIMAGE_TOOLS_DIR}/uips.${SUFFIX} - UNP=${PATCHIMAGE_TOOLS_DIR}/unp - SZS=${PATCHIMAGE_TOOLS_DIR}/wszst.${SUFFIX} - XD3=${PATCHIMAGE_TOOLS_DIR}/xdelta3.${SUFFIX} - GDOWN=${PATCHIMAGE_TOOLS_DIR}/gdown.pl - CTRTOOL=${PATCHIMAGE_TOOLS_DIR}/ctrtool.${SUFFIX} - FDSTOOL=${PATCHIMAGE_TOOLS_DIR}/3dstool.${SUFFIX} + WIT="${PATCHIMAGE_TOOLS_DIR}"/wit.${SUFFIX} + PPF="${PATCHIMAGE_TOOLS_DIR}"/applyppf3.${SUFFIX} + IPS="${PATCHIMAGE_TOOLS_DIR}"/uips.${SUFFIX} + UNP="${PATCHIMAGE_TOOLS_DIR}"/unp + SZS="${PATCHIMAGE_TOOLS_DIR}"/wszst.${SUFFIX} + XD3="${PATCHIMAGE_TOOLS_DIR}"/xdelta3.${SUFFIX} + GDOWN="${PATCHIMAGE_TOOLS_DIR}"/gdown.pl + CTRTOOL="${PATCHIMAGE_TOOLS_DIR}"/ctrtool.${SUFFIX} + FDSTOOL="${PATCHIMAGE_TOOLS_DIR}"/3dstool.${SUFFIX} } @@ -58,6 +58,7 @@ NSMB22 New Super Mario Bros. Wii - Other World NSMB23 The Legend of Yoshi NSMB24 Remixed Super Mario Bros. Wii NSMB25 Ghostly Super Ghost Boos. Wii +NSMB26 Revised Super Mario Bros. Wii NSMB99 Customize Characters @@ -85,6 +86,8 @@ PKMN6 Pokemon Wilting Y PKMN7 Pokemon Rising Ruby PKMN8 Pokemon Sinking Sapphire +BSECU Bravely Second Uncensored + <<<<<< ROMS >>>>>> ZEL1 The Legend of Zelda: Parallel Worlds @@ -98,8 +101,8 @@ read GAME download_soundtrack () { - if [[ ${SOUNDTRACK_LINK} ]]; then - wget --no-check-certificate "${SOUNDTRACK_LINK}" -O "${PATCHIMAGE_AUDIO_DIR}"/${SOUNDTRACK_ZIP} || exit 57 + if [[ ${SOUNDTRACK_LINK} && ! -f "${PATCHIMAGE_AUDIO_DIR}"/"${SOUNDTRACK_ZIP}" ]]; then + wget --no-check-certificate "${SOUNDTRACK_LINK}" -O "${PATCHIMAGE_AUDIO_DIR}"/"${SOUNDTRACK_ZIP}" || exit 57 echo -e "\n >>> soundtrack saved to\n >>> ${PATCHIMAGE_AUDIO_DIR}/${SOUNDTRACK_ZIP}" else echo -e "no soundtrack for ${GAMENAME} available." @@ -162,37 +165,37 @@ apply_banner () { check_directories () { [[ ! -d ${PATCHIMAGE_RIIVOLUTION_DIR} && -w $(dirname ${PATCHIMAGE_RIIVOLUTION_DIR}) ]] && \ - ( mkdir -p ${PATCHIMAGE_RIIVOLUTION_DIR} || PATCHIMAGE_RIIVOLUTION_DIR=${HOME} ) + ( mkdir -p "${PATCHIMAGE_RIIVOLUTION_DIR}" || PATCHIMAGE_RIIVOLUTION_DIR=${HOME} ) [[ ! -w ${PATCHIMAGE_RIIVOLUTION_DIR} ]] && PATCHIMAGE_RIIVOLUTION_DIR=${HOME} [[ ! -d ${PATCHIMAGE_WBFS_DIR} && -w $(dirname ${PATCHIMAGE_WBFS_DIR}) ]] && \ - ( mkdir -p ${PATCHIMAGE_WBFS_DIR} || PATCHIMAGE_WBFS_DIR=${HOME} ) + ( mkdir -p "${PATCHIMAGE_WBFS_DIR}" || PATCHIMAGE_WBFS_DIR=${HOME} ) - [[ ! -w ${PATCHIMAGE_WBFS_DIR} ]] && PATCHIMAGE_WBFS_DIR=${HOME} + [[ ! -w "${PATCHIMAGE_WBFS_DIR}" ]] && PATCHIMAGE_WBFS_DIR=${HOME} [[ ! -d ${PATCHIMAGE_GAME_DIR} && -w $(dirname ${PATCHIMAGE_GAME_DIR}) ]] && \ - ( mkdir -p ${PATCHIMAGE_GAME_DIR} || PATCHIMAGE_GAME_DIR=${HOME} ) + ( mkdir -p "${PATCHIMAGE_GAME_DIR}" || PATCHIMAGE_GAME_DIR=${HOME} ) [[ ! -w ${PATCHIMAGE_GAME_DIR} ]] && PATCHIMAGE_GAME_DIR=${HOME} [[ ! -d ${PATCHIMAGE_3DS_DIR} && -w $(dirname ${PATCHIMAGE_3DS_DIR}) ]] && \ - ( mkdir -p ${PATCHIMAGE_3DS_DIR} || PATCHIMAGE_3DS_DIR=${HOME} ) + ( mkdir -p "${PATCHIMAGE_3DS_DIR}" || PATCHIMAGE_3DS_DIR=${HOME} ) [[ ! -w ${PATCHIMAGE_3DS_DIR} ]] && PATCHIMAGE_3DS_DIR=${HOME} [[ ! -d ${PATCHIMAGE_ROM_DIR} && -w $(dirname ${PATCHIMAGE_ROM_DIR}) ]] && \ - ( mkdir -p ${PATCHIMAGE_ROM_DIR} || PATCHIMAGE_ROM_DIR=${HOME} ) + ( mkdir -p "${PATCHIMAGE_ROM_DIR}" || PATCHIMAGE_ROM_DIR=${HOME} ) [[ ! -w ${PATCHIMAGE_ROM_DIR} ]] && PATCHIMAGE_ROM_DIR=${HOME} [[ ! -d ${PATCHIMAGE_AUDIO_DIR} && -w $(dirname ${PATCHIMAGE_AUDIO_DIR}) ]] && \ - ( mkdir -p ${PATCHIMAGE_AUDIO_DIR} || PATCHIMAGE_AUDIO_DIR=${HOME} ) + ( mkdir -p "${PATCHIMAGE_AUDIO_DIR}" || PATCHIMAGE_AUDIO_DIR=${HOME} ) [[ ! -w ${PATCHIMAGE_AUDIO_DIR} ]] && PATCHIMAGE_AUDIO_DIR=${HOME} - [[ ! -d ${PATCHIMAGE_COVER_DIR} && -w $(dirname ${PATCHIMAGE_COVER_DIR}) ]] && \ - ( mkdir -p ${PATCHIMAGE_COVER_DIR} || PATCHIMAGE_COVER_DIR=${HOME} ) + [[ ! -d ${PATCHIMAGE_COVER_DIR} && -w $(dirname "${PATCHIMAGE_COVER_DIR}") ]] && \ + ( mkdir -p "${PATCHIMAGE_COVER_DIR}" || PATCHIMAGE_COVER_DIR=${HOME} ) [[ ! -w ${PATCHIMAGE_COVER_DIR} ]] && PATCHIMAGE_COVER_DIR=${HOME} @@ -224,12 +227,12 @@ check_input_image_nsmb () { elif test -f SMN?01.iso; then x=2 IMAGE=SMN?01.iso - elif test -f ${PATCHIMAGE_WBFS_DIR}/SMN?01.iso; then + elif test -f "${PATCHIMAGE_WBFS_DIR}"/SMN?01.iso; then x=3 - IMAGE=${PATCHIMAGE_WBFS_DIR}/SMN?01.iso - elif test -f ${PATCHIMAGE_WBFS_DIR}/SMN?01.wbfs; then + IMAGE="${PATCHIMAGE_WBFS_DIR}"/SMN?01.iso + elif test -f "${PATCHIMAGE_WBFS_DIR}"/SMN?01.wbfs; then x=4 - IMAGE=${PATCHIMAGE_WBFS_DIR}/SMN?01.wbfs + IMAGE="${PATCHIMAGE_WBFS_DIR}"/SMN?01.wbfs else echo -e "please specify image to use with --iso=" exit 15 @@ -249,12 +252,12 @@ check_input_image_kirby () { elif test -f SMN?01.iso; then x=2 IMAGE=SMN?01.iso - elif test -f ${PATCHIMAGE_WBFS_DIR}/SUK?01.iso; then + elif test -f "${PATCHIMAGE_WBFS_DIR}"/SUK?01.iso; then x=3 - IMAGE=${PATCHIMAGE_WBFS_DIR}/SUK?01.iso - elif test -f ${PATCHIMAGE_WBFS_DIR}/SUK?01.wbfs; then + IMAGE="${PATCHIMAGE_WBFS_DIR}"/SUK?01.iso + elif test -f "${PATCHIMAGE_WBFS_DIR}"/SUK?01.wbfs; then x=4 - IMAGE=${PATCHIMAGE_WBFS_DIR}/SUK?01.wbfs + IMAGE="${PATCHIMAGE_WBFS_DIR}"/SUK?01.wbfs else echo -e "please specify image to use with --iso=" exit 15 @@ -274,12 +277,12 @@ check_input_image_mkwiimm () { elif test -f RMC?01.iso; then x=2 IMAGE=RMC?01.iso - elif test -f ${PATCHIMAGE_WBFS_DIR}/RMC?01.iso; then + elif test -f "${PATCHIMAGE_WBFS_DIR}"/RMC?01.iso; then x=3 - IMAGE=${PATCHIMAGE_WBFS_DIR}/RMC?01.iso - elif test -f ${PATCHIMAGE_WBFS_DIR}/RMC?01.wbfs; then + IMAGE="${PATCHIMAGE_WBFS_DIR}"/RMC?01.iso + elif test -f "${PATCHIMAGE_WBFS_DIR}"/RMC?01.wbfs; then x=4 - IMAGE=${PATCHIMAGE_WBFS_DIR}/RMC?01.wbfs + IMAGE="${PATCHIMAGE_WBFS_DIR}"/RMC?01.wbfs else echo -e "please specify image to use with --iso=" exit 15 @@ -318,7 +321,7 @@ show_nsmb_db () { ID1=${1:0:3} ID2=${1:4:2} gawk -F \: "/^${ID1}\*${ID2}/"'{print $2}' \ - < ${PATCHIMAGE_SCRIPT_DIR}/nsmbw.db || echo "** Unknown **" + < "${PATCHIMAGE_SCRIPT_DIR}"/nsmbw.db || echo "** Unknown **" } @@ -326,7 +329,7 @@ show_mkwiimm_db () { ID=${1:4:2} [[ ${ID} == [0-9][0-9] ]] && gawk -F \: "/^${ID}/"'{print $2}' \ - < ${PATCHIMAGE_SCRIPT_DIR}/mkwiimm.db || echo "** Unknown **" + < "${PATCHIMAGE_SCRIPT_DIR}"/mkwiimm.db || echo "** Unknown **" } @@ -366,14 +369,14 @@ show_titles_db () { ID=${1/.*} gawk -F \: "/^${ID}/"'{print $2}' \ - < ${PATCHIMAGE_SCRIPT_DIR}/titles.db || echo "** Unknown **" + < "${PATCHIMAGE_SCRIPT_DIR}"/titles.db || echo "** Unknown **" } check_wfc () { ID=${1/.*} - if [[ $(grep ${ID} ${PATCHIMAGE_SCRIPT_DIR}/wfc.db) ]]; then + if [[ $(grep ${ID} "${PATCHIMAGE_SCRIPT_DIR}"/wfc.db) ]]; then echo TRUE else echo FALSE @@ -443,11 +446,24 @@ check_riivolution_patch () { download_covers () { + alt=$(echo $1 | sed s/./E/4) + for path in cover cover3D coverfull disc disccustom; do - wget -O ${PATCHIMAGE_COVER_DIR}/${1}_${path}.png \ - http://art.gametdb.com/wii/${path}/EN/${1}.png &>/dev/null \ - || ( echo "Cover (${path}) does not exist for gameid ${1}." && \ - rm ${PATCHIMAGE_COVER_DIR}/${1}_${path}.png ) + if [[ ! -f "${PATCHIMAGE_COVER_DIR}"/${1}_${path}.png ]]; then + wget -O "${PATCHIMAGE_COVER_DIR}"/${1}_${path}.png \ + http://art.gametdb.com/wii/${path}/EN/${1}.png &>/dev/null \ + || rm "${PATCHIMAGE_COVER_DIR}"/${1}_${path}.png + + if [[ ! -f "${PATCHIMAGE_COVER_DIR}"/${1}_${path}.png ]]; then + wget -O "${PATCHIMAGE_COVER_DIR}"/${1}_${path}.png \ + http://art.gametdb.com/wii/${path}/US/${alt}.png &>/dev/null \ + || rm "${PATCHIMAGE_COVER_DIR}"/${1}_${path}.png + fi + + [[ ! -f "${PATCHIMAGE_COVER_DIR}"/${1}_${path}.png ]] && \ + echo "Cover (${path}) does not exist for gameid ${1}." + fi + done }