GasInfinity/zitrus
3DS homebrew library written entirely in zig
677973e252dc39f07b8b5407d8ae5e609f81f94b
7b3387d86ec73d43863291672bbe8c3d4490b4c1
290cccefff7f3783039bed4135ccca9e503a56ae
fe3bf9389e7ff213cf3548caaf9c6f3d4bb38647
74caab5edd7c5f1d2f7d87e5717435ce0f0affa1
3DS homebrew library written entirely in zig.
# Version that supports zig 0.14.1
zig fetch --save git+https://github.com/GasInfinity/zitrus
Then add this to your build.zig
:
const zitrus_dep = b.dependency("zitrus", .{});
const zitrus_mod = zitrus_dep.module("zitrus");
// zitrus also exports the module `zitrus-tooling` which contains code useful outside of a homebrew environment (3DSX, SMDH, PICA200 shader asm, etc...)
// You must use the same target as `zitrus_mod`
const exe_mod = b.createModule(.{
.root_source_file = b.path("src/your_main.zig"),
.target = zitrus_mod.resolved_target,
.optimize = optimize,
});
exe_mod.addImport("zitrus", zitrus_mod);
const exe = zitrus.addExecutable(b, .{
.name = "homebrew.elf",
.root_module = exe_mod,
});
// You can skip installing the elf but it is recommended to keep it for debugging purposes
b.installArtifact(exe);
const homebrew_smdh = zitrus.addMakeSmdh(b, .{
.name = "homebrew.smdh",
.settings = b.path("path-to-smdh-settings.ziggy"), // look at any demo for a quick example or the schema in tools/make-smdh/settings.ziggy-schema
.icon = b.path("path-to-icon.png/jpg/..."), // supported formats depends on zigimg image decoding
});
// This step will convert your executable to 3dsx (the defacto homebrew executable format) to execute it in an emulator or real 3DS
const final_3dsx = zitrus.addMake3dsx(b, .{ .name = "homebrew.3dsx", .exe = exe, .smdh = homebrew_smdh });
b.getInstallStep().dependOn(&b.addInstallBinFile(final_3dsx, "homebrew.3dsx").step);
Currently there are 3 examples in the demo/
directory, only basic software blitting is implemented for graphics and we're missing almost all the services:
I wanted to learn arm and always wanted to develop 3DS homebrew, also I searched and I haven't found any kind of zig package that doesn't use libctru, so I just started reading a lot and doing things. Furthermore, using only zig has a lot of advantages:
zig
executable, that's it! (However, obviously it is recommended that you use devkitPRO's tools as I'm sure you'll need them. You want to use gdb, don't you?)Debug
and ReleaseSafe
modes. Zitrus currently uses the ErrDisp
port to report panics and returned errors. The only missing thing is reporting return traces with debugging symbols (Currently only addresses are logged)build.zig
is really small and makefiles are really arcane)Zitrus is currently very work in progress, it's able to run basic homebrew but lots of things are missing (services, ports, syscalls, io, etc...)
🟢 Fully implemented 🟡 Partially implemented 🔴 Implementation not started/missing critical things
srv:
err:f
APT:S/A/U
hid:SPRV/USER
cfg:u/s/i
gsp::Gpu