Wii Programming

Talk about your favorite PC games, Steam and building awesome custom rigs!

Moderator:Moderators

Post Reply
User avatar
gannon
Moderator
Posts:6974
Joined:Sun Apr 04, 2004 4:48 pm
Location:Near that one big lake
Contact:
Wii Programming

Post by gannon » Tue Oct 27, 2009 7:44 am

Been awhile it seems, schools been keeping me busy, but I've been getting some work done at least.
Lately have been programming my Wii. Haven't done anything amazing yet, but I'm learning :P
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 :P
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;
}

User avatar
WhatULive4
Posts:329
Joined:Fri Mar 28, 2008 6:19 pm
Location:Saskatchewan, Canada

Re: Wii Programming

Post by WhatULive4 » Thu Oct 29, 2009 3:29 am

I wouldn't even know where to start in the Wii homebrew scene. Do you have any resources you could share with us? Links, tutorials, etc.

User avatar
gannon
Moderator
Posts:6974
Joined:Sun Apr 04, 2004 4:48 pm
Location:Near that one big lake
Contact:

Re: Wii Programming

Post by gannon » Thu Oct 29, 2009 1:47 pm

Here's my fancy "Portable Wii Development Kit"
Image
It has a Wii, an external HDD, a wifi router, an LCD, and a powerstrip in a cardboard box :P The only thing that it needs to work for wii development is my laptop and a power source...
Should make this more portable sometime :wink:

As for starting out on wii homebrew...if you google it you'll find out :P As it involves modifying the wii and such, I'll leave that to you to find out.
As far as making homebrew, not necessarily running it, follow http://wiki.devkitpro.org/index.php/Get ... /devkitPPC" onclick="window.open(this.href);return false; to get started and read the examples

User avatar
gannon
Moderator
Posts:6974
Joined:Sun Apr 04, 2004 4:48 pm
Location:Near that one big lake
Contact:

Re: Wii Programming

Post by gannon » Sat Nov 07, 2009 12:18 am

Just wondering, anyone have any experience parsing XML in C?
Here's how I'm doing top nodes and the arg="" settings, but haven't got around to supporting children or /> ending to nodes

Code: Select all

char * readNode(char * p, char to[], char * open, char * close) {
	p = strstr(p, open);
	if (p == NULL) {
		strcpy(to, "");
	} else {
		char * s = p+strlen(open);
		p = strstr(p+1, close);
		strncpy(to, s, p-s);
	}
	return p;
}
On a side note, one of my programs made it's way to being listed on the Homebrew Browser for direct to wii download, feels nifty. Alas, it's not a very good program :P

Post Reply