Skip to content

Instantly share code, notes, and snippets.

@ImanCol
Last active February 15, 2024 23:30
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ImanCol/0c66fecf71bc5e6dff5bc9071065264d to your computer and use it in GitHub Desktop.
Save ImanCol/0c66fecf71bc5e6dff5bc9071065264d to your computer and use it in GitHub Desktop.
Sign and compile Unity-compiled projects on the Nintendo Switch platform using hacpack
@echo off
set /p ID=Ingresa el ID (SAME control.xml!!)(Example: 0100444444440000) :
Tools\hacpack.exe -k "%userprofile%\.switch\prod.keys" -o "%temp%\NCA" --titleid %ID% --type nca --ncatype program --exefsdir "E:\Switch\NSO\SNESNSO\USA-EUR\exefs" --romfsdir "E:\Switch\NSO\SNESNSO\USA-EUR\romfs" --logodir "Files\logo"
Tools\hacpack.exe -k "%userprofile%\.switch\prod.keys" -o "%temp%\NCA" --titleid %ID% --type nca --ncatype control --romfsdir "Files\control"
forfiles /P "%temp%\NCA" /M * /C "cmd /c if @fsize GEQ 20000000 echo @path > "%temp%\largefiles.txt"
set /p largefiles=<"%temp%\largefiles.txt"
forfiles /P "%temp%\NCA" /M * /C "cmd /c if @fsize LEQ 500000 echo @path > "%temp%\smalledfiles.txt"
set /p smalledfiles=<"%temp%\smalledfiles.txt"
Tools\hacpack.exe -k "%userprofile%\.switch\prod.keys" -o "%temp%\NCA" --titleid %ID% --type nca --ncatype meta --titletype application --programnca %largefiles% --controlnca %smalledfiles%
Tools\hacpack.exe -k "%userprofile%\.switch\prod.keys" -o "NSP" --titleid %ID% --type nsp --ncadir "%temp%\NCA"
rmdir /S /Q "%temp%\NCA"
rmdir /S /Q "hacpack_backup"
del /S /Q "%temp%\smalledfiles.txt"
del /S /Q "%temp%\largefiles.txt"
pause
@echo off
set /p NSP_Unpack=Ingresa el NSP a desempaquetar:
set /p ID=Ingresa el ID (SAME NSP!!)(Example: 0100444444440000) :
set /p Output_Unpack=Ingresa la Carpeta donde se desempaquetara:
%NINTENDO_SDK_ROOT%\Tools\AuthoringEditor\AuthoringTool\AuthoringTool.exe extract -o "%Output_Unpack%\extract" %NSP_Unpack%
set /p program=Ingresa la carpeta Program:
hacpack.exe -k "%userprofile%\.switch\prod.keys" -o "%temp%\NCA" --titleid %ID% --type nca --ncatype program --exefsdir "%program%\fs0" --romfsdir "%program%\fs1" --logodir "%program%\fs2"
set /p Control=Ingresa la carpeta Control:
hacpack.exe -k "%userprofile%\.switch\prod.keys" -o "%temp%\NCA" --titleid %ID% --type nca --ncatype control --romfsdir "%Control%\fs0"
forfiles /P "%temp%\NCA" /M * /C "cmd /c if @fsize GEQ 20000000 echo @path > "%temp%\largefiles.txt"
set /p largefiles=<"%temp%\largefiles.txt"
forfiles /P "%temp%\NCA" /M * /C "cmd /c if @fsize LEQ 500000 echo @path > "%temp%\smalledfiles.txt"
set /p smalledfiles=<"%temp%\smalledfiles.txt"
hacpack.exe -k "%userprofile%\.switch\prod.keys" -o "%temp%\NCA" --titleid %ID% --type nca --ncatype meta --titletype application --programnca %largefiles% --controlnca %smalledfiles%
set /p Output_Pack=Ingresa la carpeta donde desea guardar el NSP:
hacpack.exe -k "%userprofile%\.switch\prod.keys" -o "%Output_Pack%" --titleid %ID% --type nsp --ncadir "%temp%\NCA"
rmdir /S /Q "%temp%\NCA"
rmdir /S /Q "%Output_Unpack%\extract"
rmdir /S /Q "hacpack_backup"
del /S /Q "%temp%\smalledfiles.txt"
del /S /Q "%temp%\largefiles.txt"
pause
@echo off
set /p Temp_Unity=Ingresa la carpeta temp del Proyecto de Unity(Sin espacios):
set /p ID=Ingresa el ID (SAME NSP!!)(Example: 01004b9000490000) :
set program="%Temp_Unity%"\StagingArea\SwitchPlayer.nspd\program0.ncd\
set control="%Temp_Unity%"\StagingArea\SwitchPlayer.nspd\control0.ncd\
hacpack.exe -k "%userprofile%\.switch\prod.keys" -o "%temp%\NCA" --titleid %ID% --type nca --ncatype program --exefsdir "%program%code" --romfsdir "%program%data" --logodir "%program%logo"
hacpack.exe -k "%userprofile%\.switch\prod.keys" -o "%temp%\NCA" --titleid %ID% --type nca --ncatype control --romfsdir "%Control%data"
forfiles /P "%temp%\NCA" /M * /C "cmd /c if @fsize GEQ 20000000 echo @path > "%temp%\largefiles.txt"
set /p largefiles=<"%temp%\largefiles.txt"
forfiles /P "%temp%\NCA" /M * /C "cmd /c if @fsize LEQ 500000 echo @path > "%temp%\smalledfiles.txt"
set /p smalledfiles=<"%temp%\smalledfiles.txt"
hacpack.exe -k "%userprofile%\.switch\prod.keys" -o "%temp%\NCA" --titleid %ID% --type nca --ncatype meta --titletype application --programnca %largefiles% --controlnca %smalledfiles%
set /p Output_Pack=Ingresa la carpeta donde desea guardar el NSP:
hacpack.exe -k "%userprofile%\.switch\prod.keys" -o "%Output_Pack%" --titleid %ID% --type nsp --ncadir "%temp%\NCA"
rmdir /S /Q "%temp%\NCA"
rmdir /S /Q "hacpack_backup"
del /S /Q "%temp%\smalledfiles.txt"
del /S /Q "%temp%\largefiles.txt"
pause
@ImanCol
Copy link
Author

ImanCol commented Dec 16, 2020

Needs to:
NINTENDO SDK + Environment variable %NINTENDO_SDK_ROOT%
Add hackpack in an environment variable %hacpack%

Firmar NSP (Unity Temp Project).bat needs to have previously compiled an NSP to find the files in the Temp folder of the project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment