Files
itgmania212121/stepmania/src/ScreenOptionsMemoryCard.cpp
T

121 lines
3.8 KiB
C++
Raw Normal View History

2005-11-29 05:56:11 +00:00
#include "global.h"
#include "ScreenOptionsMemoryCard.h"
#include "RageLog.h"
#include "arch/MemoryCard/MemoryCardDriver.h"
#include "MemoryCardManager.h"
2005-11-29 08:02:54 +00:00
#include "GameState.h"
#include "ScreenManager.h"
2005-11-29 05:56:11 +00:00
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, "" );
2005-11-29 05:56:11 +00:00
def.m_bAllowThemeTitles = false;
def.m_bAllowExplanation = false;
m_vDefs.push_back( def );
}
vector<OptionRowHandler*> vHands( m_vDefs.size(), NULL );
InitMenu( m_vDefs, vHands );
}
2005-11-29 08:02:54 +00:00
void ScreenOptionsMemoryCard::BeginScreen()
{
ScreenOptions::BeginScreen();
// select the last chosen memory card (if present)
if( !MEMCARDMAN->m_sEditorMemoryCardOsMountPoint.Get().empty() )
{
const vector<UsbStorageDevice> v = MEMCARDMAN->GetStorageDevices();
for( unsigned i=0; i<v.size(); i++ )
{
if( v[i].sOsMountDir == MEMCARDMAN->m_sEditorMemoryCardOsMountPoint.Get() )
{
this->MoveRowAbsolute( PLAYER_1, i, false );
break;
}
}
}
}
2005-11-29 05:56:11 +00:00
void ScreenOptionsMemoryCard::HandleScreenMessage( const ScreenMessage SM )
{
ScreenOptions::HandleScreenMessage( SM );
}
void ScreenOptionsMemoryCard::HandleMessage( const CString& sMessage )
{
if( sMessage == MessageToString(Message_StorageDevicesChanged) )
{
SCREENMAN->SetNewScreen( this->m_sName ); // reload
}
}
2005-11-29 05:56:11 +00:00
void ScreenOptionsMemoryCard::MenuStart( const InputEventPlus &input )
{
ScreenOptions::MenuStart( input );
}
void ScreenOptionsMemoryCard::ImportOptions( int iRow, const vector<PlayerNumber> &vpns )
{
2005-11-29 08:02:54 +00:00
2005-11-29 05:56:11 +00:00
}
void ScreenOptionsMemoryCard::ExportOptions( int iRow, const vector<PlayerNumber> &vpns )
{
OptionRow &row = *m_pRows[iRow];
if( row.GetRowType() == OptionRow::ROW_EXIT )
return;
2005-11-29 08:02:54 +00:00
PlayerNumber pn = GAMESTATE->m_MasterPlayerNumber;
if( m_iCurrentRow[pn] == iRow )
2005-11-29 05:56:11 +00:00
{
2005-11-29 08:02:54 +00:00
const vector<UsbStorageDevice> v = MEMCARDMAN->GetStorageDevices();
const UsbStorageDevice &dev = v[iRow];
MEMCARDMAN->m_sEditorMemoryCardOsMountPoint.Set( dev.sOsMountDir );
2005-11-29 05:56:11 +00:00
}
}
/*
* (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.
*/