Usage - Nanook/NKit GitHub Wiki

NKit is primarily a library with many features and options with more to be added. The library uses a yaml config file to hold the various options. Applications using the library such as the nkit[.exe] can specify an alternative config if required.

This documentation is to reflect how the supplied command line app (nkit[.exe]) should function. Please raise an issue if the app does not conform to this documentation and it will be bug fixed or the documentation updated.

Setup

NKit is written in C# for dotnet6.0 (and .NetFramework4.8 for the Windows 7 version). Versions marked Standalone or UI have the dotnet runtime embedded and can be run without installing the dotnet runtime environment.

Versions not marked standalone require the host operating system to have the dotnet runtime environment installed. This can be downloaded here https://dotnet.microsoft.com. There are installers for Windows and Mac and many Linux distributions have it packaged. Without a distro specific package Linux is a bit more involved.

This page shows how to install on linux using the script. Summarised below:

Read the page for further instructions to permanently add the dotnet commands to your shell.

wget https://dot.net/v1/dotnet-install.sh
chmod +x dotnet-install.sh
./dotnet-install.sh -c 6.0
export DOTNET_ROOT=~/.dotnet
export PATH=$PATH:$DOTNET_ROOT

Running the nkit[.exe] app for the first time with the default config should print a basic usage message. This means it's working, however it needs input to process.

Input Parameters

This is a list of all the input params supported by NKit 2. They can be set on the command line or read from a config file. By default nkit.yaml is loaded by the nkit app. Parameter values in the config can be overridden by specifying them on the command line.

Required Parameters

Name Description
task Processing task to be performed. See the Processing Tasks documentation for more information
in Input folder / file / archive / mask. See File Masks for detailed information. Config supports 2 formats
in: path/filename.iso

in:
- path/.iso
- Path/
.wbf?
Any params following a -- param are regard as -in params e.g. -- file.iso file.rvz

Supported Images: iso / rvz / wud / wux / tmd / wbfs+wbf1 / ciso / iso.dec / wia / gcz / nkit.iso / nkit.gcz / cue+bin / gdi / dec.iso
Supported Archives: zip / rar / 7z (including split and multi volume)

Basic Parameters

Name Description
out Output path. Filenames will be calculated from the processed files. If blank, the path of the file being processed will be used
tmp Temp path. Written files are output to this path. Upon completion they are moved to the out path. If blank, the path of the file being processed will be used
r Recursive in path search y or n
arc Archive in path search y or n. Search inside archives for images. Supports split archives and multiple images per archive
v Verify processed images. Valid values:
y - enabled
n - disabled
datLookup - Force lookup in a dat for validation

Task Specific Parameters

Name Description
convert Convert Task: The format to use when using the convert task for and image matching this system type. Each system and format can have their own values
fixInfo Fix Task: Filename of a yaml with system specific system related info to repair images. Used to lookup the correct GameCube junk ID for a few demo/sample images
fixFiles Fix Task: A path to NKit recovery files (as used/created by nkit v1)

See the Processing Tasks documentation for details.

General Parameters

