Last active
May 30, 2024 05:21
-
-
Save squidrpi/4ce3ea61cbbfa3900e116f9565d45e74 to your computer and use it in GitHub Desktop.
MIST FPGA update scripts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # copy from $1 parameter which is the subdirectory from here | |
| # $2 is the Volume to copy to. | |
| if [ -z "$1" ]; then | |
| echo "Usage: rsynctosd Arcade /Volumes/ARCADE" | |
| exit 1 | |
| fi | |
| rsync -uvtr --modify-window=1 --delete --exclude='*.ini' --exclude='*.CFG' --exclude='*.RAM' --exclude='*.sav' \ | |
| --exclude='.Trashes' --exclude='.fseventsd' --exclude='.Spotlight-V100' --exclude='System Volume Information' \ | |
| --exclude='.DS_Store' \ | |
| $1/ $2 | |
| #Hide RBFs | |
| if [ -d /Volumes/ARCADE ]; then | |
| cd /Volumes/ARCADE/ | |
| chflags hidden JT-CPS[012]*/jt*.rbf JT-OTHER/jtdd2.rbf JT-OTHER/jtcomsc.rbf JT-SYSTEM16/jt*rbf | |
| cd Gehstock | |
| chflags hidden Scramble.rbf Galaxian.rbf | |
| chflags hidden DKong.rbf GBeret.rbf | |
| chflags hidden Druaga.rbf | |
| chflags hidden Williams/Robotron.rbf Williams/Defender.rbf | |
| chflags hidden Sega-System-1/Segasys1.rbf | |
| chflags hidden Midway-MCR/mcr*.rbf | |
| #Remove 64MB games from CPS2 | |
| cd /Volumes/ARCADE/JT-CPS2/ | |
| rm -f 'Dungeons & Dragons_ Shadow over Mystara (Euro 960619).arc' "Night Warriors_ Darkstalkers' Revenge (Euro 950316).arc" 'Street Fighter Alpha 3 (Euro 980904).arc' 'X-Men_ Children of the Atom (Euro 950331).arc' 'Cyberbots_ Fullmetal Madness (Euro 950424).arc' 'X-Men Vs. Street Fighter (Euro 961004).arc' 'X-Men_ Children of the Atom (Euro 950331).arc' 'Vampire Hunter 2_ Darkstalkers Revenge (Japan 970929).arc' ' Vampire Savior 2_ The Lord of Vampire (Japan 970913).arc' 'Vampire Savior_ The Lord of Vampire (Euro 970519).arc' 'Street Fighter Alpha 2 (Euro 960229).arc' "Street Fighter Zero 2 Alpha (Japan 960805).arc" | |
| fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Gets the latest cores and checks all the directories | |
| # in the current for any changes to the cores. | |
| # The directories MUST match the ones in the mist-binaries/cores so just create | |
| # the directories of the cores you want. | |
| #Define this if using Mistica for specific cores | |
| #MISTICA=Y | |
| LOGFILE=update_cores.log | |
| date >$LOGFILE | |
| echo >>$LOGFILE | |
| BASEDIR=_temp | |
| SRCDIR=${BASEDIR}/git/mist-binaries/cores | |
| # clone git repo if it doesn't exist | |
| if [[ ! -d $SRCDIR ]]; then | |
| mkdir -p ${BASEDIR}/git | |
| (cd ${BASEDIR}/git; git clone https://github.com/mist-devel/mist-binaries.git) | |
| #Set timestamps on git files to match repository commit dates | |
| (cd $SRCDIR; git ls-files | sed "s/'/\\\'/g" | xargs -I{} bash -c 'touch "{}" --date=@$(git log -n1 --pretty=format:%ct -- "{}")') | |
| fi | |
| echo $SRCDIR | |
| # Update the cores from github | |
| (cd $SRCDIR; git pull) | |
| #Check for firmware updates | |
| SRC=`ls -Lt "${SRCDIR}"/../firmware/*.upg 2>/dev/null | head -1` | |
| DST=_firmware/`basename "$SRC"` | |
| mkdir -p _firmware | |
| if [[ ! -f $DST ]]; then | |
| cp -p "$SRC" "$DST" | |
| echo ================== | |
| echo FIRMWARE UPDATED!!! $DST | tee -a $LOGFILE | |
| echo ================== | |
| echo | |
| fi | |
| echo | |
| #Check all the cores in git with current matching directories | |
| for FILE in `find . -maxdepth 1 -type d | egrep -v '_temp'` | |
| do | |
| DIR=${FILE:2} | |
| DST="${DIR}/core.rbf" | |
| if [[ $DIR = "spectrum" ]];then | |
| DST="${DIR}/zxspectrum.rbf" | |
| fi | |
| SRC=`ls -Lt ${SRCDIR}/$DIR/*.rbf 2>/dev/null | head -1` | |
| # Mistica currently has core specific SNES | |
| if [[ $DIR = "snes" && ! -z "$MISTICA" ]]; then | |
| SRC=`ls -Lt ${SRCDIR}/$DIR/snes_mist_*.rbf 2>/dev/null | head -1` | |
| if [[ ! -z "$MISTICA" ]]; then | |
| SRC=`ls -Lt ${SRCDIR}/$DIR/snes_mistica*.rbf 2>/dev/null | head -1` | |
| fi | |
| fi | |
| if [[ $DIR = "plus_too" ]]; then | |
| SRC=`ls -Lt ${SRCDIR}/$DIR/plusToo_*.rbf 2>/dev/null | head -1` | |
| fi | |
| if [[ $DIR = "zxn" ]]; then | |
| SRC=`ls -Lt ${SRCDIR}/$DIR/ZXN_*.rbf 2>/dev/null | head -1` | |
| fi | |
| if [[ -z $SRC || -z $DST ]]; then | |
| continue | |
| fi | |
| if [[ -f $SRC && ! -f $DST ]]; then | |
| cp -p "$SRC" "$DST" | |
| echo Update CORE $DST | tee -a $LOGFILE | |
| else | |
| if [[ $SRC -nt $DST ]]; then | |
| cp -p "$SRC" "$DST" | |
| echo Update CORE $DST | tee -a $LOGFILE | |
| echo | |
| else | |
| #Check checksum | |
| MD5SRC=`md5sum "$SRC" | awk '{print $1}'` | |
| MD5DST=`md5sum "$DST" | awk '{print $1}'` | |
| if [[ $MD5SRC != $MD5DST ]]; then | |
| cp -p "$SRC" "$DST" | |
| echo Update CORE $DST | tee -a $LOGFILE | |
| echo | |
| fi | |
| fi | |
| fi | |
| #Copy special ROMS | |
| [[ $DIR = "atari800" ]] && cp -pvu ${SRCDIR}/${DIR}/*.ROM ${DIR}/ | |
| [[ $DIR = "bbc" ]] && cp -pvu ${SRCDIR}/${DIR}/bbc.rom ${DIR}/ | |
| [[ $DIR = "c16" ]] && cp -pvu ${SRCDIR}/${DIR}/c16.rom ${DIR}/ | |
| [[ $DIR = "fpga64" ]] && cp -pvu ${SRCDIR}/${DIR}/*.rom ${SRCDIR}/${DIR}/C64GS.ARC ${DIR}/ | |
| [[ $DIR = "ht1080z" ]] && cp -pvu ${SRCDIR}/${DIR}/HT1080Z.ROM ${DIR}/ | |
| [[ $DIR = "ql" ]] && cp -pvu ${SRCDIR}/${DIR}/ql.rom ${DIR}/ | |
| [[ $DIR = "samcoupe" ]] && cp -pvu ${SRCDIR}/${DIR}/samcoupe.rom ${DIR}/ | |
| [[ $DIR = "spectrum" ]] && cp -pvu ${SRCDIR}/${DIR}/spectrum.rom ${DIR}/ | |
| [[ $DIR = "ti994a" ]] && cp -pvu ${SRCDIR}/${DIR}/TI994A.ROM ${DIR}/ | |
| [[ $DIR = "vic20" ]] && cp -pvu ${SRCDIR}/${DIR}/vic20.rom ${DIR}/ | |
| #Move ZXN to spectrum | |
| [[ $DIR = "zxn" ]] && cp -pvu zxn/core.rbf spectrum/ | |
| done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Only updates the cores that we have in the Arcade directory | |
| # updated from Gehstock github directory. | |
| # Doesn't add newly added cores from from github, add these manually. | |
| # Names also need to match the Gehstock name | |
| LOGFILE=update_gehstock.log | |
| date >$LOGFILE | |
| echo >$LOGFILE | |
| BASEDIR=_temp | |
| SRCDIR=$BASEDIR/git/Mist_FPGA_Cores/Arcade_MiST | |
| # clone git repo if it doesn't exist | |
| if [[ ! -d $SRCDIR ]]; then | |
| mkdir -p $BASEDIR/git | |
| (cd ${BASEDIR}/git; git clone https://github.com/Gehstock/Mist_FPGA_Cores.git) | |
| #Set timestamps on git files to match repository commit dates | |
| (cd $SRCDIR; git ls-files | sed "s/'/\\\'/g" | xargs -I{} bash -c 'touch "{}" --date=@$(git log -n1 --pretty=format:%ct -- "{}")') | |
| fi | |
| # Update the cores from github | |
| (cd $SRCDIR/..; git pull) | |
| for FILE in `find Arcade -name '*.rbf'` | |
| do | |
| DST="$FILE" | |
| DSTBASE=`basename "$FILE"` | |
| SRC=`find "$SRCDIR" -name $DSTBASE` | |
| if [[ -z $SRC || -z $DST ]]; then | |
| continue | |
| fi | |
| if [[ $SRC -nt $DST ]]; then | |
| cp -p "$SRC" "$DST" | |
| echo Update CORE $DST | tee -a $LOGFILE | |
| echo | |
| else | |
| #Check checksum | |
| MD5SRC=`md5sum "$SRC" | awk '{print $1}'` | |
| MD5DST=`md5sum "$DST" | awk '{print $1}'` | |
| if [[ $MD5SRC != $MD5DST ]]; then | |
| cp -p "$SRC" "$DST" | |
| echo Update CORE $DST | tee -a $LOGFILE | |
| echo | |
| fi | |
| fi | |
| done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Updates and gets jt cores | |
| # Retrieves new game ROMS if needed from archive.org | |
| # Don't forget to set the SYSTEM attribute for any subdirectories | |
| # on the SD card. Needs to be done in Windows "attrib +s JT-SYSTEM16" | |
| BASEDIR=_temp | |
| SRCDIR=$BASEDIR/git/jtbin | |
| ZIPDIR=$BASEDIR/mame | |
| MRABIN=./mra | |
| FLAGFILE=update_jtcores.flag | |
| if [[ ! -f $FLAGFILE ]]; then | |
| touch -t 197201010000 $FLAGFILE | |
| fi | |
| mkdir -p $ZIPDIR | |
| # clone git repo if it doesn't exist | |
| if [[ ! -d $SRCDIR ]]; then | |
| mkdir -p $BASEDIR/git | |
| (cd $BASEDIR/git; git clone https://github.com/jotego/jtbin.git) | |
| #Set timestamps on git files to match repository commit dates | |
| (cd $SRCDIR; git ls-files | sed "s/'/\\\'/g" | xargs -I{} bash -c 'touch "{}" --date=@$(git log -n1 --pretty=format:%ct -- "{}")') | |
| fi | |
| echo $SRCDIR | |
| # Update the cores and mra from jtbin | |
| (cd $SRCDIR; git pull) | |
| echo | |
| #Process MRA files first | |
| #Get new MRAs and updated ones since the last run | |
| find $SRCDIR/mra -type f -name '*.mra' -newer $FLAGFILE -print0 | | |
| while IFS= read -r -d '' MRAFILE | |
| do | |
| # Exclude what I'm not interested in | |
| [[ $MRAFILE == *_alternatives* ]] && continue | |
| [[ $MRAFILE == *Tokio* ]] && continue | |
| [[ $MRAFILE == *Trojan* ]] && continue | |
| DESTDIR=Arcade/JT-OTHER | |
| [[ $MRAFILE == *CPS0/* ]] && DESTDIR=Arcade/JT-CPS0 | |
| [[ $MRAFILE == *CPS1/* ]] && DESTDIR=Arcade/JT-CPS1 | |
| [[ $MRAFILE == *CPS15/* ]] && DESTDIR=Arcade/JT-CPS15 | |
| [[ $MRAFILE == *CPS2/* ]] && DESTDIR=Arcade/JT-CPS2 | |
| [[ $MRAFILE == *s16/* ]] && DESTDIR=Arcade/JT-SYSTEM16 | |
| mkdir -p $DESTDIR | |
| # Check ROM exists | |
| # Get First ROM section only | |
| #ZIPFILE=`$MRABIN -l "$MRAFILE" | sed -n '/rom\[0\]/,/^$/p' | grep 'zip\[0\]' | awk '{print $2}'` | |
| ZIPFILE=`$MRABIN -l "$MRAFILE" | grep 'zip\[0\]' | head -1 | awk '{print $2}'` | |
| # Skip roms not interested in | |
| #if [[ $ZIPFILE = "qtono2j.zip" ]]; then | |
| # continue | |
| #fi | |
| echo $ZIPFILE | |
| if [[ ! -f "${ZIPDIR}/${ZIPFILE}" ]]; then | |
| echo Downloading ROM $ZIPFILE | |
| (cd "$ZIPDIR"; wget -nc -nv https://archive.org/download/MAME223RomsOnlyMerged/${ZIPFILE}) | |
| #(cd "$ZIPDIR"; wget -nc -nv -O $ZIPFILE https://archive.org/download/mame0.220romssplit.7z/MAME%200.220%20ROMs%20%28split%29.7z/0.220%20ROMs%20%28split%29%2F${ZIPFILE}) | |
| fi | |
| $MRABIN -A -O $DESTDIR/ -z "$ZIPDIR" "$MRAFILE" | grep -v 'expected: None' | |
| #Copy over the related RBF | |
| RBF=$($MRABIN -l "$MRAFILE" | grep 'rbf name:' | sed 's/rbf name: //') | |
| # Fix wrong named RBFs | |
| RBF=$(echo $RBF | sed 's/jtcommando/jtcom/') | |
| RBF=$(echo $RBF | sed 's/jtgunsmoke/jtgun/') | |
| RBF=$(echo $RBF | sed 's/jtsectionz/jtsz/') | |
| RBF=$(echo $RBF | sed 's/jtf1dream/jtf1drm/') | |
| if [[ ! -f $SRCDIR/mist/${RBF}.rbf ]]; then | |
| echo "RBF $RBF is missing for MRA `basename "${MRAFILE}"`, probably BETA" | |
| else | |
| RBFBASE=$(basename "$RBFFILE" | sed 's/_[0-9]\+.rbf//') | |
| # cp -pvu "$RBFFILE" $DESTDIR/${RBFBASE}.rbf | |
| cp -pvu "$SRCDIR/mist/${RBF}.rbf" $DESTDIR/${RBF}.rbf | |
| fi | |
| done | |
| #Check for updated RBF cores | |
| SRCDIR=$SRCDIR/mist | |
| find Arcade -name '*.rbf' -print0 | | |
| while IFS= read -r -d '' FILE | |
| do | |
| DST="$FILE" | |
| DSTBASE=`basename "$FILE"` | |
| # DSTBASE="${DSTBASE/.rbf/}" | |
| # SRC="" | |
| # SRC=$(find "$SRCDIR" -name "${DSTBASE}_*rbf" -newer "$FILE" -print0 | xargs -0 -r ls -t | head -1) | |
| SRC=$SRCDIR/$DSTBASE | |
| if [[ -z $SRC || -z $DST ]]; then | |
| continue | |
| fi | |
| if [[ $SRC -nt $DST ]]; then | |
| cp -p "$SRC" "$DST" | |
| echo cp -p "$SRC" "$DST" | |
| echo Update CORE $DST | |
| echo | |
| fi | |
| done | |
| touch $FLAGFILE |
Author
dont forget to use chmod to mark the content as executable after you get the script and mra
wget https://gist.github.com/squidrpi/4ce3ea61cbbfa3900e116f9565d45e74/raw/cdbfa6d52a87ebdb7524f8fc8ceed49876c24b1d/update_jtcores
wget https://github.com/mist-devel/mra-tools-c/raw/master/release/linux/mra
chmod u+x ./update_jtcores
chmod u+x ./mra
Thanks for a great script, I had tried and failed a few times to do this manually after reading the doco. (I think I had the wrong version of the ROMS).
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Create a directory to store your MIST cores and ROMS. In this directory create subdirectories of the cores you want, name based on https://github.com/mist-devel/mist-binaries/tree/master/cores. In addition for the arcade cores create a "Arcade" subdirectory.
Run these scripts to retrieve the latest cores and ROMS.
Copy the directories to individual SD cards or one SD card using linux_sync.
Requires a number of Linux commands: git, wget and the mra executable.