Difference between revisions of "User:CarstenK"

From WiiBrew
Jump to navigation Jump to search
(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...)
 
m
Line 1: Line 1:
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
+
[[Category:Deutschsprachiger]]
 +
 
 +
The first line of the console is never displayed, it seems to be a bug in the console.
 +
This is not a matter of the TV overscan, the first line is never displayed no matter how much yoffset, you have to always printf \n at the start!?
 +
 
 
<source lang="c">
 
<source lang="c">
 
#include <stdio.h>
 
#include <stdio.h>
Line 8: Line 12:
 
#include <gccore.h>
 
#include <gccore.h>
 
#include <wiiuse/wpad.h>
 
#include <wiiuse/wpad.h>
 
  
 
static void *xfb = NULL;
 
static void *xfb = NULL;
Line 31: Line 34:
 
VIDEO_Flush();
 
VIDEO_Flush();
 
VIDEO_WaitVSync();
 
VIDEO_WaitVSync();
if (rmode->viTVMode&VI_NON_INTERLACE)
+
if (rmode->viTVMode&VI_NON_INTERLACE) {
{
 
 
VIDEO_WaitVSync();
 
VIDEO_WaitVSync();
 
}
 
}
Line 48: Line 50:
  
 
int h;
 
int h;
for (h=4;h<rows;h++)
+
for (h=4;h<rows;h++) {
{
 
 
// printf("%2d\n",h);
 
// printf("%2d\n",h);
 
printf("%2d 45678-1123456789212345678-312345678-412345678-512345678-612345678-7\n",h);
 
printf("%2d 45678-1123456789212345678-312345678-412345678-512345678-612345678-7\n",h);
Line 67: Line 68:
 
WPAD_ReadPending(WPAD_CHAN_ALL, 0 /*countevs*/);
 
WPAD_ReadPending(WPAD_CHAN_ALL, 0 /*countevs*/);
 
res = WPAD_Probe(0, &type);
 
res = WPAD_Probe(0, &type);
if (res == WPAD_ERR_NONE)
+
if (res == WPAD_ERR_NONE) {
{
 
 
wd = WPAD_Data(0);
 
wd = WPAD_Data(0);
if (wd->btns_h & WPAD_BUTTON_HOME)
+
if (wd->btns_h & WPAD_BUTTON_HOME) {
{
 
 
dohome = 1;
 
dohome = 1;
 
}
 
}
Line 80: Line 79:
 
 
 
printf("Exiting...\n");
 
printf("Exiting...\n");
/*
 
if (dooff) SYS_ResetSystem(SYS_POWEROFF,0,0);
 
 
exit(0); exit to loader
 
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;
 
return 0;
 
}
 
}
 
</source>
 
</source>

Revision as of 09:03, 22 July 2008


The first line of the console is never displayed, it seems to be a bug in the console. This is not a matter of the TV overscan, the first line is never displayed no matter how much yoffset, you have to always printf \n at the start!?

#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");
	 exit(0); exit to loader
	return 0;
}