From d06223ef9717f348ffc6dc5471ef7a9609347336 Mon Sep 17 00:00:00 2001 From: Lillian Skinner <56081713+rvtr@users.noreply.github.com> Date: Sat, 28 Mar 2026 13:17:56 -0400 Subject: [PATCH] Modified launcher TMD wasn't written, and HWInfo reading was broken. --- makenand.sh | 41 ++++++++++++++++++++++++----------------- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/makenand.sh b/makenand.sh index a3859f9..84af7c8 100755 --- a/makenand.sh +++ b/makenand.sh @@ -93,14 +93,28 @@ export MTOOLSRC=./mtoolsrc # The status variable will contain the region byte of the launcher TID. # # Probably not a bad idea to confirm that the TID is for an known region. -HWINFO_STATUS=$(python hwinfo.py --consoleid 084109149469a108 --hwinfo TJH101232355.dat verify) -if [[ "$2" == "" ]]; then - echo ">>> Region not found! Setting as 'ALL'." + +nogba_consoleid=$(echo $3 | tac -rs .. | echo "$(tr -d '\n')") +python hwinfo.py --consoleid $nogba_consoleid --hwinfo $2 verify +if [[ "$2" != "" ]]; then + if [[ "$CONSOLE_SIGNING" == "dev" ]]; then + HWINFO_STATUS=$(python hwinfo.py --consoleid $nogba_consoleid --hwinfo $2 --dev verify) + else + HWINFO_STATUS=$(python hwinfo.py --consoleid $nogba_consoleid --hwinfo $2 verify) + fi + + if [[ "$HWINFO_STATUS" == "Signature is valid" ]] && [[ "$2" != "" ]]; then + REGION_CODE=$(xxd -p -s 160 -l 1 "$2") + echo ">>> Region is $REGION_CODE" + else + echo ">>> HWInfo is bad, so region was not found! Setting as ALL." + echo ">>> Factory firmware will be used." + REGION_CODE="ALL" + fi +else + echo ">>> HWInfo is bad, so region was not found! Setting as ALL." echo ">>> Factory firmware will be used." REGION_CODE="ALL" -else - REGION_CODE=$(xxd -p -s 160 -l 1 "$2") - echo ">>> Region is $REGION_CODE" fi # Make system folders @@ -153,8 +167,8 @@ while IFS= read -r FILE; do # This is only needed for region specific firmware. Since ALL/HNAA has the backup unlaunch as a TMD, it will automatically trigger. if [[ "$FILE" == *"00030017"* ]] && [[ "$FILE" == *"title.tmd" ]]; then cp "./donor/$CONSOLE_SIGNING/software/$FILE" "./tmp.tmd" - echo "47" | dd of="./tmp.tmd" bs=1 seek=400 conv=notrunc status=none - mcopy -D o "./tmd.tmd" "d:/$FILE" + printf "G" | dd of="./tmp.tmd" bs=1 seek=400 conv=notrunc status=none + mcopy -D o "./tmp.tmd" "d:/$FILE" else mcopy -D o "./donor/$CONSOLE_SIGNING/software/$FILE" "d:/$FILE" fi @@ -169,10 +183,10 @@ while IFS= read -r FILE; do echo ">>> Writing ticket..." # Encrypt ticket to console. ./twltool syscrypt --consoleid $3 --in "./donor/$CONSOLE_SIGNING/software/$FILE" --out "./tmp.tik" --encrypt - mcopy "./tmp.tik" "d:/$FILE" + mcopy -D o "./tmp.tik" "d:/$FILE" else echo ">>> Moving title datas..." - mcopy "./donor/$CONSOLE_SIGNING/software/$FILE" "d:/$FILE" + mcopy -D o "./donor/$CONSOLE_SIGNING/software/$FILE" "d:/$FILE" fi done < "./donor/$CONSOLE_SIGNING/software/ALL.txt" @@ -180,13 +194,6 @@ done < "./donor/$CONSOLE_SIGNING/software/ALL.txt" makemdirs "title/00030017/484e4141/content/title.tmd" "d:" mcopy -D o "./donor/hb/HNAALaunch.tmd" "d:/title/00030017/484e4141/content/title.tmd" -nogba_consoleid=$(echo $3 | tac -rs .. | echo "$(tr -d '\n')") -if [[ "$CONSOLE_SIGNING" == "dev" ]]; then - HWINFO_STATUS=$(python hwinfo.py --consoleid $nogba_consoleid --hwinfo $2 --dev verify) -else - HWINFO_STATUS=$(python hwinfo.py --consoleid $nogba_consoleid --hwinfo $2 verify) -fi - if [[ "$HWINFO_STATUS" == "Signature is invalid" ]] || [[ "$2" == "" ]]; then echo ">>> HWInfo is bad! HNAA unlaunch will be needed." else