synchronize access to memory cards between mounting thread and main thread Profile Load/Save

This commit is contained in:
Chris Danford
2004-06-06 02:41:16 +00:00
parent 5c7dd115ad
commit 110ec3d331
11 changed files with 190 additions and 143 deletions
+14 -1
View File
@@ -84,6 +84,9 @@ bool ProfileManager::LoadProfile( PlayerNumber pn, CString sProfileDir, bool bIs
ASSERT( !sProfileDir.empty() );
ASSERT( sProfileDir.Right(1) == "/" );
if( bIsMemCard )
MEMCARDMAN->PauseMountingThread();
m_sProfileDir[pn] = sProfileDir;
m_bWasLoadedFromMemoryCard[pn] = bIsMemCard;
@@ -92,6 +95,8 @@ bool ProfileManager::LoadProfile( PlayerNumber pn, CString sProfileDir, bool bIs
else
m_Profile[pn].LoadAllFromDir( m_sProfileDir[pn], PREFSMAN->m_bSignProfileData );
MEMCARDMAN->UnPauseMountingThread();
LOG->Trace( "Done loading profile." );
return true;
@@ -200,7 +205,15 @@ bool ProfileManager::SaveProfile( PlayerNumber pn ) const
if( m_sProfileDir[pn].empty() )
return false;
return m_Profile[pn].SaveAllToDir( m_sProfileDir[pn], PREFSMAN->m_bSignProfileData );
if( ProfileWasLoadedFromMemoryCard(pn) )
MEMCARDMAN->PauseMountingThread();
bool b = m_Profile[pn].SaveAllToDir( m_sProfileDir[pn], PREFSMAN->m_bSignProfileData );
if( ProfileWasLoadedFromMemoryCard(pn) )
MEMCARDMAN->UnPauseMountingThread();
return b;
}
void ProfileManager::UnloadProfile( PlayerNumber pn )