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.​



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.​


Installing devkitARM
  1. Downloading devkitARM

    Visit the sourceforge download page, and download devkitProUpdater-x.x.x.exe (whichever version is the latest).
    01.gif


    dspro_01.gif
  2. 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.
    dspro_02.gif


    dspro_03.gif


    dspro_04.gif
  3. 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.
    06.gif
  4. 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.
    07.gif


    08.gif


    09.gif


    10.gif



Basic Program Creation/Compiling
  1. 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.
    11.gif


    12.gif


    13.gif


    14.gif
  2. 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!
    20.gif
  3. 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.
    18.gif



(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.
 

Foxi4

Endless Trash
Global Moderator
Joined
Sep 13, 2009
Messages
30,824
Trophies
3
Location
Gaming Grotto
XP
29,819
Country
Poland
Was devkitarm installed correctly? The minimal system is required to actually compile, it's GCC and such.
I've reinstalled it twice before. I'll go for a 3rd tomorrow.
Be sure to install it on an Administrator's account, run the installer/updater with Administrative priviledges, if all else fails, run it in Compatibility Mode for Windows XP SP2 or 3. If the registery wasn't updated with this entry then it's likely that the installer wasn't allowed to do so by User Account Control.
 

TheDreamLord

Well-Known Member
Member
Joined
Jun 8, 2011
Messages
939
Trophies
0
Age
24
Location
Ireland
Website
darkraino1.zymichost.com
XP
476
Country
Was devkitarm installed correctly? The minimal system is required to actually compile, it's GCC and such.
I've reinstalled it twice before. I'll go for a 3rd tomorrow.
Be sure to install it on an Administrator's account, run the installer/updater with Administrative priviledges, if all else fails, run it in Compatibility Mode for Windows XP SP2 or 3. If the registery wasn't updated with this entry then it's likely that the installer wasn't allowed to do so by User Account Control.
I am the admin. So thanks, I'll try this tommorrow :)
 

TheDreamLord

Well-Known Member
Member
Joined
Jun 8, 2011
Messages
939
Trophies
0
Age
24
Location
Ireland
Website
darkraino1.zymichost.com
XP
476
Country
On modern OSes, having an admin account does not mean that the programs you run are automatically given admin rights. That's actually a security hole, which is why since XP they added UAC to allow programs to request admin rights if required, though not all do correctly.
I know, it's why when I install things I right click and run as admin.
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • No one is chatting at the moment.
    Xdqwerty @ Xdqwerty: I hate myself