Remove obsolete files.

This commit is contained in:
sorgelig
2020-01-16 12:59:04 +08:00
parent c230604133
commit 0008a38b3a
7 changed files with 0 additions and 276 deletions

Binary file not shown.

View File

@@ -1,6 +0,0 @@
zip=nrallyx.zip
ifiles=(prg1_0 prg2_0 prg1_1 prg2_1 prg3_0 prg4_0 prg3_1 prg4_1 ../bang_snd.bin nrx_chg1.8e nrx_chg2.8d rx1-6.8m rx1-5.3p nrx1-7.8p nrx1-1.11n)
ofile=a.nrallyx.rom
ofileMd5sumValid=113b2afb644dd386dc7c3fc1ae685ff4
split=("split nrx_prg1.1d -b 2048 prg1_ -d -a 1" "split nrx_prg2.1e -b 2048 prg2_ -d -a 1" "split nrx_prg3.1k -b 2048 prg3_ -d -a 1" "split nrx_prg4.1l -b 2048 prg4_ -d -a 1")

View File

@@ -1,111 +0,0 @@
#!/bin/bash
exit_with_error() {
echo -e "\nERROR:\n${1}\n"
exit 1
}
check_dependencies() {
if [[ $OSTYPE == darwin* ]]; then
for j in unzip md5 cat cut; do
command -v ${j} > /dev/null 2>&1 || exit_with_error "This script requires\n${j}"
done
else
for j in unzip md5sum cat cut; do
command -v ${j} > /dev/null 2>&1 || exit_with_error "This script requires\n${j}"
done
fi
}
check_permissions () {
if [ ! -w ${BASEDIR} ]; then
exit_with_error "Cannot write to\n${BASEDIR}"
fi
}
read_ini () {
if [ ! -f ${BASEDIR}/build_rom.ini ]; then
exit_with_error "Missing build_rom.ini"
else
source ${BASEDIR}/build_rom.ini
fi
}
uncompress_zip() {
if [ -f ${BASEDIR}/${zip} ]; then
tmpdir=tmp.`date +%Y%m%d%H%M%S%s`
unzip -qq -d ${BASEDIR}/${tmpdir}/ ${BASEDIR}/${zip}
if [ $? != 0 ] ; then
rm -rf ${BASEDIR}/$tmpdir
exit_with_error "Something went wrong\nwhen extracting\n${zip}"
fi
else
exit_with_error "Cannot find ${zip}"
fi
}
split_files() {
#split nrx_prg1.1d -b 2048 prg1_ -d -a 1
pushd ${BASEDIR}/${tmpdir}/
for ((i=0;i< ${#split[@]}; i++))
do
#echo ${split[$i]}
${split[$i]}
done
popd
}
generate_rom() {
for i in "${ifiles[@]}"; do
# ensure provided zip contains required files
if [ ! -f "${BASEDIR}/${tmpdir}/${i}" ]; then
rm -rf ${BASEDIR}/$tmpdir
exit_with_error "Provided ${zip}\nis missing required file:\n\n${i}"
else
cat ${BASEDIR}/${tmpdir}/${i} >> ${BASEDIR}/${tmpdir}/${ofile}
fi
done
}
validate_rom() {
if [[ $OSTYPE == darwin* ]]; then
ofileMd5sumCurrent=$(md5 -r ${BASEDIR}/${tmpdir}/${ofile}|cut -f 1 -d " ")
else
ofileMd5sumCurrent=$(md5sum ${BASEDIR}/${tmpdir}/${ofile}|cut -f 1 -d " ")
fi
if [[ "${ofileMd5sumValid}" != "${ofileMd5sumCurrent}" ]]; then
echo -e "\nExpected checksum:\n${ofileMd5sumValid}"
echo -e "Actual checksum:\n${ofileMd5sumCurrent}"
mv ${BASEDIR}/${tmpdir}/${ofile} .
rm -rf ${BASEDIR}/$tmpdir
exit_with_error "Generated ${ofile}\nis invalid.\nThis is more likely\ndue to incorrect\n${zip} content."
else
mv ${BASEDIR}/${tmpdir}/${ofile} ${BASEDIR}/.
rm -rf ${BASEDIR}/$tmpdir
echo -e "\nChecksum verification passed\n\nCopy the ${ofile}\ninto root of SD card\nalong with the rbf file.\n"
fi
}
BASEDIR=$(dirname "$0")
echo "Generating ROM ..."
## verify dependencies
check_dependencies
## verify write permissions
check_permissions
## load ini
read_ini
## extract package
uncompress_zip
split_files
## build rom
generate_rom
## verify rom
validate_rom

View File

@@ -1,37 +0,0 @@
@powershell -NoProfile -ExecutionPolicy Unrestricted "$s=[scriptblock]::create((gc \"%~f0\"|?{$_.readcount -gt 1})-join\"`n\");&$s" %*&goto:eof
function SplitFile ($inFile, $outPrefix, [Int32] $bufSize) {
$stream = [System.IO.File]::OpenRead("tmp/$inFile")
$chunkNum = 0
$barr = New-Object byte[] $bufSize
while( $bytesRead = $stream.Read($barr,0,$bufsize)){
$outFile = "tmp/$outPrefix$chunkNum"
$ostream = [System.IO.File]::OpenWrite($outFile)
$ostream.Write($barr,0,$bytesRead);
$ostream.close();
$chunkNum += 1
}
$stream.close();
}
#==============================================================
$zip="nrallyx.zip"
$ifiles="prg1_0","prg2_0","prg1_1","prg2_1","prg3_0","prg4_0","prg3_1","prg4_1","../bang_snd.bin","nrx_chg1.8e","nrx_chg2.8d","rx1-6.8m","rx1-5.3p","nrx1-7.8p","nrx1-1.11n"
$ofile="a.nrallyx.rom"
Expand-Archive -Path "./$zip" -Destination ./tmp/ -Force
SplitFile "nrx_prg1.1d" "prg1_" 2048
SplitFile "nrx_prg2.1e" "prg2_" 2048
SplitFile "nrx_prg3.1k" "prg3_" 2048
SplitFile "nrx_prg4.1l" "prg4_" 2048
cd tmp
Get-Content $ifiles -Enc Byte -Read 512 | Set-Content "../$ofile" -Enc Byte
cd ..
Remove-Item ./tmp -Recurse -Force
echo "** done **"
echo ""
echo "Copy $ofile into root of SD card"
echo ""
echo ""
pause

View File

@@ -1,18 +0,0 @@
@powershell -NoProfile -ExecutionPolicy Unrestricted "$s=[scriptblock]::create((gc \"%~f0\"|?{$_.readcount -gt 1})-join\"`n\");&$s" %*&goto:eof
#==============================================================
$zip="rallyx.zip"
$ifiles="1b","rallyxn.1e","rallyxn.1h","rallyxn.1k","../bang_snd.bin","8e","rx1-6.8m","rx1-5.3p","rx1-7.8p","rx1-1.11n"
$ofile="a.rallyx.rom"
Expand-Archive -Path "./$zip" -Destination ./tmp/ -Force
cd tmp
Get-Content $ifiles -Enc Byte -Read 512 | Set-Content "../$ofile" -Enc Byte
cd ..
Remove-Item ./tmp -Recurse -Force
echo "** done **"
echo ""
echo "Copy $ofile into root of SD card"
echo ""
echo ""
pause

View File

@@ -1,4 +0,0 @@
zip=rallyx.zip
ifiles=(1b rallyxn.1e rallyxn.1h rallyxn.1k ../bang_snd.bin 8e rx1-6.8m rx1-5.3p rx1-7.8p rx1-1.11n)
ofile=a.rallyx.rom
ofileMd5sumValid=47b5dc3c2683e23b387115da19e2771a

View File

@@ -1,100 +0,0 @@
#!/bin/bash
exit_with_error() {
echo -e "\nERROR:\n${1}\n"
exit 1
}
check_dependencies() {
if [[ $OSTYPE == darwin* ]]; then
for j in unzip md5 cat cut; do
command -v ${j} > /dev/null 2>&1 || exit_with_error "This script requires\n${j}"
done
else
for j in unzip md5sum cat cut; do
command -v ${j} > /dev/null 2>&1 || exit_with_error "This script requires\n${j}"
done
fi
}
check_permissions () {
if [ ! -w ${BASEDIR} ]; then
exit_with_error "Cannot write to\n${BASEDIR}"
fi
}
read_ini () {
if [ ! -f ${BASEDIR}/build_rom_alt.ini ]; then
exit_with_error "Missing build_rom_alt.ini"
else
source ${BASEDIR}/build_rom_alt.ini
fi
}
uncompress_zip() {
if [ -f ${BASEDIR}/${zip} ]; then
tmpdir=tmp.`date +%Y%m%d%H%M%S%s`
unzip -qq -d ${BASEDIR}/${tmpdir}/ ${BASEDIR}/${zip}
if [ $? != 0 ] ; then
rm -rf ${BASEDIR}/$tmpdir
exit_with_error "Something went wrong\nwhen extracting\n${zip}"
fi
else
exit_with_error "Cannot find ${zip}"
fi
}
generate_rom() {
for i in "${ifiles[@]}"; do
# ensure provided zip contains required files
if [ ! -f "${BASEDIR}/${tmpdir}/${i}" ]; then
rm -rf ${BASEDIR}/$tmpdir
exit_with_error "Provided ${zip}\nis missing required file:\n\n${i}"
else
cat ${BASEDIR}/${tmpdir}/${i} >> ${BASEDIR}/${tmpdir}/${ofile}
fi
done
}
validate_rom() {
if [[ $OSTYPE == darwin* ]]; then
ofileMd5sumCurrent=$(md5 -r ${BASEDIR}/${tmpdir}/${ofile}|cut -f 1 -d " ")
else
ofileMd5sumCurrent=$(md5sum ${BASEDIR}/${tmpdir}/${ofile}|cut -f 1 -d " ")
fi
if [[ "${ofileMd5sumValid}" != "${ofileMd5sumCurrent}" ]]; then
echo -e "\nExpected checksum:\n${ofileMd5sumValid}"
echo -e "Actual checksum:\n${ofileMd5sumCurrent}"
mv ${BASEDIR}/${tmpdir}/${ofile} .
rm -rf ${BASEDIR}/$tmpdir
exit_with_error "Generated ${ofile}\nis invalid.\nThis is more likely\ndue to incorrect\n${zip} content."
else
mv ${BASEDIR}/${tmpdir}/${ofile} ${BASEDIR}/.
rm -rf ${BASEDIR}/$tmpdir
echo -e "\nChecksum verification passed\n\nCopy the ${ofile}\ninto root of SD card\nalong with the rbf file.\n"
fi
}
BASEDIR=$(dirname "$0")
echo "Generating ROM ..."
## verify dependencies
check_dependencies
## verify write permissions
check_permissions
## load ini
read_ini
## extract package
uncompress_zip
## build rom
generate_rom
## verify rom
validate_rom