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
+4
View File
@@ -179,6 +179,8 @@ void GameState::BeginGame()
// play attract on the ending screen, then in one more whole attract // play attract on the ending screen, then in one more whole attract
// sequence after the game is over (even if attract sounds are set to off) // sequence after the game is over (even if attract sounds are set to off)
m_iNumTimesThroughAttract = -2; m_iNumTimesThroughAttract = -2;
MEMCARDMAN->RefreshNames();
} }
void CheckStageStats( const StageStats &ss, int p ) void CheckStageStats( const StageStats &ss, int p )
@@ -230,6 +232,8 @@ void GameState::PlayersFinalized()
if( m_pCurSong == NULL && pProfile->m_pLastSong ) if( m_pCurSong == NULL && pProfile->m_pLastSong )
m_pCurSong = pProfile->m_pLastSong; m_pCurSong = pProfile->m_pLastSong;
} }
} }
/* 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. */
+20 -1
View File
@@ -261,7 +261,7 @@ match:
void MemoryCardManager::FlushAllDisks() void MemoryCardManager::FlushAllDisks()
{ {
for( int p=0; p<NUM_PLAYERS; p++ ) FOREACH_PlayerNumber( p )
{ {
if( m_Device[p].IsBlank() ) // no card assigned if( m_Device[p].IsBlank() ) // no card assigned
continue; // skip continue; // skip
@@ -285,3 +285,22 @@ CString MemoryCardManager::GetName( PlayerNumber pn ) const
{ {
return m_Device[pn].sName; 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 );
}
}
+1
View File
@@ -42,6 +42,7 @@ public:
bool PathIsMemCard( CString sDir ) const; bool PathIsMemCard( CString sDir ) const;
CString GetName( PlayerNumber pn ) const; CString GetName( PlayerNumber pn ) const;
void RefreshNames();
protected: protected:
void AssignUnassignedCards(); // do our best to assign a Device to each player void AssignUnassignedCards(); // do our best to assign a Device to each player
+5 -5
View File
@@ -192,19 +192,19 @@ bool Screen::JoinInput( const DeviceInput& DeviceI, const InputEventType type, c
else else
GAMESTATE->m_iCoins -= iCoinsToCharge; GAMESTATE->m_iCoins -= iCoinsToCharge;
SCREENMAN->PlayStartSound();
GAMESTATE->m_bSideIsJoined[MenuI.player] = true; GAMESTATE->m_bSideIsJoined[MenuI.player] = true;
if( GAMESTATE->m_MasterPlayerNumber == PLAYER_INVALID ) if( GAMESTATE->m_MasterPlayerNumber == PLAYER_INVALID )
GAMESTATE->m_MasterPlayerNumber = MenuI.player; GAMESTATE->m_MasterPlayerNumber = MenuI.player;
PROFILEMAN->LoadFirstAvailableProfile( MenuI.player, true ); // fast load
SCREENMAN->RefreshCreditsMessages();
SCREENMAN->PlayStartSound();
// if first player to join, set start time // if first player to join, set start time
if( GAMESTATE->GetNumSidesJoined() == 1 ) if( GAMESTATE->GetNumSidesJoined() == 1 )
GAMESTATE->BeginGame(); GAMESTATE->BeginGame();
PROFILEMAN->LoadFirstAvailableProfile( MenuI.player, true ); // fast load
SCREENMAN->RefreshCreditsMessages();
return true; return true;
} }