Files
itgmania212121/stepmania/src/MemoryCardManager.h
T

91 lines
3.1 KiB
C++
Raw Normal View History

#ifndef MemoryCardManager_H
#define MemoryCardManager_H
#include "GameConstantsAndTypes.h" // for MemoryCardState
#include "PlayerNumber.h"
2003-12-18 04:24:25 +00:00
#include "RageSound.h"
2003-12-18 07:46:21 +00:00
#include "arch/MemoryCard/MemoryCardDriver.h"
2003-12-17 10:20:53 +00:00
const CString MEM_CARD_MOUNT_POINT[NUM_PLAYERS] =
{
/* @ is importast; see RageFileManager LoadedDriver::GetPath */
"@mc1/",
"@mc2/",
};
class MemoryCardManager
{
public:
MemoryCardManager();
~MemoryCardManager();
void Update( float fDelta );
2003-12-17 10:20:53 +00:00
MemoryCardState GetCardState( PlayerNumber pn );
2003-12-17 10:20:53 +00:00
// CString GetOsMountDir( PlayerNumber pn ); // only valid when state = ready
2003-12-17 10:20:53 +00:00
void LockCards( bool bLock ); // prevent removing or changing of memory cards
2004-10-03 06:21:16 +00:00
void TryMountAllCards();
void MountAllUsedCards();
void UnmountAllUsedCards();
2004-10-03 05:27:52 +00:00
void MountCard( PlayerNumber pn );
void UnmountCard( PlayerNumber pn );
void PauseMountingThread(); // call this before mouting, reading, or writing to memory card
void UnPauseMountingThread(); // call this when done mouting, reading, or writing to memory card
void FlushAndReset(); // force all files to be flushed to mounted memory cards
2003-12-17 10:20:53 +00:00
2004-03-23 22:33:14 +00:00
bool PathIsMemCard( CString sDir ) const;
bool IsNameAvailable( PlayerNumber pn ) const;
2004-04-23 05:40:07 +00:00
CString GetName( PlayerNumber pn ) const;
2004-03-23 22:33:14 +00:00
2003-12-17 10:20:53 +00:00
protected:
2004-08-09 05:01:24 +00:00
void UpdateUnassignedCards(); // do our best to assign a Device to each player
2003-12-18 07:46:21 +00:00
2003-12-17 10:20:53 +00:00
MemoryCardDriver *m_pDriver;
2003-12-18 07:46:21 +00:00
vector<UsbStorageDevice> m_vStorageDevices; // all currently connected
2003-12-17 10:20:53 +00:00
bool m_bCardsLocked;
bool m_bTooLate[NUM_PLAYERS]; // card was inserted after lock
2003-12-18 07:46:21 +00:00
UsbStorageDevice m_Device[NUM_PLAYERS]; // device in the memory card slot, NULL if none
2003-12-18 04:24:25 +00:00
RageSound m_soundReady;
RageSound m_soundError;
RageSound m_soundTooLate;
2003-12-18 04:24:25 +00:00
RageSound m_soundDisconnect;
};
extern MemoryCardManager* MEMCARDMAN; // global and accessable from anywhere in our program
#endif
2004-06-08 01:24:17 +00:00
/*
* (c) 2003-2004 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.
*/