สคริปต์การบีบอัด/decompresson (พร้อม GUI เสริม) ที่ช่วยให้ผู้ใช้สามารถบีบอัด/คลาย Nintendo สวิตช์ Nintendo ได้อย่างไร้ที่ติด้วยอัลกอริทึมการบีบอัด ZSTD ไฟล์บีบอัดสามารถติดตั้งได้โดยตรงด้วยตัวติดตั้งชื่อ NSW Homebrew ที่รองรับ
กระจกสวิสของที่เก็บนี้ได้รับการดูแลรักษาภายใต้ https://gitlab.nicobosshard.ch/nicoboss/nsz
นี่จะเป็นบ้านใหม่ในกรณีที่ GitHub เคยลง NSZ กรุณาบุ๊กมาร์ก
มีหลายวิธีในการติดตั้งเครื่องมือนี้ คุณสามารถค้นหารายละเอียดเกี่ยวกับการติดตั้งสำหรับทั้งหมดด้านล่าง
คุณต้องมีไฟล์คีย์ที่เข้ากันได้ของ Hactool ในไดเรกทอรีที่เหมาะสมเพื่อใช้เครื่องมือนี้
ไฟล์คีย์จะต้องเป็นไฟล์ prod.keys
ใน %USERPROFILE%/.switch/
(windows)/ $HOME/.switch/
(unix) หรือ keys.txt
ในไดเรกทอรีการทำงาน คุณต้องได้รับกุญแจอย่างถูกกฎหมาย!
คุณยังสามารถใช้ไบนารี Windows พวกเขาไม่ต้องการให้ติดตั้งไลบรารีภายนอกและสามารถทำงานได้โดยไม่ต้องติดตั้งอะไรเลย คุณสามารถค้นหาไบนารีในหน้ารีลีส
วิธีการที่แสดงไว้ด้านล่างต้องการให้คุณติดตั้ง Python 3.6+ และ PIP3
ใช้คำสั่งต่อไปนี้เพื่อติดตั้งเวอร์ชันคอนโซลเท่านั้น:
pip3 install --upgrade nsz
ใช้คำสั่งต่อไปนี้เพื่อติดตั้งเวอร์ชัน GUI:
pip3 install --upgrade nsz[gui]
เครื่องมือนี้ยังสามารถเรียกใช้งานได้โดยการโคลนที่เก็บการติดตั้งข้อกำหนดแล้วดำเนินการ NSZ โดยใช้ python3 nsz.py
ใช้คำสั่งต่อไปนี้เพื่อติดตั้งข้อกำหนดเวอร์ชันคอนโซลเท่านั้น:
pip3 install -r requirements.txt
ใช้คำสั่งต่อไปนี้เพื่อติดตั้งข้อกำหนดเวอร์ชัน GUI:
pip3 install -r requirements-gui.txt
nsz.py --help
usage: nsz.py [-h] [-C] [-D] [-l LEVEL] [-L] [-B] [-S] [-s BS] [-V] [-Q] [-K]
[-F] [-p] [-P] [-t THREADS] [-m MULTI] [-o [OUTPUT]] [-w] [-r]
[--rm-source] [-i] [--depth DEPTH] [-x]
[--extractregex EXTRACTREGEX] [--titlekeys] [--undupe]
[--undupe-dryrun] [--undupe-rename] [--undupe-hardlink]
[--undupe-prioritylist UNDUPE_PRIORITYLIST]
[--undupe-whitelist UNDUPE_WHITELIST]
[--undupe-blacklist UNDUPE_BLACKLIST] [--undupe-old-versions]
[-c CREATE]
[file ...]
positional arguments:
file
options:
-h, --help show this help message and exit
-C Compress NSP/XCI
-D Decompress NSZ/XCZ/NCZ
-l LEVEL, --level LEVEL
Compression Level: Trade-off between compression speed
and compression ratio. Default: 18, Max: 22
-L, --long Enables zStandard long distance mode for even better
compression
-B, --block Use block compression option. This mode allows highly
multi-threaded compression/decompression with random
read access allowing compressed games to be played
without decompression in the future however this comes
with a slightly lower compression ratio cost. This is
the default option for XCZ.
-S, --solid Use solid compression option. Slightly higher
compression ratio but won't allow for random read
access. File compressed this way will never be
mountable (have to be installed or decompressed first
to run). This is the default option for NSZ.
-s BS, --bs BS Block Size for random read access 2^x while x between
14 and 32. Default: 20 => 1 MB
-V, --verify Verifies files after compression raising an unhandled
exception on hash mismatch and verify existing NSP and
NSZ files when given as parameter. Requires --keep
when used during compression.
-Q, --quick-verify Same as --verify but skips the NSP SHA256 hash
verification and only verifies NCA hashes. Does not
require --keep when used during compression.
-K, --keep Keep all useless files and partitions during
compression to allow bit-identical recreation
-F, --fix-padding Fixes PFS0 padding to match the nxdumptool/no-intro
standard. Incompatible with --verify so --quick-verify
will be used instead.
-p, --parseCnmt Extract TitleId/Version from Cnmt if this information
cannot be obtained from the filename. Required for
skipping/overwriting existing files and --rm-old-
version to work properly if some not every file is
named properly. Supported filenames:
*TitleID*[vVersion]*
-P, --alwaysParseCnmt
Always extract TitleId/Version from Cnmt and never
trust filenames
-t THREADS, --threads THREADS
Number of threads to compress with. Numbers < 1
corresponds to the number of logical CPU cores for
block compression and 3 for solid compression
-m MULTI, --multi MULTI
Executes multiple compression tasks in parallel. Take
a look at available RAM especially if compression
level is over 18.
-o [OUTPUT], --output [OUTPUT]
Directory to save the output NSZ files
-w, --overwrite Continues even if there already is a file with the
same name or title id inside the output directory
-r, --rm-old-version Removes older versions if found
--rm-source Deletes source file/s after compressing/decompressing.
It's recommended to only use this in combination with
--verify
-i, --info Show info about title or file
--depth DEPTH Max depth for file info and extraction
-x, --extract Extract a NSP/XCI/NSZ/XCZ/NSPZ
--extractregex EXTRACTREGEX
Regex specifying which files inside the container
should be extracted. Example: "^.*.(cert|tik)$"
--titlekeys Extracts titlekeys from your NSP/NSZ files and adds
missing keys to ./titlekeys.txt and JSON files inside
./titledb/ (obtainable from
https://github.com/blawar/titledb).
--undupe Deleted all duplicates (games with same ID and
Version). The Files folder will get parsed in order so
the later in the argument list the more likely the
file is to be deleted
--undupe-dryrun Shows what files would get deleted using --undupe
--undupe-rename Renames files to minimal standard:
[TitleId][vVersion].nsz
--undupe-hardlink Hardlinks files to minimal standard:
[TitleId][vVersion].nsz
--undupe-prioritylist UNDUPE_PRIORITYLIST
Regex specifying which dublicate deletion should be
prioritized before following the normal deletion
order. Example: "^.*.(nsp|xci)$"
--undupe-whitelist UNDUPE_WHITELIST
Regex specifying which dublicates should under no
circumstances be deleted. Example: "^.*.(nsz|xcz)$"
--undupe-blacklist UNDUPE_BLACKLIST
Regex specifying which files should always be deleted
- even if they are not even a dublicate! Be careful!
Example: "^.*.(nsp|xci)$"
--undupe-old-versions
Removes every old version as long there is a newer one
of the same titleID.
-c CREATE, --create CREATE
Inverse of --extract. Repacks files/folders to an NSP.
Example: --create out.nsp .in
nsz -C /path/to/folder/with/dumps/
nsz --verify -C /path/to/folder/with/dumps/
nsz --threads 8 --output /path/to/out/dir/ -C /path/to/folder/with/dumps/
nsz --level 22 -C /path/to/folder/with/dumps/
nsz -D /path/to/folder/with/dumps/
หากต้องการดูธงที่เป็นไปได้ทั้งหมดและคำอธิบายเกี่ยวกับสิ่งที่แต่ละธงตรวจสอบส่วนการใช้งาน
ไฟล์ NSZ นั้นเหมือนกันกับไฟล์ NSP วัตถุประสงค์เพียงอย่างเดียวของพวกเขาในการแจ้งเตือนผู้ใช้ว่ามีไฟล์ NCZ ที่บีบอัด ไฟล์ NCZ สามารถผสมกับไฟล์ NCA ในคอนเทนเนอร์เดียวกัน
อีกทางเลือกหนึ่งสำหรับเครื่องมือนี้ NSC_Builder ยังรองรับการบีบอัด NSP ถึง NSZ และการบีบอัด NSZ ถึง NSP สามารถดาวน์โหลด nsc_builder ได้ที่ https://github.com/julesontheroad/nsc_builder
ไฟล์ XCZ นั้นเหมือนกันกับไฟล์ XCI วัตถุประสงค์เพียงอย่างเดียวของพวกเขาในการแจ้งเตือนผู้ใช้ว่ามีไฟล์ NCZ ที่บีบอัด ไฟล์ NCZ สามารถผสมกับไฟล์ NCA ในคอนเทนเนอร์เดียวกัน
เหล่านี้เป็นไฟล์ NCA ที่บีบอัด NCA ถูกถอดรหัสแล้วบีบอัดโดยใช้ Zstandard
0x4000 ไบต์แรกของไฟล์ NCZ นั้นเหมือนกับ NCA ดั้งเดิม (และยังคงเข้ารหัส) สิ่งนี้ใช้ได้แม้ว่าส่วนแรกจะไม่เริ่มต้นที่ 0x4000
ที่ 0x4000 มีส่วนหัว NCZ ขนาดตัวแปร มันมีรายการของส่วนที่บอกการคลายการบีบอัดว่าจะเข้ารหัสข้อมูล NCA อีกครั้งหลังจากการบีบอัด นอกจากนี้ยังสามารถมีส่วนหัวการบีบอัดบล็อกเสริมที่ช่วยให้การเข้าถึงการอ่านแบบสุ่ม
ข้อมูลทั้งหมดในส่วนหัวสามารถได้มาจากตั๋ว NCA + ดั้งเดิมอย่างไรก็ตามมีการจัดเตรียมไว้ล่วงหน้าเพื่อให้การบีบอัดการบีบอัดเป็นเรื่องง่ายที่สุดเท่าที่จะเป็นไปได้สำหรับบุคคลที่สาม
โดยตรงหลังจากส่วนหัว NCZ สตรีม Zstandard เริ่มต้นและสิ้นสุดที่ EOF สตรีมถูกบีบอัดเพื่อชดเชย 0x4000 หากใช้การบีบอัดบล็อกจะถูกแยกออกเป็นบล็อกอิสระและสามารถบีบอัดได้ดังที่แสดงใน https://github.com/nicoboss/nsz/blob/master/nsz/blockdecompressorreader.py CompressedBlockSizeList [blockid] จะต้องไม่เกิน decompressedblocksize หากเล็กลงบล็อกจะต้องคลายการบีบอัด หากเท่ากันบล็อกจะถูกเก็บไว้ในข้อความธรรมดา
class Section :
def __init__ ( self , f ):
self . magic = f . read ( 8 ) # b'NCZSECTN'
self . offset = f . readInt64 ()
self . size = f . readInt64 ()
self . cryptoType = f . readInt64 ()
f . readInt64 () # padding
self . cryptoKey = f . read ( 16 )
self . cryptoCounter = f . read ( 16 )
class Block :
def __init__ ( self , f ):
self . magic = f . read ( 8 ) # b'NCZBLOCK'
self . version = f . readInt8 ()
self . type = f . readInt8 ()
self . unused = f . readInt8 ()
self . blockSizeExponent = f . readInt8 ()
self . numberOfBlocks = f . readInt32 ()
self . decompressedSize = f . readInt64 ()
self . compressedBlockSizeList = []
for i in range ( self . numberOfBlocks ):
self . compressedBlockSizeList . append ( f . readInt32 ())
nspf . seek ( 0x4000 )
sectionCount = nspf . readInt64 ()
for i in range ( sectionCount ):
sections . append ( Section ( nspf ))
if blockCompression :
BlockHeader = Block ( nspf )
แพ็คเกจ NSZ PIP: https://pypi.org/project/nsz/
เธรดฟอรัม: https://gbatemp.net/threads/nsz-homebrew-compatible-nsp-xci-compressor-decompressor.550556/
SciresM สำหรับฟังก์ชั่นการเข้ารหัสลับฮาร์ดแวร์ของเขา; ความเร็วในการติดตั้งที่น่าทึ่ง (50 MB/Sec +) ที่ได้รับที่นี่จะเป็นไปไม่ได้หากไม่มีสิ่งนี้
ขอบคุณผู้มีส่วนร่วมของเรา: Nicoboss, Blawar, Plato79, Exhumer, Taorni, Anthonyu, Teknoraver, Kwottrich, Gabest11, Siddhartha77, Alibryd, Seiya-Git, Drizzt, 16Bitwonder