Example #1
0
void InitVideo (void)
	{
	// Initialise the video system
	VIDEO_Init();
	
	// Obtain the preferred video mode from the system
	// This will correspond to the settings in the Wii menu
	rmode = VIDEO_GetPreferredMode(NULL);

	// Allocate memory for the display in the uncached region
	xfb = MEM_K0_TO_K1(SYS_AllocateFramebuffer(rmode));
	
	VIDEO_Configure(rmode);
	VIDEO_SetNextFramebuffer(xfb);
	VIDEO_SetBlack(FALSE);
	VIDEO_Flush();
	VIDEO_WaitVSync();
	if(rmode->viTVMode&VI_NON_INTERLACE) VIDEO_WaitVSync();

	int x, y, w, h;
	x = 20;
	y = 32;
	w = rmode->fbWidth - (32);
	h = rmode->xfbHeight - (48);
	
	CON_InitEx(rmode, x, y, w, h);
	
	VIDEO_ClearFrameBuffer(rmode, xfb, COLOR_BLACK);

	CON_InitEx(rmode, x, y, w, h);
	
	// Set console text color
	printf("\x1b[%u;%um", 37, false);
	printf("\x1b[%u;%um", 40, false);
	}
Example #2
0
void initConsole(const void *imgBgData,enum CONSOLE_COLORS CONSOLE_COLOR,const char *strSplashScreenMessage,double dbLeft,double dbTop,double dbWidth,double dbHeight) {
PNGUPROP imgProperties;
IMGCTX imgContext;
void *pFramebuffer=NULL;
GXRModeObj *pRmode=NULL;
double dbConsoleFrameX[2]={dbLeft,dbLeft},dbConsoleFrameY[2]={dbTop,dbTop},dbBgImgXScaleFactor=1,dbBgImgYScaleFactor=1,dbReferenceWidth,dbReferenceHeight;
int intConsoleColumnsCount,intConsoleRowsCount;
struct stConsoleCursorLocation stTexteLocation;
    VIDEO_Init();
    pRmode=VIDEO_GetPreferredMode(NULL);
    pFramebuffer=MEM_K0_TO_K1(SYS_AllocateFramebuffer(pRmode));
    VIDEO_ClearFrameBuffer(pRmode,pFramebuffer,CONSOLE_COLOR);
    VIDEO_Configure(pRmode);
    VIDEO_SetNextFramebuffer(pFramebuffer);
    VIDEO_SetBlack(FALSE);
    VIDEO_Flush();
    VIDEO_WaitVSync();
    if(pRmode->viTVMode&VI_NON_INTERLACE) {
        VIDEO_WaitVSync();
    }
    dbWidth=fabs(dbWidth);
    dbHeight=fabs(dbHeight);
    if ((imgContext=getPngImageRessources(imgBgData,&imgProperties))) {
        dbReferenceWidth=imgProperties.imgWidth;
        dbReferenceHeight=imgProperties.imgHeight;
        dbBgImgXScaleFactor=pRmode->fbWidth/imgProperties.imgWidth;
        dbBgImgYScaleFactor=pRmode->xfbHeight/imgProperties.imgHeight;
    }
    else {
        dbReferenceWidth=pRmode->fbWidth;
        dbReferenceHeight=pRmode->xfbHeight;
    }
    if (dbWidth<=1) {
        dbWidth=dbReferenceWidth*dbWidth;
        dbConsoleFrameX[0]=0;
        dbConsoleFrameX[1]=dbWidth;
    }
    if (dbHeight<=1) {
        dbHeight=dbReferenceHeight*dbHeight;
        dbConsoleFrameY[0]=0;
        dbConsoleFrameY[1]=dbHeight;
    }
    CON_InitEx(pRmode,(s32) getRoundNumber(getPolyContainerPosition(&dbConsoleFrameX[0],2,0,dbReferenceWidth,dbLeft)*dbBgImgXScaleFactor),(s32) getRoundNumber(getPolyContainerPosition(&dbConsoleFrameY[0],2,0,dbReferenceHeight,dbTop)*dbBgImgYScaleFactor),(s32) getRoundNumber(dbWidth*dbBgImgXScaleFactor),(s32) getRoundNumber(dbHeight*dbBgImgYScaleFactor));
    if (imgContext) {
        PNGU_DECODE_TO_COORDS_YCbYCr(imgContext,0,0,imgProperties.imgWidth,imgProperties.imgHeight,pRmode->fbWidth,pRmode->xfbHeight,pFramebuffer);
        PNGU_ReleaseImageContext(imgContext);
    }
    resetDefaultFontSyle();
    if (*strSplashScreenMessage) {
        CON_GetMetrics(&intConsoleColumnsCount,&intConsoleRowsCount);
        printAlignedText(ALIGN_CENTER,ALIGN_MIDDLE,0,0,intConsoleRowsCount-1,intConsoleColumnsCount-1,true,true,&stTexteLocation,"%s",strSplashScreenMessage);
    }

}
Example #3
0
void con_init(u32 x, u32 y)
{
	u32 w, h;

	/* Set console width and height */
	w = vmode->fbWidth - (x * 2);
	h = vmode->xfbHeight - (y + 20);

	/* Create console in the framebuffer */
	CON_InitEx(vmode, x, y, w, h);
}
Example #4
0
void log_console_init(GXRModeObj *vmode, u16 logsize) {
	u16 i;
	LWP_MutexInit(&console_mutex, false);
#ifndef WIILIB	
	CON_InitEx(vmode, 20, 30, vmode->fbWidth - 40, vmode->xfbHeight - 60);
	//CON_InitEx(vmode, 10, 10 , (vmode->fbWidth / 2)-80, vmode->xfbHeight - 40);
	
#endif
	rcb = VIDEO_SetPostRetraceCallback(NULL);
	VIDEO_SetPostRetraceCallback(rcb);

/*
	VIDEO_ClearFrameBuffer(vmode, xfb[0], COLOR_BLACK);
	VIDEO_ClearFrameBuffer(vmode, xfb[1], COLOR_BLACK);

	VIDEO_SetNextFramebuffer(xfb[whichfb]);
	VIDEO_SetBlack(FALSE);
	VIDEO_Flush();
	VIDEO_WaitVSync();

	if (vmode->viTVMode & VI_NON_INTERLACE)
		VIDEO_WaitVSync();
*/
	gecko = usb_isgeckoalive(1);

	if (log_size && log) {
		for (i = 0; i < log_size; ++i)
			if (log[i])
				free(log[i]);

		free(log);
	}

	log_size = logsize;
	log_next = 0;

	if (log_size) {
		log = (char **) malloc(log_size * sizeof(char *));

		for (i = 0; i < log_size; ++i)
			log[i] = NULL;
	}

	log_active = log_size > 0;

	dot_video = devoptab_list[STD_OUT];
	video_active = true;

	devoptab_list[STD_OUT] = &dot_out;
	devoptab_list[STD_ERR] = &dot_out;
}
Example #5
0
void init_video_and_wpad()
{
	// Video and WPAD initialized?
	if(video_and_wpad_initialized)
	{
		return;
	}
	
	// Initialise the video system
	VIDEO_Init();
	
	// Obtain the preferred video mode from the system
	// This will correspond to the settings in the Wii menu
	rmode = VIDEO_GetPreferredMode(NULL);

	// Allocate memory for the display in the uncached region
	xfb = MEM_K0_TO_K1(SYS_AllocateFramebuffer(rmode));
	
	// Set up the video registers with the chosen mode
	VIDEO_Configure(rmode);
	
	// Tell the video hardware where our display memory is
	VIDEO_SetNextFramebuffer(xfb);
	
	// Make the display visible
	VIDEO_SetBlack(FALSE);

	// Flush the video register changes to the hardware
	VIDEO_Flush();

	// Wait for Video setup to complete
	VIDEO_WaitVSync();
	if(rmode->viTVMode&VI_NON_INTERLACE) VIDEO_WaitVSync();

	// Set console parameters
    int x = 24, y = 32, w, h;
    w = rmode->fbWidth - (32);
    h = rmode->xfbHeight - (48);

    // Initialize the console - CON_InitEx works after VIDEO_ calls
	CON_InitEx(rmode, x, y, w, h);

	// Clear the garbage around the edges of the console
    VIDEO_ClearFrameBuffer(rmode, xfb, COLOR_BLACK);
	
	// This function initialises the attached controllers
	WPAD_Init();
	WPAD_SetDataFormat(WPAD_CHAN_0, WPAD_FMT_BTNS_ACC_IR);
	
	video_and_wpad_initialized = TRUE;
}