For some reason this program just loops the printed text over and over infinitely. Pressing Home works to end the program, but what am I doing wrong? I working with the codemii site to try to learn some programming for the Wii.
CODE#include
#include
#include
#include
static u32 *xfb;
static GXRModeObj *rmode;
void Initialise() {
ÂÂ
ÂÂÂÂVIDEO_Init();
ÂÂÂÂWPAD_Init();
ÂÂÂÂrmode = VIDEO_GetPreferredMode(NULL);
ÂÂÂÂxfb = MEM_K0_TO_K1(SYS_AllocateFramebuffer(rmode));
ÂÂÂÂconsole_init(xfb,20,20,rmode->fbWidth,rmode->xfbHeight,rmode->fbWidth*VI_DISPLAY_PIX_SZ);
ÂÂÂÂVIDEO_Configure(rmode);
ÂÂÂÂVIDEO_SetNextFramebuffer(xfb);
ÂÂÂÂVIDEO_SetBlack(FALSE);
ÂÂÂÂVIDEO_Flush();
ÂÂÂÂVIDEO_WaitVSync();
ÂÂÂÂif(rmode->viTVMode&VI_NON_INTERLACE) VIDEO_WaitVSync();
}
int main()
{
ÂÂÂÂInitialise();
ÂÂÂÂ
ÂÂÂÂprintf("Hello World! My first Wii program.\n");
ÂÂÂÂ
ÂÂÂÂwhile(1) {
ÂÂÂÂ
ÂÂÂÂWPAD_ScanPads();
ÂÂÂÂ
ÂÂÂÂu16 buttonsDown = WPAD_ButtonsDown(0);
ÂÂÂÂif (buttonsDown & WPAD_BUTTON_A);
ÂÂÂÂ{
ÂÂÂÂÂÂÂÂprintf("You pressed button A! Good job!\n");
ÂÂÂÂ}
ÂÂÂÂ
ÂÂÂÂu16 buttonsHeld = WPAD_ButtonsHeld(0);
ÂÂÂÂif (buttonsHeld & WPAD_BUTTON_A);
ÂÂÂÂ{
ÂÂÂÂÂÂÂÂprintf("You held button A! Good job!\n");
ÂÂÂÂ}
ÂÂÂÂ
ÂÂÂÂif (buttonsHeld & WPAD_BUTTON_B);
ÂÂÂÂ{
ÂÂÂÂÂÂÂÂprintf("You held button B! Good Job!\n");
ÂÂÂÂ}
ÂÂÂÂ
ÂÂÂÂif (buttonsHeld & WPAD_BUTTON_1);
ÂÂÂÂ{
ÂÂÂÂÂÂÂÂprintf("You held button 1! Good Job!\n");
ÂÂÂÂ}
ÂÂÂÂ
ÂÂÂÂu16 buttonsUp = WPAD_ButtonsUp(0);
ÂÂÂÂif (buttonsUp & WPAD_BUTTON_A);
ÂÂÂÂ{
ÂÂÂÂÂÂÂÂprintf("You released button A! Good job!\n");
ÂÂÂÂ}
ÂÂÂÂ
ÂÂÂÂif (buttonsDown & WPAD_BUTTON_HOME)
ÂÂÂÂ{
ÂÂÂÂÂÂÂÂexit(0);
ÂÂÂÂ}
}
return 0;
}
Can anyone shed some light?
CODE#include
#include
#include
#include
static u32 *xfb;
static GXRModeObj *rmode;
void Initialise() {
ÂÂ
ÂÂÂÂVIDEO_Init();
ÂÂÂÂWPAD_Init();
ÂÂÂÂrmode = VIDEO_GetPreferredMode(NULL);
ÂÂÂÂxfb = MEM_K0_TO_K1(SYS_AllocateFramebuffer(rmode));
ÂÂÂÂconsole_init(xfb,20,20,rmode->fbWidth,rmode->xfbHeight,rmode->fbWidth*VI_DISPLAY_PIX_SZ);
ÂÂÂÂVIDEO_Configure(rmode);
ÂÂÂÂVIDEO_SetNextFramebuffer(xfb);
ÂÂÂÂVIDEO_SetBlack(FALSE);
ÂÂÂÂVIDEO_Flush();
ÂÂÂÂVIDEO_WaitVSync();
ÂÂÂÂif(rmode->viTVMode&VI_NON_INTERLACE) VIDEO_WaitVSync();
}
int main()
{
ÂÂÂÂInitialise();
ÂÂÂÂ
ÂÂÂÂprintf("Hello World! My first Wii program.\n");
ÂÂÂÂ
ÂÂÂÂwhile(1) {
ÂÂÂÂ
ÂÂÂÂWPAD_ScanPads();
ÂÂÂÂ
ÂÂÂÂu16 buttonsDown = WPAD_ButtonsDown(0);
ÂÂÂÂif (buttonsDown & WPAD_BUTTON_A);
ÂÂÂÂ{
ÂÂÂÂÂÂÂÂprintf("You pressed button A! Good job!\n");
ÂÂÂÂ}
ÂÂÂÂ
ÂÂÂÂu16 buttonsHeld = WPAD_ButtonsHeld(0);
ÂÂÂÂif (buttonsHeld & WPAD_BUTTON_A);
ÂÂÂÂ{
ÂÂÂÂÂÂÂÂprintf("You held button A! Good job!\n");
ÂÂÂÂ}
ÂÂÂÂ
ÂÂÂÂif (buttonsHeld & WPAD_BUTTON_B);
ÂÂÂÂ{
ÂÂÂÂÂÂÂÂprintf("You held button B! Good Job!\n");
ÂÂÂÂ}
ÂÂÂÂ
ÂÂÂÂif (buttonsHeld & WPAD_BUTTON_1);
ÂÂÂÂ{
ÂÂÂÂÂÂÂÂprintf("You held button 1! Good Job!\n");
ÂÂÂÂ}
ÂÂÂÂ
ÂÂÂÂu16 buttonsUp = WPAD_ButtonsUp(0);
ÂÂÂÂif (buttonsUp & WPAD_BUTTON_A);
ÂÂÂÂ{
ÂÂÂÂÂÂÂÂprintf("You released button A! Good job!\n");
ÂÂÂÂ}
ÂÂÂÂ
ÂÂÂÂif (buttonsDown & WPAD_BUTTON_HOME)
ÂÂÂÂ{
ÂÂÂÂÂÂÂÂexit(0);
ÂÂÂÂ}
}
return 0;
}
Can anyone shed some light?