DS Programming Environment On Windows
-
Look at this guide instead, it's better.
The previous guide is still contained below, for historical reasons or some crap like that.
Look at this guide instead, it's better.
The previous guide is still contained below, for historical reasons or some crap like that.
DS Programming Environment On Windows
Looking to program for the Nintendo DS, DSi, and 3DS (in DS or DSi-mode)?
Only dealt with interpreted languages before, need to learn how to compile?
Not sure what tools are needed, where to get them, or how to set them up?
This guide walks you through setting up and using the proper environment.
Looking to program for the Nintendo DS, DSi, and 3DS (in DS or DSi-mode)?
Only dealt with interpreted languages before, need to learn how to compile?
Not sure what tools are needed, where to get them, or how to set them up?
This guide walks you through setting up and using the proper environment.
Installing devkitARM
- Downloading devkitARM
Visit the sourceforge download page, and download devkitProUpdater-x.x.x.exe (whichever version is the latest).
- Running The Installer
Run the installer you downloaded, choose Next, then choose Download and install/install from downloaded files, then click Next and choose to Remove downloaded files.
- Choosing The Components
On this page you'll select the components of devkitPro to install. The minimal system is pretty much mandatory, then comes the three devkitPro aspects. For DS development we need devkitARM (ARM being the processor type the DS uses). devkitPPC is for PPC-based targets, and devkitPSP is for the PSP, so we're not concerned with those. The next choice is Programmer's Notepad. If you already have a code editor you prefer to use (such as Notepad++) then skip it, but this tutorial assumes we'll be installing it. After that is Insight, which is a debugger you may find very helpful later on, so it's recommended you install it as well.
- Install And Wait
Choose whatever you'd like for the next two steps, then confirm. The installer needs to download, extract, set up, and install the selected components, which can take a while. When it's done click Next, and finish. Feel free to delete the installer when you're done. You'll also find a devkitProUpdate.txt file on your desktop, you can delete this.
Basic Program Creation/Compiling
- Programmer's Notepad Associations
You can't code stuff if you can't edit the code, right? Go to C:devkitProProgrammers Notepad (or wherever devkitpro is installed) and open up pn.exe (the Programmer's Notepad executable). Go to Tools - Options, then in the options window go down and click File Associations in the left. In the File Associations window, type cpp into the box in the upper-left, then click the add button. Do it again, but type just h instead of cpp, and then do it one more time for c. Close Programmer's Notepad.
After this the source code for these projects should open with the programmer's notepad. Go to C:devkitProexamplesndshello_worldsource and double-click main.cpp, it should open in Programmer's Notepad now.
- Compiling
Compiling is done through the windows commandline, but navigating to the right folder in Windows can be a bit of a pain, so we'll use a batch file to call the command in the right directory. Download this file and place a copy of it within your project's folder. Simply run it whenever you want to compile, and the tools that devkitPro set up will do the work for you. When the compiling is done (and assuming the project didn't have any coding errors) you should have your .nds file in the project folder!
- Testing
Most homebrew will run in an emulator, and it's a lot easier than transferring to your flash cart to test every time, so it's suggested you download a DS emulator to test your creations with. While NO$GBA is very popular, it hasn't been updated in over three years. My recommendations are iDeaS and DeSmuME. Both of these emulators are more up-to-date, and both of them include the ability to drag-and-drop an .nds file into the emulator's window to launch it.
(Optional) Additional Libraries
//Basic C/++ functions
#include
//libnds functions
#include
//Nightfox's lib.
#include
While PAlib used to be the big recommended one, it's development has stopped and it's fallen out of favor.
Nightfox's lib is a new one focusing on the graphical department and sprite manipulation (so users can make their own games quicker without having to worry as much about the technical back-end), so it's the recommended one for now. Visit Nightfox And Co. for the latest version, the download link near the bottom will lead you to sourceforge as before. In the download is a /docs/ folder, containing PDFs in both English and Spanish, with the function documentation.
While the default libnds library does contain a wide range of functions, these are not always the easiest to use for game development. To this end there have been multiple additional libraries aimed towards making homebrew development easier and quick, through the creation of many custom functions that do a lot of the hard work for you. These libraries are generally made up of various definition files, which define constants and custom functions inside themselves. In general adding a library is as simple as copying the definition files to a usable directory for the project, and then adding an include function in the top of your code for the library, which will call in the definition files and thus add the usable functions to your project.
Changelog
5/28/2011 - Fixed the overwritten images, whoops. Thanks Cyan.
5/23/2011 - Added .c files to the association, added descriptive intro.
5/12/2011 - Added basic info on additional libraries, using Nightfox's lib as the example.
5/12/2011 - Fixed a typo, added batch file to compile.
5/11/2011 - Initial version.