fix Windows prompts to insert disk if memory card not present

This commit is contained in:
Chris Danford
2003-11-09 11:50:28 +00:00
parent c98956653e
commit 3a9ce7be4d
3 changed files with 25 additions and 2 deletions
+2
View File
@@ -317,6 +317,7 @@ void PrefsManager::ReadGlobalPrefsFromDisk()
ini.GetValue( "Options", ssprintf("DefaultMachineProfileIDP%d",p+1), m_sDefaultMachineProfileID[p] );
ini.GetValue( "Options", ssprintf("MemoryCardDirP%d",p+1), m_sMemoryCardDir[p] );
FixSlashesInPlace( m_sMemoryCardDir[p] );
ini.GetValue( "Options", ssprintf("MemoryCardMountCommandP%d",p+1), m_sMemoryCardMountCommand[p] );
}
ini.GetValue( "Options", "CenterImageTranslateX", m_iCenterImageTranslateX );
@@ -453,6 +454,7 @@ void PrefsManager::SaveGlobalPrefsToDisk() const
{
ini.SetValue( "Options", ssprintf("DefaultMachineProfileIDP%d",p+1), m_sDefaultMachineProfileID[p] );
ini.SetValue( "Options", ssprintf("MemoryCardDirP%d",p+1), m_sMemoryCardDir[p] );
ini.SetValue( "Options", ssprintf("MemoryCardMountCommandP%d",p+1), m_sMemoryCardMountCommand[p] );
}
ini.SetValue( "Options", "CenterImageTranslateX", m_iCenterImageTranslateX );
+1
View File
@@ -108,6 +108,7 @@ public:
CString m_sLanguage;
CString m_sDefaultMachineProfileID[NUM_PLAYERS];
CString m_sMemoryCardDir[NUM_PLAYERS];
CString m_sMemoryCardMountCommand[NUM_PLAYERS];
int m_iCenterImageTranslateX;
int m_iCenterImageTranslateY;
float m_fCenterImageScaleX;
+22 -2
View File
@@ -163,9 +163,25 @@ bool ProfileManager::IsMemoryCardInserted( PlayerNumber pn )
sizeof(szFileSystemNameBuffer) );
return !!bResult;
}
#endif
#else
return true;
// Try to create directory before writing a temp file.
CreateDirectories( sDir );
// Test whether a memory card is usable by trying to write a file.
CString sFile = sDir + "temp";
FILE* fp = fopen( sFile, "w" );
if( fp )
{
fclose( fp );
remove( sFile );
return true;
}
else
{
return false;
}
#endif
}
bool ProfileManager::LoadProfileFromMemoryCard( PlayerNumber pn )
@@ -182,6 +198,10 @@ bool ProfileManager::LoadProfileFromMemoryCard( PlayerNumber pn )
bool ProfileManager::LoadFirstAvailableProfile( PlayerNumber pn )
{
// mount card
if( !PREFSMAN->m_sMemoryCardMountCommand[pn].empty() )
system( PREFSMAN->m_sMemoryCardMountCommand[pn] );
if( IsMemoryCardInserted(pn) )
{
if( LoadProfileFromMemoryCard(pn) )