#!/bin/bash #rev 2016-02-7 18:53 #Added bin+cue parsing #rev 2016-03-1 21:51 #Added .Trash and LOST.DIR #Some on screen information changed #Added information at startup clear echo "Thanks to neuroacid, Google.com, AskUbuntu.com, stackoverflow.com" echo "This scripts needs original RMENU files on 01 folder" echo "In this version only CloneCD (CCD) and raw BIN/CUE has been tested" echo "¡REMEMBER! You will need mkisofs and xxd installed" echo "You should start this app at root directory of your SD card" sleep 3 #Loop for entering/exiting recursive directories CDIR=$(pwd) echo "Deleting previous menu list (01/BIN/RMENU/LIST.INI)" rm $CDIR/01/BIN/RMENU/LIST.INI # Deleting old list.ini sleep 1 # Starting with LIST.INI creation # setting the first line of LIST.INI (RMENU) echo "Creating de RMENU entrace for LIST.INI" sleep 1 T=01.title=RMENU DI=01.disc=1/1 R=01.region=JTUE V=01.version=V0.1.3 DA=01.date=20151205 printf "$T\r\n$DI\r\n$R\r\n$V\r\n$DA\r\n" >> $CDIR/01/BIN/RMENU/LIST.INI # Starting the hard work echo "Starting the scan" sleep 1 for i in $(find . -maxdepth 1 -type d | sort | sed -e "1d;2d;3d"); do DIR=${i%:} # Strip ':' cd $DIR BASENAME=`basename $(pwd)` #Folder number if [ "$(pwd | grep -E '.Trash|LOST.DIR')" ]; then echo "" elif [ "$(ls -A)" ]; then # CloneCD images if [ "$(ls -A | grep ccd)" ]; then #Extracting values TITLE=`xxd -s 112 -l 55 -ps *.img | xxd -r -p | sed -e "s/\( \)*/\1/g"` DISC=`xxd -s 75 -l 3 -ps *.img | xxd -r -p | sed -e "s/\( \)*/\1/g"` REGION=`xxd -s 80 -l 10 -ps *.img | xxd -r -p | sed -e "s/\( \)*/\1/g"` VERSION=`xxd -s 59 -l 5 -ps *.img | xxd -r -p | sed -e "s/\( \)*/\1/g"` DATE=`xxd -s 64 -l 8 -ps *.img | xxd -r -p` #Feeding vars T=$BASENAME.title="(CCD)".$TITLE DI=$BASENAME.disc=$DISC R=$BASENAME.region=$REGION V=$BASENAME.version=$VERSION DA=$BASENAME.date=$DATE #Printing game directory info printf "$T\r\n$DI\r\n$R\r\n$V\r\n$DA\r\n" >> $CDIR/01/BIN/RMENU/LIST.INI printf "CCD image founded: $DIR:$TITLE($DISC)($REGION)\r\n" else [ "$(ls -A | grep bin)" ]; #BIN/CUE images #Extracting values TITLE=`xxd -s 112 -l 35 -ps *.bin | xxd -r -p | sed -e "s/\( \)*/\1/g"` DISC=`xxd -s 75 -l 3 -ps *.bin | xxd -r -p | sed -e "s/\( \)*/\1/g"` REGION=`xxd -s 80 -l 10 -ps *.bin | xxd -r -p | sed -e "s/\( \)*/\1/g"` VERSION=`xxd -s 59 -l 5 -ps *.bin | xxd -r -p | sed -e "s/\( \)*/\1/g"` DATE=`xxd -s 64 -l 8 -ps *.bin | xxd -r -p` #Feeding vars T=$BASENAME.title="(BIN)."$TITLE DI=$BASENAME.disc=$DISC R=$BASENAME.region=$REGION V=$BASENAME.version=$VERSION DA=$BASENAME.date=$DATE #Printing game directory info printf "$T\r\n$DI\r\n$R\r\n$V\r\n$DA\r\n" >> $CDIR/01/BIN/RMENU/LIST.INI printf "BIN image founded: $DIR:$TITLE($DISC)($REGION)\r\n" #Reseting vars fi else #empty folders T=$BASENAME.title=EMPTY\ FOLDER DI=$BASENAME.disc=1/1 R=$BASENAME.region= V=$BASENAME.version= DA=$BASENAME.date= printf "$T\r\n$DI\r\n$R\r\n$V\r\n$DA\r\n" >> $CDIR/01/BIN/RMENU/LIST.INI fi cd $CDIR done #Creating the iso echo "Ready to make de RMENU ISO" echo "Entering to 01 DIR" cd $CDIR/01/BIN/RMENU echo "Making the ISO" mkisofs -quiet -sysid "SEGA SATURN" -V "RMENU" -volset "RMENU" -publisher "SEGA ENTERPRISES, LTD." -p "SEGA ENTREPRISES, LTD." -A "RMENU" -abstract "ABS.TXT" -copyright "CPY.TXT" -biblio "BIB.TXT" -G IP.BIN -l -input-charset iso8859-1 -o $CDIR/01/RMENU.iso $CDIR/01/BIN/RMENU/ ls -lh $CDIR/01/*.iso