Skip to content

Commit

Permalink
Ticketless support + Automation Script files
Browse files Browse the repository at this point in the history
  • Loading branch information
ElektroStudios committed Dec 20, 2024
1 parent e7f58c0 commit 85e8a8f
Show file tree
Hide file tree
Showing 9 changed files with 402 additions and 16 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
@ECHO OFF & CHCP 65001 1>NUL & COLOR 07
TITLE Compress NSP/XCI to NSZ/XCZ

REM nsz.exe file path.
SET "nszFilePath=%~dp0nsz.exe"

REM Source directory path where to search for NSP/XCI files.
SET "SrcDirectoryPath=C:\Nintendo Switch dumps"

REM Destination directory path where to save generated NSZ/XCZ files.
SET "DstDirectoryPath=%SrcDirectoryPath%"

REM 'True' to enable recursive NSP/XCI file search on source directory, 'False' to disable it.
SET "EnableRecursiveSearch=False"

REM nsz.exe compression level (maximum value is 22, default is 18).
SET /A "CompressionLevel=22"

REM Additional nsz.exe parameters.
SET "AdditionalParameters=--long --solid --alwaysParseCnmt --undupe-rename --titlekeys --quick-verify"

:WELCOME_SCREEN
ECHO:╔═══════════════════════════════════════════════════════════╗
ECHO:║ TITLE │ Compress NSP/XCI to NSZ/XCZ Script ║
ECHO:║_________│_________________________________________________║
ECHO:║ │ Automates the compression of Nintendo Switch ║
ECHO:║ PURPOSE │ NSP/XCI dumps into NSZ/XCZ format respectively. ║
ECHO:║_________│_________________________________________________║
ECHO:║ VERSION │ ElektroStudios - Ver. 1.2 'keep it simple' ║
ECHO:╚═══════════════════════════════════════════════════════════╝
ECHO+
ECHO:IMPORTANT: Before proceeding, open this script file in Notepad to adjust the following script settings as needed.
ECHO+
ECHO: ○ nsz.exe full path:
ECHO: %nszFilePath%
ECHO+
ECHO: ○ Source directory path where to search for NSP/XCI files:
ECHO: %SrcDirectoryPath%
ECHO+
ECHO: ○ Destination directory path where to save NSZ/XCZ files:
ECHO: %DstDirectoryPath%
ECHO+
ECHO: ○ Enable recursive NSP/XCI file search on source directory:
ECHO: %EnableRecursiveSearch%
ECHO+
ECHO: ○ nsz.exe compression level (max. value is 22):
ECHO: %CompressionLevel%
ECHO+
ECHO: ○ Additional nsz.exe parameters:
ECHO: %AdditionalParameters%
ECHO+
PAUSE
CLS

:PRIMARY_CHECKS
REM Ensure nsz.exe file exists.
IF NOT EXIST "%nszFilePath%" (
CALL :PRINT_ERROR_AND_EXIT nsz.exe file does not exists: "%nszFilePath%"
)
REM Ensure the source directory exists.
IF NOT EXIST "%SrcDirectoryPath%" (
CALL :PRINT_ERROR_AND_EXIT Source directory does not exists: "%SrcDirectoryPath%"
)
REM Ensure the output directory can be created.
MKDIR "%DstDirectoryPath%" 1>NUL 2>&1 || (
IF NOT EXIST "%DstDirectoryPath%" (
CALL :PRINT_ERROR_AND_EXIT Output directory can't be created: "%DstDirectoryPath%"
)
)

:NSZ_WORK
REM FOR-loop logic.
IF /I "%EnableRecursiveSearch%" EQU "True" (
SET "Params=/R "%SrcDirectoryPath%" %%# IN ("*.nsp" "*.xci")"
) ELSE (
SET "Params=%%# IN ("%SrcDirectoryPath%\*.nsp" "%SrcDirectoryPath%\*.xci")"
)
FOR %Params% DO (
TITLE nsz "%%~nx#"
ECHO:Compressing "%%~f#"...
ECHO+
("%nszFilePath%" -C "%%~f#" --output "%DstDirectoryPath%" --level %CompressionLevel% %AdditionalParameters%) || (
CALL :PRINT_ERROR_AND_EXIT nsz failed to compress file: "%%~f#"
)
)

