Welcome! Log In Create A New Profile

Advanced

take screenshot libwiigui

Posted by gave92 
take screenshot libwiigui
January 06, 2013 11:42AM
Hello,
i'm trying to figure out how to take screenshots from my app, based on libwiigui.
that's what i tried so far:

in video.cpp:
static u8* videoScreen = NULL;

void TakeScreenshot()
{
    int size = VIDEO_GetFrameBufferSize(vmode);
    videoScreen = (u8*)memalign(32,size);
    if (videoScreen)
        memcpy(videoScreen,xfb[whichfb],VIDEO_GetFrameBufferSize(vmode));
}
in menu.cpp i call TakeScreenshot() and try to display the image:
    TakeScreenshot();
    ...
    GuiImage screen(videoScreen,640,480);
    HaltGui();
    mainWindow->Append(&screen);
    ResumeGui();

but all i get is a stripe of random pixels at the center of the screen
looking into wiimc/wiixplorer sources didn't help either

thanks in advance



Edited 1 time(s). Last edit at 01/06/2013 11:43AM by gave92.
Re: take screenshot libwiigui
January 13, 2013 10:16PM
Ok, i made little steps forward, looking at wiimc sources.

in video.cpp:

void TakeScreenshot()
{
	videoScreenshot = (u8 *)memalign(32, vmode->fbWidth * vmode->efbHeight * 4);
	if(!videoScreenshot)
		return;

	GX_SetTexCopySrc(0, 0, vmode->fbWidth, vmode->efbHeight);
	GX_SetTexCopyDst(vmode->fbWidth, vmode->efbHeight, GX_TF_RGBA8, GX_FALSE);
	DCInvalidateRange(videoScreenshot, vmode->fbWidth * vmode->efbHeight * 4);
	GX_CopyTex(videoScreenshot, GX_FALSE);
	GX_PixModeSync();
}

in menu.cpp:

	TakeScreenshot();
	...
	videoImg = new GuiImage();
	videoImg->SetImage(videoScreenshot, vmode->fbWidth, vmode->viHeight);
	videoImg->SetScaleX(screenwidth/(float)vmode->fbWidth);
	videoImg->SetScaleY(screenheight/(float)vmode->efbHeight);
	mainWindow->Append(videoImg);

when i try to display it i get a right sized image.. but all black :)
any guess about what's wrong in this code?
Sorry, only registered users may post in this forum.

Click here to login