An implementation of the Nitro Archive virtual file system used by the Nintendo DS
Go to file
2025-05-22 20:29:51 -07:00
cli fix!: Change the extension of generated .naix files to .naix.h 2025-05-22 20:29:51 -07:00
docs docs: Mirror DS cartridge filesystem documentation from gbatek 2024-12-26 19:16:02 -08:00
lib fix(lib-pack): Use calloc in pack_file_copy instead of malloc 2025-01-16 21:31:33 -08:00
tools feat: Generate version at compilation time 2024-12-31 19:16:04 -08:00
.clang-format feat: Implement narc_strerror, narc_load 2024-12-27 00:06:09 -08:00
.editorconfig init: Bootstrap project 2024-12-26 18:56:41 -08:00
.gitattributes chore: Add gitattributes to normalize line endings, move VERSION file 2025-01-17 15:41:23 -08:00
.gitignore fix: Fix version.h dependency for clang 2025-01-02 11:34:34 -08:00
.pre-commit-config.yaml init: Bootstrap project 2024-12-26 18:56:41 -08:00
.version fix!: Change the extension of generated .naix files to .naix.h 2025-05-22 20:29:51 -07:00
LICENSE init: Bootstrap project 2024-12-26 18:56:41 -08:00
Makefile chore: Add gitattributes to normalize line endings, move VERSION file 2025-01-17 15:41:23 -08:00
meson.build fix(meson): Point version_file to .version 2025-01-18 12:28:40 -08:00
meson.options build: Add Meson files for use as a subproject 2024-12-30 16:51:38 -08:00
README.md docs: Remove sudo from the default make install suggestion 2025-05-21 12:01:11 -07:00

narc

An implementation of the Nitro Archive (NARC) virtual file system used by the Nintendo DS.

This repository provides two code modules:

  1. A library implementation of the NARC file specification. This module can be compiled as a shared library and linked against other projects which require interactivity with NARCs.
  2. A CLI, which builds upon the included library to provide a simple program for creating NARCs, extracting files from existing NARCs, and viewing metadata about existing NARCs.

Table of Contents

Install

Install from Source

A Makefile is provided for convenience, which will build both a shareable library libnarc and a static executable. After acquiring a copy of the source -- via git or a tar archive -- cd into the source folder and run:

make install

By default:

  1. libnarc.so will be installed to ~/.local/lib
  2. narc will be installed to ~/.local/bin

If you wish to change the parent directory of these destinations, specify that parent via DESTDIR ahead of the make command, e.g.:

# This will install `libnarc.so` to `/usr/local/lib` and `narc` to
# `/usr/local/bin`.
DESTDIR=/usr/local sudo make install

Integrate via Meson

A meson.build file is also provided for integrating narc as a subproject. To add narc to your project, create the file subprojects/narc.wrap with the following content:

[wrap-git]
url = https://github.com/lhearachel/narc.git
; Replace <main> here with a release tag or commit hash, if desired.
revision = main
depth = 1

[provide]
program_names = narc
dependency_names = libnarc

CLI Usage

narc ships with rich documentation via its help-text:

narc - create, extract, and explore Nitro Archive virtual filesystems

Usage: narc [-h | --help] [-v | --version] [command] [arguments]

Commands:
  c, create    Create a NARC from a folder of physical files
  x, extract   Extract virtual files from the NARC to a folder
  y, yank      Yank individual files from the NARC to disk
  i, info      Print metadata for a NARC
  h, help      Print help-text for a particular command

For brevity, individual commands will not be explained in detail here; refer to the help-text for individual commands as needed after installation.

Library API

The meat of narc is in the libnarc API. After installation, a calling program should have access to the following files in their library include path:

#include <narc/api/check.h>
#include <narc/api/dump.h>
#include <narc/api/error.h>
#include <narc/api/files.h>
#include <narc/api/load.h>
#include <narc/api/pack.h>

If desired, the whole library can also be included with a single include statement:

#include <narc/narc.h>

Acknowledgements

  • Martin Korth's gbatek documentation, which is an excellent read on all matters related to the GameBoy Advance and Nintendo DS. In particular, his section on DS cartridge file systems was instrumental in building this implementation. The relevant documentation has been mirrored here in docs, for convenience and preservation.

License

narc is free software licensed under the Apache License, version 2.0. For further details, refer to the included license text.