:GOODBYE_SCREEN
COLOR 0A
ECHO+
ECHO:Operation Completed!
ECHO+
PAUSE & EXIT 0

:PRINT_ERROR_AND_EXIT
COLOR 0C
ECHO+
ECHO:ERROR OCCURRED: %*
ECHO+
PAUSE & EXIT 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
@ECHO OFF & CHCP 65001 1>NUL & COLOR 07
TITLE Decompress NSZ/XCZ to NSP/XCI

REM nsz.exe file path.
SET "nszFilePath=%~dp0nsz.exe"

REM Source directory path where to search for NSZ/XCZ files.
SET "SrcDirectoryPath=C:\Nintendo Switch dumps"

REM Destination directory path where to save decompressed NSP/XCI files.
SET "DstDirectoryPath=%SrcDirectoryPath%"

REM 'True' to enable recursive NSZ/XCZ file search on source directory, 'False' to disable it.
SET "EnableRecursiveSearch=False"

REM Additional nsz.exe parameters.
SET "AdditionalParameters=--alwaysParseCnmt --undupe-rename --titlekeys --quick-verify"

:WELCOME_SCREEN
ECHO:╔════════════════════════════════════════════════════════════════╗
ECHO:║ TITLE │ Decompress NSZ/XCZ to NSP/XCI Script ║
ECHO:║_________│______________________________________________________║
ECHO:║ │ Automates the decompression of Nintendo Switch ║
ECHO:║ PURPOSE │ NSZ/XCZ dumps back into NSP/XCI format respectively. ║
ECHO:║_________│______________________________________________________║
ECHO:║ VERSION │ ElektroStudios - Ver. 1.2 'keep it simple' ║
ECHO:╚════════════════════════════════════════════════════════════════╝
ECHO+
ECHO:IMPORTANT: Before proceeding, open this script file in Notepad to adjust the following script settings as needed.
ECHO+
ECHO: ○ nsz.exe file path:
ECHO: %nszFilePath%
ECHO+
ECHO: ○ Source directory path where to search for NSZ/XCZ files:
ECHO: %SrcDirectoryPath%
ECHO+
ECHO: ○ Destination directory path where to save decompressed NSP/XCI files:
ECHO: %DstDirectoryPath%
ECHO+
ECHO: ○ Enable recursive NSZ/XCZ file search on source directory:
ECHO: %EnableRecursiveSearch%
ECHO+
ECHO: ○ Additional nsz.exe parameters:
ECHO: %AdditionalParameters%
ECHO+
PAUSE
CLS

:PRIMARY_CHECKS
REM Ensure nsz.exe file exists.
IF NOT EXIST "%nszFilePath%" (
CALL :PRINT_ERROR_AND_EXIT nsz.exe file does not exists: "%nszFilePath%"
)
REM Ensure the source directory exists.
IF NOT EXIST "%SrcDirectoryPath%" (
CALL :PRINT_ERROR_AND_EXIT Source directory does not exists: "%SrcDirectoryPath%"
)
REM Ensure the output directory can be created.
MKDIR "%DstDirectoryPath%" 1>NUL 2>&1 || (
IF NOT EXIST "%DstDirectoryPath%" (
CALL :PRINT_ERROR_AND_EXIT Output directory can't be created: "%DstDirectoryPath%"
)
)

:NSZ_WORK
REM FOR-loop logic.
IF /I "%EnableRecursiveSearch%" EQU "True" (
SET "Params=/R "%SrcDirectoryPath%" %%# IN ("*.nsz" "*.xcz")"
) ELSE (
SET "Params=%%# IN ("%SrcDirectoryPath%\*.nsz" "%SrcDirectoryPath%\*.xcz")"
)
FOR %Params% DO (
TITLE nsz "%%~nx#"
ECHO:Decompressing "%%~f#"...
ECHO+
("%nszFilePath%" -D "%%~f#" --output "%DstDirectoryPath%" %AdditionalParameters%) || (
CALL :PRINT_ERROR_AND_EXIT nsz failed to decompress file: "%%~f#"
)
)

