0### introduction I updated this one as 3 people asked how to compile pong the past two days. 1### requirements devkitcube r1 : http://heliscar.com/greg/devkitcube-r1.tar.gz libogc v0.2 : http://dextrose.com/files/gc/source/libogc_v02.zip crt0.s : http://cvs.sourceforge.net/viewcvs.py/*checkout*/gclib/GCLIBCVS/crt0.s pong v1 : http://dextrose.com/files/gc/source/gc/pong.zip 2### installation Extract devkitcube in /usr/local (thus you'll have /usr/local/devkitcube). Choose a directory, like ~/gcdev and extract libogc in here (to have ~/gcdev/lib and ~/gcdev/include). Note : "~" mean your home directory, in the unix world. Simply put crt0.s in ~/gcdev. Do a "mkdir ~gcdev/pong" and extract pong in this directory. 3### make pong compatible with libogc v0.2 Go in ~/gcdev/pong and backup main.c : "cp main.c main.c_orig". Edit main.c like this (or copy this snippet to a file and do a "patch < file") : #### cut here : beginning of patch --- main.c_orig 2004-01-03 15:34:39.000000000 +0100 +++ main.c 2004-01-03 15:41:34.000000000 +0100 @@ -33,11 +33,8 @@ */ // Change these to where you keep your libs -#include "..\..\lib\types.h" -#include "..\..\lib\video.h" -#include "..\..\lib\memory.h" -#include "..\..\lib\pad.h" -#include ".\gfx\font.h" +#include +#include "gfx/font.h" // Hot-reset, mapped to Start. Very handy. Thanks to http://duke.napalm-x.com/ and Peter for this one #define REG_HOTRESET (0xCC003024) @@ -75,8 +72,9 @@ int main() { // Init video in PAL mode, change this to your video-mode. - vidInit (VID_MODE_640_480_PAL_60_YUV_16); - vidSetFrameBuffer ((u32)fb); + VIDEO_Init (VIDEO_640X480_PAL60_YUV16); + VIDEO_SetFrameBuffer (VIDEO_FRAMEBUFFER_1,(u32)fb); + VIDEO_SetFrameBuffer (VIDEO_FRAMEBUFFER_2,(u32)(fb+320)); // Init ball and players' pos. player[0].x=30; @@ -94,7 +92,7 @@ while(1) // Main game loop { - vidWaitRetrace(); // Wait for vblank + VIDEO_WaitVSync(); // Wait for vblank PAD_ReadState(&pad[0], PAD_CHANNEL_0); // Read pads PAD_ReadState(&pad[1], PAD_CHANNEL_1); ####cut here : end of patch 4### compilation Let's do this in a little script that will : -set your $PATH variable to include devkitcube -compile the sources to an elf file -convert the elf to the bin format if there were no compilation error(as psoload can read bin, there's no need to build a dol) #### cut here : beginning of script #!/bin/bash PATH=$PATH:/usr/local/devkitcube/bin rm -f main.elf main.bin powerpc-eabi-elf-gcc -o main.elf -Wl,-Ttext,0x80003100 ../crt0.s main.c -L../lib/ -logc -I../include/ -Wall [ $? = 0 ] && powerpc-eabi-elf-objcopy -O binary main.elf main.bin #### cut here : end of script Note : gcc's options -o main.elf : tells to compile sources and make a binary named main.elf -Wl,-Ttext,0x80003100 : tells where the text section should be in gamecube's memory ../crt0.s main.c : source files to compile -L../lib/ : tells where to find additional libraries -logc : tells what library to include -I../include/ : tells where to find additional includes -Wall : tells to show all warnings