Nintendo Optical Disc traversal and generation
Go to file
Jack Andersen 02a7b95606 CheckFreeSpace POSIX fix 2016-01-25 16:01:55 -10:00
LogVisor@55b81ec091 Update LogVisor 2016-01-05 09:16:41 -10:00
driver Codebase cleanups and README 2016-01-25 10:21:10 -10:00
include/NOD CheckFreeSpace POSIX fix 2016-01-25 16:01:55 -10:00
lib CheckFreeSpace POSIX fix 2016-01-25 16:01:55 -10:00
.gitmodules Updated remote URL 2015-09-17 11:40:19 -10:00
CMakeLists.txt Initial Wii image generation (needs disc header) 2016-01-21 16:30:17 -10:00
LICENSE Community Concensus MIT LICENSE revert 2016-01-05 09:13:35 -10:00
README.md CheckFreeSpace POSIX fix 2016-01-25 16:01:55 -10:00

README.md

NODLib

NODLib is a library and utility (nodtool) for traversing, dumping, and authoring GameCube and Wii optical disc images.

Library

The primary motivation of NODLib is to supply a uniform C++11 API for accessing data from image files directly. NOD::DiscBase provides a common interface for traversing partitions and individual files. Files may be individually streamed, or the whole partition may be extracted to the user's filesystem. Raw ISO and WBFS images are supported read sources.

bool isWii; /* Set by reference next line */
std::unique_ptr<NOD::DiscBase> disc = NOD::OpenDiscFromImage(path, isWii);
if (!disc)
    return FAILURE;

/* Access first data-partition on Wii, or full GameCube disc */
NOD::Partition* dataPart = disc->getDataPartition();
if (!dataPart)
    return FAILURE;

/* One-shot extraction to filesystem */
if (!dataPart->extractToDirectory(outDir, ctx))
    return FAILURE;

return SUCCESS;

Image authoring is always done from the user's filesystem and may be integrated into a content pipeline using the NOD::DiscBuilderBase interface.

/* Sample logging lambda for progress feedback */
size_t lastIdx = -1;
auto progFunc = [&](size_t idx, const NOD::SystemString& name, size_t bytes)
{
    if (idx != lastIdx)
    {
        lastIdx = idx;
        /* NOD provides I/O wrappers using wchar_t on Windows;
         * _S() conditionally makes string-literals wide */
        NOD::Printf(_S("\n"));
    }
    if (bytes != -1)
        NOD::Printf(_S("\r%s %" PRISize " B"), name.c_str(), bytes);
    else
        NOD::Printf(_S("\r%s"), name.c_str());
    fflush(stdout);
};

/* Making a GCN image */
NOD::DiscBuilderGCN b(isoOutPath, gameID, gameTitle, dolLoadAddress, progFunc);
ret = b.buildFromDirectory(fsRootDirPath, bootDolPath, apploaderPath);

/* Making a Wii image */
NOD::DiscBuilderWii b(isoOutPath, gameID, gameTitle, dualLayer, progFunc);
ret = b.buildFromDirectory(fsRootDirPath, bootDolPath, apploaderPath, partitionHeadPath);

Wii images are fakesigned using a commonly-applied signing bug.

Additionally, any *.dol files added to the disc are patched to bypass the #001 error caused by invalid signature checks. This allows games with multiple .dols to inter-boot without extensive loader-patching.

Tool

The library usage mentioned above is provided by a command-line tool called nodtool.

An extract/repack works like so:

>$ nodtool extract <image-in> [<dir-out>]
>$ cd <dir-out>

# Then one of:
>$ nodtool makegcn <gameid> <game-title> fsroot boot.dol apploader.bin [<image-out>]
>$ nodtool makewiisl <gameid> <game-title> fsroot boot.dol apploader.bin partition_head.bin [<image-out>]
>$ nodtool makewiidl <gameid> <game-title> fsroot boot.dol apploader.bin partition_head.bin [<image-out>]