:GOODBYE_SCREEN
COLOR 0A
ECHO+
ECHO:Operation Completed!
ECHO+
PAUSE & EXIT 0

:PRINT_ERROR_AND_EXIT
COLOR 0C
ECHO+
ECHO:ERROR OCCURRED: %*
ECHO+
PAUSE & EXIT 1
93 changes: 93 additions & 0 deletions Automation Scripts/Batch-Script/Extract NSP∕NSZ∕XCI∕XCZ.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
@ECHO OFF & CHCP 65001 1>NUL & COLOR 07
TITLE Extract NSP/NSZ/XCI/XCZ

:: nsz.exe file path.
SET "nszFilePath=%~dp0nsz.exe"

:: Source directory path where to search for NSP/NSZ/XCI/XCZ files.
SET "SrcDirectoryPath=C:\Nintendo Switch dumps"

:: Destination directory path where to extract NSP/NSZ/XCI/XCZ files.
SET "DstDirectoryPath=%SrcDirectoryPath%"

:: 'True' to enable recursive NSP/NSZ/XCI/XCZ file search on source directory, 'False' to disable it.
SET "EnableRecursiveSearch=False"

:: Additional NSZ parameters.
SET "AdditionalParameters=--alwaysParseCnmt --titlekeys --quick-verify"

:WELCOME_SCREEN
ECHO:╔══════════════════════════════════════════════════════════╗
ECHO:║ TITLE │ Extract NSP/NSZ/XCI/XCZ Script ║
ECHO:║_________│________________________________________________║
ECHO:║ │ Automates the extraction of Nintendo Switch ║
ECHO:║ PURPOSE │ NSP/NSZ/XCI/XCZ file content into directories. ║
ECHO:║_________│________________________________________________║
ECHO:║ VERSION │ ElektroStudios - Ver. 1.2 'keep it simple' ║
ECHO:╚══════════════════════════════════════════════════════════╝
ECHO+
ECHO:IMPORTANT: Before proceeding, open this script file in Notepad to adjust the following script settings as needed.
ECHO+
ECHO: ○ nsz.exe file path:
ECHO: %nszFilePath%
ECHO+
ECHO: ○ Source directory path where to search for NSP/NSZ/XCI/XCZ files:
ECHO: %SrcDirectoryPath%
ECHO+
ECHO: ○ Destination directory path where to extract the content of NSP/NSZ/XCI/XCZ files:
ECHO: %DstDirectoryPath%
ECHO+
ECHO: ○ Enable recursive NSP/NSZ/XCI/XCZ file search on source directory:
ECHO: %EnableRecursiveSearch%
ECHO+
ECHO: ○ Additional nsz.exe parameters:
ECHO: %AdditionalParameters%
ECHO+
PAUSE
CLS

:PRIMARY_CHECKS
REM Ensure nsz.exe file exists.
IF NOT EXIST "%nszFilePath%" (
CALL :PRINT_ERROR_AND_EXIT nsz.exe file does not exists: "%nszFilePath%"
)
REM Ensure the source directory exists.
IF NOT EXIST "%SrcDirectoryPath%" (
CALL :PRINT_ERROR_AND_EXIT Source directory does not exists: "%SrcDirectoryPath%"
)
REM Ensure the output directory can be created.
MKDIR "%DstDirectoryPath%" 1>NUL 2>&1 || (
IF NOT EXIST "%DstDirectoryPath%" (
CALL :PRINT_ERROR_AND_EXIT Output directory can't be created: "%DstDirectoryPath%"
)
)

:NSZ_WORK
REM FOR-loop logic.
IF /I "%EnableRecursiveSearch%" EQU "True" (
SET "Params=/R "%SrcDirectoryPath%" %%# IN ("*.nsp" "*.nsz" "*.xci" "*.xcz")"
) ELSE (
SET "Params=%%# IN ("%SrcDirectoryPath%\*.nsp" "%SrcDirectoryPath%\*.nsz" "%SrcDirectoryPath%\*.xci" "%SrcDirectoryPath%\*.xcz")"
)
FOR %Params% DO (
TITLE nsz "%%~nx#"
ECHO:Extracting "%%~f#"...
ECHO+
("%nszFilePath%" --extract "%%~f#" --output "%DstDirectoryPath%" %AdditionalParameters%) || (
CALL :PRINT_ERROR_AND_EXIT nsz failed to extract file: "%%~f#"
)
)

