#!/bin/bash ################################################################################ # Script: build-nes-eng-1g1r.sh # Description: Builds a 1G1R (One Game One ROM) set for the Nintendo Entertainment # System (NES), focusing on English language ROMs only. This script # sets up the environment and calls the main processing script with # the appropriate parameters. # # Usage: ./build-nes-eng-1g1r.sh # # Dependencies: # - nointro-processor.sh # - config.sh # - logger.sh # - config-arrays.sh # # Example: # ./build-nes-eng-1g1r.sh ################################################################################ # Script identification SCRIPT_NAME="build-nes-eng-1g1r.sh" # Set umask to 000 to ensure files are created with 666 permissions umask 000 # Determine the directory of the current script SCRIPT_DIR="$(dirname "$(realpath "$0")")" # Determine the project root directory PROJECT_ROOT="$(dirname "$SCRIPT_DIR")" # Load configuration and logger from the script's directory source "${PROJECT_ROOT}/core/config.sh" source "${PROJECT_ROOT}/core/logger.sh" source "${PROJECT_ROOT}/core/config-arrays.sh" # Override languageArray to only include English LANGUAGE_ARRAY_OVERRIDE="En" source "${PROJECT_ROOT}/core/config-arrays.sh" # Re-source to apply the override # ROM Organization Configuration for English 1G1R builds # Keep USA and World games in root folder (easy access for most common games) export KEEP_IN_ROOT_REGIONS="USA,World" # Organize all kinds (no exceptions) export KEEP_IN_ROOT_KINDS="" # Enable language symlinks to create "By Language/English/" folders for non-USA games export ORGANIZE_LANGUAGES_BY_SYMLINK="true" # Exclude USA and World regions from language folders (prevent clutter - 500+ USA games) export LANGUAGE_EXCLUDE_REGIONS="USA,World" # Log the script name when it is called log "DEBUG" "Starting script: $(basename "$0")" # Function to set up the environment set_environment() { SYSTEM="nes" FILTER="eng.1g1r" SOURCESITE="myrient.erista.me/files/No-Intro" SOURCESYSTEM="Nintendo - Nintendo Entertainment System (Headered)" log "DEBUG" "Environment set up for $SYSTEM with filter $FILTER" } # Function to run the processing script run_processing() { log "INFO" "Starting processing for $SYSTEM with filter $FILTER" "${PROJECT_ROOT}/tools/nointro-processor.sh" -i -d -s "$SYSTEM" -f "$FILTER" -ss "$SOURCESITE" -sy "$SOURCESYSTEM" -l -r -k -u if [ $? -ne 0 ]; then log "ERROR" "Processing failed for $SYSTEM" exit 1 fi } # Function to display a summary display_summary() { log "INFO" "Processing completed successfully for $SYSTEM" log "INFO" "Summary:" log "INFO" " - System: $SYSTEM" log "INFO" " - Filter: $FILTER" log "INFO" " - Source: $SOURCESITE/$SOURCESYSTEM" } # Main script execution main() { set_environment run_processing display_summary } # Run the main function main