No description
| src | ||
| .gitignore | ||
| build.zig | ||
| build.zig.zon | ||
| flake.lock | ||
| flake.nix | ||
| LICENSE | ||
| README.md | ||
Zig Nintendo DS
Provides an easy and convenient way to compile for nds and use functions from DevKitPro.
- Install zig 0.14 / 0.15.
nix develop- zig build # creates a .nds file
- zig build run # runs the .nds file in the
melonDSemulator
The .nds file will be in zig-out/bin/name.nds.
Adding NDS support to your project
build.zig
const std = @import("std");
pub fn build(b: *std.Build) void {
const optimize = b.standardOptimizeOption(.{});
// So that you can call exported functions from anne_nds_dev
const anne_nds_dev = b.dependency("anne_nds_dev", .{}).module("anne_nds_dev");
// Creates the module + obj + elf + nds files for you and takes care of the includes/linker arguments.
const nds_step = @import("anne_nds_dev").compileNds(b, .{
.root_file = b.path("src/main.zig"),
.optimize = optimize,
.name = "nds_test",
.imports = &.{
.{
.name = "nds",
.module = anne_nds_dev,
},
},
});
// `zig build` will build for nds.
b.default_step.dependOn(&nds_step.step);
}
src/main.zig
const nds = @import("nds").nds;
// You need to export a c-style main. Then inside of the main you can call nds' functions.
export fn main(_: c_int, _: [*]const [*:0]const u8) void {...}
Going further
The documentation for libnds, which is what actually does the heavy lifting of communicating with the DS, is available here: https://libnds.devkitpro.org/files.html Several examples are available here: https://github.com/devkitPro/nds-examples