diff --git a/stepmania/src/MemoryCardManager.cpp b/stepmania/src/MemoryCardManager.cpp index 362ecbafd6..6859df7d5d 100644 --- a/stepmania/src/MemoryCardManager.cpp +++ b/stepmania/src/MemoryCardManager.cpp @@ -49,8 +49,6 @@ Preference1D MemoryCardManager::m_iMemoryCardUsbBus( MemoryCardUsbBusInit, Preference1D MemoryCardManager::m_iMemoryCardUsbPort( MemoryCardUsbPortInit, NUM_PLAYERS ); Preference1D MemoryCardManager::m_iMemoryCardUsbLevel( MemoryCardUsbLevelInit, NUM_PLAYERS ); -Preference 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 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 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 ) diff --git a/stepmania/src/MemoryCardManager.h b/stepmania/src/MemoryCardManager.h index 7ec49e52fb..810cc4171c 100644 --- a/stepmania/src/MemoryCardManager.h +++ b/stepmania/src/MemoryCardManager.h @@ -46,9 +46,6 @@ public: static Preference1D m_iMemoryCardUsbPort; static Preference1D m_iMemoryCardUsbLevel; - static Preference m_sMemoryCardOsMountPointBlacklist; - bool IsBlacklisted( const UsbStorageDevice &dev ) const; - protected: void CheckStateChanges(); diff --git a/stepmania/src/ScreenOptionsMemoryCard.cpp b/stepmania/src/ScreenOptionsMemoryCard.cpp new file mode 100644 index 0000000000..582e85b946 --- /dev/null +++ b/stepmania/src/ScreenOptionsMemoryCard.cpp @@ -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 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 &vpns ) +{ + OptionRow &row = *m_pRows[iRow]; + if( row.GetRowType() == OptionRow::ROW_EXIT ) + return; + const vector v = MEMCARDMAN->GetStorageDevices(); + const UsbStorageDevice &dev = v[iRow]; +// row.SetOneSharedSelection( MEMCARDMAN->IsBlacklisted(dev) ? 1:0 ); +} + +void ScreenOptionsMemoryCard::ExportOptions( int iRow, const vector &vpns ) +{ +// if( iRow == 0 ) +// MEMCARDMAN->m_sMemoryCardOsMountPointBlacklist.Set( "" ); + OptionRow &row = *m_pRows[iRow]; + if( row.GetRowType() == OptionRow::ROW_EXIT ) + return; + const vector 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. + */ diff --git a/stepmania/src/ScreenOptionsMemoryCard.h b/stepmania/src/ScreenOptionsMemoryCard.h new file mode 100644 index 0000000000..8de8f5d427 --- /dev/null +++ b/stepmania/src/ScreenOptionsMemoryCard.h @@ -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 &vpns ); + void ExportOptions( int iRow, const vector &vpns ); + + vector 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. + */