From N64brew Wiki
Jump to navigation Jump to search

Libdragon is an open-source SDK for Nintendo 64. It aims for a complete N64 programming experience while providing programmers with modern approach to programming and debugging. These are the main features:

  • Based on modern GCC (10.2) and Newlib, for a full C11 programming experience. A Docker container is available to quickly set up the programming environment.
  • The GCC toolchain is 64 bit capable to be able to use the full R4300 capabilities (commercial games and libultra are based on a 32-bit ABI and is not possible to use 64-bit registers and opcodes with it)
  • Can be developed with newer-generation emulators (cen64, Ares, Dillonb's n64, m64p) or development cartridges (64drive, EverDrive64).
  • In-ROM filesystem implementation for assets. Assets can be loaded with fopen("rom:/asset.dat") without having to do complex things to link them in.
  • Efficient interrupt-based timer library (also features a monotone 64-bit timer to avoid dealing with 32-bit overflows)
  • Graphics: easy-to-use API for 2D games, accelerated with RDP
  • Support for standard N64 controllers and memory paks.
  • Support for saving to flashes and EEPROMs (including a mini EEPROM filesystem to simplify serialization of structures).
  • Audio: advanced RSP-accelerated library, supporting up to 32 channels and streaming samples from ROM during playback for very low memory usage. Supports WAV files for sound effects and XM module format for background music. Can playback a 10-channel XM with < 3% CPU and < 10% RSP.
  • Debugging aids: console (printf goes to screen) exception screen, many asserts (so that you get a nice error screen instead of a console lockup), fprintf(stderr) are redirected to your PC console in emulators and to USB via compatible tools (UNFLoader, g64drive).
  • Support to read/write to SD cards in development kits (64drive, EverDrive64), simply with fopen("sd:/data.dat")
  • Simple and powerful Makefile-based build system for your ROMs and assets (

The unstable branch features many more features:

  • a new comprehensive RDP engine
  • a full OpenGL 1.1 port for 3D graphics programming, with a custom, efficient RSP ucode with full T&L support.
  • a MPEG1 RSP-accelerated movie player
  • support for showing source-level stack traces in case of crashes or assertions, including source file name and line number.

and much more. These features will eventually land to the stable version, but you can start playing with them even today. Go the unstable branch documentation for more information.

How to get started with Libdragon development

To get started with libdragon, you need to download and install the toolchain.

Make sure to read the full installation instructions which also explain the system requirements.

Libdragon stable vs unstable

Currently, there are two main libragon versions:

  • The stable version is the one in the trunk. Stable means that we strive never to break backward compatibility, that is we will never do changes in a way that will impede existing applications to successfully compile and work against a newer libdragon version. We feel this is important because otherwise we would fragment the homebrew ecosystem too much, and we would leave a trail of libdragon-based applications that can't be compiled anymore. See also the wiki for common hurdles in upgrading libdragon.
  • The unstable version is the one in the unstable branch. This is where most development happens first. In fact, features are developed, evolved and battle-tested here, before the APIs are stabilized and they are finally merged on the trunk. Applications that use the unstable branch need to be aware that the APIs can break at any time (though we try to avoid gratuitous breakage).


Libdragon itself is licensed with the "Unlicense" license. This is the closest option to public domain release for jurisdictions where releasing a software into the public domain is not legally well defined or allowed. Libdragon ROMs do not contain any Nintendo copyrighted code or intellectual property, and are completely legal to redistribute under the owner own terms.

Also, if you are planning to distribute replication cartridges and what to stay on the completely safe side, make sure the cartridges you buy or mount contain an open source replacement of the CIC protection chip such as a MCU running the UltraCIC III open source firmware. Libdragon itself will work also with a real CIC 6102, but that contains a Nintendo firmware that would be used as unlicensed (and thus not fully legal).