Transitioned to BBN Launcher (BBNL) v2.0
- Dropped APA support in favor of loading OPL, POPStarter, Neutrino, and configuration files from the exFAT partition to speed up initialization. - Moved BBNL to the APA header to further improve loading times. - Removed dependency on renamed POPStarter ELF files to launch PS1 VCDs; POPStarter is now launched directly with a boot argument. - NHDDL now launches in ATA mode, improving startup time and avoiding potential error messages. - Updated Neutrino to version 1.6.1 - Updatec NHDDL to version MMCE + HDL Beta 4.17 - Added error message for failed repository updates
13
01-Setup.sh
@ -41,9 +41,18 @@ else
|
||||
|
||||
# Pull the latest changes
|
||||
git pull --ff-only
|
||||
|
||||
if [[ $? -ne 0 ]]; then
|
||||
echo
|
||||
echo "Error: Update failed. Delete the PSBBN-Definitive-English-Patch direcrtory and run the command:"
|
||||
echo
|
||||
echo "git clone https://github.com/CosmicScale/PSBBN-Definitive-English-Patch.git"
|
||||
echo
|
||||
read -n 1 -s -r -p "Then try running the script again. Press any key to exit"
|
||||
echo
|
||||
exit 1
|
||||
fi
|
||||
echo
|
||||
echo "The script has been updated to the latest version."
|
||||
echo "The repository has been successfully updated."
|
||||
read -n 1 -s -r -p "Press any key to exit, then run the script again."
|
||||
echo
|
||||
exit 0
|
||||
|
@ -54,8 +54,18 @@ else
|
||||
|
||||
# Pull the latest changes
|
||||
git pull --ff-only >> "${INSTALL_LOG}" 2>&1
|
||||
|
||||
echo "The script has been updated to the latest version." | tee -a "${INSTALL_LOG}"
|
||||
if [[ $? -ne 0 ]]; then
|
||||
echo
|
||||
echo "Error: Update failed. Delete the PSBBN-Definitive-English-Patch direcrtory and run the command:"
|
||||
echo
|
||||
echo "git clone https://github.com/CosmicScale/PSBBN-Definitive-English-Patch.git"
|
||||
echo
|
||||
read -n 1 -s -r -p "Then try running the script again. Press any key to exit"
|
||||
echo
|
||||
exit 1
|
||||
fi
|
||||
echo
|
||||
echo "The repository has been successfully updated." | tee -a "${INSTALL_LOG}"
|
||||
read -n 1 -s -r -p "Press any key to exit, then run the script again."
|
||||
echo
|
||||
exit 0
|
||||
@ -362,37 +372,31 @@ done
|
||||
COMMANDS="device ${DEVICE}\n"
|
||||
COMMANDS+="mkpart __linux.8 ${music_partition}M REISER\n"
|
||||
COMMANDS+="mkpart __.POPS ${pops_partition}M PFS\n"
|
||||
COMMANDS+="mkpart +OPL 128M PFS\nexit"
|
||||
COMMANDS+="exit"
|
||||
echo -e "$COMMANDS" | sudo "${TOOLKIT_PATH}/helper/PFS Shell.elf" >> "${INSTALL_LOG}" 2>&1
|
||||
|
||||
echo | tee -a "${INSTALL_LOG}"
|
||||
echo "Installing POPS and OPL..." | tee -a "${INSTALL_LOG}"
|
||||
echo "Installing POPS..." | tee -a "${INSTALL_LOG}"
|
||||
|
||||
cd "${TOOLKIT_PATH}/assets/"
|
||||
|
||||
# Copy POPS files and OPL to relevent partitions
|
||||
# Copy POPS files to __common
|
||||
COMMANDS="device ${DEVICE}\n"
|
||||
COMMANDS+="mount +OPL\n"
|
||||
COMMANDS+="put OPNPS2LD.ELF\n"
|
||||
COMMANDS+="umount\n"
|
||||
COMMANDS+="mount __common\n"
|
||||
COMMANDS+="lcd '${TOOLKIT_PATH}/assets/POPStarter'\n"
|
||||
COMMANDS+="mkdir POPS\n"
|
||||
COMMANDS+="cd POPS\n"
|
||||
COMMANDS+="put IGR_BG.TM2\n"
|
||||
COMMANDS+="put IGR_NO.TM2\n"
|
||||
COMMANDS+="put IGR_YES.TM2\n"
|
||||
COMMANDS+="lcd POPS-binaries-main\n"
|
||||
COMMANDS+="lcd '${TOOLKIT_PATH}/assets/POPS-binaries-main'\n"
|
||||
COMMANDS+="put POPS.ELF\n"
|
||||
COMMANDS+="put IOPRP252.IMG\n"
|
||||
COMMANDS+="cd ..\n"
|
||||
COMMANDS+="cd /\n"
|
||||
COMMANDS+="umount\n"
|
||||
COMMANDS+="exit"
|
||||
|
||||
# Pipe all commands to PFS Shell for mounting, copying, and unmounting
|
||||
echo -e "$COMMANDS" | sudo "${TOOLKIT_PATH}/helper/PFS Shell.elf" >> "${INSTALL_LOG}" 2>&1
|
||||
|
||||
cd "${TOOLKIT_PATH}"
|
||||
|
||||
|
||||
#//////////////////////////////////////////////// APA-Jail code by Berion ////////////////////////////////////////////////
|
||||
|
||||
@ -484,10 +488,9 @@ if echo "$output" | grep -q "aborting"; then
|
||||
fi
|
||||
|
||||
if sudo "${TOOLKIT_PATH}"/helper/HDL\ Dump.elf toc "${DEVICE}" | grep -q '__.POPS' && \
|
||||
sudo "${TOOLKIT_PATH}"/helper/HDL\ Dump.elf toc "${DEVICE}" | grep -q '__linux.8' && \
|
||||
sudo "${TOOLKIT_PATH}"/helper/HDL\ Dump.elf toc "${DEVICE}" | grep -q '+OPL'; then
|
||||
sudo "${TOOLKIT_PATH}"/helper/HDL\ Dump.elf toc "${DEVICE}" | grep -q '__linux.8'; then
|
||||
echo
|
||||
echo "POPS, Music and +OPL partitions were created successfully." | tee -a "${INSTALL_LOG}"
|
||||
echo "POPS and Music partitions were created successfully." | tee -a "${INSTALL_LOG}"
|
||||
sudo "${TOOLKIT_PATH}"/helper/HDL\ Dump.elf toc "${DEVICE}" >> "${INSTALL_LOG}"
|
||||
else
|
||||
echo
|
||||
|
@ -8,7 +8,7 @@ ICONS_DIR="${TOOLKIT_PATH}/icons"
|
||||
ARTWORK_DIR="${ICONS_DIR}/art"
|
||||
HELPER_DIR="${TOOLKIT_PATH}/helper"
|
||||
ASSETS_DIR="${TOOLKIT_PATH}/assets"
|
||||
POPSTARTER="${ASSETS_DIR}/POPSTARTER.ELF"
|
||||
POPSTARTER="${ASSETS_DIR}/POPStarter/POPSTARTER.ELF"
|
||||
NEUTRINO_DIR="${ASSETS_DIR}/neutrino"
|
||||
LOG_FILE="${TOOLKIT_PATH}/game-installer.log"
|
||||
MISSING_ART=${TOOLKIT_PATH}/missing-art.log
|
||||
@ -79,9 +79,19 @@ else
|
||||
|
||||
# Pull the latest changes
|
||||
git pull --ff-only >> "${LOG_FILE}" 2>&1
|
||||
|
||||
echo "The script has been updated to the latest version." | tee -a "${LOG_FILE}"
|
||||
read -n 1 -s -r -p "Press any key to exit, set your custom game path if needed, and then run the script again."
|
||||
if [[ $? -ne 0 ]]; then
|
||||
echo
|
||||
echo "Error: Update failed. Delete the PSBBN-Definitive-English-Patch direcrtory and run the command:"
|
||||
echo
|
||||
echo "git clone https://github.com/CosmicScale/PSBBN-Definitive-English-Patch.git"
|
||||
echo
|
||||
read -n 1 -s -r -p "Then try running the script again. Press any key to exit"
|
||||
echo
|
||||
exit 1
|
||||
fi
|
||||
echo
|
||||
echo "The repository has been successfully updated." | tee -a "${LOG_FILE}"
|
||||
read -n 1 -s -r -p "Press any key to exit, set your custom game path if required, then run the script again."
|
||||
echo
|
||||
exit 0
|
||||
else
|
||||
@ -206,7 +216,7 @@ echo | tee -a "${LOG_FILE}"
|
||||
echo "GAMES_PATH is valid: $GAMES_PATH" | tee -a "${LOG_FILE}"
|
||||
|
||||
# Create necessary folders if they don't exist
|
||||
for folder in APPS ART CFG CHT LNG THM VMC POPS CD DVD; do
|
||||
for folder in APPS ART CFG CHT LNG THM VMC POPS CD DVD bbnl; do
|
||||
dir="${GAMES_PATH}/${folder}"
|
||||
[[ -d "$dir" ]] || sudo mkdir -p "$dir" || {
|
||||
echo "Error: Failed to create $dir. Make sure you have write permissions to $GAMES_PATH" | tee -a "${LOG_FILE}"
|
||||
@ -239,13 +249,14 @@ echo "$DESC selected." >> "${LOG_FILE}"
|
||||
echo >> "${LOG_FILE}"
|
||||
|
||||
# Delete old game partitions
|
||||
delete_partition=$(sudo "${HELPER_DIR}/HDL Dump.elf" toc "$DEVICE" | grep -o 'PP\.[^ ]\+' | grep -Ev '^(PP\.WLE|PP\.LAUNCHER|PP\.DISC)$')
|
||||
delete_partition=$(sudo "${HELPER_DIR}/HDL Dump.elf" toc "$DEVICE" | grep -o 'PP\.[^ ]\+' | grep -Ev '^(PP\.WLE|PP\.DISC)$')
|
||||
COMMANDS="device ${DEVICE}\n"
|
||||
|
||||
while IFS= read -r partition; do
|
||||
COMMANDS+="rmpart ${partition}\n"
|
||||
done <<< "$delete_partition"
|
||||
|
||||
COMMANDS+="rmpart +OPL\n"
|
||||
COMMANDS+="exit"
|
||||
|
||||
echo -e "$COMMANDS" | sudo "${HELPER_DIR}/PFS Shell.elf" >> "${LOG_FILE}" 2>&1
|
||||
@ -258,7 +269,6 @@ if ! sudo "${HELPER_DIR}/HDL Dump.elf" toc "${DEVICE}" | grep -q 'PP.DISC'; then
|
||||
echo "Creating PP.DISC partition..." | tee -a "${LOG_FILE}"
|
||||
COMMANDS="device ${DEVICE}\n"
|
||||
COMMANDS+="rmpart PP.WLE\n"
|
||||
COMMANDS+="rmpart PP.LAUNCHER\n"
|
||||
COMMANDS+="mkpart PP.DISC 128M PFS\n"
|
||||
COMMANDS+="mount PP.DISC\n"
|
||||
COMMANDS+="mkdir res\n"
|
||||
@ -293,7 +303,6 @@ if ! sudo "${HELPER_DIR}/HDL Dump.elf" toc "${DEVICE}" | grep -q 'PP.WLE'; then
|
||||
echo >> "${LOG_FILE}"
|
||||
echo "Creating PP.WLE partition..." | tee -a "${LOG_FILE}"
|
||||
COMMANDS="device ${DEVICE}\n"
|
||||
COMMANDS+="rmpart PP.LAUNCHER\n"
|
||||
COMMANDS+="mkpart PP.WLE 128M PFS\n"
|
||||
COMMANDS+="mount PP.WLE\n"
|
||||
COMMANDS+="mkdir res\n"
|
||||
@ -321,99 +330,43 @@ COMMANDS+="exit"
|
||||
|
||||
echo -e "$COMMANDS" | sudo "${HELPER_DIR}/PFS Shell.elf" >> "${LOG_FILE}" 2>&1
|
||||
|
||||
# Check if PP.LAUNCHER exists and create it if not
|
||||
if ! sudo "${HELPER_DIR}/HDL Dump.elf" toc "${DEVICE}" | grep -q 'PP.LAUNCHER'; then
|
||||
echo >> "${LOG_FILE}"
|
||||
echo "Creating PP.LAUNCHER partition..." | tee -a "${LOG_FILE}"
|
||||
COMMANDS="device ${DEVICE}\n"
|
||||
COMMANDS+="mkpart PP.LAUNCHER 128M PFS\n"
|
||||
COMMANDS+="mount PP.LAUNCHER\n"
|
||||
COMMANDS+="mkdir res\n"
|
||||
COMMANDS+="umount\n"
|
||||
COMMANDS+="exit"
|
||||
echo -e "$COMMANDS" | sudo "${HELPER_DIR}/PFS Shell.elf" >> "${LOG_FILE}" 2>&1
|
||||
cd "${ASSETS_DIR}/LAUNCHER"
|
||||
sudo "${HELPER_DIR}/HDL Dump.elf" modify_header "${DEVICE}" PP.LAUNCHER >> "${LOG_FILE}" 2>&1
|
||||
fi
|
||||
|
||||
# Create PP.LAUNCHER
|
||||
echo >> "${LOG_FILE}"
|
||||
echo "Updating OPL/Neutrino..." | tee -a "${LOG_FILE}"
|
||||
echo "Updating chosen game launcher..." | tee -a "${LOG_FILE}"
|
||||
COMMANDS="device ${DEVICE}\n"
|
||||
COMMANDS+="mkpart PP.LAUNCHER 128M PFS\n"
|
||||
COMMANDS+="mount PP.LAUNCHER\n"
|
||||
COMMANDS+="lcd '${ASSETS_DIR}'\n"
|
||||
COMMANDS+="rm launcher.KELF\n"
|
||||
COMMANDS+="put launcher.KELF\n"
|
||||
COMMANDS+="mkdir res\n"
|
||||
COMMANDS+="cd res\n"
|
||||
|
||||
if [ "$LAUNCHER" = "OPL" ]; then
|
||||
COMMANDS+="lcd OPL\n"
|
||||
COMMANDS+="rm info.sys\n"
|
||||
COMMANDS+="rm jkt_001.png\n"
|
||||
COMMANDS+="lcd '${ASSETS_DIR}/OPL'\n"
|
||||
COMMANDS+="put info.sys\n"
|
||||
COMMANDS+="put jkt_001.png\n"
|
||||
COMMANDS+="cd /\n"
|
||||
COMMANDS+="rm nhddl.elf.lch\n"
|
||||
COMMANDS+="put OPNPS2LD.ELF.lch\n"
|
||||
elif [ "$LAUNCHER" = "NEUTRINO" ]; then
|
||||
COMMANDS+="lcd NHDDL\n"
|
||||
COMMANDS+="lcd '${ASSETS_DIR}/NHDDL'\n"
|
||||
COMMANDS+="put info.sys\n"
|
||||
COMMANDS+="put jkt_001.png\n"
|
||||
COMMANDS+="cd /\n"
|
||||
COMMANDS+="rm OPNPS2LD.ELF.lch\n"
|
||||
COMMANDS+="put nhddl.elf.lch\n"
|
||||
fi
|
||||
|
||||
COMMANDS+="umount\n"
|
||||
|
||||
# Generate the Neutrino file list
|
||||
neutrino_config=$( { ls -1 "$NEUTRINO_DIR/config" | sort; } 2>> "${LOG_FILE}" )
|
||||
neutrino_modules=$( { ls -1 "$NEUTRINO_DIR/modules" | sort; } 2>> "${LOG_FILE}" )
|
||||
|
||||
COMMANDS+="rmpart +OPL\n"
|
||||
COMMANDS+="mkpart +OPL 128M PFS\n"
|
||||
COMMANDS+="mount +OPL\n"
|
||||
COMMANDS+="cd /\n"
|
||||
COMMANDS+="lcd '${ASSETS_DIR}'\n"
|
||||
COMMANDS+="put OPNPS2LD.ELF\n"
|
||||
COMMANDS+="put nhddl.elf\n"
|
||||
COMMANDS+="mkdir neutrino\n"
|
||||
COMMANDS+="cd neutrino\n"
|
||||
COMMANDS+="lcd '${NEUTRINO_DIR}'\n"
|
||||
COMMANDS+="put neutrino.elf\n"
|
||||
COMMANDS+="put version.txt\n"
|
||||
COMMANDS+="mkdir config\n"
|
||||
COMMANDS+="mkdir modules\n"
|
||||
COMMANDS+="cd config\n"
|
||||
COMMANDS+="lcd '${NEUTRINO_DIR}/config'\n"
|
||||
|
||||
# Add put commands for neutrino_config
|
||||
if [ -n "$neutrino_config" ]; then
|
||||
while IFS= read -r file; do
|
||||
COMMANDS+="put \"$file\"\n"
|
||||
done <<< "$neutrino_config"
|
||||
fi
|
||||
|
||||
COMMANDS+="cd ..\n"
|
||||
COMMANDS+="cd modules\n"
|
||||
COMMANDS+="lcd '${NEUTRINO_DIR}/modules'\n"
|
||||
|
||||
# Add put commands for neutrino_modules
|
||||
if [ -n "$neutrino_modules" ]; then
|
||||
while IFS= read -r file; do
|
||||
COMMANDS+="put \"$file\"\n"
|
||||
done <<< "$neutrino_modules"
|
||||
fi
|
||||
|
||||
COMMANDS+="cd /\n"
|
||||
COMMANDS+="umount\n"
|
||||
COMMANDS+="exit"
|
||||
|
||||
echo >> "${LOG_FILE}"
|
||||
echo -e "$COMMANDS" | sudo "${HELPER_DIR}/PFS Shell.elf" >> "${LOG_FILE}" 2>&1
|
||||
|
||||
cd "${ASSETS_DIR}/BBNL"
|
||||
sudo "${HELPER_DIR}/HDL Dump.elf" modify_header "${DEVICE}" PP.LAUNCHER >> "${LOG_FILE}" 2>&1
|
||||
|
||||
cd "${TOOLKIT_PATH}"
|
||||
|
||||
# Activate the virtual environment
|
||||
echo | tee -a "${LOG_FILE}"
|
||||
echo "Activate Python virtual environment..." | tee -a "${LOG_FILE}"
|
||||
sleep 5
|
||||
source ./venv/bin/activate 2>>"${LOG_FILE}"
|
||||
source "${TOOLKIT_PATH}/venv/bin/activate" 2>>"${LOG_FILE}"
|
||||
|
||||
# Check if activation was successful
|
||||
if [ $? -ne 0 ]; then
|
||||
@ -423,7 +376,7 @@ if [ $? -ne 0 ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$LAUNCHER" = "NEUTRINO" ]; then
|
||||
if [[ "$LAUNCHER" == "NEUTRINO" ]]; then
|
||||
if find "$GAMES_PATH/CD" "$GAMES_PATH/DVD" -type f \( -iname "*.zso" \) | grep -q .; then
|
||||
echo | tee -a "${LOG_FILE}"
|
||||
echo "Games in the compressed ZSO format have been found in the CD/DVD folder." | tee -a "${LOG_FILE}"
|
||||
@ -454,7 +407,6 @@ fi
|
||||
|
||||
# Create games list of PS1 and PS2 games to be installed
|
||||
echo | tee -a "${LOG_FILE}"
|
||||
|
||||
echo "Creating PS1 games list..." | tee -a "${LOG_FILE}"
|
||||
python3 -u "${HELPER_DIR}/list-builder-ps1.py" "${GAMES_PATH}" "${PS1_LIST}" | tee -a "${LOG_FILE}"
|
||||
if [ "${PIPESTATUS[0]}" -ne 0 ]; then
|
||||
@ -542,64 +494,249 @@ if [ "$count" -gt "$partition_count" ]; then
|
||||
mv "${ALL_GAMES}.tmp" "$ALL_GAMES"
|
||||
fi
|
||||
|
||||
echo
|
||||
echo >> "${LOG_FILE}"
|
||||
echo "master.list:" >> "${LOG_FILE}"
|
||||
cat "$ALL_GAMES" >> "${LOG_FILE}"
|
||||
|
||||
echo | tee -a "${LOG_FILE}"
|
||||
read -n 1 -s -r -p "Ready to install games. Press any key to continue..."
|
||||
echo
|
||||
|
||||
mkdir -p "${ARTWORK_DIR}/tmp" 2>> "${LOG_FILE}"
|
||||
|
||||
echo | tee -a "${LOG_FILE}"
|
||||
echo "Downloading artwork..." | tee -a "${LOG_FILE}"
|
||||
|
||||
cd "${TOOLKIT_PATH}"
|
||||
|
||||
# First loop: Run the art downloader script for each game_id if artwork doesn't already exist
|
||||
while IFS='|' read -r game_title game_id publisher disc_type file_name; do
|
||||
# Check if the artwork file already exists
|
||||
png_file="${ARTWORK_DIR}/${game_id}.png"
|
||||
if [[ -f "$png_file" ]]; then
|
||||
echo "Artwork for game ID $game_id already exists. Skipping download." | tee -a "${LOG_FILE}"
|
||||
else
|
||||
# Attempt to download artwork using wget
|
||||
echo "Artwork not found locally. Attempting to download from the PSBBN art database..." | tee -a "${LOG_FILE}"
|
||||
wget --quiet --timeout=10 --tries=3 --output-document="$png_file" \
|
||||
"https://raw.githubusercontent.com/CosmicScale/psbbn-art-database/main/art/${game_id}.png"
|
||||
if [[ -s "$png_file" ]]; then
|
||||
echo "Successfully downloaded artwork for game ID: $game_id" | tee -a "${LOG_FILE}"
|
||||
else
|
||||
# If wget fails, run the art downloader
|
||||
[[ -f "$png_file" ]] && rm "$png_file"
|
||||
echo "Trying IGN for game ID: $game_id" | tee -a "${LOG_FILE}"
|
||||
node "${HELPER_DIR}/art_downloader.js" "$game_id" 2>&1 | tee -a "${LOG_FILE}"
|
||||
fi
|
||||
fi
|
||||
done < "$ALL_GAMES"
|
||||
|
||||
echo | tee -a "${LOG_FILE}"
|
||||
echo "Converting artwork..." | tee -a "${LOG_FILE}"
|
||||
|
||||
# Define input directory
|
||||
input_dir="${ARTWORK_DIR}/tmp"
|
||||
|
||||
# Check if the directory contains any files
|
||||
if compgen -G "${input_dir}/*" > /dev/null; then
|
||||
for file in "${input_dir}"/*; do
|
||||
# Extract the base filename without the path or extension
|
||||
base_name=$(basename "${file%.*}")
|
||||
|
||||
# Define output filename with .png extension
|
||||
output="${ARTWORK_DIR}/tmp/${base_name}.png"
|
||||
|
||||
# Get image dimensions using identify
|
||||
dimensions=$(identify -format "%w %h" "$file")
|
||||
width=$(echo "$dimensions" | cut -d' ' -f1)
|
||||
height=$(echo "$dimensions" | cut -d' ' -f2)
|
||||
|
||||
# Check if width >= 256 and height >= width
|
||||
if [[ $width -ge 256 && $height -ge $width ]]; then
|
||||
# Determine whether the image is square
|
||||
if [[ $width -eq $height ]]; then
|
||||
# Square: Resize without cropping
|
||||
echo "Resizing square image $file"
|
||||
convert "$file" -resize 256x256! -depth 8 -alpha off "$output"
|
||||
else
|
||||
# Not square: Resize and crop
|
||||
echo "Resizing and cropping $file"
|
||||
convert "$file" -resize 256x256^ -crop 256x256+0+44 -depth 8 -alpha off "$output"
|
||||
fi
|
||||
rm "$file"
|
||||
else
|
||||
echo "Skipping $file: does not meet size requirements" | tee -a "${LOG_FILE}"
|
||||
rm "$file"
|
||||
fi
|
||||
done
|
||||
else
|
||||
echo "No files to process in ${input_dir}" | tee -a "${LOG_FILE}"
|
||||
fi
|
||||
|
||||
cp ${ARTWORK_DIR}/tmp/* ${ARTWORK_DIR} >> "${LOG_FILE}" 2>&1
|
||||
|
||||
echo | tee -a "${LOG_FILE}"
|
||||
echo "Creating game assets..." | tee -a "${LOG_FILE}"
|
||||
|
||||
mkdir -p "${ICONS_DIR}/bbnl"
|
||||
|
||||
# Read the file line by line
|
||||
while IFS='|' read -r game_title game_id publisher disc_type file_name; do
|
||||
pp_game_id=$(echo "$game_id" | sed -E 's/_(...)\./-\1/;s/\.//')
|
||||
# Create a sub-folder named after the game_id
|
||||
game_dir="$ICONS_DIR/$game_id"
|
||||
mkdir -p "$game_dir" | tee -a "${LOG_FILE}"
|
||||
|
||||
# Determine the launcher value for this specific game
|
||||
if [[ "$disc_type" == "POPS" ]]; then
|
||||
launcher_value="POPS"
|
||||
cp "${ASSETS_DIR}/POPStarter/"{1.png,2.png,bg.png,man.xml} "$game_dir"
|
||||
else
|
||||
launcher_value="$LAUNCHER"
|
||||
fi
|
||||
|
||||
# Generate the info.sys file
|
||||
info_sys_filename="$game_dir/info.sys"
|
||||
cat > "$info_sys_filename" <<EOL
|
||||
title = $game_title
|
||||
title_id = $pp_game_id
|
||||
title_sub_id = 0
|
||||
release_date =
|
||||
developer_id =
|
||||
publisher_id = $publisher
|
||||
note =
|
||||
content_web =
|
||||
image_topviewflag = 0
|
||||
image_type = 0
|
||||
image_count = 1
|
||||
image_viewsec = 600
|
||||
copyright_viewflag = 0
|
||||
copyright_imgcount = 0
|
||||
genre =
|
||||
parental_lock = 1
|
||||
effective_date = 0
|
||||
expire_date = 0
|
||||
violence_flag = 0
|
||||
content_type = 255
|
||||
content_subtype = 0
|
||||
EOL
|
||||
echo "Created info.sys: $info_sys_filename" | tee -a "${LOG_FILE}"
|
||||
|
||||
# Copy the matching .png file and rename it to jkt_001.png
|
||||
png_file="${TOOLKIT_PATH}/icons/art/${game_id}.png"
|
||||
if [[ -f "$png_file" ]]; then
|
||||
cp "$png_file" "$game_dir/jkt_001.png"
|
||||
echo "Artwork found for $game_title" | tee -a "${LOG_FILE}"
|
||||
else
|
||||
if [[ "$disc_type" == "POPS" ]]; then
|
||||
cp "${TOOLKIT_PATH}/icons/art/ps1.png" "$game_dir/jkt_001.png"
|
||||
echo "Artwork not found for $game_title. Using default PS1 image" | tee -a "${LOG_FILE}"
|
||||
echo "$game_id $game_title" >> "${MISSING_ART}"
|
||||
else
|
||||
cp "${TOOLKIT_PATH}/icons/art/ps2.png" "$game_dir/jkt_001.png"
|
||||
echo "Artwork not found for $game_title. Using default PS2 image" | tee -a "${LOG_FILE}"
|
||||
echo "$game_id $game_title" >> "${MISSING_ART}"
|
||||
fi
|
||||
fi
|
||||
|
||||
done < "$ALL_GAMES"
|
||||
|
||||
echo | tee -a "${LOG_FILE}"
|
||||
echo "All info.sys, and .png files have been created in their respective sub-folders." | tee -a "${LOG_FILE}"
|
||||
echo | tee -a "${LOG_FILE}"
|
||||
echo "Creating Launcher partitions and installing game assets..." | tee -a "${LOG_FILE}"
|
||||
|
||||
cd "${ASSETS_DIR}/BBNL"
|
||||
|
||||
i=0
|
||||
# Reverse the lines of the file using tac and process each line
|
||||
while IFS='|' read -r game_title game_id publisher disc_type file_name; do
|
||||
|
||||
# Check the value of available
|
||||
if [ "$available" -lt 128 ]; then
|
||||
echo | tee -a "${LOG_FILE}"
|
||||
echo "Insufficient space for another partition." | tee -a "${LOG_FILE}"
|
||||
break
|
||||
fi
|
||||
|
||||
# Format game id correctly for partition
|
||||
pp_game_id=$(echo "$game_id" | sed -E 's/_(...)\./-\1/;s/\.//')
|
||||
|
||||
# Sanitize game_title by keeping only uppercase A-Z, 0-9, and underscores, and removing any trailing underscores
|
||||
sanitized_title=$(echo "$game_title" | tr 'a-z' 'A-Z' | sed 's/[^A-Z0-9]/_/g' | sed 's/^_//; s/_$//; s/__*/_/g')
|
||||
PARTITION_LABEL=$(printf "PP.%s.%s" "$pp_game_id" "$sanitized_title" | cut -c 1-32 | sed 's/_$//')
|
||||
|
||||
COMMANDS="device ${DEVICE}\n"
|
||||
COMMANDS+="mkpart ${PARTITION_LABEL} 128M PFS\n"
|
||||
COMMANDS+="mount ${PARTITION_LABEL}\n"
|
||||
COMMANDS+="cd /\n"
|
||||
|
||||
# Navigate into the sub-directory named after the gameid
|
||||
COMMANDS+="lcd '${ICONS_DIR}/${game_id}'\n"
|
||||
COMMANDS+="mkdir res\n"
|
||||
COMMANDS+="cd res\n"
|
||||
COMMANDS+="put info.sys\n"
|
||||
COMMANDS+="put jkt_001.png\n"
|
||||
|
||||
# Check if man.xml exists
|
||||
if [ -f "${ICONS_DIR}/${game_id}/man.xml" ]; then
|
||||
COMMANDS+="put 1.png\n"
|
||||
COMMANDS+="put 2.png\n"
|
||||
COMMANDS+="put bg.png\n"
|
||||
COMMANDS+="put man.xml\n"
|
||||
fi
|
||||
|
||||
COMMANDS+="umount\n"
|
||||
COMMANDS+="exit\n"
|
||||
|
||||
echo "Creating $PARTITION_LABEL" | tee -a "${LOG_FILE}"
|
||||
echo -e "$COMMANDS" | sudo "${HELPER_DIR}/PFS Shell.elf" >> "${LOG_FILE}" 2>&1
|
||||
|
||||
# Generate the BBNL cfg file
|
||||
# Determine the launcher value for this specific game
|
||||
if [[ "$disc_type" == "POPS" ]]; then
|
||||
launcher_value="POPS"
|
||||
else
|
||||
launcher_value="$LAUNCHER"
|
||||
fi
|
||||
bbnl_label="${PARTITION_LABEL:3}"
|
||||
bbnl_cfg="$ICONS_DIR/bbnl/$bbnl_label.cfg"
|
||||
cat > "$bbnl_cfg" <<EOL
|
||||
file_name=$file_name
|
||||
title_id=$game_id
|
||||
disc_type=$disc_type
|
||||
launcher=$launcher_value
|
||||
EOL
|
||||
sudo "${HELPER_DIR}/HDL Dump.elf" modify_header "${DEVICE}" "${PARTITION_LABEL}" >> "${LOG_FILE}" 2>&1
|
||||
|
||||
function_space
|
||||
((i++))
|
||||
done < <(tac "$ALL_GAMES")
|
||||
|
||||
cd "${TOOLKIT_PATH}"
|
||||
|
||||
# Set game launcher app
|
||||
if [[ "$LAUNCHER" == "OPL" ]]; then
|
||||
# Generate the BBNL cfg file for OPL
|
||||
cat > "$ICONS_DIR/bbnl/LAUNCHER.cfg" <<EOL
|
||||
file_name=/bbnl/OPNPS2LD.ELF
|
||||
launcher=ELF
|
||||
EOL
|
||||
fi
|
||||
|
||||
if [[ "$LAUNCHER" == "NEUTRINO" ]]; then
|
||||
# Generate the BBNL cfg file for NHDDL
|
||||
cat > "$ICONS_DIR/bbnl/LAUNCHER.cfg" <<EOL
|
||||
file_name=/bbnl/nhddl.elf
|
||||
launcher=ELF
|
||||
arg=-mode=ata
|
||||
EOL
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "Preparing to sync PS1 games..." | tee -a "${LOG_FILE}"
|
||||
|
||||
# Step 1: Create matching .ELF files for .VCD files
|
||||
echo "Creating matching .ELF files for .VCDs..." | tee -a "${LOG_FILE}"
|
||||
for vcd_file in "$POPS_FOLDER"/*.VCD; do
|
||||
if [ -f "$vcd_file" ]; then
|
||||
# Extract the base name (without extension) from the .VCD file
|
||||
base_name=$(basename "$vcd_file" .VCD)
|
||||
# Define the corresponding .ELF file name
|
||||
elf_file="$POPS_FOLDER/$base_name.ELF"
|
||||
# Copy and rename POPSTARTER.ELF to match the .VCD file
|
||||
if [ ! -f "$elf_file" ]; then
|
||||
echo "Creating $elf_file..." | tee -a "${LOG_FILE}"
|
||||
sudo cp "$POPSTARTER" "$elf_file" 2>>"${LOG_FILE}" || {
|
||||
echo
|
||||
echo "Error: Failed to create $elf_file." | tee -a "${LOG_FILE}"
|
||||
echo "Chech that $POPSTARTER exists and you have write permissions to $GAMES_PATH" | tee -a "${LOG_FILE}"
|
||||
echo
|
||||
read -n 1 -s -r -p "Press any key to exit..."
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
fi
|
||||
fi
|
||||
done
|
||||
echo "Matching .ELF files created successfully." | tee -a "${LOG_FILE}"
|
||||
|
||||
# Step 2: Delete .ELF files without matching .VCD files
|
||||
echo "Removing orphan .ELF files..." | tee -a "${LOG_FILE}"
|
||||
for elf_file in "$POPS_FOLDER"/*.ELF; do
|
||||
if [ -f "$elf_file" ]; then
|
||||
# Extract the base name (without extension) from the .ELF file
|
||||
base_name=$(basename "$elf_file" .ELF)
|
||||
# Check if a corresponding .VCD file exists
|
||||
vcd_file="$POPS_FOLDER/$base_name.VCD"
|
||||
if [ ! -f "$vcd_file" ]; then
|
||||
echo "Deleting orphan $elf_file..." | tee -a "${LOG_FILE}"
|
||||
sudo rm "$elf_file" 2>>"${LOG_FILE}" || {
|
||||
echo
|
||||
echo "Error: Failed to delete $elf_file." | tee -a "${LOG_FILE}"
|
||||
echo "Chech that you have write permissions to $GAMES_PATH" | tee -a "${LOG_FILE}"
|
||||
echo
|
||||
read -n 1 -s -r -p "Press any key to exit..."
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
fi
|
||||
fi
|
||||
done
|
||||
echo "Orphan .ELF files removed successfully." | tee -a "${LOG_FILE}"
|
||||
sudo rm "$POPS_FOLDER"/*.[eE][lL][fF] >> "${LOG_FILE}" 2>&1
|
||||
|
||||
# Get the local POPS folder size in MB
|
||||
POPS_SIZE=$(du -s --block-size=1M "$POPS_FOLDER" | awk '{print $1}')
|
||||
@ -626,7 +763,7 @@ if [ "$POPS_SIZE" -gt "$THRESHOLD" ]; then
|
||||
fi
|
||||
|
||||
# Generate the local file list directly in a variable
|
||||
local_files=$( { ls -1 "$POPS_FOLDER" | grep -Ei '\.VCD$|\.ELF$' | sort; } 2>> "${LOG_FILE}" )
|
||||
local_files=$( { ls -1 "$POPS_FOLDER" | grep -Ei '\.VCD$' | sort; } 2>> "${LOG_FILE}" )
|
||||
|
||||
# Build the commands for PFS Shell
|
||||
COMMANDS="device ${DEVICE}\n"
|
||||
@ -710,7 +847,7 @@ echo >> "${LOG_FILE}"
|
||||
|
||||
# Syncing PS2 games
|
||||
echo "Mounting OPL partition..." | tee -a "${LOG_FILE}"
|
||||
mkdir "${TOOLKIT_PATH}"/OPL 2>> "${LOG_FILE}"
|
||||
mkdir -p "${TOOLKIT_PATH}"/OPL 2>> "${LOG_FILE}"
|
||||
|
||||
sudo mount ${DEVICE}3 "${TOOLKIT_PATH}"/OPL >> "${LOG_FILE}" 2>&1
|
||||
|
||||
@ -730,7 +867,7 @@ if [ $? -ne 0 ]; then
|
||||
fi
|
||||
|
||||
# Create necessary folders if they don't exist
|
||||
for folder in APPS ART CFG CHT LNG THM VMC POPS CD DVD; do
|
||||
for folder in APPS ART CFG CHT LNG THM VMC CD DVD bbnl; do
|
||||
dir="${TOOLKIT_PATH}/OPL/${folder}"
|
||||
[[ -d "$dir" ]] || sudo mkdir -p "$dir" || {
|
||||
echo "Error: Failed to create $dir." | tee -a "${LOG_FILE}"
|
||||
@ -740,11 +877,8 @@ for folder in APPS ART CFG CHT LNG THM VMC POPS CD DVD; do
|
||||
}
|
||||
done
|
||||
|
||||
# Get the local CD & DVD folder's size in MB
|
||||
CD_FOLDER=$(du -s --block-size=1M "${GAMES_PATH}/CD" | awk '{print $1}')
|
||||
DVD_FOLDER=$(du -s --block-size=1M "${GAMES_PATH}/DVD" | awk '{print $1}')
|
||||
|
||||
PS2_SIZE=$((CD_FOLDER + DVD_FOLDER))
|
||||
# Get the local games folder size in MB
|
||||
PS2_SIZE=$(du -s --block-size=1M "${GAMES_PATH}" | awk '{print $1}')
|
||||
|
||||
echo | tee -a "${LOG_FILE}"
|
||||
echo "Size of PS2 games: $PS2_SIZE MB" | tee -a "${LOG_FILE}"
|
||||
@ -765,9 +899,72 @@ if [ "$PS2_SIZE" -gt "$THRESHOLD" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo | tee -a "${LOG_FILE}"
|
||||
echo "Checking for POPStarter update..." | tee -a "${LOG_FILE}"
|
||||
sudo rsync -ut --progress "${POPSTARTER}" "${TOOLKIT_PATH}/OPL/bbnl/" 2>>"${LOG_FILE}" | tee -a "${LOG_FILE}"
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
echo
|
||||
echo
|
||||
echo "Error: Failed to install POPStarter. See ${LOG_FILE} for details." | tee -a "${LOG_FILE}"
|
||||
read -n 1 -s -r -p "Press any key to exit..."
|
||||
echo
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Checking for OPL update..." | tee -a "${LOG_FILE}"
|
||||
sudo rsync -ut --progress "${ASSETS_DIR}/OPL/OPNPS2LD.ELF" "${TOOLKIT_PATH}/OPL/bbnl/" 2>>"${LOG_FILE}" | tee -a "${LOG_FILE}"
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
echo
|
||||
echo
|
||||
echo "Error: Failed to install OPL. See ${LOG_FILE} for details." | tee -a "${LOG_FILE}"
|
||||
read -n 1 -s -r -p "Press any key to exit..."
|
||||
echo
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Checking for NHDDL update..." | tee -a "${LOG_FILE}"
|
||||
sudo rsync -ut --progress "${ASSETS_DIR}/NHDDL/nhddl.elf" "${TOOLKIT_PATH}/OPL/bbnl/" 2>>"${LOG_FILE}" | tee -a "${LOG_FILE}"
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
echo
|
||||
echo
|
||||
echo "Error: Failed to install NHDDL. See ${LOG_FILE} for details." | tee -a "${LOG_FILE}"
|
||||
read -n 1 -s -r -p "Press any key to exit..."
|
||||
echo
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Checking fot Neutrino update..." | tee -a "${LOG_FILE}"
|
||||
sudo rsync -rut --progress "${NEUTRINO_DIR}/" "${TOOLKIT_PATH}/OPL/neutrino/" 2>>"${LOG_FILE}" | tee -a "${LOG_FILE}"
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
echo
|
||||
echo
|
||||
echo "Error: Failed to install Neutrino. See ${LOG_FILE} for details." | tee -a "${LOG_FILE}"
|
||||
read -n 1 -s -r -p "Press any key to exit..."
|
||||
echo
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo | tee -a "${LOG_FILE}"
|
||||
echo "Copying BBNL configs..." | tee -a "${LOG_FILE}"
|
||||
sudo rm "${TOOLKIT_PATH}"/OPL/bbnl/*.cfg >> "${LOG_FILE}" 2>&1
|
||||
sudo cp "${ICONS_DIR}"/bbnl/*.cfg "${TOOLKIT_PATH}/OPL/bbnl" >> "${LOG_FILE}" 2>&1
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
echo
|
||||
echo
|
||||
echo "Error: Failed to copy BBNL config files. See ${LOG_FILE} for details." | tee -a "${LOG_FILE}"
|
||||
read -n 1 -s -r -p "Press any key to exit..."
|
||||
echo
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo | tee -a "${LOG_FILE}"
|
||||
echo "Syncing PS2 games..." | tee -a "${LOG_FILE}"
|
||||
sudo rsync -r --progress --ignore-existing --delete --exclude=".*" "${GAMES_PATH}/CD/" "${TOOLKIT_PATH}/OPL/CD/" 2>>"${LOG_FILE}" | tee -a "${LOG_FILE}"
|
||||
sudo rsync -rL --progress --ignore-existing --delete --exclude=".*" "${GAMES_PATH}/CD/" "${TOOLKIT_PATH}/OPL/CD/" 2>>"${LOG_FILE}" | tee -a "${LOG_FILE}"
|
||||
if [ $? -ne 0 ]; then
|
||||
echo
|
||||
echo
|
||||
@ -777,7 +974,7 @@ if [ $? -ne 0 ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
sudo rsync -r --progress --ignore-existing --delete --exclude=".*" "${GAMES_PATH}/DVD/" "${TOOLKIT_PATH}/OPL/DVD/" 2>>"${LOG_FILE}" | tee -a "${LOG_FILE}"
|
||||
sudo rsync -rL --progress --ignore-existing --delete --exclude=".*" "${GAMES_PATH}/DVD/" "${TOOLKIT_PATH}/OPL/DVD/" 2>>"${LOG_FILE}" | tee -a "${LOG_FILE}"
|
||||
if [ $? -ne 0 ]; then
|
||||
echo
|
||||
echo
|
||||
@ -786,226 +983,58 @@ if [ $? -ne 0 ]; then
|
||||
echo
|
||||
exit 1
|
||||
fi
|
||||
sudo cp --update=none "${GAMES_PATH}/APPS/"* "${TOOLKIT_PATH}"/OPL/APPS >> "${LOG_FILE}" 2>&1
|
||||
sudo cp --update=none "${GAMES_PATH}/ART/"* "${TOOLKIT_PATH}"/OPL/ART >> "${LOG_FILE}" 2>&1
|
||||
sudo cp --update=none "${GAMES_PATH}/CFG/"* "${TOOLKIT_PATH}"/OPL/CFG >> "${LOG_FILE}" 2>&1
|
||||
sudo cp --update=none "${GAMES_PATH}/CHT/"* "${TOOLKIT_PATH}"/OPL/CHT >> "${LOG_FILE}" 2>&1
|
||||
sudo cp --update=none "${GAMES_PATH}/LNG/"* "${TOOLKIT_PATH}"/OPL/LNG >> "${LOG_FILE}" 2>&1
|
||||
sudo cp --update=none "${GAMES_PATH}/THM/"* "${TOOLKIT_PATH}"/OPL/THM >> "${LOG_FILE}" 2>&1
|
||||
sudo cp --update=none "${GAMES_PATH}/VMC/"* "${TOOLKIT_PATH}"/OPL/VMC >> "${LOG_FILE}" 2>&1
|
||||
|
||||
# Define the directories to check
|
||||
dirs=(
|
||||
"${GAMES_PATH}/APPS"
|
||||
"${GAMES_PATH}/ART"
|
||||
"${GAMES_PATH}/CFG"
|
||||
"${GAMES_PATH}/CHT"
|
||||
"${GAMES_PATH}/LNG"
|
||||
"${GAMES_PATH}/THM"
|
||||
"${GAMES_PATH}/VMC"
|
||||
)
|
||||
|
||||
# Flag to track if any files exist
|
||||
files_exist=false
|
||||
|
||||
# Check each directory and copy files if not empty
|
||||
for dir in "${dirs[@]}"; do
|
||||
if [ -d "$dir" ] && [ -n "$(find "$dir" -type f ! -name '.*' -print -quit 2>/dev/null)" ]; then
|
||||
# Create the subdirectory in the destination path using the directory name
|
||||
folder_name=$(basename "$dir")
|
||||
dest_dir=""${TOOLKIT_PATH}"/OPL/$folder_name"
|
||||
|
||||
# Copy non-hidden files to the corresponding destination subdirectory
|
||||
if [ "$folder_name" == "CFG" ] || [ "$folder_name" == "VMC" ]; then
|
||||
echo "Copying OPL $folder_name files..." | tee -a "${LOG_FILE}"
|
||||
find "$dir" -type f ! -name '.*' -exec sudo cp --update=none {} "$dest_dir" \; >> "${LOG_FILE}" 2>&1
|
||||
else
|
||||
if [ -n "$(find "$dir" -mindepth 1 ! -name '.*' -print -quit)" ]; then
|
||||
echo "Copying OPL $folder_name files..." | tee -a "${LOG_FILE}"
|
||||
sudo cp -r "$dir"/* "$dest_dir" >> "${LOG_FILE}" 2>&1
|
||||
fi
|
||||
fi
|
||||
files_exist=true
|
||||
fi
|
||||
done
|
||||
|
||||
# Print message based on the check
|
||||
if ! $files_exist; then
|
||||
echo "No OPL files to copy." | tee -a "${LOG_FILE}"
|
||||
fi
|
||||
|
||||
echo | tee -a "${LOG_FILE}"
|
||||
echo "PS2 Games on PS2 drive:" >> "${LOG_FILE}"
|
||||
ls -1 "${TOOLKIT_PATH}/OPL/CD/" >> "${LOG_FILE}" 2>&1
|
||||
ls -1 "${TOOLKIT_PATH}/OPL/DVD/" >> "${LOG_FILE}" 2>&1
|
||||
echo >> "${LOG_FILE}" 2>&1
|
||||
echo "PS2 games successfully synced" | tee -a "${LOG_FILE}"
|
||||
echo | tee -a "${LOG_FILE}"
|
||||
echo "Unmounting OPL partition..." | tee -a "${LOG_FILE}"
|
||||
sync
|
||||
sudo umount -l "${TOOLKIT_PATH}"/OPL
|
||||
|
||||
mkdir -p "${ARTWORK_DIR}/tmp" 2>> "${LOG_FILE}"
|
||||
|
||||
echo | tee -a "${LOG_FILE}"
|
||||
echo "Downloading artwork..." | tee -a "${LOG_FILE}"
|
||||
|
||||
cd "${TOOLKIT_PATH}"
|
||||
|
||||
# First loop: Run the art downloader script for each game_id if artwork doesn't already exist
|
||||
while IFS='|' read -r game_title game_id publisher disc_type file_name; do
|
||||
# Check if the artwork file already exists
|
||||
png_file="${ARTWORK_DIR}/${game_id}.png"
|
||||
if [[ -f "$png_file" ]]; then
|
||||
echo "Artwork for game ID $game_id already exists. Skipping download." | tee -a "${LOG_FILE}"
|
||||
else
|
||||
# Attempt to download artwork using wget
|
||||
echo "Artwork not found locally. Attempting to download from the PSBBN art database..." | tee -a "${LOG_FILE}"
|
||||
wget --quiet --timeout=10 --tries=3 --output-document="$png_file" \
|
||||
"https://raw.githubusercontent.com/CosmicScale/psbbn-art-database/main/art/${game_id}.png"
|
||||
if [[ -s "$png_file" ]]; then
|
||||
echo "Successfully downloaded artwork for game ID: $game_id" | tee -a "${LOG_FILE}"
|
||||
else
|
||||
# If wget fails, run the art downloader
|
||||
[[ -f "$png_file" ]] && rm "$png_file"
|
||||
echo "Trying IGN for game ID: $game_id" | tee -a "${LOG_FILE}"
|
||||
node "${HELPER_DIR}/art_downloader.js" "$game_id" 2>&1 | tee -a "${LOG_FILE}"
|
||||
fi
|
||||
fi
|
||||
done < "$ALL_GAMES"
|
||||
|
||||
echo | tee -a "${LOG_FILE}"
|
||||
echo "Converting artwork..." | tee -a "${LOG_FILE}"
|
||||
|
||||
# Define input directory
|
||||
input_dir="${ARTWORK_DIR}/tmp"
|
||||
|
||||
# Check if the directory contains any files
|
||||
if compgen -G "${input_dir}/*" > /dev/null; then
|
||||
for file in "${input_dir}"/*; do
|
||||
# Extract the base filename without the path or extension
|
||||
base_name=$(basename "${file%.*}")
|
||||
|
||||
# Define output filename with .png extension
|
||||
output="${ARTWORK_DIR}/tmp/${base_name}.png"
|
||||
|
||||
# Get image dimensions using identify
|
||||
dimensions=$(identify -format "%w %h" "$file")
|
||||
width=$(echo "$dimensions" | cut -d' ' -f1)
|
||||
height=$(echo "$dimensions" | cut -d' ' -f2)
|
||||
|
||||
# Check if width >= 256 and height >= width
|
||||
if [[ $width -ge 256 && $height -ge $width ]]; then
|
||||
# Determine whether the image is square
|
||||
if [[ $width -eq $height ]]; then
|
||||
# Square: Resize without cropping
|
||||
echo "Resizing square image $file"
|
||||
convert "$file" -resize 256x256! -depth 8 -alpha off "$output"
|
||||
else
|
||||
# Not square: Resize and crop
|
||||
echo "Resizing and cropping $file"
|
||||
convert "$file" -resize 256x256^ -crop 256x256+0+44 -depth 8 -alpha off "$output"
|
||||
fi
|
||||
rm "$file"
|
||||
else
|
||||
echo "Skipping $file: does not meet size requirements" | tee -a "${LOG_FILE}"
|
||||
rm "$file"
|
||||
fi
|
||||
done
|
||||
else
|
||||
echo "No files to process in ${input_dir}" | tee -a "${LOG_FILE}"
|
||||
fi
|
||||
|
||||
cp ${ARTWORK_DIR}/tmp/* ${ARTWORK_DIR} >> "${LOG_FILE}" 2>&1
|
||||
|
||||
echo | tee -a "${LOG_FILE}"
|
||||
echo "Creating game assets..." | tee -a "${LOG_FILE}"
|
||||
|
||||
# Read the file line by line
|
||||
while IFS='|' read -r game_title game_id publisher disc_type file_name; do
|
||||
pp_game_id=$(echo "$game_id" | sed -E 's/_(...)\./-\1/;s/\.//')
|
||||
# Create a sub-folder named after the game_id
|
||||
game_dir="$ICONS_DIR/$game_id"
|
||||
mkdir -p "$game_dir" | tee -a "${LOG_FILE}"
|
||||
|
||||
# Determine the launcher value for this specific game
|
||||
if [[ "$disc_type" == "POPS" ]]; then
|
||||
launcher_value="POPS"
|
||||
cp "${ASSETS_DIR}/"{1.png,2.png,bg.png,man.xml} "$game_dir"
|
||||
else
|
||||
launcher_value="$LAUNCHER"
|
||||
fi
|
||||
|
||||
# Generate the launcher.cfg file
|
||||
launcher_cfg_filename="$game_dir/launcher.cfg"
|
||||
cat > "$launcher_cfg_filename" <<EOL
|
||||
file_name=$file_name
|
||||
title_id=$game_id
|
||||
disc_type=$disc_type
|
||||
launcher=$launcher_value
|
||||
EOL
|
||||
echo "Created launcher.cfg: $launcher_cfg_filename" | tee -a "${LOG_FILE}"
|
||||
|
||||
# Generate the info.sys file
|
||||
info_sys_filename="$game_dir/info.sys"
|
||||
cat > "$info_sys_filename" <<EOL
|
||||
title = $game_title
|
||||
title_id = $pp_game_id
|
||||
title_sub_id = 0
|
||||
release_date =
|
||||
developer_id =
|
||||
publisher_id = $publisher
|
||||
note =
|
||||
content_web =
|
||||
image_topviewflag = 0
|
||||
image_type = 0
|
||||
image_count = 1
|
||||
image_viewsec = 600
|
||||
copyright_viewflag = 0
|
||||
copyright_imgcount = 0
|
||||
genre =
|
||||
parental_lock = 1
|
||||
effective_date = 0
|
||||
expire_date = 0
|
||||
violence_flag = 0
|
||||
content_type = 255
|
||||
content_subtype = 0
|
||||
EOL
|
||||
echo "Created info.sys: $info_sys_filename" | tee -a "${LOG_FILE}"
|
||||
|
||||
# Copy the matching .png file and rename it to jkt_001.png
|
||||
png_file="${TOOLKIT_PATH}/icons/art/${game_id}.png"
|
||||
if [[ -f "$png_file" ]]; then
|
||||
cp "$png_file" "$game_dir/jkt_001.png"
|
||||
echo "Artwork found for $game_title" | tee -a "${LOG_FILE}"
|
||||
else
|
||||
if [[ "$disc_type" == "POPS" ]]; then
|
||||
cp "${TOOLKIT_PATH}/icons/art/ps1.png" "$game_dir/jkt_001.png"
|
||||
echo "Artwork not found for $game_title. Using default PS1 image" | tee -a "${LOG_FILE}"
|
||||
echo "$game_id $game_title" >> "${MISSING_ART}"
|
||||
else
|
||||
cp "${TOOLKIT_PATH}/icons/art/ps2.png" "$game_dir/jkt_001.png"
|
||||
echo "Artwork not found for $game_title. Using default PS2 image" | tee -a "${LOG_FILE}"
|
||||
echo "$game_id $game_title" >> "${MISSING_ART}"
|
||||
fi
|
||||
fi
|
||||
|
||||
done < "$ALL_GAMES"
|
||||
|
||||
echo | tee -a "${LOG_FILE}"
|
||||
echo "All .cfg, info.sys, and .png files have been created in their respective sub-folders." | tee -a "${LOG_FILE}"
|
||||
echo | tee -a "${LOG_FILE}"
|
||||
echo "Installing game assets..." | tee -a "${LOG_FILE}"
|
||||
|
||||
cd "${ASSETS_DIR}"
|
||||
|
||||
i=0
|
||||
# Reverse the lines of the file using tac and process each line
|
||||
while IFS='|' read -r game_title game_id publisher disc_type file_name; do
|
||||
|
||||
# Check the value of available
|
||||
if [ "$available" -lt 128 ]; then
|
||||
echo | tee -a "${LOG_FILE}"
|
||||
echo "Insufficient space for another partition." | tee -a "${LOG_FILE}"
|
||||
break
|
||||
fi
|
||||
|
||||
# Format game id correctly for partition
|
||||
pp_game_id=$(echo "$game_id" | sed -E 's/_(...)\./-\1/;s/\.//')
|
||||
|
||||
# Sanitize game_title by keeping only uppercase A-Z, 0-9, and underscores, and removing any trailing underscores
|
||||
sanitized_title=$(echo "$game_title" | tr 'a-z' 'A-Z' | sed 's/[^A-Z0-9]/_/g' | sed 's/^_//; s/_$//; s/__*/_/g')
|
||||
PARTITION_LABEL=$(printf "PP.%s.%s" "$pp_game_id" "$sanitized_title" | cut -c 1-32 | sed 's/_$//')
|
||||
|
||||
COMMANDS="device ${DEVICE}\n"
|
||||
|
||||
COMMANDS+="mkpart ${PARTITION_LABEL} 128M PFS\n"
|
||||
COMMANDS+="mount ${PARTITION_LABEL}\n"
|
||||
COMMANDS+="cd /\n"
|
||||
COMMANDS+="lcd '${ASSETS_DIR}'\n"
|
||||
COMMANDS+="put bbnl.KELF\n"
|
||||
|
||||
# Navigate into the sub-directory named after the gameid
|
||||
COMMANDS+="lcd '${ICONS_DIR}/${game_id}'\n"
|
||||
COMMANDS+="put 'launcher.cfg'\n"
|
||||
COMMANDS+="mkdir res\n"
|
||||
COMMANDS+="cd res\n"
|
||||
COMMANDS+="put info.sys\n"
|
||||
COMMANDS+="put jkt_001.png\n"
|
||||
COMMANDS+="put 1.png\n"
|
||||
COMMANDS+="put 2.png\n"
|
||||
COMMANDS+="put bg.png\n"
|
||||
COMMANDS+="put man.xml\n"
|
||||
COMMANDS+="umount\n"
|
||||
COMMANDS+="exit\n"
|
||||
|
||||
echo "Creating $PARTITION_LABEL" | tee -a "${LOG_FILE}"
|
||||
echo -e "$COMMANDS" | sudo "${HELPER_DIR}/PFS Shell.elf" >> "${LOG_FILE}" 2>&1
|
||||
|
||||
sudo "${HELPER_DIR}/HDL Dump.elf" modify_header "${DEVICE}" "${PARTITION_LABEL}" >> "${LOG_FILE}" 2>&1
|
||||
|
||||
function_space
|
||||
((i++))
|
||||
done < <(tac "$ALL_GAMES")
|
||||
|
||||
# Submit missing artwork to the PSBBN Art Database
|
||||
|
||||
cp $MISSING_ART $ARTWORK_DIR/tmp >> "${LOG_FILE}" 2>&1
|
||||
@ -1043,4 +1072,4 @@ echo | tee -a "${LOG_FILE}"
|
||||
echo "Game installer script complete." | tee -a "${LOG_FILE}"
|
||||
echo
|
||||
read -n 1 -s -r -p "Press any key to exit..."
|
||||
echo
|
||||
echo
|
27
README.md
@ -45,15 +45,25 @@ This project uses [webhook.site](https://webhook.site/) to automatically contrib
|
||||
- PSBBN image updated to version 2.01:
|
||||
- Set USB keyboard layout to US English. Press `ALT+~` to toggle between kana and direct input
|
||||
- Minor corrections to the English translation
|
||||
- Added **Open PS2 Loader** and **Launch Disc** to the Game Channel
|
||||
- Added [Open PS2 Loader](https://github.com/ps2homebrew/Open-PS2-Loader) and [Launch Disc](https://github.com/CosmicScale/Retro-GEM-PS2-Disc-Launcher) to the Game Channel
|
||||
- The Game Installer script has been updated to create and delete game partitions as needed. Say goodbye to those annoying "Coming soon..." placeholders!
|
||||
- Files placed in the `CFG`, `CHT`, `LNG`, `THM`, and `APPS` folders on your PC will now be copied to the PS2 drive during game sync
|
||||
- Added Game ID support for MemCard Pro 2 and SD2PSX
|
||||
- The scripts now auto-update when an update is available
|
||||
- Optimised art work
|
||||
- Art downloads from IGN are now automatically contributed to the [PSBBN art database](https://github.com/CosmicScale/psbbn-art-database), and missing artwork is also automatically reported. Manual submissions are welcome, see the [PSBBN art database GitHub page](https://github.com/CosmicScale/psbbn-art-database) for details
|
||||
- Added Neutrino support
|
||||
- Added [Neutrino](https://github.com/rickgaiser/neutrino) support. You can now choose between [Open PS2 Loader](https://github.com/ps2homebrew/Open-PS2-Loader) and [Neutrino](https://github.com/rickgaiser/neutrino) as your game launcher
|
||||
- [Open PS2 Loader](https://github.com/ps2homebrew/Open-PS2-Loader) updated to version 1.2.0-Beta-2201-4b6cc21:
|
||||
- Limited max BDM UDMA mode to UDMA4 to avoid compatibility issues with various SATA/IDE2SD adapters
|
||||
- Added a manual for PS1 games. It can be accessed in the Game Channel by selecting a game, pressing Triangle, and then selecting `Manual`
|
||||
- Transitioned to [BBN Launcher (BBNL)](https://github.com/pcm720/bbnl) version 2.0:
|
||||
- Dropped APA support in favor of loading [OPL](https://github.com/ps2homebrew/Open-PS2-Loader), [POPStarter](https://bitbucket.org/ShaolinAssassin/popstarter-documentation-stuff/wiki/Home), [Neutrino](https://github.com/rickgaiser/neutrino), and configuration files from the exFAT partition to speed up initialization.
|
||||
- Moved [BBNL](https://github.com/pcm720/bbnl) to the APA header to further improve loading times.
|
||||
- Removed dependency on renamed [POPStarter](https://bitbucket.org/ShaolinAssassin/popstarter-documentation-stuff/wiki/Home) ELF files to launch PS1 VCDs; [POPStarter](https://bitbucket.org/ShaolinAssassin/popstarter-documentation-stuff/wiki/Home) is now launched directly with a boot argument.
|
||||
- [NHDDL](https://github.com/pcm720/nhddl) now launches in ATA mode, improving startup time and avoiding potential error messages.
|
||||
- Updated [Neutrino](https://github.com/rickgaiser/neutrino) to version 1.6.1
|
||||
- Updated [NHDDL](https://github.com/pcm720/nhddl) to version MMCE + HDL Beta 4.17
|
||||
|
||||
|
||||
## New installation scripts
|
||||
|
||||
@ -81,7 +91,7 @@ sudo apt install git
|
||||
- Downloads and installs the latest version of the **PSBBN Definitive English Patch** from archive.org
|
||||
- Prompts for the desired size of the Music Partition
|
||||
- Prompts for the desired size of the POPS Partition
|
||||
- Installs [POPStarter](https://bitbucket.org/ShaolinAssassin/popstarter-documentation-stuff/wiki/Home)
|
||||
- Installs [POPS] binaries (https://bitbucket.org/ShaolinAssassin/popstarter-documentation-stuff/wiki/Home)
|
||||
- Runs [APA-Jail](#notes-on-apa-jail), creating an exFAT partition using all remaining disk space beyond the first 128 GB (up to 2 TB)
|
||||
|
||||
### Game installer script:
|
||||
@ -93,7 +103,7 @@ The script will:
|
||||
- Create all game assets
|
||||
- Download artwork from the [PSBBN Art Database](https://github.com/CosmicScale/psbbn-art-database) or IGN if not found in the database
|
||||
- Automatically contribute game artwork from IGN and reports missing artwork to the [PSBBN Art Database](https://github.com/CosmicScale/psbbn-art-database)
|
||||
- Install [BBN Launcher](https://github.com/pcm720/bbnl) into every game partition, making games bootable from the Game Channel
|
||||
- Creates [BBN Launcher](https://github.com/pcm720/bbnl) partitions, making games bootable from the PSBBN Game Channel
|
||||
|
||||
To add or delete games, simply add or remove them from the `games` folder on your computer, then run the script again to synchronise. All games are kept in alphabetical order and grouped by series in the Game Channel on PSBBN.
|
||||
|
||||
@ -153,12 +163,15 @@ If games still do not appear in the OPL/NHDDL games list and fail to launch from
|
||||
4. Try using a different SATA mod for your PS2
|
||||
|
||||
### Notes on APA-Jail:
|
||||
APA-Jail, created and developed by [Berion](https://www.psx-place.com/resources/authors/berion.1431/), enables the PS2's APA partitions to coexist with an exFAT partition. This setup allows PSBBN to access the first 128 GB of the HDD/SSD directly. The remaining space on the drive is formatted as an exFAT partition, which can be accessed directly on a PC and on the PS2 by the [pre-release build of Open PS2 Loader](https://github.com/ps2homebrew/Open-PS2-Loader) and [Neutrino](https://github.com/rickgaiser/neutrino). PS2 games in the `ISO` or `ZSO` format are stored on the exFAT partition.
|
||||
|
||||

|
||||
|
||||
An application called [BBN Launcher](https://github.com/pcm720/bbnl) resides on the APA partitions, along with the [pre-release build of Open PS2 Loader](https://github.com/ps2homebrew/Open-PS2-Loader) or [Neutrino](https://github.com/rickgaiser/neutrino).
|
||||
|
||||
APA-Jail, created and developed by [Berion](https://www.psx-place.com/resources/authors/berion.1431/), enables the PS2's APA partitions to coexist with an exFAT partition. This setup allows PSBBN to access the first 128 GB of the HDD/SSD directly. All remaining space on the drive is formatted as exFAT.
|
||||
|
||||
An application called [BBN Launcher](https://github.com/pcm720/bbnl) resides on the APA partitions, a [pre-release build of Open PS2 Loader](https://github.com/ps2homebrew/Open-PS2-Loader) and [Neutrino](https://github.com/rickgaiser/neutrino) reside on the exFAT partition, along with the PS2 games in the `ISO` or `ZSO` format.
|
||||
|
||||
The exFAT partition can be accessed on a PC and on the PS2 by [BBN Launcher](https://github.com/pcm720/bbnl), a [pre-release build of Open PS2 Loader](https://github.com/ps2homebrew/Open-PS2-Loader) and [Neutrino](https://github.com/rickgaiser/neutrino).
|
||||
|
||||
[BBN Launcher](https://github.com/pcm720/bbnl) directs [Open PS2 Loader](https://github.com/ps2homebrew/Open-PS2-Loader) or [Neutrino](https://github.com/rickgaiser/neutrino) to launch specific PS2 games.
|
||||
|
||||
### Warning: Creating new partitions manually on your PS2 drive (e.g., with wLaunchELF) and exceeding the 128 GB limit will cause drive corruption.
|
||||
|
BIN
assets/BBNL/boot.kelf
Normal file
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 21 KiB |
@ -1,4 +1,4 @@
|
||||
BOOT2 = pfs:/bbnl.KELF
|
||||
BOOT2 = PATINFO
|
||||
VER = 1.01
|
||||
VMODE = NTSC
|
||||
HDDUNITPOWER = NICHDD
|
@ -1,18 +0,0 @@
|
||||
PS2X
|
||||
title0=Homebrew Launcher
|
||||
title1=
|
||||
bgcola=0
|
||||
bgcol0=0,0,0
|
||||
bgcol1=0,0,0
|
||||
bgcol2=0,0,0
|
||||
bgcol3=0,0,0
|
||||
lightdir0=1.0,-1.0,1.0
|
||||
lightdir1=-1.0,1.0,-1.0
|
||||
lightdir2=0.0,0.0,0.0
|
||||
lightcolamb=64,64,64
|
||||
lightcol0=64,64,64
|
||||
lightcol1=16,16,16
|
||||
lightcol2=0,0,0
|
||||
uninstallmes0=
|
||||
uninstallmes1=
|
||||
uninstallmes2=
|
Before Width: | Height: | Size: 46 KiB |
@ -1,4 +0,0 @@
|
||||
BOOT2 = pfs:/launcher.KELF
|
||||
VER = 1.01
|
||||
VMODE = NTSC
|
||||
HDDUNITPOWER = NICHDD
|
BIN
assets/NHDDL/nhddl.elf
Normal file
Before Width: | Height: | Size: 7.3 KiB After Width: | Height: | Size: 7.3 KiB |
Before Width: | Height: | Size: 31 KiB After Width: | Height: | Size: 31 KiB |
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
BIN
assets/bbnl.KELF
@ -175,5 +175,6 @@ Loader | Author
|
||||
[NHDDL](https://github.com/pcm720/nhddl) | pcm720
|
||||
[RETROLauncher](https://github.com/Spaghetticode-Boon-Tobias/RETROLauncher) | Boon Tobias
|
||||
[OSD-XMB](https://github.com/HiroTex/OSD-XMB) | Hiro Tex
|
||||
[PSBBN](https://github.com/CosmicScale/PSBBN-Definitive-English-Patch) + [BBNL](https://github.com/pcm720/bbnl) | CosmicScale + pcm720
|
||||
|
||||
Add your project here? Send me a PR.
|
||||
|
@ -8,3 +8,9 @@ name = "Block Device filesystem driver"
|
||||
[[module]]
|
||||
file = "bdfs.irx"
|
||||
env = ["LE"]
|
||||
|
||||
# Modules to load in emulation environment
|
||||
[[module]]
|
||||
file = "fhi_bd.irx"
|
||||
func = "FHI_BD"
|
||||
env = ["EE"]
|
||||
|
@ -8,3 +8,9 @@ name = "exFat filesystem driver"
|
||||
[[module]]
|
||||
file = "bdmfs_fatfs.irx"
|
||||
env = ["LE"]
|
||||
|
||||
# Modules to load in emulation environment
|
||||
[[module]]
|
||||
file = "fhi_bd_defrag.irx"
|
||||
func = "FHI_BD_DEFRAG"
|
||||
env = ["EE"]
|
||||
|
@ -12,3 +12,9 @@ env = ["LE"]
|
||||
[[module]]
|
||||
file = "hdlfs.irx"
|
||||
env = ["LE"]
|
||||
|
||||
# Modules to load in emulation environment
|
||||
[[module]]
|
||||
file = "fhi_bd_defrag.irx"
|
||||
func = "FHI_BD_DEFRAG"
|
||||
env = ["EE"]
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Name of loaded config, to show to user
|
||||
name = "Block Device Manager (with FHI)"
|
||||
name = "Block Device Manager"
|
||||
|
||||
# Modules to load in load environment
|
||||
[[module]]
|
||||
@ -11,9 +11,3 @@ env = ["LE"]
|
||||
[[module]]
|
||||
file = "fileXio.irx"
|
||||
env = ["LE"]
|
||||
|
||||
# Modules to load in emulation environment
|
||||
[[module]]
|
||||
file = "fhi_bd_defrag.irx"
|
||||
func = "FHI_BD"
|
||||
env = ["EE"]
|
||||
|
@ -1 +1 @@
|
||||
v1.5.0-20-gbc685a4
|
||||
v1.6.1
|
||||
|