Lately have been programming my Wii. Haven't done anything amazing yet, but I'm learning
I'll try to get some pics of my dev setup uploaded soon...it's um..in a box
Here's a copy of the first program I wrote, which works...sometimes
I've done better stuff since, but no games yet
Code: Select all
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <malloc.h>
#include <gccore.h>
#include <wiiuse/wpad.h>
#include <ogc/ios.h>
#include <unistd.h>
static unsigned int *xfb[2] = { NULL, NULL };
static GXRModeObj *vmode;
void setupVideo() {
VIDEO_Init();
CONF_Init();
vmode = VIDEO_GetPreferredMode(NULL);
VIDEO_Configure (vmode);
xfb[0] = (u32 *) MEM_K0_TO_K1 (SYS_AllocateFramebuffer (&TVPal528IntDf));
xfb[1] = (u32 *) MEM_K0_TO_K1 (SYS_AllocateFramebuffer (&TVPal528IntDf));
console_init (xfb[0], 20, 64, vmode->fbWidth, vmode->xfbHeight, vmode->fbWidth * 2);
VIDEO_ClearFrameBuffer (vmode, xfb[0], COLOR_BLACK);
VIDEO_ClearFrameBuffer (vmode, xfb[1], COLOR_BLACK);
VIDEO_SetNextFramebuffer (xfb[0]);
VIDEO_SetBlack (0);
VIDEO_Flush ();
VIDEO_WaitVSync ();
if (vmode->viTVMode & VI_NON_INTERLACE)
VIDEO_WaitVSync ();
}
void launchTitle(u64 TitleID) {
WII_Initialize();
WII_LaunchTitle(TitleID);
}
int main(int argc, char **argv) {
setupVideo();
WPAD_Init();
printf("\n\n\n\n\n");
printf(" Gannon's Opera Loader");
printf("\n\n\n\n\n");
printf(" loading Opera...\n");
launchTitle(0x0001000148414445LL);
printf(" USA fail...\n");
launchTitle(0x000100014841444ALL);
printf(" Japan fail...\n");
launchTitle(0x0001000148414450LL);
printf(" PAL fail...\n");
printf(" Couldn't find Opera!\n");
printf(" Press Home to return\n");
while(1) {
WPAD_ScanPads();
u32 pressed = WPAD_ButtonsDown(0);
if ( pressed & WPAD_BUTTON_HOME ) exit(0);
VIDEO_WaitVSync();
}
return 0;
}