a collection of my hacking/reverse engineering writeups and tech guides

Creating a Homebrew 3ds Program With Rust (Windows)

fekie July 24, 2024 #3ds #rust #embedded #guide

Creating a 3ds Project

  1. Download the graphical installer for devkitPro here. Run the updater and have it install everything. Preferably, install it to C:\devkitPro (the default path) so the rest of the guide is easier to follow. It will take a bit to install.
  2. Set environment variable $DEVKITPRO to C:\devkitPro. Set environment variable $DEVKITARM to C:\devkitPro\devkitARM. Set environment variable $DEVKITPPC to C:\devkitPro\devkitPPC.
  3. Make sure that Rust is installed, as cargo is needed to install toolchains and create the project.
  4. To install cargo-3ds, run the following
cargo install --locked cargo-3ds

If you run into errors, make sure rust is updated and on stable. 5. Switch to rust nightly with

rustup override set nightly
  1. You may need to run
rustup component add rust-src --toolchain nightly-x86_64-pc-windows-msvc

before running the cargo 3ds command. Just follow what it tells you to do if a toolchain error comes up. 7. Create a new project with

cargo 3ds new first-3ds-rust-project
  1. Make sure LLVM is installed. You can do this by downloading the Windows executable from here. Make sure that when you install it, you check the box that creates a path for all users.
  2. Add C:\devkitPro\devkitARM\bin to your PATH so that your system can find the linkers.
  3. Make sure that smdhtool is part of your path by adding C:\devkitPro\tools\bin to your PATH.
  4. Create a new terminal window. cd into the directory and run
cargo 3ds build

and you have successfully created a 3ds project in Rust!

Additional Resources