clean up screenshot saving

use a unique name for every screenshot in case image files are moved off the memory card
This commit is contained in:
Chris Danford
2004-02-22 05:04:11 +00:00
parent 97e9277d1c
commit 721f29c458
6 changed files with 39 additions and 27 deletions
+5 -3
View File
@@ -37,6 +37,7 @@
#include "RageDisplay.h"
#include "StepMania.h"
#include "CryptManager.h"
#include <time.h>
const int NUM_SCORE_DIGITS = 9;
@@ -1298,17 +1299,18 @@ void ScreenEvaluation::Input( const DeviceInput& DeviceI, const InputEventType t
if( !m_bSavedScreenshot[pn] && // only allow one screenshot
PROFILEMAN->IsUsingProfile(pn) )
{
Profile* pProfile = PROFILEMAN->GetProfile(pn);
CString sDir = PROFILEMAN->GetProfileDir((ProfileSlot)pn) + "Screenshots/";
CString sFileName = SaveScreenshot( sDir, true, true );
int iScreenshotIndex = pProfile->GetNextScreenshotIndex();
CString sFileName = SaveScreenshot( sDir, true, true, iScreenshotIndex );
CString sPath = sDir+sFileName;
if( !sFileName.empty() )
{
Profile* pProfile = PROFILEMAN->GetProfile(pn);
Profile::Screenshot screenshot;
screenshot.sFileName = sFileName;
screenshot.sMD5 = CRYPTMAN->GetMD5( sPath );
screenshot.highScore = m_HighScore[pn];
screenshot.time = time(NULL);
pProfile->AddScreenshot( screenshot );
}