Setting up Development Environment
Setup
- Install devkitPro. If it's already installed, give it an update, it can't hurt. On Windows there's a GUI installer. On Linux/Mac there's a perl-script.
- Install the 3dsxtools on top of devkitPro according to the website.
- On Linux/Mac cd into your devkitPro folder and execute:
git clone https://github.com/smealum/ctrulib
- If you're on Windows you can download ctrulib as a [zip https://github.com/smealum/ctrulib/archive/master.zip] and extract it into your devkitPro folder.
Note: devkitPro/ctrulib/libctru contains ctrulib itself, and devkitPro/ctrulib/examples contains a few 3DS homebrew examples.
Adding some environment variables
- Under Windows: go to System properties, Advanced system settings, Environment variables.
- Add an environment variable named CTRULIB. Set it to the path to ctrulib.
- Example: CTRULIB -> C:\devkitPro\ctrulib\libctru
- You also need to add devkitARM/bin to the PATH environment variable.
- Example: PATH -> [previous value of PATH];C:\devkitPro\devkitARM\bin
- Add an environment variable named CTRULIB. Set it to the path to ctrulib.
- Under Linux/Mac:
- Add the following to your ~/.bash_proflle or equivalent:
export CTRULIB=<path to ctrulib/libctru>
Building ctrulib
In the form under which it's provided, ctrulib needs to be built before you can build homebrew.
Open a terminal (cmd window under Windows) and browse to ctrulibs directory (the one you entered in the CTRULIB variable of the previous step). Run the following commands:
make clean make
If everything goes right, a lib folder should be created with a file named 'libctru.a' in it.
Building the examples
You can build from the examples provided with ctrulib.
- arm11u: simple homebrew example
- sdmc: demonstrates how to access files on the SD card
- mic: demonstrates how to read sound from the microphone
- gpu: demonstrates how to render 3D geometry with the GPU
Building homebrew for distribution
To build your homebrew, it works the same way as for building ctrulib. Open a terminal, browse to your homebrew's folder and run make.
- This will build a .elf file and a .3dsx file together with an icon. The icon and .3dsx file is meant for upcoming homebrew launchers.
- To build a Gateway-compatible .3ds file you need to strip the .elf file and use makerom on it (with the provided RSF file):
arm-none-eabi-strip [ELF file] makerom -f cci -o [.3ds file] -rsf [RSF file] -target d -exefslogo -elf [ELF file] -icon [icon file] -banner [banner file]