diff --git a/stepmania/src/MemoryCardManager.cpp b/stepmania/src/MemoryCardManager.cpp index eeb18db10b..4af6f9707c 100644 --- a/stepmania/src/MemoryCardManager.cpp +++ b/stepmania/src/MemoryCardManager.cpp @@ -159,12 +159,12 @@ void MemoryCardManager::AssignUnassignedCards() unsigned i; // search for card dir match - if( !PREFSMAN->m_sMemoryCardDir[p].empty() ) + if( !PREFSMAN->m_sMemoryCardOsMountPoint[p].empty() ) { for( i=0; im_sMemoryCardDir[p]) == 0 ) // match + if( usd.sOsMountDir.CompareNoCase(PREFSMAN->m_sMemoryCardOsMountPoint[p]) == 0 ) // match goto match; } } diff --git a/stepmania/src/PrefsManager.cpp b/stepmania/src/PrefsManager.cpp index 8d3f81ac08..51f4c75be4 100644 --- a/stepmania/src/PrefsManager.cpp +++ b/stepmania/src/PrefsManager.cpp @@ -19,6 +19,7 @@ #include "arch/arch.h" /* for default driver specs */ #include "RageSoundReader_Resample.h" /* for ResampleQuality */ #include "RageFile.h" +#include "ProductInfo.h" #define STEPMANIA_INI_PATH "Data/StepMania.ini" #define STATIC_INI_PATH "Data/Static.ini" @@ -215,6 +216,8 @@ PrefsManager::PrefsManager() m_iMemoryCardUsbPort[p] = -1; } + m_sMemoryCardProfileSubdir = PRODUCT_NAME; + ReadGlobalPrefsFromDisk(); } @@ -361,11 +364,12 @@ void PrefsManager::ReadGlobalPrefsFromDisk() ini.GetValue( "Options", "EndlessStagesUntilBreak", m_iEndlessNumStagesUntilBreak ); ini.GetValue( "Options", "EndlessBreakLength", m_iEndlessBreakLength ); + ini.GetValue( "Options", "MemoryCardProfileSubdir", m_sMemoryCardProfileSubdir ); for( int p=0; pIsMounted(sDir) ) - return false; + + DEBUG_ASSERT( FILEMAN->IsMounted(sDir) ); // should be called only if we've already mounted + // tack on a subdirectory so that we don't write everything to the root + sDir += PREFSMAN->m_sMemoryCardProfileSubdir; + sDir += '/'; + m_bUsingMemoryCard[pn] = true; bool bResult; bResult = LoadProfile( pn, sDir, false ); return bResult; } +bool ProfileManager::CreateMemoryCardProfile( PlayerNumber pn ) +{ + CString sDir = MEM_CARD_DIR[pn]; + + DEBUG_ASSERT( FILEMAN->IsMounted(sDir) ); // should be called only if we've already mounted + + // tack on a subdirectory so that we don't write everything to the root + sDir += PREFSMAN->m_sMemoryCardProfileSubdir; + sDir += '/'; + + return CreateProfile( sDir, NEW_MEM_CARD_NAME ); +} + bool ProfileManager::LoadFirstAvailableProfile( PlayerNumber pn ) { #ifndef _XBOX @@ -182,8 +199,7 @@ bool ProfileManager::LoadFirstAvailableProfile( PlayerNumber pn ) if( LoadProfileFromMemoryCard(pn) ) return true; - CString sDir = MEM_CARD_DIR[pn]; - CreateProfile( sDir, NEW_MEM_CARD_NAME ); + CreateMemoryCardProfile( pn ); if( LoadProfileFromMemoryCard(pn) ) return true; } diff --git a/stepmania/src/ProfileManager.h b/stepmania/src/ProfileManager.h index 48d2b6e1d8..0e2e8ddeca 100644 --- a/stepmania/src/ProfileManager.h +++ b/stepmania/src/ProfileManager.h @@ -133,6 +133,7 @@ public: private: bool LoadDefaultProfileFromMachine( PlayerNumber pn ); + bool CreateMemoryCardProfile( PlayerNumber pn ); bool LoadProfileFromMemoryCard( PlayerNumber pn ); bool LoadProfile( PlayerNumber pn, CString sProfileDir, bool bIsMemCard ); bool CreateProfile( CString sProfileDir, CString sName ); diff --git a/stepmania/src/ScreenProfileOptions.cpp b/stepmania/src/ScreenProfileOptions.cpp index 90583dbfb4..c261243561 100644 --- a/stepmania/src/ScreenProfileOptions.cpp +++ b/stepmania/src/ScreenProfileOptions.cpp @@ -28,8 +28,8 @@ enum { PO_CREATE_NEW, PO_DELETE_, PO_RENAME_, - PO_CARD_DIR_1, - PO_CARD_DIR_2, + PO_OS_MOUNT_1, + PO_OS_MOUNT_2, NUM_PROFILE_OPTIONS_LINES }; @@ -39,8 +39,8 @@ OptionRow g_ProfileOptionsLines[NUM_PROFILE_OPTIONS_LINES] = { OptionRow( "Create\nNew", true, "PRESS START" ), OptionRow( "Delete", true ), OptionRow( "Rename", true ), - OptionRow( "Card Dir\nPlayer1", true, "" ), - OptionRow( "Card Dir\nPlayer2", true, "" ), + OptionRow( "OS Mount\nPlayer1", true, "" ), + OptionRow( "OS Mount\nPlayer2", true, "" ), }; const ScreenMessage SM_DoneCreating = ScreenMessage(SM_User+1); @@ -67,15 +67,15 @@ ScreenProfileOptions::ScreenProfileOptions( CString sClassName ) : ScreenOptions g_ProfileOptionsLines[PO_RENAME_].choices.push_back( "-NONE-" ); PROFILEMAN->GetLocalProfileNames( g_ProfileOptionsLines[PO_RENAME_].choices ); - if( PREFSMAN->m_sMemoryCardDir[PLAYER_1].empty() ) - g_ProfileOptionsLines[PO_CARD_DIR_1].choices[0] = "-NOT SET IN INI-"; + if( PREFSMAN->m_sMemoryCardOsMountPoint[PLAYER_1].empty() ) + g_ProfileOptionsLines[PO_OS_MOUNT_1].choices[0] = "-NOT SET IN INI-"; else - g_ProfileOptionsLines[PO_CARD_DIR_1].choices[0] = PREFSMAN->m_sMemoryCardDir[PLAYER_1]; + g_ProfileOptionsLines[PO_OS_MOUNT_1].choices[0] = PREFSMAN->m_sMemoryCardOsMountPoint[PLAYER_1]; - if( PREFSMAN->m_sMemoryCardDir[PLAYER_2].empty() ) - g_ProfileOptionsLines[PO_CARD_DIR_2].choices[0] = "-NOT SET IN INI-"; + if( PREFSMAN->m_sMemoryCardOsMountPoint[PLAYER_2].empty() ) + g_ProfileOptionsLines[PO_OS_MOUNT_2].choices[0] = "-NOT SET IN INI-"; else - g_ProfileOptionsLines[PO_CARD_DIR_2].choices[0] = PREFSMAN->m_sMemoryCardDir[PLAYER_2]; + g_ProfileOptionsLines[PO_OS_MOUNT_2].choices[0] = PREFSMAN->m_sMemoryCardOsMountPoint[PLAYER_2]; Init( INPUTMODE_TOGETHER,