engine/wii/video.c
/**
 * Initialize the video, including GX.  This functon calls VIDEO_Init(), which
 * in turn initializes libogc, so this function must be called before making any
 * libogc calls.
 */
Initialize the video, including GX.  This functon calls VIDEO_Init(), which
in turn initializes libogc, so this function must be called before making any
libogc calls.
Initialize the video including GX . This functon calls VIDEO_Init () which in turn initializes libogc so this function must be called before making any libogc calls .
void video_init()
{
	if(inited) return;
	VIDEO_Init();
	vmode = VIDEO_GetPreferredMode(NULL);
	viewportHeight = vmode->xfbHeight;
	viewportWidth = vmode->fbWidth;
	if(CONF_GetAspectRatio() == CONF_ASPECT_16_9)
	{
		viewportWidth = viewportHeight * 16 / 9;
		vmode->viXOrigin = 5;
		vmode->viWidth = VI_MAX_WIDTH_NTSC - 10;
	}
	VIDEO_Configure(vmode);
	xfb[0] = MEM_K0_TO_K1(SYS_AllocateFramebuffer(vmode));
	xfb[1] = MEM_K0_TO_K1(SYS_AllocateFramebuffer(vmode));
	VIDEO_ClearFrameBuffer(vmode, xfb[0], COLOR_BLACK);
	VIDEO_ClearFrameBuffer(vmode, xfb[1], COLOR_BLACK);
	VIDEO_SetNextFramebuffer(xfb[whichbuffer]);
	VIDEO_SetBlack(FALSE);
	VIDEO_Flush();
	VIDEO_WaitVSync();
	if(vmode->viTVMode & VI_NON_INTERLACE) VIDEO_WaitVSync();
	video_gx_init();
	inited = 1;
}
void video_init ( ) { if ( inited ) return ; VIDEO_Init ( ) ; vmode = VIDEO_GetPreferredMode ( NULL ) ; viewportHeight = vmode -> xfbHeight ; viewportWidth = vmode -> fbWidth ; if ( CONF_GetAspectRatio ( ) == CONF_ASPECT_16_9 ) { viewportWidth = viewportHeight * 16 / 9 ; vmode -> viXOrigin = 5 ; vmode -> viWidth = VI_MAX_WIDTH_NTSC - 10 ; } VIDEO_Configure ( vmode ) ; xfb [ 0 ] = MEM_K0_TO_K1 ( SYS_AllocateFramebuffer ( vmode ) ) ; xfb [ 1 ] = MEM_K0_TO_K1 ( SYS_AllocateFramebuffer ( vmode ) ) ; VIDEO_ClearFrameBuffer ( vmode , xfb [ 0 ] , COLOR_BLACK ) ; VIDEO_ClearFrameBuffer ( vmode , xfb [ 1 ] , COLOR_BLACK ) ; VIDEO_SetNextFramebuffer ( xfb [ whichbuffer ] ) ; VIDEO_SetBlack ( FALSE ) ; VIDEO_Flush ( ) ; VIDEO_WaitVSync ( ) ; if ( vmode -> viTVMode & VI_NON_INTERLACE ) VIDEO_WaitVSync ( ) ; video_gx_init ( ) ; inited = 1 ; }
Initialize the video, including GX.
Initialize the video including GX .
// widescreen fix // allocate 2 video buffers for double buffering // clear framebuffers, etc. // initialize GX // finally, the video is up and ready for use :)