First post, findings, end result!

15/01/2010

Hello, my name is Herman van der Meulen.

Started with no C and NDS knowledge a few weeks ago, I have now built a simple game!

I will try to write the events in this one post in chronological order:

Learning C

Installing (on Mac OS X)

Game concept

Coding

Problems

Read the rest of this entry »


Makefile

26/12/2009

Next to the use of the video memory banks on the nds, one of the strangest features in newbies for homebrew nds programming is the makefile.

I already wrote a blog on this in an older version of a homebrew blog, and here is the updated text:

Makefile monsters

Having the incredible urge to make a game for the nds, you dont think of the makefile.
You think of your game!

After having sniffed at all sorts of examples in the devkitpro examples folder you try something of your own, and “Fi Donc!”, (french for all kinds of trouble!), the makefile doesn’t quite let you taste the sweetness of succes….:-( These are (were) dedicated smaller version, only including what was needed for this example.

What is this monster? The MAKEFILE is a file with rules how to link all the things you have put together in your project, and, finally presenting the code, the images, the sounds to the devkitpro, to let it be crunched and digestible by the nds: All of this has to be done to be able to produce the miracle .nds file, which can be put in the emulators or the nds itself.

Wow!

You can do this by hand too!
http://www.dev-scene.com/NDS/Tutorials_Day_2#Build_A_Demo_The_Hard_Way
the name of this link speaks for itself.

There is some luck around the corner: you are not the first to confront this….monster you didn’t ask for, (you just wanted to program C…..in an IDE like DevCpp – actually also here you need a makefile but it is hidden, taken care of….like this with JAVA by the way and any other programming environment, only it is totally hidden for JAVA.)
Makefile making: Killroy was here! is written on this wall, and whoever it was, they were good!!!
They have created templates for the makefile.

Want to see a not so template makefile?
Look at this sound example:
http://www.double.co.nz/nintendo_ds/nds_develop4.html
and download and open this makefile, it shows its working very clearly, totally dedicated to this very instructive sound project!

Then go to the devkitpro examples, there you see more generic makefiles, although the methods to work with sprites differ, so, the even the generic makefiles will differ amongst themselves.

in between and writing about the “old” style and the “new” is this link:
http://www.fampennings.nl/maarten/nds/index.htm
here the workings are explained fixing the watch example in de Devkitpro examples in the meantime, and expanding on the two processors ARM7 and ARM9.

Now that you now the why and the how, you can go and talk to these monster makefiles…
what helps too is searching a tutorial on makefile, although this tends to be too general, you can extract some rules and get used to the very short commands….
http://www.opussoftware.com/tutorial/TutMakefile.htm

later on (in nds traditions never) there will be more on makefiles!!!

this is the offcial description:
http://www.gnu.org/software/make/manual/make.html


Sound on the nds

26/12/2009

Before the last update, devkitpro release 27, we had to do sound using SOX in tht terminal window.

Now we use maxmod, http://maxmod.org/ (api: http://maxmod.org/ref/ )

Basically having the right setup you can use .wav files.

Auke asked me where the soundbank.h file could be found. Well this file is generated by the MAKEFILE itself:

there is a special line for this in the MAKEFILE:

#———————————————————————————
# rule to build soundbank from music files
#———————————————————————————
soundbank.bin : $(AUDIOFILES)
#———————————————————————————
@mmutil $^ -d -osoundbank.bin -hsoundbank.h

and you can find the soundbank.h in the build folder, after buidling (make command in Programmer’s NotePad)

Also the header file for the .wav files are generated by the MAKEFILE.

export AUDIOFILES    :=    $(foreach dir,$(notdir $(wildcard $(MUSIC)/*.*)),$(CURDIR)/$(MUSIC)/$(dir))

and the folder where to find the sound data:

MUSIC       :=  maxmod_data

The interplay between header files of media (image and sound) and the MAKEFILE is something you have to get used to. Using the MAKEFILE template everything is taken care of in principle.

All is explained excellently on this page: http://maxmod.org/ref/tut/dsprog.html