Changes

Jump to navigation Jump to search
m
no edit summary
Line 1: Line 1: −
== Setup ==
+
= Setup =
* Install [http://devkitpro.org/ 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 [https://devkitpro.org/ devkitARM]. If it's already installed, update it using sudo (dkp-)pacman -Syu. On Windows, there's a [https://github.com/devkitPro/installer/releases/latest graphical installer]. On Unix-like platforms such as Linux/macOS, there's [https://github.com/devkitPro/pacman/releases/latest pacman]..
* Install the [http://mtheall.com/~fincs/3dsdkA/ 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 [https://github.com/smealum/ctrulib/archive/master.zip 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.
+
==Windows==
 +
* If you already use msys2 then you can follow the instructions at https://github.com/devkitPro/pacman/releases/latest to add the devkitPro repositories.
   −
== Adding some environment variables ==
+
Otherwise
* 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
     −
* Under Linux/Mac:
+
* [https://github.com/devkitPro/installer/releases/latest download the latest version of the graphical installer] from github and run it, following the instructions as you go.
** Add the following to your ~/.bash_proflle or equivalent:
+
* An Internet connection is required.
export CTRULIB=''<path to ctrulib/libctru>''
+
* Ensure at least "3DS Development" is ticked - you can also leave the other options ticked if you wish.
 +
* Once the installer has finished, launch MSYS from:
 +
** Windows 7 and earlier: Start -> All Programs -> devkitPro -> MSYS
 +
** Windows 8 and 8.1: Right click on the Start screen and select 'All Apps'. You should find MSYS there.
 +
** Windows 10 (pre-Anniversary Update): Start -> All Apps -> devkitPro -> MSYS
 +
** Windows 10 (post-Anniversary Update): Start -> devkitPro -> MSYS
   −
== Building ctrulib ==
+
Alternatively starting with Windows 10 Anniversary Update (Version 1607), the [https://msdn.microsoft.com/en-us/commandline/wsl/install_guide Windows Subsystem for Linux (WSL)] may also be used to run the Linux version of devkitARM. Unless you have some particular need for WSL it's recommended that you stick to a more standard environment.  
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:
+
==Unix-like platforms==
make clean
+
Currently devkitPro provides precompiled versions of devkitARM for the following Unix-like platforms: Linux (x86_64), macOS (x86_64). Note that Linux x86_64 binaries are usable under WSL.
make
     −
If everything goes right, a lib folder should be created with a file named 'libctru.a' in it.
+
* Follow the instructions to install pacman found at https://github.com/devkitPro/pacman/releases/latest
 +
* run sudo (dkp-)pacman -S 3ds-dev to install the tools and libraries for 3ds development
 +
* logout and login again to get the environment settings needed.
   −
== Building the examples ==
+
= Building the examples =
You can build from the examples provided with ctrulib.
+
3DS examples are still being created; however, there are a growing number of examples available from the [https://github.com/devkitPro/3ds-examples devkitPro/3ds-examples GitHub repository]. These are downloaded by the installer and can be found in $DEVKITPRO/examples/3ds
   −
* '''arm11u:''' simple homebrew example
+
These can be built from the command line.
* '''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 start a new homebrew project from the <code>bash</code> shell, simply type the following (replacing <code>'''~/projects/my3dsproject'''</code> with the place you would like your project to be stored, with <code>~</code> meaning your HOME directory):
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.
+
cp -r $DEVKITPRO/examples/3ds/templates/application '''~/projects/my3dsproject'''
 +
cd '''~/projects/my3dsproject'''
   −
* This will build a .elf file and a .3dsx file together with an icon. The icon and .3dsx file are the format required for the [[Homebrew Channel]].
+
The standard Makefile will use the folder as the name of the 3dsx that will be built. You can keep that behaviour or simply change the <code>TARGET := $(notdir $(CURDIR))</code> line in the Makefile to explicitly name your project.
   −
* To build a Gateway-compatible .3ds file you need to strip the .elf file and use makerom on it (with the provided RSF file):
+
To compile it, type <code>make</code> in the project directory.
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]
+
==Running your code==
 +
To run it on your 3DS, start the Homebrew Launcher, press Y to open the network loader, then on your PC type: <code>$DEVKITPRO/tools/bin/3dslink  '''my3dsproject'''.3dsx</code>, replacing '''my3dsproject''' with the name of the 3dsx file you want to run.)
 +
 
 +
If all goes well, you'll soon see your application running on your 3DS. If not, it could help to add <code>-a '''ipaddress'''</code>, replacing '''ipaddress''' with the ip address of the console (visible on homebrew launcher after pressing Y).
 +
 
 +
= Troubleshooting =
 +
'''I get the "Please set DEVKITARM in your environment." error.'''
 +
 
 +
Ensure you have the devkit-env package installed - (dkp-)pacman -Sl | grep devkit-env. Logout and login to get the enviroment settings.
 +
 
 +
For WSL users, you need to close the Bash shell, then reopen it for WSL to reload all of the variables from a clean state.
2

edits

Navigation menu