This file contains 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
#!/usr/bin/env bash | |
HACTOOL=./hactool.exe | |
UPDATES=`find . ! -name . -type d` | |
for updates in $UPDATES; do | |
updates=`basename $updates` | |
NCA=`find $updates -name '*.cnmt.nca'` | |
for nca in $NCA; do | |
TITLEID=`$HACTOOL -k keys.txt -t nca --listromfs $nca | grep "Title ID:" | grep 0100000000000809 | tr -s ' ' | cut -d' ' -f3` | |
if [[ $TITLEID == 0100000000000809* ]]; then | |
CNMT=`$HACTOOL -k keys.txt -t nca --section0dir=tmp_$updates $nca | grep "SystemData_" | tr -s ' ' | cut -d' ' -f4 | sed 's/\.\{2,\}//g'` | |
VERSION=`od -t x4 --skip-bytes=8 --read-bytes=4 tmp_$updates/SystemData_0100000000000809.cnmt | head -1 | cut -d' ' -f2` | |
rm -Rf tmp_$updates | |
FIRMWARE=`echo -n $(((0x$VERSION >> 26) & 0x3F))"."$(((0x$VERSION >> 20) & 0x3F))"."$(((0x$VERSION >> 16) & 0x0F))` | |
echo -e "$nca\t$FIRMWARE\t`printf "%d" 0x$VERSION`" | |
break | |
fi | |
done | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment