SongManager::LoadAllFromProfiles -> SongManager::LoadAllFromProfile
mount each memory card as needed, one at a time working on being able to start a timeout period in MEMCARDMAN::MountCard
This commit is contained in:
+12
-10
@@ -232,12 +232,11 @@ void GameState::PlayersFinalized()
|
|||||||
|
|
||||||
MEMCARDMAN->LockCards();
|
MEMCARDMAN->LockCards();
|
||||||
|
|
||||||
/* Mount all available cards, for loading the profile and edits. */
|
|
||||||
MEMCARDMAN->TryMountAllCards();
|
|
||||||
|
|
||||||
// apply saved default modifiers if any
|
// apply saved default modifiers if any
|
||||||
FOREACH_HumanPlayer( pn )
|
FOREACH_HumanPlayer( pn )
|
||||||
{
|
{
|
||||||
|
MEMCARDMAN->MountUsedCard( pn );
|
||||||
|
|
||||||
PROFILEMAN->LoadFirstAvailableProfile( pn ); // load full profile
|
PROFILEMAN->LoadFirstAvailableProfile( pn ); // load full profile
|
||||||
|
|
||||||
if( !PROFILEMAN->IsUsingProfile(pn) )
|
if( !PROFILEMAN->IsUsingProfile(pn) )
|
||||||
@@ -266,17 +265,18 @@ void GameState::PlayersFinalized()
|
|||||||
m_pPreferredSong = pProfile->m_lastSong.ToSong();
|
m_pPreferredSong = pProfile->m_lastSong.ToSong();
|
||||||
if( m_pPreferredCourse == NULL )
|
if( m_pPreferredCourse == NULL )
|
||||||
m_pPreferredCourse = pProfile->m_lastCourse.ToCourse();
|
m_pPreferredCourse = pProfile->m_lastCourse.ToCourse();
|
||||||
|
|
||||||
|
SONGMAN->LoadAllFromProfile( (ProfileSlot) pn );
|
||||||
|
MEMCARDMAN->UnmountCard( pn );
|
||||||
}
|
}
|
||||||
|
|
||||||
SONGMAN->LoadAllFromProfiles();
|
SONGMAN->LoadAllFromProfile( PROFILE_SLOT_MACHINE );
|
||||||
|
|
||||||
FOREACH_PlayerNumber( pn )
|
FOREACH_PlayerNumber( pn )
|
||||||
{
|
{
|
||||||
if( !IsHumanPlayer(pn) )
|
if( !IsHumanPlayer(pn) )
|
||||||
ApplyModifiers( pn, DEFAULT_CPU_MODIFIERS );
|
ApplyModifiers( pn, DEFAULT_CPU_MODIFIERS );
|
||||||
}
|
}
|
||||||
|
|
||||||
MEMCARDMAN->UnmountAllUsedCards();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This data is added to each player profile, and to the machine profile per-player. */
|
/* This data is added to each player profile, and to the machine profile per-player. */
|
||||||
@@ -350,20 +350,22 @@ void GameState::EndGame()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MEMCARDMAN->MountAllUsedCards();
|
|
||||||
|
|
||||||
BOOKKEEPER->WriteToDisk();
|
BOOKKEEPER->WriteToDisk();
|
||||||
PROFILEMAN->SaveAllProfiles();
|
|
||||||
|
|
||||||
FOREACH_HumanPlayer( pn )
|
FOREACH_HumanPlayer( pn )
|
||||||
{
|
{
|
||||||
if( !PROFILEMAN->IsUsingProfile(pn) )
|
if( !PROFILEMAN->IsUsingProfile(pn) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if( PROFILEMAN->ProfileWasLoadedFromMemoryCard(pn) )
|
||||||
|
MEMCARDMAN->MountUsedCard( pn );
|
||||||
|
PROFILEMAN->SaveProfile( pn );
|
||||||
|
MEMCARDMAN->UnmountCard( pn );
|
||||||
|
|
||||||
PROFILEMAN->UnloadProfile( pn );
|
PROFILEMAN->UnloadProfile( pn );
|
||||||
}
|
}
|
||||||
|
|
||||||
MEMCARDMAN->UnmountAllUsedCards();
|
PROFILEMAN->SaveMachineProfile();
|
||||||
|
|
||||||
// Reset the USB storage device numbers -after- saving
|
// Reset the USB storage device numbers -after- saving
|
||||||
CHECKPOINT;
|
CHECKPOINT;
|
||||||
|
|||||||
@@ -248,51 +248,35 @@ void MemoryCardManager::TryMountAllCards()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Called in EndGame just before writing the profile. Should block. */
|
/* Called in EndGame just before writing the profile. Should block. */
|
||||||
void MemoryCardManager::MountAllUsedCards()
|
void MemoryCardManager::MountUsedCard( PlayerNumber pn )
|
||||||
{
|
{
|
||||||
FOREACH_EnabledPlayer( p )
|
if( m_Device[pn].IsBlank() ) // they don't have an assigned card
|
||||||
{
|
return;
|
||||||
if( m_Device[p].IsBlank() ) // they don't have an assigned card
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if( m_bTooLate[p] || !m_Device[p].bWriteTestSucceeded || !PROFILEMAN->ProfileWasLoadedFromMemoryCard(p) )
|
MountCard( pn );
|
||||||
continue;
|
|
||||||
|
|
||||||
MountCard( p );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Called in EndGame just after writing the profile. Called by PlayersFinalized just after
|
|
||||||
* reading the profile. Should never block; use FlushAndReset to block until writes complete. */
|
|
||||||
void MemoryCardManager::UnmountAllUsedCards()
|
|
||||||
{
|
|
||||||
FOREACH_EnabledPlayer( p )
|
|
||||||
{
|
|
||||||
if( m_Device[p].IsBlank() ) // they don't have an assigned card
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if( m_bTooLate[p] || !m_Device[p].bWriteTestSucceeded || !PROFILEMAN->ProfileWasLoadedFromMemoryCard(p) )
|
|
||||||
continue;
|
|
||||||
|
|
||||||
UnmountCard( p );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MemoryCardManager::MountCard( PlayerNumber pn )
|
void MemoryCardManager::MountCard( PlayerNumber pn )
|
||||||
{
|
{
|
||||||
ASSERT( !m_Device[pn].IsBlank() );
|
ASSERT( !m_Device[pn].IsBlank() );
|
||||||
|
|
||||||
|
if( !m_Device[pn].bWriteTestSucceeded || m_bTooLate[pn] )
|
||||||
|
return;
|
||||||
|
|
||||||
/* Pause the mounting thread when we mount the first drive. */
|
/* Pause the mounting thread when we mount the first drive. */
|
||||||
bool bNeedPause = true;
|
bool bStartingMemoryCardAccess = true;
|
||||||
FOREACH_PlayerNumber( p )
|
FOREACH_PlayerNumber( p )
|
||||||
if( m_bMounted[p] )
|
if( m_bMounted[p] )
|
||||||
bNeedPause = false;
|
bStartingMemoryCardAccess = false; /* already did */
|
||||||
if( bNeedPause )
|
if( bStartingMemoryCardAccess )
|
||||||
|
{
|
||||||
|
/* We're starting to do stuff to the memory cards. */
|
||||||
this->PauseMountingThread();
|
this->PauseMountingThread();
|
||||||
|
}
|
||||||
|
|
||||||
if( !m_pDriver->MountAndTestWrite(&m_Device[pn]) )
|
if( !m_pDriver->MountAndTestWrite(&m_Device[pn]) )
|
||||||
{
|
{
|
||||||
if( bNeedPause )
|
if( bStartingMemoryCardAccess )
|
||||||
this->UnPauseMountingThread();
|
this->UnPauseMountingThread();
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@@ -319,6 +303,8 @@ void MemoryCardManager::MountCard( PlayerNumber pn )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Called in EndGame just after writing the profile. Called by PlayersFinalized just after
|
||||||
|
* reading the profile. Should never block; use FlushAndReset to block until writes complete. */
|
||||||
void MemoryCardManager::UnmountCard( PlayerNumber pn )
|
void MemoryCardManager::UnmountCard( PlayerNumber pn )
|
||||||
{
|
{
|
||||||
ASSERT( !m_Device[pn].IsBlank() );
|
ASSERT( !m_Device[pn].IsBlank() );
|
||||||
|
|||||||
@@ -22,8 +22,7 @@ public:
|
|||||||
void LockCards(); // prevent removing or changing of memory cards
|
void LockCards(); // prevent removing or changing of memory cards
|
||||||
void UnlockCards();
|
void UnlockCards();
|
||||||
void TryMountAllCards();
|
void TryMountAllCards();
|
||||||
void MountAllUsedCards();
|
void MountUsedCard( PlayerNumber pn );
|
||||||
void UnmountAllUsedCards();
|
|
||||||
void MountCard( PlayerNumber pn );
|
void MountCard( PlayerNumber pn );
|
||||||
void UnmountCard( PlayerNumber pn );
|
void UnmountCard( PlayerNumber pn );
|
||||||
|
|
||||||
|
|||||||
@@ -1175,16 +1175,14 @@ void SongManager::UpdateRankingCourses()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SongManager::LoadAllFromProfiles()
|
void SongManager::LoadAllFromProfile( ProfileSlot s )
|
||||||
{
|
{
|
||||||
FOREACH_ProfileSlot( s )
|
|
||||||
{
|
|
||||||
if( !PROFILEMAN->IsUsingProfile(s) )
|
if( !PROFILEMAN->IsUsingProfile(s) )
|
||||||
continue;
|
return;
|
||||||
|
|
||||||
CString sProfileDir = PROFILEMAN->GetProfileDir( s );
|
CString sProfileDir = PROFILEMAN->GetProfileDir( s );
|
||||||
if( sProfileDir.empty() )
|
if( sProfileDir.empty() )
|
||||||
continue; // skip
|
return; // skip
|
||||||
//
|
//
|
||||||
// Load all .edit files.
|
// Load all .edit files.
|
||||||
//
|
//
|
||||||
@@ -1216,7 +1214,6 @@ void SongManager::LoadAllFromProfiles()
|
|||||||
//
|
//
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SongManager::FreeAllLoadedFromProfiles()
|
void SongManager::FreeAllLoadedFromProfiles()
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ public:
|
|||||||
void RegenerateNonFixedCourses();
|
void RegenerateNonFixedCourses();
|
||||||
void SetPreferences();
|
void SetPreferences();
|
||||||
|
|
||||||
void LoadAllFromProfiles(); // song, edits
|
void LoadAllFromProfile( ProfileSlot s ); // songs, edits
|
||||||
void FreeAllLoadedFromProfiles();
|
void FreeAllLoadedFromProfiles();
|
||||||
|
|
||||||
void LoadGroupSymLinks( CString sDir, CString sGroupFolder );
|
void LoadGroupSymLinks( CString sDir, CString sGroupFolder );
|
||||||
|
|||||||
Reference in New Issue
Block a user