Changes

Jump to navigation Jump to search
2,258 bytes added ,  09:14, 17 July 2008
New page: Seems to be a bug in the console. This is not a matter of the TV, the first line is never displayed no matter how much yoffset, you have to always printf \n at the start. <source lang="c...
Seems to be a bug in the console. This is not a matter of the TV, the first line is never displayed no matter how much yoffset, you have to always printf \n at the start.
<source lang="c">
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <malloc.h>
#include <ogcsys.h>
#include <gccore.h>
#include <wiiuse/wpad.h>


static void *xfb = NULL;
static GXRModeObj *rmode = NULL;

int main(int argc, char **argv) {

VIDEO_Init();
PAD_Init();
WPAD_Init();

rmode = VIDEO_GetPreferredMode(NULL);

xfb = MEM_K0_TO_K1(SYS_AllocateFramebuffer(rmode));
int xorigin=0;
int yorigin=0;
console_init(xfb,xorigin,yorigin,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();
}
s32 Err;
int xoff = 0;
int yoff = 16;
Err = CON_InitEx(rmode, xoff,yoff,rmode->fbWidth-(2*xoff),rmode->xfbHeight-(2*yoff));
if (Err) printf("\n\nErr: %d",Err);
int cols,rows;
CON_GetMetrics(&cols, &rows);
printf("1\n"); /*1st line not visible? */
printf("1-345678-1-23456789212345678-3-2345678-4-2345678-5-2345678-6-2345678-7-2345678-8");
printf(" 2 Hello World! Press HOME to exit. w=%4d h=%4d\n",rmode->fbWidth,rmode->xfbHeight);
printf(" 3 cols=%4d rows=%4d\n",cols,rows);

int h;
for (h=4;h<rows;h++)
{
// printf("%2d\n",h);
printf("%2d 45678-1123456789212345678-312345678-412345678-512345678-612345678-7\n",h);

}

int dohome = 0;
int res;
u32 type;
WPADData *wd;

while (!dohome)
{

VIDEO_WaitVSync();

WPAD_ReadPending(WPAD_CHAN_ALL, 0 /*countevs*/);
res = WPAD_Probe(0, &type);
if (res == WPAD_ERR_NONE)
{
wd = WPAD_Data(0);
if (wd->btns_h & WPAD_BUTTON_HOME)
{
dohome = 1;
}
}

}


printf("Exiting...\n");
/*
if (dooff) SYS_ResetSystem(SYS_POWEROFF,0,0);
exit(0); exit to loader
SYS_ResetSystem(SYS_RETURNTOMENU,0,0);
SYS_RESTART reboot wii
SYS_RETURNTOMENU for a "soft" return to the system menu
SYS_POWEROFF to shut down the wii (automatically to the appropriate Idle or Standby mode,
depending on the WC24 setting)
*/
return 0;
}
</source>
316

edits

Navigation menu