remove memory card OS dir blacklist

This commit is contained in:
Chris Danford
2005-11-29 05:56:11 +00:00
parent 476a0990ff
commit 74287d4589
4 changed files with 155 additions and 17 deletions
-14
View File
@@ -49,8 +49,6 @@ Preference1D<int> MemoryCardManager::m_iMemoryCardUsbBus( MemoryCardUsbBusInit,
Preference1D<int> MemoryCardManager::m_iMemoryCardUsbPort( MemoryCardUsbPortInit, NUM_PLAYERS );
Preference1D<int> MemoryCardManager::m_iMemoryCardUsbLevel( MemoryCardUsbLevelInit, NUM_PLAYERS );
Preference<CString> MemoryCardManager::m_sMemoryCardOsMountPointBlacklist( "MemoryCardOsMountPointBlacklist", "" );
const CString MEM_CARD_MOUNT_POINT[NUM_PLAYERS] =
{
@@ -327,15 +325,6 @@ MemoryCardManager::~MemoryCardManager()
}
}
bool MemoryCardManager::IsBlacklisted( const UsbStorageDevice &dev ) const
{
vector<CString> vsMemoryCardOsMountPointBlacklist;
split( m_sMemoryCardOsMountPointBlacklist, ",", vsMemoryCardOsMountPointBlacklist );
bool bBlacklisted = find( vsMemoryCardOsMountPointBlacklist.begin(), vsMemoryCardOsMountPointBlacklist.end(), dev.sOsMountDir ) != vsMemoryCardOsMountPointBlacklist.end();
return bBlacklisted;
}
void MemoryCardManager::Update( float fDelta, bool bForceUpdate )
{
vector<UsbStorageDevice> vOld;
@@ -407,9 +396,6 @@ void MemoryCardManager::Update( float fDelta, bool bForceUpdate )
d->sOsMountDir.CompareNoCase(m_sMemoryCardOsMountPoint[p].Get()) )
continue; // not a match
if( IsBlacklisted(*d) )
continue;
// search for USB bus match
if( m_iMemoryCardUsbBus[p] != -1 &&
m_iMemoryCardUsbBus[p] != d->iBus )
-3
View File
@@ -46,9 +46,6 @@ public:
static Preference1D<int> m_iMemoryCardUsbPort;
static Preference1D<int> m_iMemoryCardUsbLevel;
static Preference<CString> m_sMemoryCardOsMountPointBlacklist;
bool IsBlacklisted( const UsbStorageDevice &dev ) const;
protected:
void CheckStateChanges();
+107
View File
@@ -0,0 +1,107 @@
#include "global.h"
#include "ScreenOptionsMemoryCard.h"
#include "RageLog.h"
#include "arch/MemoryCard/MemoryCardDriver.h"
#include "MemoryCardManager.h"
REGISTER_SCREEN_CLASS( ScreenOptionsMemoryCard );
ScreenOptionsMemoryCard::ScreenOptionsMemoryCard( CString sClassName ) : ScreenOptions( sClassName )
{
LOG->Trace( "ScreenOptionsMemoryCard::ScreenOptionsMemoryCard()" );
}
void ScreenOptionsMemoryCard::Init()
{
ScreenOptions::Init();
FOREACH_CONST( UsbStorageDevice, MEMCARDMAN->GetStorageDevices(), iter )
{
CString sOsMountDir = iter->sOsMountDir;
if( sOsMountDir.empty() )
sOsMountDir = "(not mounted)";
CString sVolumeLabel = iter->sVolumeLabel;
if( sVolumeLabel.empty() )
sVolumeLabel = "(no label)";
CString sDescription = ssprintf( "%s %s", sOsMountDir.c_str(), sVolumeLabel.c_str() );
OptionRowDefinition def( sDescription, true, "Enable", "Disable" );
def.m_bAllowThemeTitles = false;
def.m_bAllowExplanation = false;
m_vDefs.push_back( def );
}
vector<OptionRowHandler*> vHands( m_vDefs.size(), NULL );
InitMenu( m_vDefs, vHands );
}
void ScreenOptionsMemoryCard::HandleScreenMessage( const ScreenMessage SM )
{
if( SM == SM_GoToNextScreen )
{
MEMCARDMAN->Update(0, true);
}
ScreenOptions::HandleScreenMessage( SM );
}
void ScreenOptionsMemoryCard::MenuStart( const InputEventPlus &input )
{
ScreenOptions::MenuStart( input );
}
void ScreenOptionsMemoryCard::ImportOptions( int iRow, const vector<PlayerNumber> &vpns )
{
OptionRow &row = *m_pRows[iRow];
if( row.GetRowType() == OptionRow::ROW_EXIT )
return;
const vector<UsbStorageDevice> v = MEMCARDMAN->GetStorageDevices();
const UsbStorageDevice &dev = v[iRow];
// row.SetOneSharedSelection( MEMCARDMAN->IsBlacklisted(dev) ? 1:0 );
}
void ScreenOptionsMemoryCard::ExportOptions( int iRow, const vector<PlayerNumber> &vpns )
{
// if( iRow == 0 )
// MEMCARDMAN->m_sMemoryCardOsMountPointBlacklist.Set( "" );
OptionRow &row = *m_pRows[iRow];
if( row.GetRowType() == OptionRow::ROW_EXIT )
return;
const vector<UsbStorageDevice> v = MEMCARDMAN->GetStorageDevices();
const UsbStorageDevice &dev = v[iRow];
int iSel = row.GetOneSharedSelection();
if( iSel == 1 )
{
// CString s = MEMCARDMAN->m_sMemoryCardOsMountPointBlacklist;
// if( s.empty() )
// s = dev.sOsMountDir;
// else
// s += ","+dev.sOsMountDir;
// MEMCARDMAN->m_sMemoryCardOsMountPointBlacklist.Set( s );
}
}
/*
* (c) 2005 Chris Danford
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, and/or sell copies of the Software, and to permit persons to
* whom the Software is furnished to do so, provided that the above
* copyright notice(s) and this permission notice appear in all copies of
* the Software and that both the above copyright notice(s) and this
* permission notice appear in supporting documentation.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
+48
View File
@@ -0,0 +1,48 @@
#ifndef ScreenOptionsMemoryCard_H
#define ScreenOptionsMemoryCard_H
#include "ScreenOptions.h"
class ScreenOptionsMemoryCard : public ScreenOptions
{
public:
ScreenOptionsMemoryCard( CString sName );
virtual void Init();
virtual void HandleScreenMessage( const ScreenMessage SM );
virtual void MenuStart( const InputEventPlus &input );
private:
void ImportOptions( int iRow, const vector<PlayerNumber> &vpns );
void ExportOptions( int iRow, const vector<PlayerNumber> &vpns );
vector<OptionRowDefinition> m_vDefs;
};
#endif
/*
* (c) 2005 Chris Danford
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, and/or sell copies of the Software, and to permit persons to
* whom the Software is furnished to do so, provided that the above
* copyright notice(s) and this permission notice appear in all copies of
* the Software and that both the above copyright notice(s) and this
* permission notice appear in supporting documentation.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/