Skip to content

Getting Started

Meziu edited this page Mar 20, 2023 · 12 revisions

Install Requirements

To run our tools and libraries to their full potential you must meet these requirements:

Own a CFW 3DS

To run homebrew software on your Nintendo 3DS, you'll need to modify its firmware to bypass executable verification. New ways to modify the system are always in development, but you can follow these latest guides. You will especially need the "Homebrew Launcher" application, which lets you run and debug your software (packaged in .3dsx executable files).

Install the Rust programming language

Follow this guide to install the language on your platform.

Install the devkitARM toolchain

This section is unnecessary for people who already use the devkitARM toolchain to develop homebrew. If it's your first time using it, follow the next instruction, otherwise, skip to the next main paragraph.

Get dkp-pacman

devkitARM provides many packages to start working on software. You can install these tools and libraries on Windows, MacOS and Linux, by using dkp-pacman. Follow their "Getting Started" guide for your platform, by the end of which you should have the dkp-pacman installer ready in your terminal emulator (for Linux distros that use pacman, you can also just add their repositories as sources and use that instead, but keep in mind that we'll refer to it as dkp-pacman from now on).

Install the tools

dkp-pacman is the main installer for all devkitARM packages, including some third-party C libraries which have been ported over to Nintendo 3DS (these are known as "portlibs"). By using this tool, you can now install the main packages for developing. As the devkitPRO guide suggests, simply do sudo dkp-pacman -S 3ds-dev to install all main packages.

Link the tools to the system

This may be a hard step to follow (especially if you're not used to using the command line) but it's absolutely needed to get our tools up and running. Restart your terminal emulator and check whether the environment variables DEVKITPRO and DEVKITARM are properly set. Also, check if $DEVKITPRO/tools/bin and $DEVKITARM/bin are visible in the PATH. If not, set them manually.

Install the rust3ds tools

We are finally out of the C realm, and can continue our safe journey into Rust programming.

Install cargo-3ds

cargo-3ds is our custom made cargo extension to build and test 3DS executable files. You can install the latest stable version on crates.io by running cargo install cargo-3ds or install the bleeding edge version by running cargo install --git https://github.com/rust3ds/cargo-3ds.

Start developing

Phew, it's over! You can now start writing some real code! There are many ways to start, and it all depends on your objective. In general, the process is the same as writing any other Rust project: simply cargo new <project-name> and go! However, there are a few things to note:

  • All building, testing and running will have to be done via cargo-3ds (go look at it's README to learn how it works).
  • To use all system-specific functionality and the Rust std you'll have to depend on ctru-rs. There are ways to get those working by yourself, but for the sake of this guide you should just add ctru-rs to your dependency list (there is a lot of great stuff here!).
  • Even when using ctru-rs, modules such as std::process and std::thread (plus most third party crates) may not work (or work differently than originally intended) because of how the OS operates. You can read more about that in [Unsupported Functionality].

Get to know it

If you don’t feel ready to start your own project, or simply want to see what the console is capable of, you can try the included examples.

Happy coding! 👋 🦀

Clone this wiki locally