Setting up a 3DS development environment in WSL
I've recently become interested in developing for hardware outside my comfort zone. I got my hands on a Nintendo 2DS, and figured this would be a good opportunity to delve into homebrew development. Getting a custom firmware running on the device was quite straight forward, but information for actually setting up a development environemnt seems to be scattered across various forum posts.
This is mostly a collection of notes for my own sake, put out into the ether in the off chance it's useful to someone else.
Install pacman
Firstly - we need to get pacman installed.
Follow instructions in the official devkitPro GitHub releases
- devkitPro provides an install script for pacman
- Fetch with:
wget https://apt.devkitpro.org/install-devkitpro-pacman
- Make the script executable with
chmod +x ./install-devkitpro-pacman
- Run the script with admin privileges
sudo ./install-devkitpro-pacman
- Now we’ve got a working pacman install setup to point to the correct repositories
Install devkitPro
- Run
sudo dkp-pacman -S 3ds-dev
- When prompted for an option, just press enter to install “all” packages
- Close and reopen your shell to get all the environment variables loaded
Building an example
- Run
cp -r $DEVKITPRO/examples/3ds/templates/application ~/projects/my3dsproject
to copy a base template - Enter directory with
cd ~/projects/my3dsproject
- The destination directory (the "~/projects/my3dsproject" in the
cp
command can be any directory of your choosing). The name of the compiled 3dsx output binary will be, by default, the name of the directory the houses the project (in the above example “my3dsproject”). - Run the command
make
- You should have an {PROJECT_NAME}.3dsx file in the current working directory (in our example ~/projects/my3dsproject)
Running the compiled example
- You have two options: running the compiled binary in an emulator, or running the binary on a modded 3DS
- (We will not consider how to mod a 3DS in this tutorial, but there are many readily available guides available across the internet)
- On your 3DS open the Homebrew Launcher
- Press Y to open the 3dslink NetLoader
- Execute this command in your terminal:
$DEVKITPRO/tools/bin/3dslink my3dsproject.3dsx -a 192.168.2.11
replacing the IP address with whatever IP your 3DS shows in the 3dslink NetLoader opened above - Success!