finish import/export of edits

This commit is contained in:
Chris Danford
2005-11-30 05:33:01 +00:00
parent 42f056dfdb
commit 3b799327fc
5 changed files with 48 additions and 5 deletions
+6
View File
@@ -624,6 +624,12 @@ bool MemoryCardManager::MountCard( PlayerNumber pn, int iTimeout )
return true; return true;
} }
bool MemoryCardManager::MountCard( PlayerNumber pn, const UsbStorageDevice &d )
{
m_Device[pn] = d;
return MountCard( pn );
}
/* Called in EndGame just after writing the profile. Called by PlayersFinalized just after /* 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. */ * reading the profile. Should never block; use FlushAndReset to block until writes complete. */
void MemoryCardManager::UnmountCard( PlayerNumber pn ) void MemoryCardManager::UnmountCard( PlayerNumber pn )
+3
View File
@@ -24,8 +24,11 @@ public:
void LockCards(); // prevent removing or changing of memory cards void LockCards(); // prevent removing or changing of memory cards
void UnlockCards(); void UnlockCards();
bool MountCard( PlayerNumber pn, int iTimeout = 10 ); bool MountCard( PlayerNumber pn, int iTimeout = 10 );
bool MountCard( PlayerNumber pn, const UsbStorageDevice &d );
void UnmountCard( PlayerNumber pn ); void UnmountCard( PlayerNumber pn );
bool IsMounted( PlayerNumber pn ) const { return m_bMounted[pn]; }
/* When paused, no changes in memory card state will be noticed until unpaused. */ /* When paused, no changes in memory card state will be noticed until unpaused. */
void PauseMountingThread( int iTimeout = 20 ); void PauseMountingThread( int iTimeout = 20 );
void UnPauseMountingThread(); void UnPauseMountingThread();
+27
View File
@@ -5,6 +5,7 @@
#include "MemoryCardManager.h" #include "MemoryCardManager.h"
#include "GameState.h" #include "GameState.h"
#include "ScreenManager.h" #include "ScreenManager.h"
#include "ScreenPrompt.h"
REGISTER_SCREEN_CLASS( ScreenOptionsMemoryCard ); REGISTER_SCREEN_CLASS( ScreenOptionsMemoryCard );
@@ -94,6 +95,32 @@ void ScreenOptionsMemoryCard::ExportOptions( int iRow, const vector<PlayerNumber
} }
} }
void ScreenOptionsMemoryCard::ProcessMenuStart( const InputEventPlus &input )
{
int iCurRow = m_iCurrentRow[GAMESTATE->m_MasterPlayerNumber];
if( iCurRow == (int)m_pRows.size()-1 ) // "exit"
{
MenuBack( GAMESTATE->m_MasterPlayerNumber );
}
else // a card
{
const vector<UsbStorageDevice> v = MEMCARDMAN->GetStorageDevices();
const UsbStorageDevice &dev = v[iCurRow];
MEMCARDMAN->m_sEditorMemoryCardOsMountPoint.Set( dev.sOsMountDir );
bool bSuccess = MEMCARDMAN->MountCard( PLAYER_1, dev );
if( bSuccess )
{
this->BeginFadingOut();
}
else
{
CString s = ssprintf("error mounting card: %s", MEMCARDMAN->GetCardError(PLAYER_1).c_str() );
ScreenPrompt::Prompt( SM_None, s );
}
}
}
/* /*
* (c) 2005 Chris Danford * (c) 2005 Chris Danford
* All rights reserved. * All rights reserved.
+2
View File
@@ -20,6 +20,8 @@ private:
void HandleMessage( const CString& sMessage ); void HandleMessage( const CString& sMessage );
void ProcessMenuStart( const InputEventPlus &input );
vector<OptionRowDefinition> m_vDefs; vector<OptionRowDefinition> m_vDefs;
}; };
+10 -5
View File
@@ -66,7 +66,8 @@ static CString ClearMemoryCardEdits()
if( MEMCARDMAN->GetCardState(pn) != MEMORY_CARD_STATE_READY ) if( MEMCARDMAN->GetCardState(pn) != MEMORY_CARD_STATE_READY )
continue; // skip continue; // skip
MEMCARDMAN->MountCard(pn); if( !MEMCARDMAN->IsMounted(pn) )
MEMCARDMAN->MountCard(pn);
bTriedToLoad = true; bTriedToLoad = true;
@@ -183,7 +184,8 @@ static CString TransferStatsMachineToMemoryCard()
if( MEMCARDMAN->GetCardState(pn) != MEMORY_CARD_STATE_READY ) if( MEMCARDMAN->GetCardState(pn) != MEMORY_CARD_STATE_READY )
continue; // skip continue; // skip
MEMCARDMAN->MountCard(pn); if( !MEMCARDMAN->IsMounted(pn) )
MEMCARDMAN->MountCard(pn);
bTriedToSave = true; bTriedToSave = true;
@@ -217,7 +219,8 @@ static CString TransferStatsMemoryCardToMachine()
if( MEMCARDMAN->GetCardState(pn) != MEMORY_CARD_STATE_READY ) if( MEMCARDMAN->GetCardState(pn) != MEMORY_CARD_STATE_READY )
continue; // skip continue; // skip
MEMCARDMAN->MountCard(pn); if( !MEMCARDMAN->IsMounted(pn) )
MEMCARDMAN->MountCard(pn);
bTriedToLoad = true; bTriedToLoad = true;
@@ -264,7 +267,8 @@ static CString CopyEditsMachineToMemoryCard()
if( MEMCARDMAN->GetCardState(pn) != MEMORY_CARD_STATE_READY ) if( MEMCARDMAN->GetCardState(pn) != MEMORY_CARD_STATE_READY )
continue; // skip continue; // skip
MEMCARDMAN->MountCard(pn); if( !MEMCARDMAN->IsMounted(pn) )
MEMCARDMAN->MountCard(pn);
bTriedToCopy = true; bTriedToCopy = true;
@@ -328,7 +332,8 @@ static CString CopyEditsMemoryCardToMachine()
if( MEMCARDMAN->GetCardState(pn) != MEMORY_CARD_STATE_READY ) if( MEMCARDMAN->GetCardState(pn) != MEMORY_CARD_STATE_READY )
continue; // skip continue; // skip
MEMCARDMAN->MountCard(pn); if( !MEMCARDMAN->IsMounted(pn) )
MEMCARDMAN->MountCard(pn);
bTriedToCopy = true; bTriedToCopy = true;