ugly hack to fix "mem card name not updated if card left in between games"

This commit is contained in:
Chris Danford
2004-04-23 06:35:24 +00:00
parent e4353d5cb8
commit 6928e8e864
4 changed files with 30 additions and 6 deletions
+20 -1
View File
@@ -261,7 +261,7 @@ match:
void MemoryCardManager::FlushAllDisks()
{
for( int p=0; p<NUM_PLAYERS; p++ )
FOREACH_PlayerNumber( p )
{
if( m_Device[p].IsBlank() ) // no card assigned
continue; // skip
@@ -285,3 +285,22 @@ CString MemoryCardManager::GetName( PlayerNumber pn ) const
{
return m_Device[pn].sName;
}
void MemoryCardManager::RefreshNames()
{
// HACK: UsbStorageDevice::sName is only read when the device is connected.
// If the player leaves their memory card in after the game ends and they
// immediate start another game, then sName isn't re-read automatically.
// It's much harder to add logic to read the name again to MemoryCardDriver
// than to add a small hack here.
FOREACH_PlayerNumber( p )
{
if( m_Device[p].IsBlank() ) // no card assigned
continue; // skip
if( m_bWriteError[p] || m_bTooLate[p] )
continue; // skip
CString sProfileDir = MEM_CARD_MOUNT_POINT[p] + PREFSMAN->m_sMemoryCardProfileSubdir + '/';
m_Device[p].sName = Profile::GetProfileDisplayNameFromDir( sProfileDir );
}
}