Created
January 28, 2022 04:44
-
-
Save Azure-Agst/e93c3e55a5c6b2f42d0b5f7fb6301701 to your computer and use it in GitHub Desktop.
Botched Switch Update Recovery Seript
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
@echo off | |
:: Check for all tools | |
set tools=hactool.exe bincmp.exe BCPKG2-1-Normal-Main.bin prod.keys | |
for %%f in (%tools%) do ( | |
if NOT EXIST %%f ( | |
echo ERROR: '%%f' is not in this directory! | |
goto END | |
) | |
) | |
:: Check for XCI | |
if "%~x1" neq ".xci" ( | |
echo ERROR: Please run me with your XCI as an argument! | |
goto END | |
) | |
:: Extract XCI's update contents | |
hactool.exe -t xci --disablekeywarns --updatedir=update %1 | |
:: Iterate thru them, and if they have relevant content, extract. | |
:: Reminder: 010000000000081b == BootImagePackageExFat | |
:: https://switchbrew.org/wiki/Title_list | |
for %%f in (update/*.*) do ( | |
hactool -i -k prod.keys --disablekeywarns update/%%f | findstr 010000000000081b>NUL | |
if NOT ERRORLEVEL 1 ( | |
hactool -k prod.keys --disablekeywarns --romfsdir=out update/%%f | |
) | |
) | |
:: Make a backup of the old BCPKG2-1-Normal-Main.bin dump | |
:: If a backup exists, restore from it | |
if EXIST BCPKG2-1-Normal-Main.bin.bak ( | |
echo Restoring from backup... | |
del /f BCPKG2-1-Normal-Main.bin | |
copy BCPKG2-1-Normal-Main.bin.bak BCPKG2-1-Normal-Main.bin | |
) else ( | |
echo Making backup... | |
copy BCPKG2-1-Normal-Main.bin BCPKG2-1-Normal-Main.bin.bak | |
) | |
:: Edit package2 and copy in ExFat driver | |
bincmp out/nx/package2 -writeto BCPKG2-1-Normal-Main.bin -offs2=16384 | |
:END | |
pause |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment