add memory card level matching to disallow deep USB devices

This commit is contained in:
Chris Danford
2004-04-17 22:41:34 +00:00
parent f7b18deff3
commit 2531bc9a84
3 changed files with 17 additions and 9 deletions
+11 -7
View File
@@ -66,7 +66,7 @@ void MemoryCardManager::Update( float fDelta )
const UsbStorageDevice &old = vOld[i]; const UsbStorageDevice &old = vOld[i];
if( find(vNew.begin(),vNew.end(),old) == vNew.end() ) // didn't find if( find(vNew.begin(),vNew.end(),old) == vNew.end() ) // didn't find
{ {
LOG->Trace( ssprintf("Disconnected bus %d port %d device %d path %s", old.iBus, old.iPortOnHub, old.iDeviceOnBus, old.sOsMountDir.c_str()) ); LOG->Trace( ssprintf("Disconnected bus %d port %d device %d path %s", old.iBus, old.iPort, old.iLevel, old.sOsMountDir.c_str()) );
vDisconnects.push_back( old ); vDisconnects.push_back( old );
} }
} }
@@ -79,7 +79,7 @@ void MemoryCardManager::Update( float fDelta )
const UsbStorageDevice &newd = vNew[i]; const UsbStorageDevice &newd = vNew[i];
if( find(vOld.begin(),vOld.end(),newd) == vOld.end() ) // didn't find if( find(vOld.begin(),vOld.end(),newd) == vOld.end() ) // didn't find
{ {
LOG->Trace( ssprintf("Connected bus %d port %d device %d path %s", newd.iBus, newd.iPortOnHub, newd.iDeviceOnBus, newd.sOsMountDir.c_str()) ); LOG->Trace( ssprintf("Connected bus %d port %d device %d path %s", newd.iBus, newd.iPort, newd.iLevel, newd.sOsMountDir.c_str()) );
vConnects.push_back( newd ); vConnects.push_back( newd );
} }
} }
@@ -203,8 +203,8 @@ void MemoryCardManager::AssignUnassignedCards()
UsbStorageDevice &usbd = vUnassignedDevices[i]; UsbStorageDevice &usbd = vUnassignedDevices[i];
if( usbd.sOsMountDir.CompareNoCase(PREFSMAN->m_sMemoryCardOsMountPoint[p]) == 0 ) // match if( usbd.sOsMountDir.CompareNoCase(PREFSMAN->m_sMemoryCardOsMountPoint[p]) == 0 ) // match
{ {
LOG->Trace( "dir match: iUsbStorageIndex: %d, iBus: %d, iDeviceOnBus: %d, iPortOnHub: %d", LOG->Trace( "dir match: iUsbStorageIndex: %d, iBus: %d, iLevel: %d, iPort: %d",
usbd.iUsbStorageIndex, usbd.iBus, usbd.iDeviceOnBus, usbd.iPortOnHub ); usbd.iUsbStorageIndex, usbd.iBus, usbd.iLevel, usbd.iPort );
goto match; goto match;
} }
} }
@@ -220,11 +220,15 @@ void MemoryCardManager::AssignUnassignedCards()
continue; // not a match continue; // not a match
if( PREFSMAN->m_iMemoryCardUsbPort[p] != -1 && if( PREFSMAN->m_iMemoryCardUsbPort[p] != -1 &&
PREFSMAN->m_iMemoryCardUsbPort[p] != usbd.iPortOnHub ) PREFSMAN->m_iMemoryCardUsbPort[p] != usbd.iPort )
continue; // not a match continue; // not a match
LOG->Trace( "bus/port match: iUsbStorageIndex: %d, iBus: %d, iDeviceOnBus: %d, iPortOnHub: %d", if( PREFSMAN->m_iMemoryCardUsbLevel[p] != -1 &&
usbd.iUsbStorageIndex, usbd.iBus, usbd.iDeviceOnBus, usbd.iPortOnHub ); PREFSMAN->m_iMemoryCardUsbLevel[p] != usbd.iLevel )
continue; // not a match
LOG->Trace( "bus/port match: iUsbStorageIndex: %d, iBus: %d, iLevel: %d, iPort: %d",
usbd.iUsbStorageIndex, usbd.iBus, usbd.iLevel, usbd.iPort );
goto match; goto match;
} }
+3
View File
@@ -279,6 +279,7 @@ PrefsManager::PrefsManager()
{ {
m_iMemoryCardUsbBus[p] = -1; m_iMemoryCardUsbBus[p] = -1;
m_iMemoryCardUsbPort[p] = -1; m_iMemoryCardUsbPort[p] = -1;
m_iMemoryCardUsbLevel[p] = -1;
} }
m_sMemoryCardProfileSubdir = PRODUCT_NAME; m_sMemoryCardProfileSubdir = PRODUCT_NAME;
@@ -490,6 +491,7 @@ void PrefsManager::ReadGlobalPrefsFromDisk()
FixSlashesInPlace( m_sMemoryCardOsMountPoint[p] ); FixSlashesInPlace( m_sMemoryCardOsMountPoint[p] );
ini.GetValue( "Options", ssprintf("MemoryCardUsbBusP%d",p+1), m_iMemoryCardUsbBus[p] ); ini.GetValue( "Options", ssprintf("MemoryCardUsbBusP%d",p+1), m_iMemoryCardUsbBus[p] );
ini.GetValue( "Options", ssprintf("MemoryCardUsbPortP%d",p+1), m_iMemoryCardUsbPort[p] ); ini.GetValue( "Options", ssprintf("MemoryCardUsbPortP%d",p+1), m_iMemoryCardUsbPort[p] );
ini.GetValue( "Options", ssprintf("MemoryCardUsbLevelP%d",p+1), m_iMemoryCardUsbLevel[p] );
} }
ini.GetValue( "Options", "CenterImageTranslateX", m_iCenterImageTranslateX ); ini.GetValue( "Options", "CenterImageTranslateX", m_iCenterImageTranslateX );
@@ -707,6 +709,7 @@ void PrefsManager::SaveGlobalPrefsToDisk() const
ini.SetValue( "Options", ssprintf("MemoryCardOsMountPointP%d",p+1), m_sMemoryCardOsMountPoint[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("MemoryCardUsbBusP%d",p+1), m_iMemoryCardUsbBus[p] );
ini.SetValue( "Options", ssprintf("MemoryCardUsbPortP%d",p+1), m_iMemoryCardUsbPort[p] ); ini.SetValue( "Options", ssprintf("MemoryCardUsbPortP%d",p+1), m_iMemoryCardUsbPort[p] );
ini.SetValue( "Options", ssprintf("MemoryCardUsbLevelP%d",p+1), m_iMemoryCardUsbLevel[p] );
} }
ini.SetValue( "Options", "CenterImageTranslateX", m_iCenterImageTranslateX ); ini.SetValue( "Options", "CenterImageTranslateX", m_iCenterImageTranslateX );
+3 -2
View File
@@ -181,8 +181,9 @@ public:
CString m_sMemoryCardProfileSubdir; // the directory on a memory card to look in for a profile CString m_sMemoryCardProfileSubdir; // the directory on a memory card to look in for a profile
CString m_sDefaultLocalProfileID[NUM_PLAYERS]; CString m_sDefaultLocalProfileID[NUM_PLAYERS];
CString m_sMemoryCardOsMountPoint[NUM_PLAYERS]; // if set, always use the device that mounts to this point 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_iMemoryCardUsbBus[NUM_PLAYERS]; // look for this bus when assigning cards. -1 = match any
int m_iMemoryCardUsbPort[NUM_PLAYERS]; // take the first storage device on this usb bus int m_iMemoryCardUsbPort[NUM_PLAYERS]; // look for this port when assigning cards. -1 = match any
int m_iMemoryCardUsbLevel[NUM_PLAYERS]; // look for this level when assigning cards. -1 = match any
int m_iCenterImageTranslateX; int m_iCenterImageTranslateX;
int m_iCenterImageTranslateY; int m_iCenterImageTranslateY;
float m_fCenterImageScaleX; float m_fCenterImageScaleX;