Merge pull request #14 from selfslaughter/master

1.5 - Save log file, automate alt rom folder detection, remove 1943 workaround.
This commit is contained in:
Locutus73
2019-11-16 21:30:32 +01:00
committed by GitHub

View File

@@ -15,6 +15,8 @@
# Copyright 2019 "self_slaughter"
# Version 1.5 - 2019-11-10 - Attempt to future proof alt rom creation
# Version 1.4 - 2019-11-07 - Show fails on screen / Generate report
# Version 1.3 - 2019-11-07 - More special cases / More ini options
# Version 1.2 - 2019-10-27 - Handle special cases
# Version 1.1 - 2019-10-05 - Read mame dir from ini file instead of editing script directly
@@ -186,6 +188,7 @@ grab_zips()
build_roms()
{
cd "$WORK_DIR/${CORE_NAME[$1]}"
scriptCount=$(ls *.sh | wc -l)
for buildScript in *.sh; do
source "$WORK_DIR/${CORE_NAME[$1]}/${buildScript%.*}.ini"
echo "- Building ROM"
@@ -205,28 +208,17 @@ build_roms()
fi
fi
# more special case handling
case ${CORE_NAME[$1]} in
Druaga) # alt roms
mkdir "$ALT_OUTPUT_DIR/a.druaga" &>/dev/null
if [ ! -f "$ALT_OUTPUT_DIR/a.druaga/${ofile}" ] || [ $OVERWRITE_EXISTING = "true" ]; then
cp "$WORK_DIR/${CORE_NAME[$1]}/${ofile}" "$ALT_OUTPUT_DIR/a.druaga/${ofile}"
# handle alt roms
if [ $scriptCount -gt 1 ]; then
CORE_INTERNAL_NAME="$(curl $CURL_RETRY -sLf "${CORE_URL[$1]}/raw/master/Arcade-${CORE_NAME[$1]}.sv" | awk '/CONF_STR[^=]*=/,/;/' | grep -oE -m1 '".*?;' | sed 's/[";]//g')"
if [ ! "$CORE_INTERNAL_NAME" == "" ]; then
mkdir "$ALT_OUTPUT_DIR/$CORE_INTERNAL_NAME" &>/dev/null
if [ ! -f "$ALT_OUTPUT_DIR/$CORE_INTERNAL_NAME/${ofile}" ] || [ $OVERWRITE_EXISTING = "true" ]; then
cp "$WORK_DIR/${CORE_NAME[$1]}/${ofile}" "$ALT_OUTPUT_DIR/$CORE_INTERNAL_NAME/${ofile}"
fi
;;
RallyX) # alt roms
mkdir "$ALT_OUTPUT_DIR/a.nrallyx" &>/dev/null
if [ ! -f "$ALT_OUTPUT_DIR/a.nrallyx/${ofile}" ] || [ $OVERWRITE_EXISTING = "true" ]; then
cp "$WORK_DIR/${CORE_NAME[$1]}/${ofile}" "$ALT_OUTPUT_DIR/a.nrallyx/${ofile}"
fi
;;
1943) # branding issues
if [ "${ofile}" == "a.JT1943.rom" ]; then
if [ ! -f "$OUTPUT_DIR/a.1943.rom" ] || [ $OVERWRITE_EXISTING = "true" ]; then
cp "$WORK_DIR/${CORE_NAME[$1]}/${ofile}" "$OUTPUT_DIR/a.1943.rom"
fi
fi
;;
esac
fi
fi
cp "$WORK_DIR/${CORE_NAME[$1]}/${ofile}" "$OUTPUT_DIR/${ofile}"
done
}
@@ -238,6 +230,19 @@ show_stats()
echo "Unverified: ${#unverified[@]}"
echo "Failed: ${#failed[@]}"
echo "Skipped: ${#skipped[@]}"
echo ""
echo "Fails: ${failed[@]}"
}
save_log()
{
LOG_FILE="${0%.*}.log"
echo "" >> "$LOG_FILE"
date >> "$LOG_FILE"
echo "- Verified (${#verified[@]}): ${verified[@]}" >> "$LOG_FILE"
echo "- Unverified (${#unverified[@]}): ${unverified[@]}" >> "$LOG_FILE"
echo "- Failed (${#failed[@]}): ${failed[@]}" >> "$LOG_FILE"
echo "- Skipped (${#skipped[@]}): ${skipped[@]}" >> "$LOG_FILE"
}
read_ini
@@ -257,4 +262,5 @@ do
done
show_stats
save_log
cleanup