add PATCHIMAGE_3DS_DIR rc variable

add PATCHIMAGE_ROM_DIR rc variable
more robust creation of rc defined directories
fallback to HOME if rc defined directories don't exist and can't be created
make check_input_rom a common function (prevent duplicated code)
This commit is contained in:
Christopher Roy Bratusek 2016-08-02 22:22:48 +02:00
parent 07e41566bf
commit 6760369b13
9 changed files with 55 additions and 105 deletions

View File

@ -1,5 +1,14 @@
v6.4.0: v6.4.0:
- add PATCHIMAGE_DIR new internal directory - add PATCHIMAGE_DIR new internal variable
- before creating any of the directories defined in ${HOME}/.patchimage.rc
check whether the parent directory is writeable, else fallback to ${HOME}
- new ${HOME}/.patchimage.rc variable PATCHIMAGE_3DS_DIR, global directory
where to look for unmodified 3DS ROM files
- new ${HOME}/.patchimage.rc variable PATCHIMAGE_ROM_DIR, global directory
where to store your modified 3DS ROM files
- make check_input_rom search in both ${PATCHIMAGE_3DS_DIR} and ${PWD}
- make check_input_rom a common.sh function, prevent duplicated code
- update README.RC, README.STATUS_CODES, README.GAMEIDS
- fix telling user path to Hans Files for Pokemon Rutile Ruby - fix telling user path to Hans Files for Pokemon Rutile Ruby
- fix telling user path to Hans Files for Pokemon Star Sapphire - fix telling user path to Hans Files for Pokemon Star Sapphire
- show full path for Hans Files for all games, instead of relative - show full path for Hans Files for all games, instead of relative

View File

@ -330,10 +330,12 @@ case ${GAME_TYPE} in
echo -e "\n*** 6) repack_romfs" echo -e "\n*** 6) repack_romfs"
repack_3dsromfs romfs/ "${RFS}" || exit 51 repack_3dsromfs romfs/ "${RFS}" || exit 51
echo " mv "${RFS}" "${RIIVOLUTION_ROM_DIR}"
*** succesfully created new romfs as \"${RFS}\"
1) place \"${RFS}\" into sd card > hans/ folder echo "
*** succesfully created new romfs as \"${RIIVOLUTION_ROM_DIR}/${RFS}\"
1) place \"${RIIVOLUTION_ROM_DIR}/${RFS}\" into sd card > hans/ folder
2) place all files from 2) place all files from
$(readlink -m "${DAT}") $(readlink -m "${DAT}")

View File

