Nintendo DS Development for Mac

When the Nintendo DS was released, there was broo-ha-ha. Why? Because devkitPro and PAlib were also released. What did this mean? It meant people like you and me could develop games for the Nintendo DS (which has wifi!!!). See this flickr feed [link]

plundr

PAlib is meant to run on Windows, but I got it running successfully on a Mac Powerbook [a small miracle in my eyes].

::: Here’s the beginnings of the documentation for PAlib + DevKitPro for Mac :::
Assuming you have a flashCard [link] and a mini SD card to go in the flash card, you can download and program your own NDS games. We’re using the R4 flashCard [link]
R4 FlashCard

devkitPro and PAlib work together to allow you to write, program, and compile games for the Nintendo DS. Since the NDS has wifi capability, this opens up quite a bit for the open source community. There’s lots of legal implications, which I won’t really cover.

Both devKitPro and PAlib were made to run on Windows, so getting it to run on a Mac involves a bit more legwork.

Like Windows, it basically involves 3 steps –
1. Download DevKitPro
2. Download PAlib
3. Compile a Demo file from PAlib
If you get a compiling error, download XCode from the Apple
Developers site [link] – login required

Below, I’ll cover in DETAIL how I got the environment running on my mac powerbook (pre-Intel chip) and overcame the error messages. This should also work for your Intel machine…

Basically this is a revision to the PAlib docuwiki [link]

===================
1. Download devKitArm [link]
===================

===============================
2. Now,
Download the most recent version of PALib [link]

===============================
You do not want the installer – that’s for Windows. At the time of writing, I downloaded a zip file called PAlib 070323 Zip.

After you download it and unpack it, move it to the correct directory :: take a look to make sure it installed like this:

|–MacintoshHD
|—opt
|—-local
|—–devkitpro
|—–devkitARM
|—–libnds
|—–PAlib
|—–PAlibDoc Eng
|—–PAlibExamples
|—–PAlibTemplate

[img here]

*** The paths are the most important part of this install – if you do not take care to install it in the right path, you will lose days of work and might even give up ***
======================================================
After carefully checking your paths and double checking again, set the paths in terminal.
======================================================
(this taken direct from PAlib docuwiki [link]

There seem to be many ways to do this, and it seems to depend partly on which “shell” you have installed or selected I use the Mac OS X default for 10.4, which is bash. To find out which shell you use, open the Terminal program (from Applications/Utilities) and then select the “Terminal” menu item and select “Window Settings”. Make sure the top drop-down item “Shell” is selected. In that screen, you should see the 2nd line saying Shell: . If it’s bash, here’s how to set your “environment paths”.

If you are using something other than bash, you either know what you are doing, or will need to find a tutorial to set up your environent paths for your shell.

Environment Paths are just paths in your operating system that you or a program define to let yourself or a program do something more easily. For example, say that everyday you have to log in to another machine using the terminal using ssh to check a university email. The first step would be to log in to the server, probably using a program called ssh. Here’s what a command for that might look like: “ssh -i firstname.lastname@server.university.com”. If you are doing this from your own machine, you can simplify this by making what is called an alias. your alias for this example might simply be “unimail” or something of the sort. Far easier to remember. We do this in a hidden file in your home directory called .bash_profile.

1) To create the file, or open the file if it already exists, open a new terminal window. 2) type in (without the quotes) “pico ~/.bash_profile”. Now you should see a blank screen and some text a the bottom starting with: Get Help, Exit, WriteOut . . . You are in a program called Pico. All control is via the keyboard, your mouse won’t help you here. 3) copy and paste these next two lines:

export DEVKITARM=/opt/local/devkitPro/devkitARM/
export DEVKITPRO=/opt/local/devkitPro/
export PAPATH=/opt/local/PAlib/

4) Hold the “control” key, and then press the “x” key, this sends the Exit command to the program. It asks if you want to save, so press the “y” button. It then comes up with a screen asking what the name of the document should be, we gave it a name when we made the command to open Pico, so just hit the “return” key.

5) Either close this terminal window or type source ~/.bash_profile so that your changes will take effect in it.

6) There is no step 6.

=========================
3. Compile
=========================
Now, open up Terminal [img]
type “cd” + SPACE + PATH OF FILE

OPTIONAL TIP: If you want to execute or access a file in terminal, you can do this by DRAGGING THE ICON, program, or file you want into the terminal window.

Find a demo in PAlib you can compile. I tried Bunny and HelloWorld. Do a spotlight search for Bunny. Once you locate the folder:

Type “cd” + SPACE
Drag the folder
your terminal window will read “cd /opt/local/devkitPro/Bunny/”
Hit enter

You should get something like this
JakilevyComputer:/opt/local/devkitPro/Bunny jakilevy$

type “make”

You terminal window should look something like this:
compile

SUCCESS!!!!
It should have created an “.nds” file for you.

Now, take your SD card, put the “.nds” file onto the SD card. Take the SD card, put into the flashCard. Take the flashCard and put into the NDS. Take the NDS and put it into your hands.

Smile. Sigh. Thanks !

To be continued….
< This is a separate section in development - In this page, I am mainly concerned with getting the environment up and running - this is more of an appendix and will constitute another page or so...>

After you get everything running, you will want to create games and program. That’s not so hard – if you know C.

If you don’t I will refer you back to http://www.palib.info/wiki/doku.php?id=day1

After you get some programming going, you will need to take your images (BMP, GIF, whatever) and get them into shape for the NDS. There’s a few things out there – here’s what I’ve found for the Powerbook and Intel-Macs

::: Graphics Conversion :::
taken from this site [link]

Here’s what you MIGHT need:
Graphics Converter [link]
hConvert [link]
grit [link]

Make sure you have the latest versions of each – I was using an old version of Graphics Converter, and it did not have the necessary “Byte-Array Header” format I was looking for. Download the most recent version.

In GraphicsConverter -
1. Take your image file.
2. Open it in Graphics Converter
3. Save file as “Byte-Array Header”

You should be able to use this “.h” file in your program.

If you have found this to be particular useful, or have any questions, please leave a comment below. Thanks!

Socially Bookmarkit!
  • Digg
  • del.icio.us
  • Technorati
  • Reddit