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
|
|
|
#
|
2014-05-16 20:39:01 +02:00
|
|
|
# Christopher Roy Bratusek <nano@jpberlin.de>
|
2013-06-13 20:12:19 +02:00
|
|
|
#
|
|
|
|
# License: GPL v3
|
|
|
|
|
2016-07-03 20:07:55 +02:00
|
|
|
basedir=$(readlink -m "${BASH_SOURCE[0]}")
|
2016-08-05 20:52:01 +02:00
|
|
|
basedir=$(dirname "${basedir}")
|
2016-07-03 20:07:55 +02:00
|
|
|
|
2016-08-05 20:52:01 +02:00
|
|
|
export PATCHIMAGE_DIR=${basedir}
|
2016-08-02 21:40:04 +02:00
|
|
|
|
2016-08-06 10:36:54 +02:00
|
|
|
if [[ -d ${basedir}/scripts ]]; then
|
|
|
|
export PATCHIMAGE_SCRIPT_DIR=${basedir}/scripts
|
2016-08-05 20:52:01 +02:00
|
|
|
export PATCHIMAGE_PATCH_DIR=${basedir}/patches
|
|
|
|
export PATCHIMAGE_DATA_DIR=${basedir}/data
|
|
|
|
export PATCHIMAGE_TOOLS_DIR=${basedir}/tools
|
|
|
|
export PATCHIMAGE_OVERRIDE_DIR=${basedir}/override
|
|
|
|
export PATCHIMAGE_DATABASE_DIR=${basedir}/database
|
2013-08-06 23:53:43 +02:00
|
|
|
else
|
2016-08-06 10:36:54 +02:00
|
|
|
export PATCHIMAGE_SCRIPT_DIR=/usr/share/patchimage/scripts
|
2016-08-05 20:52:01 +02:00
|
|
|
export PATCHIMAGE_PATCH_DIR=/usr/share/patchimage/patches
|
|
|
|
export PATCHIMAGE_DATA_DIR=/usr/share/patchimage/data
|
2016-08-06 11:03:39 +02:00
|
|
|
if [[ $(uname -m) == "x86_64" ]]; then
|
|
|
|
export PATCHIMAGE_TOOLS_DIR=/usr/lib/x86_64-linux-gnu/patchimage/tools
|
|
|
|
export PATCHIMAGE_OVERRIDE_DIR=/usr/lib/x86_64-linux-gnu/patchimage/override
|
|
|
|
else
|
|
|
|
export PATCHIMAGE_TOOLS_DIR=/usr/lib/i386-linux-gnu/patchimage/tools
|
|
|
|
export PATCHIMAGE_OVERRIDE_DIR=/usr/lib/i386-linux-gnu/patchimage/override
|
|
|
|
fi
|
2016-08-05 20:52:01 +02:00
|
|
|
export PATCHIMAGE_DATABASE_DIR=/usr/share/patchimage/database
|
2013-08-06 23:53:43 +02:00
|
|
|
fi
|
|
|
|
|
2016-08-05 20:52:01 +02:00
|
|
|
export PATCHIMAGE_RIIVOLUTION_DIR="${basedir}"
|
|
|
|
export PATCHIMAGE_WBFS_DIR="${basedir}"
|
|
|
|
export PATCHIMAGE_AUDIO_DIR="${basedir}"
|
|
|
|
export PATCHIMAGE_GAME_DIR="${basedir}"
|
|
|
|
export PATCHIMAGE_COVER_DIR="${basedir}"
|
2016-08-23 18:09:14 +02:00
|
|
|
export PATCHIMAGE_ROM_DIR="${basedir}"
|
|
|
|
export PATCHIMAGE_3DS_DIR="${basedir}"
|
2013-10-12 10:37:29 +02:00
|
|
|
|
2016-08-24 18:41:53 +02:00
|
|
|
MODULES="common downloader helper-3ds helper-mkwii \
|
|
|
|
helper-nsmb helper-wiimmfi messages optparse patcher"
|
|
|
|
for mod in ${MODULES[@]}; do
|
|
|
|
source "${PATCHIMAGE_SCRIPT_DIR}/common/${mod}.sh"
|
|
|
|
done
|
|
|
|
|
2016-07-01 20:11:25 +02:00
|
|
|
optparse "${@}"
|
|
|
|
|
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
|
|
|
|
2016-07-03 20:12:22 +02:00
|
|
|
[[ ! ${GAME} ]] && ask_game
|
2013-06-13 20:12:19 +02:00
|
|
|
|
2016-08-17 21:41:44 +02:00
|
|
|
for game in ${GAME[@]}; do
|
|
|
|
case ${game} in
|
|
|
|
NSMB_ALL )
|
2016-09-09 20:05:31 +02:00
|
|
|
NEW_GAME=(${NEW_GAME[@]} NSMB{1..29})
|
2016-08-17 21:41:44 +02:00
|
|
|
;;
|
|
|
|
|
|
|
|
PKMN_ALL )
|
2016-08-20 12:17:34 +02:00
|
|
|
NEW_GAME=(${NEW_GAME[@]} PKMN{1..10})
|
2016-08-17 21:41:44 +02:00
|
|
|
;;
|
|
|
|
|
|
|
|
PKMN_Y )
|
|
|
|
NEW_GAME=(${NEW_GAME[@]} PKMN2 PKMN6)
|
|
|
|
;;
|
|
|
|
|
|
|
|
PKMN_X )
|
|
|
|
NEW_GAME=(${NEW_GAME[@]} PKMN1 PKMN5)
|
|
|
|
;;
|
|
|
|
|
|
|
|
PKMN_OR )
|
2016-08-19 10:15:50 +02:00
|
|
|
NEW_GAME=(${NEW_GAME[@]} PKMN3 PKMN7 PKMN10)
|
2016-08-17 21:41:44 +02:00
|
|
|
;;
|
|
|
|
|
|
|
|
PKMN_AS )
|
|
|
|
NEW_GAME=(${NEW_GAME[@]} PKMN4 PKMN8 PKMN9)
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
[[ ${NEW_GAME} ]] && GAME=(${NEW_GAME[@]})
|
|
|
|
done
|
|
|
|
|
2016-08-23 18:14:27 +02:00
|
|
|
CURDIR=${PWD}
|
|
|
|
if [[ -w ${CURDIR} ]]; then
|
|
|
|
BUILD_DIR="${CURDIR}"/patchimage_build
|
|
|
|
else BUILD_DIR="${HOME}"/patchimage_build
|
|
|
|
fi
|
|
|
|
|
2016-08-06 21:19:21 +02:00
|
|
|
for game in ${GAME[@]}; do
|
2013-06-13 20:12:19 +02:00
|
|
|
|
2016-08-18 19:51:26 +02:00
|
|
|
script=$(gawk -F : "/\<${game}\>/"'{print $3}' ${PATCHIMAGE_DATABASE_DIR}/scripts.db)
|
|
|
|
if [[ -f ${PATCHIMAGE_SCRIPT_DIR}/${script} ]]; then
|
|
|
|
source ${PATCHIMAGE_SCRIPT_DIR}/${script}
|
|
|
|
else echo -e "specified Game ${game} not recognized"
|
|
|
|
continue
|
|
|
|
fi
|
2016-08-06 21:19:21 +02:00
|
|
|
|
2016-08-17 22:47:29 +02:00
|
|
|
if [[ ${PATCHIMAGE_SHOW_DOWNLOAD} ]]; then
|
2016-08-23 18:45:38 +02:00
|
|
|
echo -e "\nDownloadlink for required files of Game:\n\t${GAMENAME} (${game}):\n\n\t${DOWNLOAD_LINK}\n"
|
2016-08-17 22:47:29 +02:00
|
|
|
continue
|
|
|
|
fi
|
|
|
|
|
2016-08-27 14:53:33 +02:00
|
|
|
rm -rf "${BUILD_DIR}"
|
2016-08-23 18:14:27 +02:00
|
|
|
mkdir -p "${BUILD_DIR}"
|
|
|
|
cd "${BUILD_DIR}"
|
|
|
|
|
2016-08-06 21:19:21 +02:00
|
|
|
case ${GAME_TYPE} in
|
|
|
|
"RIIVOLUTION" )
|
|
|
|
patchimage_riivolution
|
|
|
|
;;
|
2016-07-26 23:16:49 +02:00
|
|
|
|
2016-08-06 21:19:21 +02:00
|
|
|
"MKWIIMM")
|
|
|
|
patchimage_mkwiimm
|
|
|
|
;;
|
2016-07-01 22:06:13 +02:00
|
|
|
|
2016-08-06 21:19:21 +02:00
|
|
|
"GENERIC")
|
|
|
|
patchimage_generic
|
|
|
|
;;
|
2016-07-01 22:06:13 +02:00
|
|
|
|
2016-08-06 21:19:21 +02:00
|
|
|
"IPS" )
|
|
|
|
patchimage_ips
|
|
|
|
;;
|
2016-08-06 19:46:07 +02:00
|
|
|
|
2016-08-09 22:54:12 +02:00
|
|
|
"BPS" )
|
|
|
|
patchimage_bps
|
|
|
|
;;
|
|
|
|
|
2016-08-07 11:26:15 +02:00
|
|
|
"PPF" )
|
|
|
|
patchimage_ppf
|
|
|
|
;;
|
|
|
|
|
2016-08-06 21:19:21 +02:00
|
|
|
"HANS" )
|
|
|
|
patchimage_hans
|
|
|
|
;;
|
2016-08-06 19:46:07 +02:00
|
|
|
|
2016-08-06 21:19:21 +02:00
|
|
|
"DELTA" )
|
|
|
|
patchimage_delta
|
|
|
|
;;
|
2016-07-01 20:07:53 +02:00
|
|
|
|
2016-08-06 21:19:21 +02:00
|
|
|
esac
|
2016-08-23 18:14:27 +02:00
|
|
|
|
|
|
|
cd "${CURDIR}"
|
2016-08-06 21:19:21 +02:00
|
|
|
done
|