Name Description
system Limit scanning to the specified system. If blank then all system images are processed
keys A path and mask to file, folder or zip / rar / 7z / gzip e.g.
- path/folderOfWiiUkeyFiles
- path/WiiUKeys*.zip
If no key is found for an input image then nkit looks for a side by side .key/.dkey in the same folder e.g. file.iso / file.key
dat zip/rar/7z/gzip arc mask and/or dat mask. The Latest modified file is used where there are multiple matches e.g. path/Dats/WiiDats *.zip/*.dat or path/directoryOfWiiDats/*.dat
outAsDatMatch Rename output images to a matched dat entry
baseInPath If an image is not recognised (e.g. Audio CDs) and resides in this folder then settings in this system's section apply
dedupeInPath The path of the deduped file set for this system. Using the NKit scan as the in image and this file set. NKit will process the image as if it was processing the full image. E.g. you can convert an NKit scan with a deduped file set to rvz or wbfs etc for wii.
scanOut Save path of nkit scan files
scanIn Path to load scans. Not currently used, to be used for verifying and identifying missing files in dedupe sets
consoleLevel none, info, detail, error, debug. Level of detail output to the console window. Currently only none and info are implemented properly.
logOutLevel Level of detail logged to the logOut file. Set to none to turn it off
logOut Path of the log file
results Log a 1 line summary result of each image processed to resultsOut
resultsOut Path of results file
deleteProcessed Deletes source file on successful processing and verify (convert / convertSwap / Expand) - does not apply to archives
skipIfCompleted If the output file exists skip processing (convert / convertSwap / Expand)
parallelism NKit processes blocks of data from the source image in 3 concurrent streams, Read, Processing and Write. This value sets how many blocks of data are within each. A value of 4 means 12 in total with 4 processing data while the other eight read and write. It affects performance, it's a balance of disk read and write speeds and processing power.

Keywords

Keywords can be used in path parameters. The default config yaml uses them to dynamically specify file locations while processing.

Keyword Description
$appPath$ path of the launched exe
$task$ task being performed
$system$ system being processed, cannot be used for in or tmp
$date$ Current date as yyyymmdd
$timestamp$ Current time as yyyymmddhhmmss

Yaml Configuration Files

The config file specifies parameters and defaults all the current features nkit. It serves as a handy reference allowing the users to easily browse and edit settings without needing to consult documentation.

The configuration parameters are split in to types:

  • Root level
  • System level

System level params allow a parameter to have a different value per system. Meaning once nkit has identified the system type for the image being processed the value is read from the corresponding section. System level params override Root level parameters of the same name if present.

The params task, system, in, r, arc, logOut, logOutLevel, consoleLevel are root level only as they are applied before processing begins.

The default nkit.yaml can be overridden by the command line parameter cfg.

nkit -cfg other.yaml -task scan -in *.*

Clone the nkit[.exe] and have a matching named yaml to create your own apps that do specific things. rvzconvert and wuxconvert have been bundled with the release to demonstrate this. Dragging and dropping files on to these apps will convert between ISO and RVZ or WUD and WUX respectively.

rvzconvert *.iso
wuxconvert *.wud

The config can also be switched off via the command line or by removing the nkit.yaml or any yaml that matches the app name. See the command line section below for examples.

Command Line Overrides

The NKit command line supplements the config file by allowing config yaml to be overridden. Command line parameter names match the parameter names listed above and are prefixed with - in the format -name value

Any parameters that are not in the -name value format are regarded as input (in) paths / masks. This allows for the default config to contain all the settings to perform a specific task. Then dropping files on to the nkit app will group and process them.

If you need to specify an input that starts with - you can prefix it with the -in parameter for each input that needs it. Alternatively specify the -- parameter as the last option on the command line and follow it with any inputs that should only be considered as input files / masks.

Params can be specified per system by prefixing them e.g. -wii:dat Wii*.dat -gamecube:dat GC*.dat allowing multiple values.

Examples

Load the default config and scan the current folder for iso files, scan images and set recursive search off

nkit -in *.iso -r n -task scan

Alternative way to specify in plus multiple paths

nkit *.iso *.gcm "..\other path\*.iso"

Override a parameter for one system only by prefixing the param with the system name. This allows all the other systems to convert to the values set in the config

nkit *.iso -task convert -wii:convert wbfs

Specify an alternate config - in this example the config would be set to task: convertSwap and sys\wii\convert: rvz:zstd:19:128k:16.

nkit -cfg rvzconvert.yaml *.iso

Rather than passing in -cfg rvzconvert.yaml in the above example the nkit app can be cloned to rvzconvert[.exe] and it will be loaded instead of the default nkit.yaml allowing it to be ran like this

rvzconvert *.iso

Force no config (also possible by deleting any config files) and perform a convert to wbfs on the iso (which is a wii iso in this example)

nkit -cfg ""   *.iso -task convert -convert wbfs      (for Windows and Linux)
nkit -cfg ''   *.iso -task convert -convert wbfs      (alternative for Linux)
nkit -cfg `"`" *.iso -task convert -convert wbfs      (for PowerShell)
nkit -cfg n    *.iso -task convert -convert wbfs      (simplified method to remove ambiguity)

Exit codes / Return codes

When nkit closes and returns control back to the command line it will set its exit code to indicate the final status of the process. This can be very useful when writing a script that uses the nkit command line app.
The following exit codes are implemented:

Exit code Meaning
0 Completed successfully without errors
1 Completed but with one or multiple failed images
2 Required parameters not specified, such as the desired task or input file(s) / input mask(s)
3 An error when reading the the config file / config file may be corrupt
4 An error when writing to the log file
5 An error when writing to the results file
6 An unknown error in the nkit app not caught by the above issues
7 Processing was cancelled at the user's request. (Ctrl+C / SIGINT)
⚠️ **GitHub.com Fallback** ⚠️