NCPrePatcher

A preprocessor for NCPatcher with access to your NDS ROM, a disassembler, an assembler, and an emulator.

Installation

Requirements

From the command line, enter:

gem install NCPrePatcher

The ncpp command should now be available at your command line (a system reboot may be required).

Usage

NCPrePatcher can be used as a Ruby library or, as it was built for, as a preprocessor alongside NCPatcher.

For the former, simply require it as you would with any gem:

require ncpp

For the latter, navigate to an existing project using NCPatcher (where an ncpatcher.json file is present), and run:

ncpp

Follow the directions given, and it will be installed into your project. Subsequently, running ncpp manually will no longer be required; being added as a pre-build command in ncpatcher.json, it will run when NCPatcher does.

For examples of usage as a preprocessor, see ncpp-demos.

To view what else NCPrePatcher can do, run:

ncpp --help

Building

[!NOTE] This is an alternative to installing NCPrePatcher via the methods described in the installation guide

Requirements

  • Ruby
  • CMake and a modern C++ compiler
  • Rust and Cargo
  • vcpkg

To build the native libraries, go to /ext/ and run:

ruby build.rb

Finally, go back to the base directory and run:

gem build ncpp.gemspec

Credits

  • Code from NCPatcher used by the nitro library
  • unarm used for disassembling
  • Keystone used for assembling
  • Unicorn used for emulating
  • Ruby-FFI used for binding the above libraries to Ruby
  • Parslet used for parsing the DSL