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
|
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] =
|
const CString MEM_CARD_MOUNT_POINT[NUM_PLAYERS] =
|
||||||
{
|
{
|
||||||
/* @ is importast; see RageFileManager LoadedDriver::GetPath */
|
/* @ is importast; see RageFileManager LoadedDriver::GetPath */
|
||||||
@@ -386,21 +417,21 @@ void MemoryCardManager::Update( float fDelta )
|
|||||||
FOREACH( UsbStorageDevice, vUnassignedDevices, d )
|
FOREACH( UsbStorageDevice, vUnassignedDevices, d )
|
||||||
{
|
{
|
||||||
// search for card dir match
|
// search for card dir match
|
||||||
if( !PREFSMAN->m_sMemoryCardOsMountPoint[p].Get().empty() &&
|
if( !m_sMemoryCardOsMountPoint[p].Get().empty() &&
|
||||||
d->sOsMountDir.CompareNoCase(PREFSMAN->m_sMemoryCardOsMountPoint[p].Get()) )
|
d->sOsMountDir.CompareNoCase(m_sMemoryCardOsMountPoint[p].Get()) )
|
||||||
continue; // not a match
|
continue; // not a match
|
||||||
|
|
||||||
// search for USB bus match
|
// search for USB bus match
|
||||||
if( PREFSMAN->m_iMemoryCardUsbBus[p] != -1 &&
|
if( m_iMemoryCardUsbBus[p] != -1 &&
|
||||||
PREFSMAN->m_iMemoryCardUsbBus[p] != d->iBus )
|
m_iMemoryCardUsbBus[p] != d->iBus )
|
||||||
continue; // not a match
|
continue; // not a match
|
||||||
|
|
||||||
if( PREFSMAN->m_iMemoryCardUsbPort[p] != -1 &&
|
if( m_iMemoryCardUsbPort[p] != -1 &&
|
||||||
PREFSMAN->m_iMemoryCardUsbPort[p] != d->iPort )
|
m_iMemoryCardUsbPort[p] != d->iPort )
|
||||||
continue; // not a match
|
continue; // not a match
|
||||||
|
|
||||||
if( PREFSMAN->m_iMemoryCardUsbLevel[p] != -1 &&
|
if( m_iMemoryCardUsbLevel[p] != -1 &&
|
||||||
PREFSMAN->m_iMemoryCardUsbLevel[p] != d->iLevel )
|
m_iMemoryCardUsbLevel[p] != d->iLevel )
|
||||||
continue; // not a match
|
continue; // not a match
|
||||||
|
|
||||||
LOG->Trace( "Player %i: matched %s", p+1, d->sDevice.c_str() );
|
LOG->Trace( "Player %i: matched %s", p+1, d->sDevice.c_str() );
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
#include "PlayerNumber.h"
|
#include "PlayerNumber.h"
|
||||||
#include "RageSound.h"
|
#include "RageSound.h"
|
||||||
#include "arch/MemoryCard/MemoryCardDriver.h"
|
#include "arch/MemoryCard/MemoryCardDriver.h"
|
||||||
|
#include "Preference.h"
|
||||||
|
|
||||||
|
|
||||||
extern const CString MEM_CARD_MOUNT_POINT[NUM_PLAYERS];
|
extern const CString MEM_CARD_MOUNT_POINT[NUM_PLAYERS];
|
||||||
@@ -38,6 +39,11 @@ public:
|
|||||||
bool IsNameAvailable( PlayerNumber pn ) const;
|
bool IsNameAvailable( PlayerNumber pn ) const;
|
||||||
CString GetName( 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:
|
protected:
|
||||||
void CheckStateChanges();
|
void CheckStateChanges();
|
||||||
|
|
||||||
|
|||||||
@@ -214,30 +214,6 @@ void DefaultLocalProfileIDInit( size_t /*PlayerNumber*/ i, CString &sNameOut, CS
|
|||||||
defaultValueOut = "";
|
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() :
|
PrefsManager::PrefsManager() :
|
||||||
m_sCurrentGame ( "CurrentGame", "" ),
|
m_sCurrentGame ( "CurrentGame", "" ),
|
||||||
@@ -351,10 +327,6 @@ PrefsManager::PrefsManager() :
|
|||||||
m_iProductID ( "ProductID", 1 ),
|
m_iProductID ( "ProductID", 1 ),
|
||||||
m_sDefaultLocalProfileID ( DefaultLocalProfileIDInit, NUM_PLAYERS ),
|
m_sDefaultLocalProfileID ( DefaultLocalProfileIDInit, NUM_PLAYERS ),
|
||||||
m_bMemoryCards ( "MemoryCards", false ),
|
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_iCenterImageTranslateX ( "CenterImageTranslateX", 0 ),
|
||||||
m_iCenterImageTranslateY ( "CenterImageTranslateY", 0 ),
|
m_iCenterImageTranslateY ( "CenterImageTranslateY", 0 ),
|
||||||
m_fCenterImageAddWidth ( "CenterImageAddWidth", 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.
|
Preference<int> m_iProductID; // Saved in HighScore to track what software version a score came from.
|
||||||
Preference1D<CString> m_sDefaultLocalProfileID;
|
Preference1D<CString> m_sDefaultLocalProfileID;
|
||||||
Preference<bool> m_bMemoryCards;
|
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_iCenterImageTranslateX;
|
||||||
Preference<int> m_iCenterImageTranslateY;
|
Preference<int> m_iCenterImageTranslateY;
|
||||||
Preference<int> m_fCenterImageAddWidth;
|
Preference<int> m_fCenterImageAddWidth;
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
#include "ScreenPrompt.h"
|
#include "ScreenPrompt.h"
|
||||||
#include "GameState.h"
|
#include "GameState.h"
|
||||||
#include "Profile.h"
|
#include "Profile.h"
|
||||||
|
#include "MemoryCardManager.h"
|
||||||
|
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
@@ -63,15 +64,15 @@ void ScreenProfileOptions::Init()
|
|||||||
g_ProfileOptionsLines[PO_RENAME_].m_vsChoices.push_back( "-NONE-" );
|
g_ProfileOptionsLines[PO_RENAME_].m_vsChoices.push_back( "-NONE-" );
|
||||||
PROFILEMAN->GetLocalProfileDisplayNames( g_ProfileOptionsLines[PO_RENAME_].m_vsChoices );
|
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-";
|
g_ProfileOptionsLines[PO_OS_MOUNT_1].m_vsChoices[0] = "-NOT SET IN INI-";
|
||||||
else
|
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-";
|
g_ProfileOptionsLines[PO_OS_MOUNT_2].m_vsChoices[0] = "-NOT SET IN INI-";
|
||||||
else
|
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
|
//Enable all lines for all players
|
||||||
for ( unsigned int i = 0; i < NUM_PROFILE_OPTIONS_LINES; i++ )
|
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(
|
CStringArray::iterator iter = find(
|
||||||
vsProfiles.begin(),
|
vsProfiles.begin(),
|
||||||
vsProfiles.end(),
|
vsProfiles.end(),
|
||||||
PREFSMAN->m_sMemoryCardOsMountPoint[pn].Get() );
|
MemoryCardManager::m_sMemoryCardOsMountPoint[pn].Get() );
|
||||||
if( iter != vsProfiles.end() )
|
if( iter != vsProfiles.end() )
|
||||||
m_pRows[iRow]->SetOneSharedSelection( iter - vsProfiles.begin() + 1 );
|
m_pRows[iRow]->SetOneSharedSelection( iter - vsProfiles.begin() + 1 );
|
||||||
}
|
}
|
||||||
@@ -117,9 +118,9 @@ void ScreenProfileOptions::ExportOptions( int iRow, const vector<PlayerNumber> &
|
|||||||
PROFILEMAN->GetLocalProfileIDs( vsProfiles );
|
PROFILEMAN->GetLocalProfileIDs( vsProfiles );
|
||||||
|
|
||||||
if( m_pRows[iRow]->GetOneSharedSelection() > 0 )
|
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
|
else
|
||||||
PREFSMAN->m_sMemoryCardOsMountPoint[pn].Set( "" );
|
MemoryCardManager::m_sMemoryCardOsMountPoint[pn].Set( "" );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user