GasInfinity/zitrus
3DS homebrew library written entirely in zig
cc5c6a5d71a317ed4b0ad776842d1d0655f72d0a
677973e252dc39f07b8b5407d8ae5e609f81f94b
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, 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);
// 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.addConvert3dsx(b, .{ .name = "homebrew.3dsx", .exe = exe });
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
gsp::Gpu