ugly hack to fix "mem card name not updated if card left in between games"
This commit is contained in:
@@ -179,6 +179,8 @@ void GameState::BeginGame()
|
||||
// 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)
|
||||
m_iNumTimesThroughAttract = -2;
|
||||
|
||||
MEMCARDMAN->RefreshNames();
|
||||
}
|
||||
|
||||
void CheckStageStats( const StageStats &ss, int p )
|
||||
@@ -230,6 +232,8 @@ void GameState::PlayersFinalized()
|
||||
if( m_pCurSong == NULL && pProfile->m_pLastSong )
|
||||
m_pCurSong = pProfile->m_pLastSong;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/* This data is added to each player profile, and to the machine profile per-player. */
|
||||
|
||||
@@ -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 );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,6 +42,7 @@ public:
|
||||
bool PathIsMemCard( CString sDir ) const;
|
||||
|
||||
CString GetName( PlayerNumber pn ) const;
|
||||
void RefreshNames();
|
||||
|
||||
protected:
|
||||
void AssignUnassignedCards(); // do our best to assign a Device to each player
|
||||
|
||||
@@ -192,19 +192,19 @@ bool Screen::JoinInput( const DeviceInput& DeviceI, const InputEventType type, c
|
||||
else
|
||||
GAMESTATE->m_iCoins -= iCoinsToCharge;
|
||||
|
||||
SCREENMAN->PlayStartSound();
|
||||
|
||||
GAMESTATE->m_bSideIsJoined[MenuI.player] = true;
|
||||
if( GAMESTATE->m_MasterPlayerNumber == PLAYER_INVALID )
|
||||
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( GAMESTATE->GetNumSidesJoined() == 1 )
|
||||
GAMESTATE->BeginGame();
|
||||
|
||||
PROFILEMAN->LoadFirstAvailableProfile( MenuI.player, true ); // fast load
|
||||
SCREENMAN->RefreshCreditsMessages();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user