From 42c67ccefdb263a81c70a9ab6328484071c41049 Mon Sep 17 00:00:00 2001 From: gotbletu Date: Tue, 12 Nov 2019 10:36:35 -0800 Subject: [PATCH] convert psx to psp --- psx2ebootpbp | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100755 psx2ebootpbp diff --git a/psx2ebootpbp b/psx2ebootpbp new file mode 100755 index 0000000..ca512d8 --- /dev/null +++ b/psx2ebootpbp @@ -0,0 +1,52 @@ +#!/usr/bin/env bash +# AUTHOR: gotbletu +# SOCIAL: https://www.youtube.com/user/gotbletu|https://github.com/gotbletu|https://twitter.com/gotbletu +# DESC: convert psx (playstation 1) games to EBOOT.PBP (psp compatible) +# DEPEND: coreutils gawk sed popstationr (https://github.com/pseiler/popstationr) +# DEMO: https://youtu.be/G_9g6DxO5Q0 +# REFF: https://psxdatacenter.com/ntsc-u_list.html + +if [[ $# -lt 1 || $1 = "-h" || $1 = "--help" ]]; then + printf "%s\n" "info: convert psx (playstation 1) games to EBOOT.PBP (psp compatible)" + printf "\n" + printf "%s\n" "usage: ${0##*/} [options] [iso|bin|img]" + printf "\n" + printf "%s\n" " $ ${0##*/} file.bin" + printf "%s\n" " $ ${0##*/} file1.bin file2.iso file3.img" + printf "%s\n" " $ ${0##*/} -f *.bin" + printf "%s\n" " $ ${0##*/} *.bin" + printf "\n" + printf "%s\n" " -f, --fileonly convert and do not create directory (for emulator only)" + printf "%s\n" " -h, --help display this help message" + printf "\n" + printf "%s\n" "Where To Put PSX EBOOT.PBP Games On PSP?:" + printf "%s\n" " MemCard:/PSP/GAME/{PSX GAMETITLE FOLDER 30 CHARACTER LIMIT}/EBOOT.PBP" + printf "%s\n" " MemCard:/PSP/GAME/Street Fighter Alpha 3 (USA)/EBOOT.PBP" + printf "%s\n" " MemCard:/PSP/GAME/WCW Nitro (USA)/EBOOT.PBP" + exit 1 +fi + + # popstationr $human_readable_name $GameID $compressionlevel $image.iso + # popstationr 'Tony Hawks Skateboarding' SLUS00860 9 THPS1_SLUS_008.60.iso + # Instead of the GameID you also can use AUTO to let popstationr detect the GameID + # popstationr 'Tony Hawks Skateboarding' AUTO 9 THPS1_SLUS_008.60.iso + +if [[ $1 = "-f" || $1 = "--fileonly" ]]; then + # e.g --> Street Fighter Alpha 3 (USA) [SLUS-00821].PBP + myArray=( "$@" ) + for arg in "${myArray[@]:1}"; do + PSX_LOG=/tmp/psx2ebootpbp.log + popstationr "${arg%.*}" AUTO 9 "$arg" > "$PSX_LOG" + GAMEID_WITH_DASH="$(head -n1 "$PSX_LOG" | awk -F '[][]' '{print $2}' | sed 's/./&-/4')" # add dash e.g SLUS-00327 + mv EBOOT.PBP "${arg%.*} [$GAMEID_WITH_DASH].PBP" + done +else + # compatible with PSP console (30 character foldername limit) + myArray=( "$@" ) + for arg in "${myArray[@]}"; do + popstationr "${arg%.*}" AUTO 9 "$arg" + PSX_EBOOT_DIR="$( echo "${arg%.*}" | head -c 30 | awk '{$1=$1};1' )" # trim dir name to 30 char only + mkdir "$PSX_EBOOT_DIR" + mv EBOOT.PBP "$PSX_EBOOT_DIR" + done +fi