various improvements for HANS, IPS, PPF and BPS patching functions

This commit is contained in:
Christopher Roy Bratusek 2016-08-13 19:04:34 +02:00
parent d765da7017
commit 2590fe98da

View File

@ -130,11 +130,17 @@ patchimage_generic () {
patchimage_ips () { patchimage_ips () {
show_notes show_notes
check_input_rom check_input_rom
check_riivolution_patch --nofail
if [[ -f ${PATCH} ]]; then if [[ -f ${PATCH} ]]; then
ext="${ROM/*.}" ext="${ROM/*.}"
cp "${ROM}" "${GAMENAME}.${ext}" cp "${ROM}" "${GAMENAME}.${ext}"
"${IPS}" a "${PATCH}" "${GAMENAME}.${ext}" || exit 51 "${IPS}" a "${PATCH}" "${GAMENAME}.${ext}" || exit 51
elif [[ -f ${PATCHIMAGE_RIIVOLUTION_DIR}/${PATCH} ]]; then
ext="${ROM/*.}"
cp "${ROM}" "${GAMENAME}.${ext}"
"${IPS}" a "${PATCHIMAGE_RIIVOLUTION_DIR}"/"${PATCH}" \
"${GAMENAME}.${ext}" || exit 51
else else
echo -e "error: patch (${PATCH}) could not be found" echo -e "error: patch (${PATCH}) could not be found"
exit 21 exit 21
@ -144,11 +150,17 @@ patchimage_ips () {
patchimage_bps () { patchimage_bps () {
show_notes show_notes
check_input_rom check_input_rom
check_riivolution_patch --nofail
if [[ -f ${PATCH} ]]; then if [[ -f ${PATCH} ]]; then
ext="${ROM/*.}" ext="${ROM/*.}"
cp "${ROM}" "${GAMENAME}.${ext}" cp "${ROM}" "${GAMENAME}.${ext}"
"${BPS}" -decode -t "${GAMENAME}.${ext}" "${PATCH}" || exit 51 "${BPS}" -decode -t "${GAMENAME}.${ext}" "${PATCH}" || exit 51
elif [[ -f ${PATCHIMAGE_RIIVOLUTION_DIR}/${PATCH} ]]; then
ext="${ROM/*.}"
cp "${ROM}" "${GAMENAME}.${ext}"
"${BPS}" -decode -t "${GAMENAME}.${ext}" \
"${PATCHIMAGE_RIIVOLUTION_DIR}"/"${PATCH}" || exit 51
else else
echo -e "error: patch (${PATCH}) could not be found" echo -e "error: patch (${PATCH}) could not be found"
exit 21 exit 21
@ -158,11 +170,17 @@ patchimage_bps () {
patchimage_ppf () { patchimage_ppf () {
show_notes show_notes
check_input_rom check_input_rom
check_riivolution_patch --nofail
if [[ -f ${PATCH} ]]; then if [[ -f ${PATCH} ]]; then
ext="${ROM/*.}" ext="${ROM/*.}"
cp "${ROM}" "${GAMENAME}.${ext}" cp "${ROM}" "${GAMENAME}.${ext}"
"${PPF}" a "${PATCH}" "${GAMENAME}.${ext}" || exit 51 "${PPF}" a "${PATCH}" "${GAMENAME}.${ext}" || exit 51
elif [[ -f ${PATCHIMAGE_RIIVOLUTION_DIR}/${PATCH} ]]; then
ext="${ROM/*.}"
cp "${ROM}" "${GAMENAME}.${ext}"
"${PPF}" a "${PATCHIMAGE_RIIVOLUTION_DIR}"/"${PATCH}" \
"${GAMENAME}.${ext}" || exit 51
else else
echo -e "error: patch (${PATCH}) could not be found" echo -e "error: patch (${PATCH}) could not be found"
exit 21 exit 21
@ -186,16 +204,35 @@ patchimage_hans () {
echo "*** 3) unpack_3dsrom" echo "*** 3) unpack_3dsrom"
unpack_3dsrom "${ROM}" || exit 51 unpack_3dsrom "${ROM}" || exit 51
echo "*** 4) unpack_3dsromfs" if [[ ${HANS_DELTA} ]]; then
unpack_3dsromfs romfs.bin || exit 51 echo "*** 4) apply_delta"
echo "*** 5) patch_romfs" if [[ -f ${PATCH} ]]; then
patch_romfs "${XD3}" -d -f -s romfs.bin \
"${PATCH}" "${ROMFS}" || exit 51
elif [[ -f ${PATCHIMAGE_RIIVOLUTION_DIR}/${PATCH} ]]; then
"${XD3}" -d -f -s romfs.bin \
"${PATCHIMAGE_RIIVOLUTION_DIR}"/"${PATCH}" \
"${ROMFS}" || exit 51
else
echo -e "error: patch (${PATCH}) could not be found"
exit 21
fi
echo "*** 6) repack_romfs" echo "*** 5) storing game"
repack_3dsromfs romfs/ "${ROMFS}" || exit 51 else
echo "*** 4) unpack_3dsromfs"
unpack_3dsromfs romfs.bin || exit 51
echo "*** 5) patch_romfs"
patch_romfs
echo "*** 6) repack_romfs"
repack_3dsromfs romfs/ "${ROMFS}" || exit 51
echo "*** 7) storing game"
fi
echo "*** 7) storing game"
mv "${ROMFS}" "${PATCHIMAGE_ROM_DIR}" mv "${ROMFS}" "${PATCHIMAGE_ROM_DIR}"
echo " echo "
@ -210,7 +247,11 @@ patchimage_hans () {
into the root of your sd card into the root of your sd card
" "
echo "*** 8) remove workdir" if [[ ${HANS_DELTA} ]]; then
echo "*** 6) remove workdir"
else echo "*** 8) remove workdir"
fi
rm -rf romfs/ romfs.bin rm -rf romfs/ romfs.bin
} }
@ -408,6 +449,10 @@ for game in ${GAME[@]}; do
source "${PATCHIMAGE_SCRIPT_DIR}/pokemon/pokemonsinkingsapphire.sh" source "${PATCHIMAGE_SCRIPT_DIR}/pokemon/pokemonsinkingsapphire.sh"
;; ;;
PKMN9 | DeltaEmeraldAS )
source "${PATCHIMAGE_SCRIPT_DIR}/pokemon/pokemondeltaemerald-as.sh"
;;
BSECU | BravelySecondUncensored ) BSECU | BravelySecondUncensored )
source "${PATCHIMAGE_SCRIPT_DIR}/bravelyseconduncensored.sh" source "${PATCHIMAGE_SCRIPT_DIR}/bravelyseconduncensored.sh"
;; ;;