support for HOME/.patchimage.rc configuration file

This commit is contained in:
Christopher Roy Bratusek 2013-07-07 22:36:04 +02:00
parent 7da399dd68
commit ced41b0e7b
4 changed files with 65 additions and 16 deletions

View File

@ -1,5 +1,7 @@
v2.5: v2.5:
- add opening titles for NSMBW 4 and Retro Remix (PAL, US) by alejandroues - add opening titles for NSMBW 4 and Retro Remix (PAL, US) by alejandroues
- add ucat and unp utilites (perl script to detect archive type and extract it)
- add support for $HOME/.patchimage.rc (see README.RC)
v2.4: v2.4:
- fixed downloading NewerSMBW - fixed downloading NewerSMBW

31
README.RC Normal file
View File

@ -0,0 +1,31 @@
patchimage rc file
patchimage (as of version 2.5) supports a configuration file, below is an example with explanations:
Filename: $HOME/.patchimage.rc
##################
# patchimage rc #
##################
# global directory your riivolution hacks will be looked for
# or there they will be downloaded to:
PATCHIMAGE_RIIVOLUTION_DIR=${HOME}/Hacks
# global directory your wbfs files will be saved to
PATCHIMAGE_WBFS_DIR=/media/WiiHDD/wbfs
# global directory to look for original game image
PATCHIMAGE_GAME_DIR=/media/WiiHDD/wbfs
# global directory soundtracks will be saved to
PATCHIMAGE_AUDIO_DIR=${HOME}/Music
# always (try) to download riivolution patches
PATCHIMAGE_RIIVOLUTION_DOWNLOAD=TRUE
# always (try) to download custom banners
PATCHIMAGE_BANNER_DOWNLOAD=TRUE
# always share the save with original game
PATCHIMAGE_SHARE_SAVE=TRUE

View File

@ -87,9 +87,21 @@ case ${GAME_TYPE} in
if [[ ${CUSTOMID} ]]; then if [[ ${CUSTOMID} ]]; then
GAMEID = ${CUSTOMID} GAMEID = ${CUSTOMID}
fi fi
if [[ ${PATCHIMAGE_SHARE_SAVE} == "TRUE" ]]; then
TMD_OPTS=""
else
TMD_OPTS="--tt-id=K"
fi
${WIT} cp -v -B ${WORKDIR} ${GAMEID}.wbfs -vv --disc-id=${GAMEID} ${TMD_OPTS} --name "${GAMENAME}" || exit 1 ${WIT} cp -v -B ${WORKDIR} ${GAMEID}.wbfs -vv --disc-id=${GAMEID} ${TMD_OPTS} --name "${GAMENAME}" || exit 1
echo -e "\n >>> ${GAMENAME} saved as:\n >>> ${GAMEID}.wbfs" if [[ -d ${PATCHIMAGE_WBFS_DIR} ]]; then
mv ${GAMEID}.wbfs "${PATCHIMAGE_WBFS_DIR}"/
fi
echo -e "\n >>> ${GAMENAME} saved as:\n >>> ${PATCHIMAGE_WBFS_DIR}/${GAMEID}.wbfs"
;; ;;
"IPS" ) "IPS" )

View File

