From b4b4b403d5e5e78315422973d4dad3a420bf8b96 Mon Sep 17 00:00:00 2001 From: Christopher Roy Bratusek Date: Sun, 11 May 2014 21:57:19 +0200 Subject: [PATCH] v4.91, see ChangeLog --- ChangeLog | 21 +++++++++++++ patchimage.sh | 27 ++++++++++++++--- script.d/common.sh | 72 ++++++++++++++++++++++++++++++++++++--------- script.d/wiimmfi.sh | 29 ++++++++++++------ 4 files changed, 122 insertions(+), 27 deletions(-) diff --git a/ChangeLog b/ChangeLog index 031a543..134eebc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,24 @@ +v4.91: +- update my mail address +- fixed downloading soundtracks +- when using wiimmfi stuff, ask whether to patch all or a specific image +- previously --soundtrack would download the soundtrack and exit. Now + it does no longer exit. +- added --only-soundtrack (download soundtrack for selected game and exit) +- added --covers (download covers for selected game) +- added --only-covers (download covers for selected game and exit) +- added mkwiimm.db ("database" containing all RMC??? IDs for MKWiimm) + +v4.90: +- support wiimmfi patcher. All RMC??? images in the current directory or + all RMC??? images in ${PATCHIMAGE_WBFS_DIR} will be patched to use the + new server. patchimage will download and prepare the wiimmfi-patcher, + check the directory for RMC??? images (.iso and .wbfs), create a copy + of your image for the patcher, let Wiimm's patcher do it's work, move + the new image to ${PATCHIMAGE_GAME_DIR}. + . + Ensure both variables are set in ${HOME}/.patchimage.rc + v4.0: - bugfix: fix looking for already downloaded riivolution files in ${PATCHIMAGE_RIIVOLUTION_DIR} diff --git a/patchimage.sh b/patchimage.sh index 57a3e81..5f7020c 100755 --- a/patchimage.sh +++ b/patchimage.sh @@ -27,6 +27,8 @@ cd ${PWD}/workdir PATCHIMAGE_RIIVOLUTION_DIR=${PWD} PATCHIMAGE_WBFS_DIR=${PWD} PATCHIMAGE_AUDIO_DIR=${PWD} +PATCHIMAGE_GAME_DIR=${PWD} +PATCHIMAGE_COVER_DIR=${PWD} if [[ -e $HOME/.patchimage.rc ]]; then source $HOME/.patchimage.rc @@ -116,11 +118,14 @@ case ${GAME_TYPE} in "RIIVOLUTION" ) show_notes rm -rf ${WORKDIR} - if [[ ${DOWNLOAD_SOUNDTRACK} == TRUE ]]; then - echo "\n*** 1) download_soundtrack" + if [[ ${PATCHIMAGE_SOUNDTRACK_DOWNLOAD} == TRUE ]]; then + echo -e "\n*** A) download_soundtrack" download_soundtrack - exit 0 + if [[ ${ONLY_SOUNDTRACK} == TRUE ]]; then + exit 0 + fi fi + echo -e "\n*** 1) check_input_image" check_input_image echo "*** 2) check_input_image_special" @@ -146,7 +151,7 @@ case ${GAME_TYPE} in dolpatch if [[ ${CUSTOMID} ]]; then - GAMEID = ${CUSTOMID} + GAMEID=${CUSTOMID} fi if [[ ${PATCHIMAGE_SHARE_SAVE} == "TRUE" ]]; then @@ -169,10 +174,24 @@ case ${GAME_TYPE} in echo -e "\n >>> ${GAMENAME} saved as: ${PATCHIMAGE_WBFS_DIR}/${GAMEID}.wbfs\n" + if [[ ${PATCHIMAGE_COVER_DOWNLOAD} == TRUE ]]; then + echo -e "\n*** Z) download_covers" + download_covers ${GAMEID} + fi + ;; "MKWIIMM") show_notes + + if [[ ${PATCHIMAGE_COVER_DOWNLOAD} == TRUE ]]; then + echo "\n*** B) download_covers" + download_covers + if [[ ${ONLY_COVERS} ]]; then + exit 0 + fi + fi + echo -e "\n*** 1) check_input_image" check_input_image echo -e "\n*** 2) check_input_image_special" diff --git a/script.d/common.sh b/script.d/common.sh index 31841b1..81bdde1 100644 --- a/script.d/common.sh +++ b/script.d/common.sh @@ -66,13 +66,12 @@ read GAME download_soundtrack () { - if [[ ${SOUNDTRACK} ]]; then - if [[ ${SOUNDTRACK_LINK} ]]; then - wget --no-check-certificate "${PATCHIMAGE_AUDIO_DIR}"/"${SOUNDTRACK_LINK}" -O "${PATCHIMAGE_RIIVOLUTION_DIR}"/${SOUNDTRACK_ZIP} || exit 57 - echo -e "\n >>> soundtrack saved to\n >>> ${PATCHIMAGE_AUDIO_DIR}/${SOUNDTRACK_ZIP}" - else - echo -e "no soundtrack for ${GAME} available." - fi + if [[ ${SOUNDTRACK_LINK} ]]; then + [[ ! -d ${PATCHIMAGE_AUDIO_DIR} ]] && mkdir -p ${PATCHIMAGE_AUDIO_DIR} + 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 ${GAME} available." fi } @@ -216,6 +215,30 @@ check_input_image_mkwiimm () { } +show_mkwiimm_db () { + + ID=${1:4:2} + [[ ${ID} == [0-9][0-9] ]] && gawk -F \: "/^${ID}/"'{print $2}' \ + < ${PATCHIMAGE_SCRIPT_DIR}/mkwiimm.db || echo "** Unknown **" + +} + +ask_input_image_mkwiimm () { + + echo "Choose Mario Kart Wii Image to wiimmfi + + ALL patch all images" + + for image in ${1}/RMC???.{iso,wbfs}; do + if [[ -e ${image} ]]; then + echo " ${image##*/} $(show_mkwiimm_db ${image##*/})" + fi + done + + echo "" + +} + check_riivolution_patch () { x=0 @@ -255,10 +278,13 @@ check_riivolution_patch () { download_covers () { + [[ ! -d ${PATCHIMAGE_COVER_DIR} ]] && mkdir -p ${PATCHIMAGE_COVER_DIR} + for path in cover cover3D coverfull disc disccustom; do - wget -O ${PATCHIMAGE_COVER_DIR}/${1}_${cover}.png \ - http://art.gametdb.com/wii/cover/${cover}/EN/${1}.png &>/dev/null \ - || echo "Cover (${cover}) does not exists for gameid ${1}." + wget -O ${PATCHIMAGE_COVER_DIR}/${1}_${path}.png \ + http://art.gametdb.com/wii/${path}/EN/${1}.png &>/dev/null \ + || ( echo "Cover (${path}) does not exists for gameid ${1}." && \ + rm ${PATCHIMAGE_COVER_DIR}/${1}_${path}.png ) done } @@ -330,7 +356,12 @@ while [[ $xcount -lt $pcount ]]; do ;; --soundtrack ) - DOWNLOAD_SOUNDTRACK=TRUE + PATCHIMAGE_SOUNDTRACK_DOWNLOAD=TRUE + ;; + + --only-soundtrack ) + PATCHIMAGE_SOUNDTRACK_DOWNLOAD=TRUE + ONLY_SOUNDTRACK=TRUE ;; --version=* ) @@ -371,6 +402,16 @@ while [[ $xcount -lt $pcount ]]; do GAME=${1/*=} ;; + --covers* ) + PATCHIMAGE_COVER_DOWNLOAD=TRUE + ;; + + --only-covers* ) + PATCHIMAGE_COVER_DOWNLOAD=TRUE + download_covers ${1/*=} + exit 0 + ;; + --banner=* ) BANNER=${1/*=} BANNER_EXT=${BANNER//*./} @@ -385,9 +426,9 @@ while [[ $xcount -lt $pcount ]]; do ;; "" | --help ) - echo -e "patchimage 4.0 (2013-10-11) + echo -e "patchimage 4.91 (2014-05-10) - (c) 2013 Christopher Roy Bratusek + (c) 2013-2014 Christopher Roy Bratusek patchimage creates wbfs images from riivolution patches. --game= | specify game you want to create @@ -397,7 +438,10 @@ while [[ $xcount -lt $pcount ]]; do --customdid=SMNP02 | specify a custom ID to use for the game --sharesave | let modified game share savegame with original game --download | download riivolution patchfiles ---soundtrack | download soundtrack (if available) and exit +--soundtrack | download soundtrack (if available) +--only-soundtrack | download soundtrack only (if available) and exit +--covers | download covers (if available) +--only-covers=SMNP02 | download covers only (if available) --banner= | use a custom banner (riivolution games) --download-banner | download a custom banner (if available)" exit 0 diff --git a/script.d/wiimmfi.sh b/script.d/wiimmfi.sh index 9ff45d0..32965a1 100644 --- a/script.d/wiimmfi.sh +++ b/script.d/wiimmfi.sh @@ -22,7 +22,9 @@ Supported Versions: EUR, JAP, USA check_input_image_special () { check_input_image_mkwiimm - IMAGE_DIR=${IMAGE%/*} + ask_input_image_mkwiimm ${IMAGE%/*} + echo -e "type ALL or RMC???.wbfs:\n" + read ID } @@ -41,13 +43,22 @@ download_wiimm () { patch_wiimm () { cd ${HOME}/.patchimage/tools/wiimmfi-patcher/ - for image in "${IMAGE_DIR}"/RMC???.iso "${IMAGE_DIR}"/RMC???.wbfs; do - if [[ -e ${image} ]]; then - cp -v "${image}" . - ./create-image.sh >/dev/null - mv -v ./wiimmfi-images/${image##*/} "${PATCHIMAGE_GAME_DIR}"/ - rm ${image##*/} - fi - done + + if [[ ${ID} == ALL ]]; then + for image in ${IMAGE%/*}/RMC???.{iso,wbfs}; do + if [[ -e ${image} ]]; then + cp -v "${image}" . + ./create-image.sh >/dev/null + mv -v ./wiimmfi-images/${image##*/} "${PATCHIMAGE_GAME_DIR}"/ + rm ${image##*/} + fi + done + else + cp -v ${IMAGE%/*}/${ID} . 2>/dev/null + ./create-image.sh >/dev/null + mv -v ./wiimmfi-images/${ID} "${PATCHIMAGE_GAME_DIR}"/ + rm -f ${ID} + fi + rm -rf ${HOME}/.patchimage/tools/wiimfi-patcher/ }