Jump to content
Setting up an AI agent? ReverseEngineering.wiki skill (works from the command line, no configuration): https://reverseengineering.wiki/skill/rewiki/SKILL.md · setup for every client, including MCP: https://reverseengineering.wiki/llms.txt · REWiki:Connect

Library:libnds

From ReverseEngineering.wiki
Library
On this wiki Facts · Code · Notes · Topics

The homebrew library of devkitPro for the Nintendo DS (ARM9 and ARM7): hardware access, interrupts, DMA, input, IPC, cartridge and DLDI support. Its headers are a public reference for DS memory layout and the ROM header structures.

Overview

libnds (devkitPro, zlib-style license libnds_license.txt) ships include/nds/*.h. Useful for reversing: nds/memory.h has tNDSHeader, the DSi header and sNDSBanner; nds/dldi.h describes DLDI driver headers (homebrew storage drivers patched into a ROM); nds/bios.h lists BIOS call numbers; nds/ipc.h the ARM9/ARM7 shared struct.

Identification

Homebrew built with libnds has the usual devkitARM crt0 and a DLDI section (magic 0xBF8DA5ED followed by Chishm at offset 0 of the driver stub). Checked in devkitPro/calico commit 81b75e314d57ed1784545e28554e567f26f572f1 (the DLDI header moved there from libnds): include/calico/dev/dldi_defs.h defines DLDI_MAGIC_VAL 0xbf8da5ed, DLDI_MAGIC_STRING " Chishm" and DLDI_MAGIC_STRING_LEN 8 (lines 13-16), and source/dev/dldi_stub.s emits .word DLDI_MAGIC_VAL then .asciz DLDI_MAGIC_STRING at the start of the stub (lines 12-13). libnds source/common/dldi.c (commit 84e6082ce27c87ed218fb369a9944644aa2243a6, lines 33-35) keeps the string backwards in the code so patchers do not find it.

See Platform:Nintendo DS.

Code & repositories

  • https://github.com/devkitPro/libnds @ 84e6082ce27c87ed218fb369a9944644aa2243a6 · license: Zlib (declared by the contributor; GitHub's detector did not recognize a license file)
    libnds: include/nds/memory.h (tNDSHeader, DSi header, banner), dldi.h, bios.h, ipc.h.
    Tested on: source read, not run: source read · checked 2026-10-18; last activity 2026-02-19