Toggle menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

HacBrewPack Switch

From GameBrew
Revision as of 07:38, 10 Haziran 2023 by HydeWing (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
hacBrewPack
Hacbrewpacknx.png
General
AuthorThe-4n
TypePC Utilities
Version3.05
LicenseGPL-2.0
Last Updated2019/10/13
Links
Download
Website
Source

hacBrewPack is a tool for creating Nintendo Switch NCAs (Nintendo Content Archive) from homebrews and pack them into NSPs (Nintendo Submission Package).

User guide

Keys

  • You should place your keyset file with "keys.dat" filename in the same folder as hacBrewPack.
  • hacBrewPack tries to load "keys.txt", "keys.ini", "prod.keys" and "~/.switch/prod.keys" files if "keys.dat" doesn't exist.
  • Alternatively, You can use -k or --keyset option to load your keyset file.

Required keys are:

Key Name Description
header_key NCA Header Key
key_area_key_application_xx Application key area encryption keys

Compiling Homebrew

  • You need to compile homebrew with proper Makefile, you can use the one in template folder.
  • You must use valid lower-case titleid in Makefile and npdm.json. Valid titleid range is: 0x0100000000000000 - 0x0fffffffffffffff.
  • It's not suggested to use a titleid higher than 0x01ffffffffffffff.
  • Both titleids in Makefile and npdm.json must be the same.

Compiled homebrew must have following files:

build\exefs\main  
build\exefs\main.npdm  
[TARGET].nacp  

You must place created 'main' and 'main.npdm' files in exefs folder, you can find them in build/exefs.

You must rename created nacp file to 'control.nacp' and place it in control folder.

Icon

You should place your icon with "icon_{Language}.dat" file name in control folder, "icon_AmericanEnglish.dat" is the default one if you don't manually edit your nacp. dat files are just renamed jpg files.

Check switchbrew for more info about language names.

Your icon file format must be JPEG with 256x256 dimensions.

  • It's highly recommended to delete unnecessary exif data from your jpeg file (easy way: Open icon with GIMP or Paint, save as bmp, Open it again and save as jpg).
  • If you see placeholder instead of icon after installing nsp, It's likely due to exif data.
  • If you have some exif data that horizon os doesn't like (like Camera Brand), Your app may leave in installing state in qlaunch.

If you don't put your icon in control folder, you'll see a general icon after installing nsp (this is not recommended).

"logo" folder should contain "NintendoLogo.png" and "StartupMovie.gif". They'll appear when the app is loading.

Both files are not licensed according to switchbrew but none of those are included. You can also replace these files with custom ones.

You can use --nologo if you don't have any custom logos and you don't have the original ones, as the result switch will show a black screen without nintendo logo at top left and switch animation on bottom right.

CLI options

*nix: ./hacbrewpack [options...]  
Windows: .\hacbrewpack.exe [options...]  
  
Options:  
-k, --keyset             Set keyset filepath, default filepath is ./keys.dat  
-h, --help               Display usage  
--nspdir                 Set output nsp directory path, default path is ./hacbrewpack_nsp/  
--ncadir                 Set output nca directory path, default path is ./hacbrewpack_nca/  
--tempdir                Set temp directory filepath, default filepath is ./hacbrewpack_temp/  
--backupdir              Set output nsp directory path, default path is ./hacbrewpack_backup/  
--exefsdir               Set program exefs directory path, default path is ./exefs/  
--romfsdir               Set program romfs directory path, default path is ./romfs/  
--logodir                Set program logo directory path, default path is ./logo/  
--controldir             Set control romfs directory path, default path is ./control/  
--htmldocdir             Set HtmlDocument romfs directory path  
--legalinfodir           Set LegalInformation romfs directory path  
--noromfs                Skip creating program romfs section  
--nologo                 Skip creating program logo section  
--keygeneration          Set keygeneration for encrypting key area keys  
--keyareakey             Set Set key area key 2 in hex with 16 bytes lenght  
--sdkversion             Set SDK version in hex, default SDK version is 000C1100  
--plaintext              Skip encrypting sections and set section header block crypto type to plaintext  
--keepncadir             Keep NCA directory  
--nosignncasig2          Skip patching acid public key in npdm and signing nca header with acid public key  
Overriding options:  
--titleid                Use specified titleid for creating ncas and patch titleid in npdm and nacp  
--titlename              Change title name in nacp for all languages, max size is 512 bytes  
--titlepublisher         Change title publisher in nacp for all languages, max size is 256 bytes  
--nopatchnacplogo        Skip changing logo handeling to auto in NACP  

hacBrewPack doesn't need any options to work. if you follow folder structure properly, you can just run the program and it'll make a NSP.

Check template folder for default folder structure, Makefile, npdm json and other useful info.

Changelog

v3.05 2019/10/13

  • Added support for keygeneration 8+.

v3.00 2019/04/03

  • Added support for creating LegalInformation NCA.
  • Added program nca signature 2 signing using self-generated acid public key.
  • Added automatic backup from main.npdm and control.nacp.
  • Fixed a bug in loading keyset file.

v2.05 2019/02/03

  • hacBrewPack now tries to load "keys.txt", "keys.ini", "prod.keys" and "~/.switch/prod.keys" files if "keys.dat" doesn't exist.

v2.00 2019/02/02

  • Added support for creating HtmlDocument ncas.

v1.30 2019/01/14

  • Added --titleid, --titlename and --titlepublisher options for overriding main.npdm and control.nacp.

v1.21 2018/12/27

  • Added support for keygeneration 7.
  • Changed PFS0 hash block size and padding size for better compatibility.

v1.20 2018/11/26

  • hacBrewPack now reads titleid from NPDM.
  • Added nonacplogopatch option.
  • Fixed a bug cause invalid IVFC level 6 when romfs section is big.
  • Fixed a bug in writing padding.
  • Fixed sdkversion valid range.
  • Changed hash block size for better compatibility.
  • Increased NCA section encryption buffer size.
  • Changed valid titleid range.

v1.18 2018/10/11

  • Fixed a bug cause making bad PFS0 for files larger than 4GB in 32-bit platforms.

v1.17 2018/10/09

  • Added buffer for creating PFS0.
  • Increased buffer size for creating RomFS.

v1.16 2018/10/03

  • Fixed a bug cause failure of control.nacp validation in titles without AmericanEnglish title name and title author.

v1.15 2018/09/28

  • hacBrewPack now removes temp and nca directories before start and after the process is done. You can use --keepncadir to keep nca directory and files after the process is done.
  • hacBrewpack no longer creates separate files for ivfc level 6 and romfs which decreases the temp folder size.
  • Added buffer for calculating PFS0 masterhash.
  • Fixed a bug in building PFS0 which cause duplicate filepath separator in paths.

v1.10 2018/09/24

  • Added sdkverison option.
  • Added keyareakey option.
  • Added summary.

v1.00 2018/09/22

  • Added keygeneration option.

v0.99-beta.2 2018/09/21

  • Added NACP verification for TitleID, Title Name and Author.
  • Added Plaintext option.

v0.99-beta.1 2018/09/19

  • Initial Release.

Credits

Thanks: SciresM, yellows8, Adubbz, SwitchBrew.

External links

Advertising: