move memory card prefs into MemoryCardManager
This commit is contained in:
@@ -18,6 +18,37 @@
|
||||
|
||||
MemoryCardManager* MEMCARDMAN = NULL; // global and accessable from anywhere in our program
|
||||
|
||||
static void MemoryCardOsMountPointInit( size_t /*PlayerNumber*/ i, CString &sNameOut, CString &defaultValueOut )
|
||||
{
|
||||
sNameOut = "MemoryCardOsMountPoint" + PlayerNumberToString( (PlayerNumber)i );
|
||||
defaultValueOut = "";
|
||||
}
|
||||
|
||||
static void MemoryCardUsbBusInit( size_t /*PlayerNumber*/ i, CString &sNameOut, int &defaultValueOut )
|
||||
{
|
||||
sNameOut = "MemoryCardUsbBus" + PlayerNumberToString( (PlayerNumber)i );
|
||||
defaultValueOut = -1;
|
||||
}
|
||||
|
||||
static void MemoryCardUsbPortInit( size_t /*PlayerNumber*/ i, CString &sNameOut, int &defaultValueOut )
|
||||
{
|
||||
sNameOut = "MemoryCardUsbPort" + PlayerNumberToString( (PlayerNumber)i );
|
||||
defaultValueOut = -1;
|
||||
}
|
||||
|
||||
static void MemoryCardUsbLevelInit( size_t /*PlayerNumber*/ i, CString &sNameOut, int &defaultValueOut )
|
||||
{
|
||||
sNameOut = "MemoryCardUsbLevel" + PlayerNumberToString( (PlayerNumber)i );
|
||||
defaultValueOut = -1;
|
||||
}
|
||||
|
||||
// if set, always use the device that mounts to this point
|
||||
Preference1D<CString> MemoryCardManager::m_sMemoryCardOsMountPoint( MemoryCardOsMountPointInit, NUM_PLAYERS );
|
||||
// Look for this level, bus, port when assigning cards. -1 = match any
|
||||
Preference1D<int> MemoryCardManager::m_iMemoryCardUsbBus( MemoryCardUsbBusInit, NUM_PLAYERS );
|
||||
Preference1D<int> MemoryCardManager::m_iMemoryCardUsbPort( MemoryCardUsbPortInit, NUM_PLAYERS );
|
||||
Preference1D<int> MemoryCardManager::m_iMemoryCardUsbLevel( MemoryCardUsbLevelInit, NUM_PLAYERS );
|
||||
|
||||
const CString MEM_CARD_MOUNT_POINT[NUM_PLAYERS] =
|
||||
{
|
||||
/* @ is importast; see RageFileManager LoadedDriver::GetPath */
|
||||
@@ -386,21 +417,21 @@ void MemoryCardManager::Update( float fDelta )
|
||||
FOREACH( UsbStorageDevice, vUnassignedDevices, d )
|
||||
{
|
||||
// search for card dir match
|
||||
if( !PREFSMAN->m_sMemoryCardOsMountPoint[p].Get().empty() &&
|
||||
d->sOsMountDir.CompareNoCase(PREFSMAN->m_sMemoryCardOsMountPoint[p].Get()) )
|
||||
if( !m_sMemoryCardOsMountPoint[p].Get().empty() &&
|
||||
d->sOsMountDir.CompareNoCase(m_sMemoryCardOsMountPoint[p].Get()) )
|
||||
continue; // not a match
|
||||
|
||||
// search for USB bus match
|
||||
if( PREFSMAN->m_iMemoryCardUsbBus[p] != -1 &&
|
||||
PREFSMAN->m_iMemoryCardUsbBus[p] != d->iBus )
|
||||
if( m_iMemoryCardUsbBus[p] != -1 &&
|
||||
m_iMemoryCardUsbBus[p] != d->iBus )
|
||||
continue; // not a match
|
||||
|
||||
if( PREFSMAN->m_iMemoryCardUsbPort[p] != -1 &&
|
||||
PREFSMAN->m_iMemoryCardUsbPort[p] != d->iPort )
|
||||
if( m_iMemoryCardUsbPort[p] != -1 &&
|
||||
m_iMemoryCardUsbPort[p] != d->iPort )
|
||||
continue; // not a match
|
||||
|
||||
if( PREFSMAN->m_iMemoryCardUsbLevel[p] != -1 &&
|
||||
PREFSMAN->m_iMemoryCardUsbLevel[p] != d->iLevel )
|
||||
if( m_iMemoryCardUsbLevel[p] != -1 &&
|
||||
m_iMemoryCardUsbLevel[p] != d->iLevel )
|
||||
continue; // not a match
|
||||
|
||||
LOG->Trace( "Player %i: matched %s", p+1, d->sDevice.c_str() );
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "PlayerNumber.h"
|
||||
#include "RageSound.h"
|
||||
#include "arch/MemoryCard/MemoryCardDriver.h"
|
||||
#include "Preference.h"
|
||||
|
||||
|
||||
extern const CString MEM_CARD_MOUNT_POINT[NUM_PLAYERS];
|
||||
@@ -38,6 +39,11 @@ public:
|
||||
bool IsNameAvailable( PlayerNumber pn ) const;
|
||||
CString GetName( PlayerNumber pn ) const;
|
||||
|
||||
static Preference1D<CString> m_sMemoryCardOsMountPoint;
|
||||
static Preference1D<int> m_iMemoryCardUsbBus;
|
||||
static Preference1D<int> m_iMemoryCardUsbPort;
|
||||
static Preference1D<int> m_iMemoryCardUsbLevel;
|
||||
|
||||
protected:
|
||||
void CheckStateChanges();
|
||||
|
||||
|
||||
@@ -214,30 +214,6 @@ void DefaultLocalProfileIDInit( size_t /*PlayerNumber*/ i, CString &sNameOut, CS
|
||||
defaultValueOut = "";
|
||||
}
|
||||
|
||||
void MemoryCardOsMountPointInit( size_t /*PlayerNumber*/ i, CString &sNameOut, CString &defaultValueOut )
|
||||
{
|
||||
sNameOut = "MemoryCardOsMountPoint" + PlayerNumberToString( (PlayerNumber)i );
|
||||
defaultValueOut = "";
|
||||
}
|
||||
|
||||
void MemoryCardUsbBusInit( size_t /*PlayerNumber*/ i, CString &sNameOut, int &defaultValueOut )
|
||||
{
|
||||
sNameOut = "MemoryCardUsbBus" + PlayerNumberToString( (PlayerNumber)i );
|
||||
defaultValueOut = -1;
|
||||
}
|
||||
|
||||
void MemoryCardUsbPortInit( size_t /*PlayerNumber*/ i, CString &sNameOut, int &defaultValueOut )
|
||||
{
|
||||
sNameOut = "MemoryCardUsbPort" + PlayerNumberToString( (PlayerNumber)i );
|
||||
defaultValueOut = -1;
|
||||
}
|
||||
|
||||
void MemoryCardUsbLevelInit( size_t /*PlayerNumber*/ i, CString &sNameOut, int &defaultValueOut )
|
||||
{
|
||||
sNameOut = "MemoryCardUsbLevel" + PlayerNumberToString( (PlayerNumber)i );
|
||||
defaultValueOut = -1;
|
||||
}
|
||||
|
||||
|
||||
PrefsManager::PrefsManager() :
|
||||
m_sCurrentGame ( "CurrentGame", "" ),
|
||||
@@ -351,10 +327,6 @@ PrefsManager::PrefsManager() :
|
||||
m_iProductID ( "ProductID", 1 ),
|
||||
m_sDefaultLocalProfileID ( DefaultLocalProfileIDInit, NUM_PLAYERS ),
|
||||
m_bMemoryCards ( "MemoryCards", false ),
|
||||
m_sMemoryCardOsMountPoint ( MemoryCardOsMountPointInit, NUM_PLAYERS ),
|
||||
m_iMemoryCardUsbBus ( MemoryCardUsbBusInit, NUM_PLAYERS ),
|
||||
m_iMemoryCardUsbPort ( MemoryCardUsbPortInit, NUM_PLAYERS ),
|
||||
m_iMemoryCardUsbLevel ( MemoryCardUsbLevelInit, NUM_PLAYERS ),
|
||||
m_iCenterImageTranslateX ( "CenterImageTranslateX", 0 ),
|
||||
m_iCenterImageTranslateY ( "CenterImageTranslateY", 0 ),
|
||||
m_fCenterImageAddWidth ( "CenterImageAddWidth", 0 ),
|
||||
|
||||
@@ -148,10 +148,6 @@ public:
|
||||
Preference<int> m_iProductID; // Saved in HighScore to track what software version a score came from.
|
||||
Preference1D<CString> m_sDefaultLocalProfileID;
|
||||
Preference<bool> m_bMemoryCards;
|
||||
Preference1D<CString> m_sMemoryCardOsMountPoint; // if set, always use the device that mounts to this point
|
||||
Preference1D<int> m_iMemoryCardUsbBus; // look for this bus when assigning cards. -1 = match any
|
||||
Preference1D<int> m_iMemoryCardUsbPort; // look for this port when assigning cards. -1 = match any
|
||||
Preference1D<int> m_iMemoryCardUsbLevel; // look for this level when assigning cards. -1 = match any
|
||||
Preference<int> m_iCenterImageTranslateX;
|
||||
Preference<int> m_iCenterImageTranslateY;
|
||||
Preference<int> m_fCenterImageAddWidth;
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include "ScreenPrompt.h"
|
||||
#include "GameState.h"
|
||||
#include "Profile.h"
|
||||
#include "MemoryCardManager.h"
|
||||
|
||||
|
||||
enum {
|
||||
@@ -63,15 +64,15 @@ void ScreenProfileOptions::Init()
|
||||
g_ProfileOptionsLines[PO_RENAME_].m_vsChoices.push_back( "-NONE-" );
|
||||
PROFILEMAN->GetLocalProfileDisplayNames( g_ProfileOptionsLines[PO_RENAME_].m_vsChoices );
|
||||
|
||||
if( PREFSMAN->m_sMemoryCardOsMountPoint[PLAYER_1].Get().empty() )
|
||||
if( MemoryCardManager::m_sMemoryCardOsMountPoint[PLAYER_1].Get().empty() )
|
||||
g_ProfileOptionsLines[PO_OS_MOUNT_1].m_vsChoices[0] = "-NOT SET IN INI-";
|
||||
else
|
||||
g_ProfileOptionsLines[PO_OS_MOUNT_1].m_vsChoices[0] = PREFSMAN->m_sMemoryCardOsMountPoint[PLAYER_1].Get();
|
||||
g_ProfileOptionsLines[PO_OS_MOUNT_1].m_vsChoices[0] = MemoryCardManager::m_sMemoryCardOsMountPoint[PLAYER_1].Get();
|
||||
|
||||
if( PREFSMAN->m_sMemoryCardOsMountPoint[PLAYER_2].Get().empty() )
|
||||
if( MemoryCardManager::m_sMemoryCardOsMountPoint[PLAYER_2].Get().empty() )
|
||||
g_ProfileOptionsLines[PO_OS_MOUNT_2].m_vsChoices[0] = "-NOT SET IN INI-";
|
||||
else
|
||||
g_ProfileOptionsLines[PO_OS_MOUNT_2].m_vsChoices[0] = PREFSMAN->m_sMemoryCardOsMountPoint[PLAYER_2].Get();
|
||||
g_ProfileOptionsLines[PO_OS_MOUNT_2].m_vsChoices[0] = MemoryCardManager::m_sMemoryCardOsMountPoint[PLAYER_2].Get();
|
||||
|
||||
//Enable all lines for all players
|
||||
for ( unsigned int i = 0; i < NUM_PROFILE_OPTIONS_LINES; i++ )
|
||||
@@ -97,7 +98,7 @@ void ScreenProfileOptions::ImportOptions( int iRow, const vector<PlayerNumber> &
|
||||
CStringArray::iterator iter = find(
|
||||
vsProfiles.begin(),
|
||||
vsProfiles.end(),
|
||||
PREFSMAN->m_sMemoryCardOsMountPoint[pn].Get() );
|
||||
MemoryCardManager::m_sMemoryCardOsMountPoint[pn].Get() );
|
||||
if( iter != vsProfiles.end() )
|
||||
m_pRows[iRow]->SetOneSharedSelection( iter - vsProfiles.begin() + 1 );
|
||||
}
|
||||
@@ -117,9 +118,9 @@ void ScreenProfileOptions::ExportOptions( int iRow, const vector<PlayerNumber> &
|
||||
PROFILEMAN->GetLocalProfileIDs( vsProfiles );
|
||||
|
||||
if( m_pRows[iRow]->GetOneSharedSelection() > 0 )
|
||||
PREFSMAN->m_sMemoryCardOsMountPoint[pn].Set( vsProfiles[m_pRows[iRow]->GetOneSharedSelection()-1] );
|
||||
MemoryCardManager::m_sMemoryCardOsMountPoint[pn].Set( vsProfiles[m_pRows[iRow]->GetOneSharedSelection()-1] );
|
||||
else
|
||||
PREFSMAN->m_sMemoryCardOsMountPoint[pn].Set( "" );
|
||||
MemoryCardManager::m_sMemoryCardOsMountPoint[pn].Set( "" );
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user