Tutorial 1: Setting up the environment

This is the first tutorial of programming for the Wii and it will cover setting up our environment. These tutorials will be as detailed as I can make them and will try to cover different programming subjects. You can grab the PDF of this tutorial here: codemii-tutorial-1.

Our first step in order to code for the Wii is to set up the programming environment and for this we are required to download DevKitPro. DevKitPro is a compilation of compilers, useful applications and example source code which will all be set up for us at a click of a button. For those wondering what a compiler is, a compiler is an application which can convert our code into a machine executable format.

So let’s go to www.devkitpro.org, select Downloads then select Windows Installer. This will take you to the sourceforge devkitpro page where you should click on the .exe file to download it. At the time of writing this tutorial it is devkitProUpdater-1.4.7.exe. Save the file somewhere on your computer and then run it.

Once in the installer, say yes to downloading and installing files and yes to keeping the files we download. When it gets to the screen where it’s asking you which components you want to install, you only need to check the minimal system box, devkitPPC box and Programmer’s notepad box. PPC (PowerPC) is the computer hardware which our compiler will compile our source code to. Leave the installation directory as c:\devkitpro.

So now we’ve set up the programming environment which was pretty simple wasn’t it?

I will give you a run down of the things included in DevKitPro that will be useful for us.

Firstly we have Programmers Notepad (devkitpro/Programmers Notepad) which is where we will be writing our code in. Programmers notepad makes things a whole lot easier for us by using syntax highlighting, showing line numbers, grouping files into a project, etc.

The next application we have is called gcube (devkitpro/emulators/gcube) which is a gamecube emulator. This application is quite handy as you can test most of the code that you develop on it. I find it much easier when writing code to test things out on gcube instead of having to turn on the Wii and test it that way. I used gcube to test out the two homebrew games that I made, which were Simon and Matching Cards.

The last thing that is handy is the gamecube and Wii example source code (devkitpro/examples). The source code gives us a template which we can start our applications on. Example source code for the gamecube includes how to access the dvd, memory card, network, etc.

In the next tutorial I’ll cover Makefiles, compiling your first source using the template example, dealing with errors and a very basic run down on the C programming language.

Tags: , , , , , , , , , , , , , , , , , , , , , , ,

13 Responses to “Tutorial 1: Setting up the environment”

  1. graingert says:

    Can you post posix (mac/linux) instructions?

  2. octoroks says:

    sweet man, can’t wait for the next tutorials,

  3. LOLDSFAN says:

    yay! I will use this.

  4. datdude says:

    When are you going to post your next blog on compiling?

  5. harry says:

    yay, great! waiting for mooooore 🙂

  6. keith says:

    brilliant!
    can’t wait for more!

  7. teknecal says:

    For Mac/Linux instructions I don’t actually run either of those systems so I won’t be able to post any instructions on them.

    I will hopefully make and post the next tutorial on the weekend.

  8. Speggy says:

    thank you a lot. I’ve tried to start coding by myself but didn’t know how to start.

    by the by, you should give Bushing a shout ( http://www.hackmii.com ) he mite be able to post some code examples form high-level projects (such as DVD reading)

  9. Pvt Ryan says:

    @ graingert

    The there is no difference in what you do under linux/mac, mainly the difference is in the setup:
    http://wiibrew.org/wiki/Getting_started_with_DevkitPPC_on_Linux
    http://wiibrew.org/wiki/Getting_started_with_DevkitPPC_on_Mac_OS_X

    codewise just use your favourite editor to edit the source file, all the actual code is the same as you are cross compiling.

  10. ryan says:

    i had devkit before. and it used to work fine, but then i had to format my pc. i am still on windows. but this time around i installed devkit, and i go to programmers notepad, and all seems well, then i go to “make” and it says
    > “make”
    main.c
    linking … tutorial4.elf (it pauses here for a few minutes then ….)

    This application has requested the Runtime to terminate it in an unusual way.
    Please contact the application’s support team for more information.
    powerpc-gekko-gcc.exe: Internal error: Aborted (program collect2)
    Please submit a full bug report.
    See for instructions.
    make[1]: *** [/c/programming/tutorial4-blank-1/tutorial4/tutorial4.elf] Error 1
    “make”: *** [build] Error 2

    > Process Exit Code: 2
    > Time Taken: 04:11

    i tried re installing, re downloading, and still nothing, i even tried older versions of the program, it happens the same with every version.
    i tried to send a bug report. but it also gave me an error with that. i don’t know what the problem could be

  11. Bernard says:

    Its origins will be the way to obtain significantly controversy but I’ll get into what’s regarded as being probably the most
    recognised edition.

  12. Jhonny says:

    thanks! this is the only tutorial for making wii games i could find

  13. SampleText says:

    newbie here, what do we do if the useful programs (ie. programmer’s notepad) is not included with devkitpro? i installed using the devkitpro updater 3.0.3.

Leave a Reply for teknecal