add batch mode for generating more than one mod at once

This commit is contained in:
Christopher Roy Bratusek 2016-08-06 21:19:21 +02:00
parent cfd9eb47d2
commit 560c457efc
4 changed files with 279 additions and 273 deletions

View File

@ -16,6 +16,7 @@ v7.0.0:
- add --override-szs to override Wiims Mario Kart Fun wit and szs with - add --override-szs to override Wiims Mario Kart Fun wit and szs with
the ones supplied by patchimage. Use this if building Wiims Mario Kart Fun the ones supplied by patchimage. Use this if building Wiims Mario Kart Fun
fails due to incompatible library versions being installed. fails due to incompatible library versions being installed.
- add batch mode for generating more than one mod at once
::bug fixes ::bug fixes
- several minor bugfixes and improvements - several minor bugfixes and improvements

View File

@ -1,6 +1,7 @@
*** General parameters *** *** General parameters ***
--help | show this message --help | show this message
--game=<ID/Short Name> | specify game you want to create --game=<ID/Short Name> | specify game you want to create
--game="<ID1/Short Name1> <ID2/Short Name2>" | specify multiple games you want to create
--list-games | show possible options for --game --list-games | show possible options for --game
*** Wii game parameters *** *** Wii game parameters ***

View File

@ -46,370 +46,373 @@ setup_tools
[[ ! ${GAME} ]] && ask_game [[ ! ${GAME} ]] && ask_game
case ${GAME} in for game in ${GAME[@]}; do
NSMB1 | NewerSMB ) case ${game} in
source "${PATCHIMAGE_SCRIPT_DIR}/nsmbw/newersmb.sh"
;;
NSMB2 | NewerSummerSun ) NSMB1 | NewerSMB )
source "${PATCHIMAGE_SCRIPT_DIR}/nsmbw/newersummersun.sh" source "${PATCHIMAGE_SCRIPT_DIR}/nsmbw/newersmb.sh"
;; ;;
NSMB3 | AnotherSMB ) NSMB2 | NewerSummerSun )
source "${PATCHIMAGE_SCRIPT_DIR}/nsmbw/anothersmb.sh" source "${PATCHIMAGE_SCRIPT_DIR}/nsmbw/newersummersun.sh"
;; ;;
NSMB4 | HolidaySpecial ) NSMB3 | AnotherSMB )
source "${PATCHIMAGE_SCRIPT_DIR}/nsmbw/newerholiday.sh" source "${PATCHIMAGE_SCRIPT_DIR}/nsmbw/anothersmb.sh"
;; ;;
NSMB5 | Cannon ) NSMB4 | HolidaySpecial )
source "${PATCHIMAGE_SCRIPT_DIR}/nsmbw/cannon.sh" source "${PATCHIMAGE_SCRIPT_DIR}/nsmbw/newerholiday.sh"
;; ;;
NSMB6 | BowserWorld ) NSMB5 | Cannon )
source "${PATCHIMAGE_SCRIPT_DIR}/nsmbw/epicbowserworld.sh" source "${PATCHIMAGE_SCRIPT_DIR}/nsmbw/cannon.sh"
;; ;;
NSMB7 | KoopaCountry ) NSMB6 | BowserWorld )
source "${PATCHIMAGE_SCRIPT_DIR}/nsmbw/koopacountry.sh" source "${PATCHIMAGE_SCRIPT_DIR}/nsmbw/epicbowserworld.sh"
;; ;;
NSMB8 | NewSuperMarioBros4 ) NSMB7 | KoopaCountry )
source "${PATCHIMAGE_SCRIPT_DIR}/nsmbw/nsmbw4.sh" source "${PATCHIMAGE_SCRIPT_DIR}/nsmbw/koopacountry.sh"
;; ;;
NSMB9 | RetroRemix ) NSMB8 | NewSuperMarioBros4 )
source "${PATCHIMAGE_SCRIPT_DIR}/nsmbw/retroremix.sh" source "${PATCHIMAGE_SCRIPT_DIR}/nsmbw/nsmbw4.sh"
;; ;;
NSMB10 | WinterMoon ) NSMB9 | RetroRemix )
source "${PATCHIMAGE_SCRIPT_DIR}/nsmbw/wintermoon.sh" source "${PATCHIMAGE_SCRIPT_DIR}/nsmbw/retroremix.sh"
;; ;;
NSMB11 | NSMBW3 ) NSMB10 | WinterMoon )
source "${PATCHIMAGE_SCRIPT_DIR}/nsmbw/nsmbw3.sh" source "${PATCHIMAGE_SCRIPT_DIR}/nsmbw/wintermoon.sh"
;; ;;
NSMB12 | Vacation ) NSMB11 | NSMBW3 )
source "${PATCHIMAGE_SCRIPT_DIR}/nsmbw/summervacation.sh" source "${PATCHIMAGE_SCRIPT_DIR}/nsmbw/nsmbw3.sh"
;; ;;
NSMB13 | ASLM ) NSMB12 | Vacation )
source "${PATCHIMAGE_SCRIPT_DIR}/nsmbw/awesomersuperluigi.sh" source "${PATCHIMAGE_SCRIPT_DIR}/nsmbw/summervacation.sh"
;; ;;
NSMB14 | Sykland ) NSMB13 | ASLM )
source "${PATCHIMAGE_SCRIPT_DIR}/nsmbw/skyland.sh" source "${PATCHIMAGE_SCRIPT_DIR}/nsmbw/awesomersuperluigi.sh"
;; ;;
NSMB15 | RVLution ) NSMB14 | Sykland )
source "${PATCHIMAGE_SCRIPT_DIR}/nsmbw/rvlution.sh" source "${PATCHIMAGE_SCRIPT_DIR}/nsmbw/skyland.sh"
;; ;;
NSMB16 | Midi ) NSMB15 | RVLution )
source "${PATCHIMAGE_SCRIPT_DIR}/nsmbw/midissupermariowii.sh" source "${PATCHIMAGE_SCRIPT_DIR}/nsmbw/rvlution.sh"
;; ;;
NSMB17 | DarkUmbra ) NSMB16 | Midi )
source "${PATCHIMAGE_SCRIPT_DIR}/nsmbw/darkumbrasmb.sh" source "${PATCHIMAGE_SCRIPT_DIR}/nsmbw/midissupermariowii.sh"
;; ;;
NSMB18 | NewerApocalypse ) NSMB17 | DarkUmbra )
source "${PATCHIMAGE_SCRIPT_DIR}/nsmbw/newerapocalypse.sh" source "${PATCHIMAGE_SCRIPT_DIR}/nsmbw/darkumbrasmb.sh"
;; ;;
NSMB19 | LuigisSuperYoshiBros ) NSMB18 | NewerApocalypse )
source "${PATCHIMAGE_SCRIPT_DIR}/nsmbw/luigissuperyoshibros.sh" source "${PATCHIMAGE_SCRIPT_DIR}/nsmbw/newerapocalypse.sh"
;; ;;
NSMB20 | NewerFallingLeaf ) NSMB19 | LuigisSuperYoshiBros )
source "${PATCHIMAGE_SCRIPT_DIR}/nsmbw/newerfallingleaf.sh" source "${PATCHIMAGE_SCRIPT_DIR}/nsmbw/luigissuperyoshibros.sh"
;; ;;
NSMB21 | DevilMarioWinterSpecial ) NSMB20 | NewerFallingLeaf )
source "${PATCHIMAGE_SCRIPT_DIR}/nsmbw/devilmariowinterspecial.sh" source "${PATCHIMAGE_SCRIPT_DIR}/nsmbw/newerfallingleaf.sh"
;; ;;
NSMB22 | NewSMBWOtherWorld ) NSMB21 | DevilMarioWinterSpecial )
source "${PATCHIMAGE_SCRIPT_DIR}/nsmbw/newsmbwotherworld.sh" source "${PATCHIMAGE_SCRIPT_DIR}/nsmbw/devilmariowinterspecial.sh"
;; ;;
NSMB23 | TheLegendOfYoshi ) NSMB22 | NewSMBWOtherWorld )
source "${PATCHIMAGE_SCRIPT_DIR}/nsmbw/thelegendofyoshi.sh" source "${PATCHIMAGE_SCRIPT_DIR}/nsmbw/newsmbwotherworld.sh"
;; ;;
NSMB24 | RemixedSuperMarioBros ) NSMB23 | TheLegendOfYoshi )
source "${PATCHIMAGE_SCRIPT_DIR}/nsmbw/remixedsupermariobroswii.sh" source "${PATCHIMAGE_SCRIPT_DIR}/nsmbw/thelegendofyoshi.sh"
;; ;;
NSMB25 | GhostlySuperGhostBoos ) NSMB24 | RemixedSuperMarioBros )
source "${PATCHIMAGE_SCRIPT_DIR}/nsmbw/ghostlysuperghostbooswii.sh" source "${PATCHIMAGE_SCRIPT_DIR}/nsmbw/remixedsupermariobroswii.sh"
;; ;;
NSMB26 | RevisedSuperMarioBros ) NSMB25 | GhostlySuperGhostBoos )
source "${PATCHIMAGE_SCRIPT_DIR}/nsmbw/revisedsupermariobroswii.sh" source "${PATCHIMAGE_SCRIPT_DIR}/nsmbw/ghostlysuperghostbooswii.sh"
;; ;;
NSMB99 | NSMBWCharacters ) NSMB26 | RevisedSuperMarioBros )
source "${PATCHIMAGE_SCRIPT_DIR}/nsmbw/nsmbw_characters.sh" source "${PATCHIMAGE_SCRIPT_DIR}/nsmbw/revisedsupermariobroswii.sh"
;; ;;
MKW1 | Wiimmfi ) NSMB99 | NSMBWCharacters )
source "${PATCHIMAGE_SCRIPT_DIR}/mkwii/wiimmfi.sh" source "${PATCHIMAGE_SCRIPT_DIR}/nsmbw/nsmbw_characters.sh"
;; ;;
MKW2 | Wiimmpatch ) MKW1 | Wiimmfi )
source "${PATCHIMAGE_SCRIPT_DIR}/wiimmfi_generic.sh" source "${PATCHIMAGE_SCRIPT_DIR}/mkwii/wiimmfi.sh"
;; ;;
MKW3 | Mkwiimm ) MKW2 | Wiimmpatch )
source "${PATCHIMAGE_SCRIPT_DIR}/mkwii/mkwiimm.sh" source "${PATCHIMAGE_SCRIPT_DIR}/wiimmfi_generic.sh"
;; ;;
MKW4 | MkwiimmItems ) MKW3 | Mkwiimm )
source "${PATCHIMAGE_SCRIPT_DIR}/mkwii/mkwiimm_items.sh" source "${PATCHIMAGE_SCRIPT_DIR}/mkwii/mkwiimm.sh"
;; ;;
MKW5 | MkwiimmFonts ) MKW4 | MkwiimmItems )
source "${PATCHIMAGE_SCRIPT_DIR}/mkwii/mkwiimm_fonts.sh" source "${PATCHIMAGE_SCRIPT_DIR}/mkwii/mkwiimm_items.sh"
;; ;;
MKW6 | MkwiimmKarts ) MKW5 | MkwiimmFonts )
source "${PATCHIMAGE_SCRIPT_DIR}/mkwii/mkwiimm_karts.sh" source "${PATCHIMAGE_SCRIPT_DIR}/mkwii/mkwiimm_fonts.sh"
;; ;;
KAW1 | Kirby ) MKW6 | MkwiimmKarts )
source "${PATCHIMAGE_SCRIPT_DIR}/kirbywii.sh" source "${PATCHIMAGE_SCRIPT_DIR}/mkwii/mkwiimm_karts.sh"
;; ;;
TMS1 | TokyoMirageSessions ) KAW1 | Kirby )
source "${PATCHIMAGE_SCRIPT_DIR}/tokyomiragesessionsfe.sh" source "${PATCHIMAGE_SCRIPT_DIR}/kirbywii.sh"
;; ;;
PKMN1 | NeoX ) TMS1 | TokyoMirageSessions )
source "${PATCHIMAGE_SCRIPT_DIR}/pokemon/pokemonneox.sh" source "${PATCHIMAGE_SCRIPT_DIR}/tokyomiragesessionsfe.sh"
;; ;;
PKMN2 | NeoY ) PKMN1 | NeoX )
source "${PATCHIMAGE_SCRIPT_DIR}/pokemon/pokemonneoy.sh" source "${PATCHIMAGE_SCRIPT_DIR}/pokemon/pokemonneox.sh"
;; ;;
PKMN3 | RutileRuby ) PKMN2 | NeoY )
source "${PATCHIMAGE_SCRIPT_DIR}/pokemon/pokemonrutileruby.sh" source "${PATCHIMAGE_SCRIPT_DIR}/pokemon/pokemonneoy.sh"
;; ;;
PKMN4 | AlphaSapphire ) PKMN3 | RutileRuby )
source "${PATCHIMAGE_SCRIPT_DIR}/pokemon/pokemonstarsapphire.sh" source "${PATCHIMAGE_SCRIPT_DIR}/pokemon/pokemonrutileruby.sh"
;; ;;
PKMN5 | EternalX ) PKMN4 | AlphaSapphire )
source "${PATCHIMAGE_SCRIPT_DIR}/pokemon/pokemoneternalx.sh" source "${PATCHIMAGE_SCRIPT_DIR}/pokemon/pokemonstarsapphire.sh"
;; ;;
PKMN6 | WiltingY ) PKMN5 | EternalX )
source "${PATCHIMAGE_SCRIPT_DIR}/pokemon/pokemonwiltingy.sh" source "${PATCHIMAGE_SCRIPT_DIR}/pokemon/pokemoneternalx.sh"
;; ;;
PKMN7 | RisingRuby ) PKMN6 | WiltingY )
source "${PATCHIMAGE_SCRIPT_DIR}/pokemon/pokemonrisingruby.sh" source "${PATCHIMAGE_SCRIPT_DIR}/pokemon/pokemonwiltingy.sh"
;; ;;
PKMN8 | SinkingSapphire ) PKMN7 | RisingRuby )
source "${PATCHIMAGE_SCRIPT_DIR}/pokemon/pokemonsinkingsapphire.sh" source "${PATCHIMAGE_SCRIPT_DIR}/pokemon/pokemonrisingruby.sh"
;; ;;
BSECU | BravelySecondUncensored ) PKMN8 | SinkingSapphire )
source "${PATCHIMAGE_SCRIPT_DIR}/bravelyseconduncensored.sh" source "${PATCHIMAGE_SCRIPT_DIR}/pokemon/pokemonsinkingsapphire.sh"
;; ;;
ZEL1 | ParallelWorlds ) BSECU | BravelySecondUncensored )
source "${PATCHIMAGE_SCRIPT_DIR}/parallelworlds.sh" source "${PATCHIMAGE_SCRIPT_DIR}/bravelyseconduncensored.sh"
;; ;;
* ) ZEL1 | ParallelWorlds )
echo -e "specified Game ${GAME} not recognized" source "${PATCHIMAGE_SCRIPT_DIR}/parallelworlds.sh"
exit 9 ;;
;;
esac * )
echo -e "specified Game ${game} not recognized"
exit 9
;;
patchimage_riivolution () { esac
show_notes patchimage_riivolution () {
rm -rf "${WORKDIR}"
if [[ ${PATCHIMAGE_SOUNDTRACK_DOWNLOAD} == TRUE ]]; then show_notes
echo -e "\n*** A) download_soundtrack" rm -rf "${WORKDIR}"
download_soundtrack if [[ ${PATCHIMAGE_SOUNDTRACK_DOWNLOAD} == TRUE ]]; then
if [[ ${ONLY_SOUNDTRACK} == TRUE ]]; then echo -e "\n*** A) download_soundtrack"
exit 0 download_soundtrack
if [[ ${ONLY_SOUNDTRACK} == TRUE ]]; then
exit 0
fi
fi fi
fi
echo -e "\n*** 1) check_input_image" echo -e "\n*** 1) check_input_image"
check_input_image check_input_image
echo "*** 2) check_input_image_special" echo "*** 2) check_input_image_special"
check_input_image_special check_input_image_special
echo "*** 3) check_riivolution_patch" echo "*** 3) check_riivolution_patch"
check_riivolution_patch check_riivolution_patch
echo "*** 4) extract game" echo "*** 4) extract game"
${WIT} extract "${IMAGE}" "${WORKDIR}" --psel=DATA -q || exit 51 ${WIT} extract "${IMAGE}" "${WORKDIR}" --psel=DATA -q || exit 51
echo "*** 5) detect_game_version" echo "*** 5) detect_game_version"
detect_game_version detect_game_version
rm -f "${GAMEID}".wbfs "${CUSTOMID}".wbfs rm -f "${GAMEID}".wbfs "${CUSTOMID}".wbfs
echo "*** 6) place_files" echo "*** 6) place_files"
place_files || exit 45 place_files || exit 45
echo "*** 7) download_banner" echo "*** 7) download_banner"
download_banner download_banner
echo "*** 8) apply_banner" echo "*** 8) apply_banner"
apply_banner apply_banner
echo "*** 9) dolpatch" echo "*** 9) dolpatch"
dolpatch dolpatch
if [[ ${CUSTOMID} ]]; then if [[ ${CUSTOMID} ]]; then
GAMEID="${CUSTOMID}" GAMEID="${CUSTOMID}"
fi fi
if [[ ${PATCHIMAGE_SHARE_SAVE} == "TRUE" ]]; then if [[ ${PATCHIMAGE_SHARE_SAVE} == "TRUE" ]]; then
TMD_OPTS="" TMD_OPTS=""
else else
TMD_OPTS="--tt-id=K" TMD_OPTS="--tt-id=K"
fi fi
echo "*** 10) rebuild and store game" echo "*** 10) rebuild and store game"
"${WIT}" cp -o -q --disc-id="${GAMEID}" "${TMD_OPTS}" --name "${GAMENAME}" \ "${WIT}" cp -o -q --disc-id="${GAMEID}" "${TMD_OPTS}" --name "${GAMENAME}" \
-B "${WORKDIR}" "${PATCHIMAGE_GAME_DIR}"/"${GAMEID}".wbfs || exit 51 -B "${WORKDIR}" "${PATCHIMAGE_GAME_DIR}"/"${GAMEID}".wbfs || exit 51
echo "*** 12) remove workdir" echo "*** 12) remove workdir"
rm -rf "${WORKDIR}" rm -rf "${WORKDIR}"
echo -e "\n >>> ${GAMENAME} saved as: ${PATCHIMAGE_GAME_DIR}/${GAMEID}.wbfs\n" echo -e "\n >>> ${GAMENAME} saved as: ${PATCHIMAGE_GAME_DIR}/${GAMEID}.wbfs\n"
if [[ ${PATCHIMAGE_COVER_DOWNLOAD} == TRUE ]]; then if [[ ${PATCHIMAGE_COVER_DOWNLOAD} == TRUE ]]; then
echo -e "*** Z) download_covers" echo -e "*** Z) download_covers"
download_covers "${GAMEID}" download_covers "${GAMEID}"
echo -e "\nCovers downloaded to ${PATCHIMAGE_COVER_DIR}" echo -e "\nCovers downloaded to ${PATCHIMAGE_COVER_DIR}"
fi fi
} }
patchimage_mkwiimm () { patchimage_mkwiimm () {
show_notes show_notes
echo -e "\n*** 1) check_input_image" echo -e "\n*** 1) check_input_image"
check_input_image check_input_image
echo -e "\n*** 2) download_wiimm" echo -e "\n*** 2) download_wiimm"
download_wiimm download_wiimm
echo -e "\n*** 3) patch_wiimm" echo -e "\n*** 3) patch_wiimm"
patch_wiimm patch_wiimm
} }
patchimage_generic () { patchimage_generic () {
show_notes show_notes
echo -e "\n*** 1) check_input_image" echo -e "\n*** 1) check_input_image"
check_input_image_special check_input_image_special
echo -e "\n*** 2) pi_action" echo -e "\n*** 2) pi_action"
pi_action pi_action
} }
patchimage_ips () { patchimage_ips () {
show_notes show_notes
check_input_rom check_input_rom
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
else else
echo -e "error: patch (${PATCH}) could not be found" echo -e "error: patch (${PATCH}) could not be found"
exit 21 exit 21
fi fi
} }
patchimage_hans () { patchimage_hans () {
show_notes show_notes
echo -e "\n*** 1) check_input_rom" echo -e "\n*** 1) check_input_rom"
if [[ ${HANS_MULTI_SOURCE} ]]; then if [[ ${HANS_MULTI_SOURCE} ]]; then
check_input_rom_special check_input_rom_special
else check_input_rom else check_input_rom
fi fi
rm -rf romfs/ romfs.bin "${ROMFS}" rm -rf romfs/ romfs.bin "${ROMFS}"
echo -e "\n*** 2) check_hans_files" echo -e "\n*** 2) check_hans_files"
check_hans_files check_hans_files
echo -e "\n*** 3) unpack_3dsrom" echo -e "\n*** 3) unpack_3dsrom"
unpack_3dsrom "${ROM}" || exit 51 unpack_3dsrom "${ROM}" || exit 51
echo -e "\n*** 4) unpack_3dsromfs" echo -e "\n*** 4) unpack_3dsromfs"
unpack_3dsromfs romfs.bin || exit 51 unpack_3dsromfs romfs.bin || exit 51
echo -e "\n*** 5) patch_romfs" echo -e "\n*** 5) patch_romfs"
patch_romfs patch_romfs
echo -e "\n*** 6) repack_romfs" echo -e "\n*** 6) repack_romfs"
repack_3dsromfs romfs/ "${ROMFS}" || exit 51 repack_3dsromfs romfs/ "${ROMFS}" || exit 51
mv "${ROMFS}" "${PATCHIMAGE_ROM_DIR}" mv "${ROMFS}" "${PATCHIMAGE_ROM_DIR}"
echo " echo "
*** succesfully created new romfs as \"${PATCHIMAGE_ROM_DIR}/${ROMFS}\" *** succesfully created new romfs as \"${PATCHIMAGE_ROM_DIR}/${ROMFS}\"
" "
[[ ${DATA} ]] && echo \ [[ ${DATA} ]] && echo \
">> for Hans Banners / Launchers, place all files from ">> for Hans Banners / Launchers, place all files from
$(readlink -m "${DATA}") $(readlink -m "${DATA}")
into the root of your sd card into the root of your sd card
" "
} }
patchimage_delta () { patchimage_delta () {
show_notes show_notes
echo -e "\n*** 1) menu" echo -e "\n*** 1) menu"
menu || exit 9 menu || exit 9
echo -e "\n*** 2) patch" echo -e "\n*** 2) patch"
patch || exit 51 patch || exit 51
} }
case ${GAME_TYPE} in case ${GAME_TYPE} in
"RIIVOLUTION" ) "RIIVOLUTION" )
patchimage_riivolution patchimage_riivolution
;; ;;
"MKWIIMM") "MKWIIMM")
patchimage_mkwiimm patchimage_mkwiimm
;; ;;
"GENERIC") "GENERIC")
patchimage_generic patchimage_generic
;; ;;
"IPS" ) "IPS" )
patchimage_ips patchimage_ips
;; ;;
"HANS" ) "HANS" )
patchimage_hans patchimage_hans
;; ;;
"DELTA" ) "DELTA" )
patchimage_delta patchimage_delta
;; ;;
esac esac
done

View File

@ -96,7 +96,7 @@ ask_game () {
echo -e \ echo -e \
"${SUPPORTED_GAMES} "${SUPPORTED_GAMES}
Enter ID or Short Name for the Game you want to build: Enter ID or Short Name for the Game you want to build (multiple separated by space):
" "
read -r GAME read -r GAME
@ -622,6 +622,7 @@ while [[ $xcount -lt $pcount ]]; do
*** General parameters *** *** General parameters ***
--help | show this message --help | show this message
--game=<ID/Short Name> | specify game you want to create --game=<ID/Short Name> | specify game you want to create
--game=\"<ID1/Short Name1> <ID2/Short Name2>\" | specify multiple games you want to create
--list-games | show possible options for --game --list-games | show possible options for --game
*** Wii game parameters *** *** Wii game parameters ***