// save a screenshot icon void SaveScreenShotPreview() { const int w = Vision::Video.GetXRes(); const int h = Vision::Video.GetYRes(); unsigned char *pTempBuffer = new unsigned char [w*h*3]; char pszPreviewFileName[FS_MAX_PATH]; sprintf(pszPreviewFileName, SAVEGAME_PREVIEW, m_iSlotIndex + 1); // write the screen buffer to memory buffer if (Vision::Game.WriteScreenToBuffer(0,0,w,h,(UBYTE *)pTempBuffer)) { // use VTEX to scale and save the image Image_cl image; ImageMap_cl colorMap(w,h,24, (UBYTE*)pTempBuffer); image.AddColorMap(colorMap); image.Scale(128,128); image.SaveBMP(pszPreviewFileName,Vision::File.GetOutputManager()); } delete []pTempBuffer; // make sure texture is reloaded next time if (m_spPreviewMask->GetTextureObject()) m_spPreviewMask->GetTextureObject()->EnsureUnloaded(); }
void VRestoreScreen::SaveBackgroundScreenshot() { // GrabBackgroundScreenshot() needs to be called before if (m_pScreenshotBuffer == NULL) return; const int iScreenWidth = Vision::Video.GetXRes(); const int iScreenHeight = Vision::Video.GetYRes(); ColorCorrect(m_pScreenshotBuffer, iScreenWidth, iScreenHeight, m_fBrightness, m_fSaturation); // use VTEX to scale and save the image Image_cl image; ImageMap_cl colorMap(iScreenWidth, iScreenHeight, 24, static_cast<UBYTE*>(m_pScreenshotBuffer)); image.AddColorMap(colorMap); // Decide which resolution to use for the saved image. int iScaledWidth = 512; while (iScaledWidth > iScreenWidth || iScaledWidth > iScreenHeight) { iScaledWidth /= 2; VASSERT(iScaledWidth > 0); } image.Scale(iScaledWidth, iScaledWidth); const char* szFilename = ":app_cache/vision_background.bmp"; IVFileOutStream* pOut = Vision::File.Create(szFilename); const bool bSaved = (image.SaveBMP(pOut) == VERR_NOERROR); V_SAFE_DELETE_ARRAY(m_pScreenshotBuffer); if (pOut != NULL) pOut->Close(); if (bSaved) { // Set up loading screen settings. Settings settings(szFilename); settings.m_eAspectRatioAlignment = ALIGN_NONE; SetSettings(settings); } else { hkvLog::Dev("VRestoreScreen: Could not save backgrounding screenshot\n"); } }