save profile data to memory card subdir so we don't clutter the root

This commit is contained in:
Chris Danford
2003-12-19 08:51:47 +00:00
parent 67a6fddcf3
commit 64f24895d7
6 changed files with 43 additions and 20 deletions
+2 -2
View File
@@ -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; i<vUnassignedDevices.size(); i++ )
{
UsbStorageDevice &usd = vUnassignedDevices[i];
if( usd.sOsMountDir.CompareNoCase(PREFSMAN->m_sMemoryCardDir[p]) == 0 ) // match
if( usd.sOsMountDir.CompareNoCase(PREFSMAN->m_sMemoryCardOsMountPoint[p]) == 0 ) // match
goto match;
}
}
+8 -3
View File
@@ -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; p<NUM_PLAYERS; p++ )
{
ini.GetValue( "Options", ssprintf("DefaultLocalProfileIDP%d",p+1), m_sDefaultLocalProfileID[p] );
ini.GetValue( "Options", ssprintf("MemoryCardDirP%d",p+1), m_sMemoryCardDir[p] );
FixSlashesInPlace( m_sMemoryCardDir[p] );
ini.GetValue( "Options", ssprintf("MemoryCardOsMountPointP%d",p+1), m_sMemoryCardOsMountPoint[p] );
FixSlashesInPlace( m_sMemoryCardOsMountPoint[p] );
ini.GetValue( "Options", ssprintf("MemoryCardUsbBusP%d",p+1), m_iMemoryCardUsbBus[p] );
ini.GetValue( "Options", ssprintf("MemoryCardUsbPortP%d",p+1), m_iMemoryCardUsbPort[p] );
}
@@ -520,10 +524,11 @@ void PrefsManager::SaveGlobalPrefsToDisk() const
ini.SetValue( "Options", "EndlessStagesUntilBreak", m_iEndlessNumStagesUntilBreak );
ini.SetValue( "Options", "EndlessBreakLength", m_iEndlessBreakLength );
ini.SetValue( "Options", "MemoryCardProfileSubdir", m_sMemoryCardProfileSubdir );
for( int p=0; p<NUM_PLAYERS; p++ )
{
ini.SetValue( "Options", ssprintf("DefaultLocalProfileIDP%d",p+1), m_sDefaultLocalProfileID[p] );
ini.SetValue( "Options", ssprintf("MemoryCardDirP%d",p+1), m_sMemoryCardDir[p] );
ini.SetValue( "Options", ssprintf("MemoryCardOsMountPointP%d",p+1), m_sMemoryCardOsMountPoint[p] );
ini.SetValue( "Options", ssprintf("MemoryCardUsbBusP%d",p+1), m_iMemoryCardUsbBus[p] );
ini.SetValue( "Options", ssprintf("MemoryCardUsbPortP%d",p+1), m_iMemoryCardUsbPort[p] );
}
+2 -1
View File
@@ -120,8 +120,9 @@ public:
int m_iEndlessNumStagesUntilBreak;
int m_iEndlessBreakLength;
CString m_sLanguage;
CString m_sMemoryCardProfileSubdir; // if set, always use the device that mounts to this point
CString m_sDefaultLocalProfileID[NUM_PLAYERS];
CString m_sMemoryCardDir[NUM_PLAYERS]; // if set, always use this dir for the memory card
CString m_sMemoryCardOsMountPoint[NUM_PLAYERS]; // if set, always use the device that mounts to this point
int m_iMemoryCardUsbBus[NUM_PLAYERS]; // take the first storage device on this usb bus
int m_iMemoryCardUsbPort[NUM_PLAYERS]; // take the first storage device on this usb bus
int m_iCenterImageTranslateX;
+20 -4
View File
@@ -162,15 +162,32 @@ bool ProfileManager::LoadDefaultProfileFromMachine( PlayerNumber pn )
bool ProfileManager::LoadProfileFromMemoryCard( PlayerNumber pn )
{
CString sDir = MEM_CARD_DIR[pn];
if( !FILEMAN->IsMounted(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;
}
+1
View File
@@ -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 );
+10 -10
View File
@@ -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,