• Stars
    star
    678
  • Rank 66,178 (Top 2 %)
  • Language
    C
  • License
    The Unlicense
  • Created almost 14 years ago
  • Updated about 2 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Open source library for N64 development.

Libdragon

Build

Welcome to libdragon

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 (13) 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 (ares, cen64, Dillonb's n64, simple64) or development cartridges (64drive, EverDrive64, SummerCart64).
  • Support both vanilla N64 and iQue Player (Chinese variant). The support is experimental and done fully at runtime, so it is possible to run ROMs built with libdragon on iQue without modifying the source code.
  • 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 the XM (FastTracker, MilkyTracker, OpenMPT), and YM (Arkos Tracker 2) module formats 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) calls 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, SummerCart64), simply with fopen("sd://sdata.dat")
  • Simple and powerful Makefile-based build system for your ROMs and assets (n64.mk)

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 trunk, but you can start playing with them even today. Go the unstable branch doc for more information.

Getting started: how to build a ROM

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.

Getting started: how to run a ROM

Using emulators

libdragon requires a modern N64 emulator (the first generation of emulators are basically HLE-only and can only play the old commercial games). Suggested emulators for homebrew developemnt are: ares, cen64, dgb-n64, simple64.

On all the above emulators, you are also able to see in console anything printed via fprintf(stderr), see the debug library for more information.

Using a development cartridge on a real N64

All cartridges that are able to load custom ROMs should be able to successfully load libdragon ROMs via either USB/serial, or from a MMC/SD card. For instance, the following are known to work: 64drive, EverDrive64 (all models), SC64.

If your cartridge has USB support, use one of the loaders that implement the libdragon debugging protocol, so to be able to show logs in console. For instance, UNFLoader, g64drive, ed64. The official loaders provided by the vendors are usually less feature-rich.

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.
  • 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).

Upgrading libdragon

If you are upgrade the stable version, check the ChangeLog in the wiki to see latest changes that were merged into the stable version of libdragon. Also check the wiki page for common hurdles in upgrading libdragon.

If you are upgrading the unstable version, instead, remember that some breaking changes are expected. We do not keep track of those though, so you will have to check the relevant header files yourself to check what is changed.

Resources

More Repositories

1

bemaniutils

A collection of utilities which together make up a hobby game services network and associated utilities for historic games in the BEMANI series.
Python
214
star
2

netboot

Utilities for netbooting and talking to a NetDimm installed in a Naomi, Triforce or Chihiro.
Python
51
star
3

libnaomi

Toolchain and system library enabling hobby/homebrew software to be developed for the Sega Naomi platform.
C
31
star
4

naomidoom

Doom for the Sega Naomi.
C++
26
star
5

jubeatmenu

A menu that can be used on a Jubeat cabinet to choose one of multiple installed games.
C++
13
star
6

ACIOLauncher

Multi-game launcher for BEMANI series arcade games.
C++
12
star
7

sm2museca

A conversion utility to replace or add songs to MÚSECA.
Python
10
star
8

serialdvdemu

DVD serial interface emulator for various DVD players.
C++
8
star
9

ddrmenu

A menu for DDR cabinets that can launch one of several executables.
C++
7
star
10

naomidiag

System diagnostic program for testing various parts of a SEGA Naomi system.
C
6
star
11

beamfrenzy

A simple homebrew game for the SEGA Naomi platform.
C
5
star
12

homeassistant-streamdeck

A simple utility that can talk to both a StreamDeck and a Home Assistant installation over a network to turn the StreamDeck into a panel of switches.
CSS
5
star
13

reflec2mouse

A simple utility that reads the serial data from Reflec Beat's touch panel and translates it to mouse events.
C++
4
star
14

firebeat

Documentation and utilities for Konami Firebeat hacking.
Python
3
star
15

PyStreaming

Simple web server that works with nginx to allow RTMP streaming on the web.
Python
3
star
16

reflecmenu

A touch-aware menu for Reflec Beat cabinets that can launch one of several executables.
C++
3
star
17

arcadeutils

Collection of utilities written in Python for working with various arcade binaries.
Python
3
star
18

naomixargon

Xargon for the Sega Naomi.
C
2
star
19

twinkle

Documentation and code for working with Twinkle systems.
Assembly
2
star
20

mastodon-vt100

A Mastodon client that displays on a VT-100 or compatible physical serial terminal.
Python
2
star
21

minidragon

Hardware and software files for the MiniDragon CPU.
Python
2
star
22

ledsigndriver

Sign driver for Alpha Signs which talk over RS232/RS485.
Python
1
star
23

xmplay

XM (and other format) player for Sega Naomi arcade platform.
C
1
star
24

homeassistant-vt100

A VT-100 frontend for a Home Assistant instance.
Python
1
star
25

dragoncurses

Curses-based UI wrapper for being mad at console UI code in a different way.
Python
1
star
26

vttermproxy

Simple terminal proxy to run any command and connect it's stdin/stdout/stderr to a VT-100 over serial without forcing the serial to be a pty.
Python
1
star