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); } }
bool drawPng(const void *imgData,u32 intLeft,u32 intTop,u32 intWidth,u32 intHeight,void *pFramebuffer) { IMGCTX imgContext; PNGUPROP imgProperties; bool varout=true; if ((imgContext=getPngImageRessources(imgData,&imgProperties))) { PNGU_DECODE_TO_COORDS_YCbYCr(imgContext,intLeft,intTop,imgProperties.imgWidth,imgProperties.imgHeight,intWidth,intHeight,pFramebuffer); PNGU_ReleaseImageContext(imgContext); } else { varout=false; } return varout; }
void video_drawpng(IMGCTX ctx, PNGUPROP imgProp, u16 x, u16 y) { PNGU_DECODE_TO_COORDS_YCbYCr(ctx, x, y, imgProp.imgWidth, imgProp.imgHeight, vmode->fbWidth, vmode->xfbHeight, framebuffer); }