@ -97,7 +97,6 @@ read GAME
download_soundtrack () { download_soundtrack () {
if [[ ${SOUNDTRACK_LINK} ]]; then 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 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}" echo -e "\n >>> soundtrack saved to\n >>> ${PATCHIMAGE_AUDIO_DIR}/${SOUNDTRACK_ZIP}"
else else
@ -160,19 +159,29 @@ apply_banner () {
check_directories () { check_directories () {
[[ ! -d ${PATCHIMAGE_RIIVOLUTION_DIR} ]] && mkdir -p ${PATCHIMAGE_RIIVOLUTION_DIR} [[ ! -d ${PATCHIMAGE_RIIVOLUTION_DIR} && -w $(dirname ${PATCHIMAGE_RIIVOLUTION_DIR}) ]] && \
( mkdir -p ${PATCHIMAGE_RIIVOLUTION_DIR} || PATCHIMAGE_RIIVOLUTION_DIR=${HOME} )
[[ ! -d ${PATCHIMAGE_WBFS_DIR} ]] && mkdir -p ${PATCHIMAGE_WBFS_DIR} [[ ! -d ${PATCHIMAGE_WBFS_DIR} && -w $(dirname ${PATCHIMAGE_WBFS_DIR}) ]] && \
( mkdir -p ${PATCHIMAGE_WBFS_DIR} || PATCHIMAGE_WBFS_DIR=${HOME} )
[[ ! -d ${PATCHIMAGE_GAME_DIR} ]] && mkdir -p ${PATCHIMAGE_GAME_DIR} [[ ! -d ${PATCHIMAGE_GAME_DIR} && -w $(dirname ${PATCHIMAGE_GAME_DIR}) ]] && \
( mkdir -p ${PATCHIMAGE_GAME_DIR} || PATCHIMAGE_GAME_DIR=${HOME} )
[[ ! -d ${PATCHIMAGE_AUDIO_DIR} ]] && mkdir -p ${PATCHIMAGE_AUDIO_DIR} [[ ! -d ${PATCHIMAGE_3DS_DIR} && -w $(dirname ${PATCHIMAGE_3DS_DIR}) ]] && \
( mkdir -p ${PATCHIMAGE_3DS_DIR} || PATCHIMAGE_3DS_DIR=${HOME} )
[[ ! -d ${PATCHIMAGE_COVER_DIR} ]] && mkdir -p ${PATCHIMAGE_COVER_DIR} [[ ! -d ${PATCHIMAGE_ROM_DIR} && -w $(dirname ${PATCHIMAGE_ROM_DIR}) ]] && \
( mkdir -p ${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} )
[[ ! -d ${PATCHIMAGE_COVER_DIR} && -w $(dirname ${PATCHIMAGE_COVER_DIR}) ]] && \
( mkdir -p ${PATCHIMAGE_COVER_DIR} || PATCHIMAGE_COVER_DIR=${HOME} )
} }
check_input_image () { check_input_image () {
x=0 x=0
@ -264,6 +273,30 @@ check_input_image_mkwiimm () {
} }
check_input_rom () {
x=5
if [[ ! ${CXI} ]]; then
CXI=$(find . -name ${CXI_MASK} | sed -e 's,./,,')
if [[ -f ${CXI} ]]; then
x=6
CXI=${CXI}
RFS=${ROMFS}
else
CXI=$(find ${PATCHIMAGE_3DS_DIR} -name ${CXI_MASK})
if [[ -f ${CXI} ]]; then
x=7
CXI=${CXI}
RFS=${ROMFS}
else
echo -e "error: could not find suitable ROM, specify using --rom"
exit 15
fi
fi
fi
echo "*** >> status: ${x}"
}
show_nsmb_db () { show_nsmb_db () {
ID1=${1:0:3} ID1=${1:0:3}

View File

@ -27,21 +27,6 @@ Supported Versions: US, EU, JAP
} }
check_input_rom () {
if [[ ! ${CXI} ]]; then
CXI=$(find . -name ${CXI_MASK} | sed -e 's,./,,')
if [[ -f ${CXI} ]]; then
CXI=${CXI}
RFS=${ROMFS}
else
echo -e "error: could not find suitable ROM, specify using --rom"
exit 15
fi
fi
}
viola_nerf () { viola_nerf () {
echo " echo "

View File

@ -29,22 +29,6 @@ Supported Versions: US, EU, JAP
} }
check_input_rom () {
if [[ ! ${CXI} ]]; then
CXI=$(find . -name ${CXI_MASK} | sed -e 's,./,,')
if [[ -f ${CXI} ]]; then
CXI=${CXI}
RFS=${ROMFS}
DAT=${PATCHIMAGE_DATA_DIR}/${DATA}
else
echo -e "error: could not find suitable ROM, specify using --rom"
exit 15
fi
fi
}
check_hans_files () { check_hans_files () {
check_riivolution_patch check_riivolution_patch

View File

@ -29,22 +29,6 @@ Supported Versions: US, EU, JAP
} }
check_input_rom () {
if [[ ! ${CXI} ]]; then
CXI=$(find . -name ${CXI_MASK} | sed -e 's,./,,')
if [[ -f ${CXI} ]]; then
CXI=${CXI}
RFS=${ROMFS}
DAT=${PATCHIMAGE_DATA_DIR}/${DATA}
else
echo -e "error: could not find suitable ROM, specify using --rom"
exit 15
fi
fi
}
check_hans_files () { check_hans_files () {
check_riivolution_patch check_riivolution_patch

View File

@ -32,22 +32,6 @@ Supported Versions: US, EU, JAP
} }
check_input_rom () {
if [[ ! ${CXI} ]]; then
CXI=$(find . -name ${CXI_MASK} | sed -e 's,./,,')
if [[ -f ${CXI} ]]; then
CXI=${CXI}
RFS=${ROMFS}
DAT=${DATA}
else
echo -e "error: could not find suitable ROM, specify using --rom"
exit 15
fi
fi
}
check_hans_files () { check_hans_files () {
check_riivolution_patch check_riivolution_patch

View File

@ -32,22 +32,6 @@ Supported Versions: US, EU, JAP
} }
check_input_rom () {
if [[ ! ${CXI} ]]; then
CXI=$(find . -name ${CXI_MASK} | sed -e 's,./,,')
if [[ -f ${CXI} ]]; then
CXI=${CXI}
RFS=${ROMFS}
DAT=${DATA}
else
echo -e "error: could not find suitable ROM, specify using --rom"
exit 15
fi
fi
}
check_hans_files () { check_hans_files () {
check_riivolution_patch check_riivolution_patch

View File

@ -27,21 +27,6 @@ Supported Versions: US, EU, JAP
} }
check_input_rom () {
if [[ ! ${CXI} ]]; then
CXI=$(find . -name ${CXI_MASK} | sed -e 's,./,,')
if [[ -f ${CXI} ]]; then
CXI=${CXI}
RFS=${ROMFS}
else
echo -e "error: could not find suitable ROM, specify using --rom"
exit 15
fi
fi
}
viola_nerf () { viola_nerf () {
echo " echo "