:GOODBYE_SCREEN
COLOR 0A
ECHO+
ECHO:Operation Completed!
ECHO+
PAUSE & EXIT 0

:PRINT_ERROR_AND_EXIT
COLOR 0C
ECHO+
ECHO:ERROR OCCURRED: %*
ECHO+
PAUSE & EXIT 1
81 changes: 81 additions & 0 deletions Automation Scripts/Batch-Script/Get title keys.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
@ECHO OFF & CHCP 65001 1>NUL & COLOR 07
TITLE Get title keys

REM nsz.exe file path.
SET "nszFilePath=%~dp0nsz.exe"

REM Source directory path where to search for NSP/NSZ/XCI/XCZ files.
SET "SrcDirectoryPath=C:\Nintendo Switch dumps"

REM 'True' to enable recursive NSP/NSZ/XCI/XCZ file search on source directory, 'False' to disable it.
SET "EnableRecursiveSearch=False"

REM Additional nsz.exe parameters.
SET "AdditionalParameters=--alwaysParseCnmt"

:WELCOME_SCREEN
ECHO:╔══════════════════════════════════════════════════════╗
ECHO:║ TITLE │ Extract title keys Script ║
ECHO:║_________│____________________________________________║
ECHO:║ │ Automates the extraction of title keys for ║
ECHO:║ PURPOSE │ Nintendo Switch NSP/NSZ/XCI/XCZ dumps. ║
ECHO:║_________│____________________________________________║
ECHO:║ VERSION │ ElektroStudios - Ver. 1.2 'keep it simple' ║
ECHO:╚══════════════════════════════════════════════════════╝
ECHO+
ECHO:IMPORTANT: Before proceeding, open this script file in Notepad to adjust the following script settings as needed.
ECHO+
ECHO: ○ nsz.exe file path:
ECHO: %nszFilePath%
ECHO+
ECHO: ○ Source directory path where to search for NSP/NSZ/XCI/XCZ files:
ECHO: %SrcDirectoryPath%
ECHO+
ECHO: ○ Enable recursive NSP/NSZ/XCI/XCZ file search on source directory:
ECHO: %EnableRecursiveSearch%
ECHO+
ECHO: ○ Additional nsz.exe parameters:
ECHO: %AdditionalParameters%
ECHO+
PAUSE
CLS

:PRIMARY_CHECKS
REM Ensure nsz.exe file exists.
IF NOT EXIST "%nszFilePath%" (
CALL :PRINT_ERROR_AND_EXIT nsz.exe file does not exists: "%nszFilePath%"
)
REM Ensure the source directory exists.
IF NOT EXIST "%SrcDirectoryPath%" (
CALL :PRINT_ERROR_AND_EXIT Source directory does not exists: "%SrcDirectoryPath%"
)

:NSZ_WORK
REM FOR-loop logic.
IF /I "%EnableRecursiveSearch%" EQU "True" (
SET "Params=/R "%SrcDirectoryPath%" %%# IN ("*.nsp" "*.xci")"
) ELSE (
SET "Params=%%# IN ("%SrcDirectoryPath%\*.nsp" "%SrcDirectoryPath%\*.xci")"
)
FOR %Params% DO (
TITLE nsz "%%~nx#"
ECHO:Extracting title keys for "%%~f#"...
ECHO+
("%nszFilePath%" --info "%%~f#" --titlekeys %AdditionalParameters%) || (
CALL :PRINT_ERROR_AND_EXIT nsz failed to parse file: "%%~f#"
)
)

:GOODBYE_SCREEN
COLOR 0A
ECHO+
ECHO:Operation Completed!
ECHO+
PAUSE & EXIT 0

:PRINT_ERROR_AND_EXIT
COLOR 0C
ECHO+
ECHO:ERROR OCCURRED: %*
ECHO+
PAUSE & EXIT 1
Loading

0 comments on commit 85e8a8f

Please sign in to comment.