@ -1,11 +1,14 @@
#!/bin/bash #!/bin/bash
TMD_OPTS="--tt-id=K"
TMP_FILES=(Another nsmb.d XmasNewer NewerFiles "Newer*Summer*Sun" \ TMP_FILES=(Another nsmb.d XmasNewer NewerFiles "Newer*Summer*Sun" \
ZPW_1.1.ips Epic_Super_Bowser_World_v1.00 Riivolution Koopa \ ZPW_1.1.ips Epic_Super_Bowser_World_v1.00 Riivolution Koopa \
Cannon_Super_Mario_Bros._Wii_v1.1 riivolution "Readme*" "*.txt" "*.rtf" \ Cannon_Super_Mario_Bros._Wii_v1.1 riivolution "Readme*" "*.txt" "*.rtf" \
"*.dol" "*.elf" nsmb "Retro Remix") "*.dol" "*.elf" nsmb "Retro Remix")
PATCHIMAGE_RIIVOLUTION_DIR="."
PATCHIMAGE_WBFS_DIR="."
PATCHIMAGE_AUDIO_DIR="."
if [[ -e $HOME/.patchimage.rc ]]; then if [[ -e $HOME/.patchimage.rc ]]; then
source $HOME/.patchimage.rc source $HOME/.patchimage.rc
fi fi
@ -58,7 +61,8 @@ download_soundtrack () {
if [[ ${SOUNDTRACK} ]]; then if [[ ${SOUNDTRACK} ]]; then
if [[ ${SOUNDTRACK_LINK} ]]; then if [[ ${SOUNDTRACK_LINK} ]]; then
wget --no-check-certificate "${SOUNDTRACK_LINK}" -O ${SOUNDTRACK_ZIP} wget --no-check-certificate "${PATCHIMAGE_AUDIO_DIR}"/"${SOUNDTRACK_LINK}" -O "${PATCHIMAGE_RIIVOLUTION_DIR}"/${SOUNDTRACK_ZIP}
echo -e "\n >>> soundtrack saved to\n >>> ${PATCHIMAGE_AUDIO_DIR}/${SOUNDTRACK_ZIP}"
exit 0 exit 0
else else
echo -e "no soundtrack for ${GAME} available." echo -e "no soundtrack for ${GAME} available."
@ -70,10 +74,12 @@ download_soundtrack () {
download_banner () { download_banner () {
if [[ ${DL_BANNER} == "TRUE" ]]; then if [[ ${PATCHIMAGE_BANNER_DOWNLOAD} == "TRUE" ]]; then
if [[ ${CUSTOM_BANNER} ]]; then if [[ ${CUSTOM_BANNER} ]]; then
wget --no-check-certificate "${CUSTOM_BANNER}" -O ${GAMEID}-custom-banner.bnr if [[ ! -f "${PATCHIMAGE_RIIVOLUTION_DIR}"/${GAMEID}-custom-banner.bnr ]]; then
BANNER=${GAMEID}-custom-banner.bnr wget --no-check-certificate "${CUSTOM_BANNER}" -O "${PATCHIMAGE_RIIVOLUTION_DIR}"/${GAMEID}-custom-banner.bnr
fi
BANNER="${PATCHIMAGE_RIIVOLUTION_DIR}"/${GAMEID}-custom-banner.bnr
else else
echo "no custom banner for ${GAMENAME} available, not modifying" echo "no custom banner for ${GAMENAME} available, not modifying"
fi fi
@ -134,20 +140,18 @@ check_input_image () {
check_riivolution_patch () { check_riivolution_patch () {
if [[ ${DOWNLOAD} ]]; then if [[ ${PATCHIMAGE_RIIVOLTUION_DOWNLOAD} == "TRUE" ]]; then
if [[ ${DOWNLOAD_LINK} ]]; then if [[ ${DOWNLOAD_LINK} ]]; then
if [[ ! -f "${RIIVOLUTION_ZIP}" ]]; then if [[ ! -f "${PATCHIMAGE_RIIVOLUTION_DIR}"/"${RIIVOLUTION_ZIP}" ]]; then
wget --no-check-certificate ${DOWNLOAD_LINK} -O "${RIIVOLUTION_ZIP}" wget --no-check-certificate ${DOWNLOAD_LINK} -O "${PATCHIMAGE_RIIVOLUTION_DIR}"/"${RIIVOLUTION_ZIP}"
tools/unp "${RIIVOLUTION_ZIP}" >/dev/null tools/unp "${PATCHIMAGE_RIIVOLUTION_DIR}"/"${RIIVOLUTION_ZIP}" >/dev/null
fi fi
else else
echo "no download link for ${GAMENAME} available." echo "no download link for ${GAMENAME} available."
exit 1 exit 1
fi fi
elif [[ -f "${RIIVOLUTION_ZIP}" && ! -d "${RIIVOLUTION_DIR}" ]]; then
tools/unp "${RIIVOLUTION_ZIP}" >/dev/null
elif [[ -f "${PATCHIMAGE_RIIVOLUTION_DIR}"/"${RIIVOLUTION_ZIP}" && ! -d "${RIIVOLUTION_DIR}" ]]; then elif [[ -f "${PATCHIMAGE_RIIVOLUTION_DIR}"/"${RIIVOLUTION_ZIP}" && ! -d "${RIIVOLUTION_DIR}" ]]; then
tools/unp "${PATCHIMAGE_RIIVOLUTION_DIR}"/"${RIIVOLUTION_ZIP}" >/dev/null tools/unp "${RIIVOLUTION_ZIP}" >/dev/null
elif [[ ! -d "${RIIVOLUTION_DIR}" ]]; then elif [[ ! -d "${RIIVOLUTION_DIR}" ]]; then
echo -e "please specify zip/rar to use with --riivolution=<path>" echo -e "please specify zip/rar to use with --riivolution=<path>"
exit 1 exit 1
@ -218,7 +222,7 @@ while [[ $xcount -lt $pcount ]]; do
;; ;;
--download ) --download )
DOWNLOAD=TRUE PATCHIMAGE_RIIVOLUTION_DOWNLOAD=TRUE
;; ;;
--soundtrack ) --soundtrack )
@ -256,7 +260,7 @@ while [[ $xcount -lt $pcount ]]; do
;; ;;
--sharesave ) --sharesave )
TMD_OPTS="" PATCHIMAGE_SHARE_SAVE=TRUE
;; ;;
--game* ) --game* )
@ -278,7 +282,7 @@ while [[ $xcount -lt $pcount ]]; do
;; ;;
--download-banner ) --download-banner )
DL_BANNER=TRUE PATCHIMAGE_BANNER_DOWNLOAD=TRUE
;; ;;
"" | --help ) "" | --help )