2003-09-08 03:26:58 +00:00
|
|
|
#include "global.h"
|
|
|
|
|
#include "ProfileManager.h"
|
|
|
|
|
#include "RageUtil.h"
|
|
|
|
|
#include "PrefsManager.h"
|
|
|
|
|
#include "RageLog.h"
|
2003-12-05 00:07:18 +00:00
|
|
|
#include "RageFile.h"
|
|
|
|
|
#include "RageFileManager.h"
|
2003-09-08 03:26:58 +00:00
|
|
|
#include "IniFile.h"
|
2003-09-08 07:21:41 +00:00
|
|
|
#include "GameConstantsAndTypes.h"
|
|
|
|
|
#include "SongManager.h"
|
2003-11-10 04:32:12 +00:00
|
|
|
#include "GameState.h"
|
2003-12-07 07:09:13 +00:00
|
|
|
#include "song.h"
|
2003-12-18 03:40:57 +00:00
|
|
|
#include "Steps.h"
|
2003-12-07 07:09:13 +00:00
|
|
|
#include "Course.h"
|
|
|
|
|
#include "GameManager.h"
|
|
|
|
|
#include "ProductInfo.h"
|
2003-12-07 08:19:10 +00:00
|
|
|
#include "RageUtil.h"
|
2003-12-08 10:27:45 +00:00
|
|
|
#include "ThemeManager.h"
|
2003-12-19 08:17:44 +00:00
|
|
|
#include "MemoryCardManager.h"
|
2004-02-09 08:10:01 +00:00
|
|
|
#include "XmlFile.h"
|
2004-04-18 07:34:37 +00:00
|
|
|
#include "StepsUtil.h"
|
2004-09-12 05:56:24 +00:00
|
|
|
#include "Style.h"
|
2003-09-08 03:26:58 +00:00
|
|
|
|
2003-11-14 17:17:36 +00:00
|
|
|
|
2003-09-08 03:26:58 +00:00
|
|
|
ProfileManager* PROFILEMAN = NULL; // global and accessable from anywhere in our program
|
|
|
|
|
|
2004-01-07 02:56:47 +00:00
|
|
|
#define NEW_MEM_CARD_NAME ""
|
2003-12-10 09:15:40 +00:00
|
|
|
#define USER_PROFILES_DIR "Data/LocalProfiles/"
|
|
|
|
|
#define MACHINE_PROFILE_DIR "Data/MachineProfile/"
|
2004-10-07 19:57:51 +00:00
|
|
|
const CString LAST_GOOD_DIR = "LastGood/";
|
2003-12-07 07:09:13 +00:00
|
|
|
|
2005-04-24 19:18:46 +00:00
|
|
|
// Directories to search for a profile if m_sMemoryCardProfileSubdir doesn't
|
|
|
|
|
// exist, separated by ";":
|
|
|
|
|
static Preference<CString> g_sMemoryCardProfileImportSubdirs(
|
|
|
|
|
Options, "MemoryCardProfileImportSubdirs", "" );
|
|
|
|
|
|
|
|
|
|
|
2003-09-08 03:26:58 +00:00
|
|
|
ProfileManager::ProfileManager()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ProfileManager::~ProfileManager()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2004-05-25 05:52:57 +00:00
|
|
|
void ProfileManager::Init()
|
|
|
|
|
{
|
|
|
|
|
FOREACH_PlayerNumber( p )
|
2004-10-06 08:39:38 +00:00
|
|
|
{
|
2004-05-25 05:52:57 +00:00
|
|
|
m_bWasLoadedFromMemoryCard[p] = false;
|
2004-10-06 08:39:38 +00:00
|
|
|
m_bLastLoadWasTamperedOrCorrupt[p] = false;
|
2004-10-07 19:57:51 +00:00
|
|
|
m_bLastLoadWasFromLastGood[p] = false;
|
2004-10-06 08:39:38 +00:00
|
|
|
}
|
2004-05-25 05:52:57 +00:00
|
|
|
|
|
|
|
|
LoadMachineProfile();
|
|
|
|
|
}
|
|
|
|
|
|
2004-02-22 02:01:40 +00:00
|
|
|
void ProfileManager::GetLocalProfileIDs( vector<CString> &asProfileIDsOut ) const
|
2003-09-08 03:26:58 +00:00
|
|
|
{
|
2003-12-07 07:46:21 +00:00
|
|
|
GetDirListing( USER_PROFILES_DIR "*", asProfileIDsOut, true, false );
|
2003-09-08 03:26:58 +00:00
|
|
|
}
|
|
|
|
|
|
2004-02-22 02:01:40 +00:00
|
|
|
void ProfileManager::GetLocalProfileNames( vector<CString> &asNamesOut ) const
|
2003-09-08 07:21:41 +00:00
|
|
|
{
|
2003-11-01 19:36:52 +00:00
|
|
|
CStringArray vsProfileIDs;
|
2003-12-07 08:19:10 +00:00
|
|
|
GetLocalProfileIDs( vsProfileIDs );
|
2004-02-24 01:22:39 +00:00
|
|
|
LOG->Trace("GetLocalProfileNames: %u", unsigned(vsProfileIDs.size()));
|
2003-11-01 19:36:52 +00:00
|
|
|
for( unsigned i=0; i<vsProfileIDs.size(); i++ )
|
2003-09-08 07:21:41 +00:00
|
|
|
{
|
2003-11-01 19:36:52 +00:00
|
|
|
CString sProfileID = vsProfileIDs[i];
|
2004-02-10 09:42:01 +00:00
|
|
|
CString sProfileDir = USER_PROFILES_DIR + sProfileID + "/";
|
|
|
|
|
CString sDisplayName = Profile::GetProfileDisplayNameFromDir( sProfileDir );
|
2004-05-25 05:52:57 +00:00
|
|
|
LOG->Trace(" '%s'", sDisplayName.c_str());
|
2004-02-10 09:42:01 +00:00
|
|
|
asNamesOut.push_back( sDisplayName );
|
2003-09-08 07:21:41 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2005-04-24 19:18:46 +00:00
|
|
|
Profile::LoadResult ProfileManager::LoadProfile( PlayerNumber pn, CString sProfileDir, bool bIsMemCard )
|
2003-09-08 03:26:58 +00:00
|
|
|
{
|
2004-08-09 05:53:10 +00:00
|
|
|
LOG->Trace( "LoadingProfile P%d, %s, %d", pn+1, sProfileDir.c_str(), bIsMemCard );
|
2004-06-05 19:40:53 +00:00
|
|
|
|
2003-11-01 22:04:43 +00:00
|
|
|
ASSERT( !sProfileDir.empty() );
|
2003-12-10 09:26:05 +00:00
|
|
|
ASSERT( sProfileDir.Right(1) == "/" );
|
2003-09-08 03:26:58 +00:00
|
|
|
|
2004-06-06 02:41:16 +00:00
|
|
|
|
2003-11-01 22:04:43 +00:00
|
|
|
m_sProfileDir[pn] = sProfileDir;
|
2004-01-03 03:42:40 +00:00
|
|
|
m_bWasLoadedFromMemoryCard[pn] = bIsMemCard;
|
2004-10-07 19:57:51 +00:00
|
|
|
m_bLastLoadWasFromLastGood[pn] = false;
|
2003-11-01 19:36:52 +00:00
|
|
|
|
2004-10-07 19:57:51 +00:00
|
|
|
// Try to load the original, non-backup data.
|
|
|
|
|
Profile::LoadResult lr = m_Profile[pn].LoadAllFromDir( m_sProfileDir[pn], PREFSMAN->m_bSignProfileData );
|
|
|
|
|
|
|
|
|
|
CString sBackupDir = m_sProfileDir[pn] + LAST_GOOD_DIR;
|
2004-10-06 08:39:38 +00:00
|
|
|
|
2004-10-07 19:57:51 +00:00
|
|
|
// Save a backup of the non-backup profile now that we've loaded it and know
|
|
|
|
|
// it's good. This should be reasonably fast because we're only saving Stats.xml
|
|
|
|
|
// and signatures - not all of the files in the Profile.
|
|
|
|
|
if( lr == Profile::success )
|
2004-10-06 08:39:38 +00:00
|
|
|
{
|
2004-10-06 08:54:37 +00:00
|
|
|
Profile::BackupToDir( m_sProfileDir[pn], sBackupDir );
|
2004-10-06 08:39:38 +00:00
|
|
|
}
|
2003-09-08 03:26:58 +00:00
|
|
|
|
2004-10-07 19:57:51 +00:00
|
|
|
m_bLastLoadWasTamperedOrCorrupt[pn] = lr == Profile::failed_tampered;
|
2004-06-05 19:40:53 +00:00
|
|
|
|
2004-10-07 19:57:51 +00:00
|
|
|
// Try to load from the backup if the original data fails to load
|
|
|
|
|
//
|
|
|
|
|
if( lr == Profile::failed_tampered )
|
|
|
|
|
{
|
|
|
|
|
lr = m_Profile[pn].LoadAllFromDir( sBackupDir, PREFSMAN->m_bSignProfileData );
|
|
|
|
|
m_bLastLoadWasFromLastGood[pn] = lr == Profile::success;
|
|
|
|
|
}
|
2003-11-01 22:04:43 +00:00
|
|
|
|
2004-10-07 19:57:51 +00:00
|
|
|
LOG->Trace( "Done loading profile - result %d", lr );
|
2003-11-01 22:04:43 +00:00
|
|
|
|
2005-04-24 19:18:46 +00:00
|
|
|
return lr;
|
2003-11-01 22:04:43 +00:00
|
|
|
}
|
|
|
|
|
|
2004-08-09 05:01:24 +00:00
|
|
|
bool ProfileManager::LoadLocalProfileFromMachine( PlayerNumber pn )
|
2003-11-01 22:04:43 +00:00
|
|
|
{
|
2003-12-07 08:19:10 +00:00
|
|
|
CString sProfileID = PREFSMAN->m_sDefaultLocalProfileID[pn];
|
2003-11-01 22:04:43 +00:00
|
|
|
if( sProfileID.empty() )
|
|
|
|
|
{
|
|
|
|
|
m_sProfileDir[pn] = "";
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2003-12-10 09:26:05 +00:00
|
|
|
CString sDir = USER_PROFILES_DIR + sProfileID + "/";
|
2003-11-01 22:04:43 +00:00
|
|
|
|
2005-04-24 19:18:46 +00:00
|
|
|
return LoadProfile( pn, sDir, false ) == Profile::success;
|
2003-11-01 22:04:43 +00:00
|
|
|
}
|
|
|
|
|
|
2005-04-24 23:23:32 +00:00
|
|
|
void ProfileManager::GetMemoryCardProfileDirectoriesToTry( vector<CString> &asDirsToTry ) const
|
2005-04-24 19:39:54 +00:00
|
|
|
{
|
|
|
|
|
/* Try to load the preferred profile. */
|
|
|
|
|
asDirsToTry.push_back( PREFSMAN->m_sMemoryCardProfileSubdir );
|
|
|
|
|
|
|
|
|
|
/* If that failed, try loading from all fallback directories. */
|
|
|
|
|
split( g_sMemoryCardProfileImportSubdirs, ";", asDirsToTry, true );
|
|
|
|
|
}
|
|
|
|
|
|
2004-08-09 05:01:24 +00:00
|
|
|
bool ProfileManager::LoadProfileFromMemoryCard( PlayerNumber pn )
|
2003-11-01 22:04:43 +00:00
|
|
|
{
|
2004-01-03 03:42:40 +00:00
|
|
|
UnloadProfile( pn );
|
2004-08-09 05:01:24 +00:00
|
|
|
|
2004-03-14 01:40:24 +00:00
|
|
|
// mount slot
|
2005-04-22 04:28:46 +00:00
|
|
|
if( MEMCARDMAN->GetCardState(pn) != MEMORY_CARD_STATE_READY )
|
|
|
|
|
return false;
|
2004-10-07 19:57:51 +00:00
|
|
|
|
2005-04-24 19:18:46 +00:00
|
|
|
vector<CString> asDirsToTry;
|
2005-04-24 19:39:54 +00:00
|
|
|
GetMemoryCardProfileDirectoriesToTry( asDirsToTry );
|
2005-04-24 19:18:46 +00:00
|
|
|
|
2005-04-24 19:39:54 +00:00
|
|
|
int iLoadedFrom = -1;
|
2005-04-24 19:18:46 +00:00
|
|
|
for( unsigned i = 0; i < asDirsToTry.size(); ++i )
|
|
|
|
|
{
|
|
|
|
|
const CString &sSubdir = asDirsToTry[i];
|
|
|
|
|
CString sDir = MEM_CARD_MOUNT_POINT[pn] + sSubdir + "/";
|
|
|
|
|
|
|
|
|
|
/* If the load fails with Profile::no_profile, keep searching. However,
|
|
|
|
|
* if it fails with failed_tampered, data existed but couldn't be loaded;
|
|
|
|
|
* we don't want to mess with it, since it's confusing and may wipe out
|
|
|
|
|
* recoverable backup data. The only time we really want to import data
|
|
|
|
|
* is on the very first use, when the new profile doesn't exist at all,
|
|
|
|
|
* but we also want to import scores in the case where the player created
|
|
|
|
|
* a directory for edits before playing, so keep searching if the directory
|
|
|
|
|
* exists with exists with no scores. */
|
|
|
|
|
Profile::LoadResult res = LoadProfile( pn, sDir, true );
|
2005-04-24 19:39:54 +00:00
|
|
|
if( res == Profile::success )
|
|
|
|
|
iLoadedFrom = i;
|
|
|
|
|
else if( res != Profile::failed_no_profile )
|
2005-04-24 19:18:46 +00:00
|
|
|
break;
|
|
|
|
|
}
|
2004-01-03 03:42:40 +00:00
|
|
|
|
2005-04-24 19:39:54 +00:00
|
|
|
/* Store the directory we imported from, for display purposes. */
|
|
|
|
|
if( iLoadedFrom > 0 )
|
|
|
|
|
{
|
|
|
|
|
m_sProfileDirImportedFrom[pn] = asDirsToTry[iLoadedFrom];
|
|
|
|
|
}
|
|
|
|
|
|
2005-04-24 19:18:46 +00:00
|
|
|
/* If we imported a profile fallback directory, change the memory card
|
|
|
|
|
* directory back to the preferred directory: never write over imported
|
|
|
|
|
* scores. */
|
|
|
|
|
m_sProfileDir[pn] = MEM_CARD_MOUNT_POINT[pn] + PREFSMAN->m_sMemoryCardProfileSubdir + "/";
|
2004-10-07 19:57:51 +00:00
|
|
|
|
2005-04-22 04:28:46 +00:00
|
|
|
return true; // If a card is inserted, we want to use the memory card to save - even if the Profile load failed.
|
2003-11-01 22:04:43 +00:00
|
|
|
}
|
2003-11-09 21:39:54 +00:00
|
|
|
|
2004-08-09 05:01:24 +00:00
|
|
|
bool ProfileManager::LoadFirstAvailableProfile( PlayerNumber pn )
|
2004-02-22 03:44:04 +00:00
|
|
|
{
|
2004-08-09 05:01:24 +00:00
|
|
|
if( LoadProfileFromMemoryCard(pn) )
|
2004-02-22 03:44:04 +00:00
|
|
|
return true;
|
|
|
|
|
|
2004-08-09 05:01:24 +00:00
|
|
|
if( LoadLocalProfileFromMachine(pn) )
|
2004-02-22 03:44:04 +00:00
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2003-11-01 22:04:43 +00:00
|
|
|
|
2005-04-24 23:06:15 +00:00
|
|
|
|
|
|
|
|
bool ProfileManager::FastLoadProfileNameFromMemoryCard( CString sRootDir, CString &sName ) const
|
|
|
|
|
{
|
2005-04-24 23:23:32 +00:00
|
|
|
vector<CString> asDirsToTry;
|
|
|
|
|
GetMemoryCardProfileDirectoriesToTry( asDirsToTry );
|
|
|
|
|
|
|
|
|
|
for( unsigned i = 0; i < asDirsToTry.size(); ++i )
|
|
|
|
|
{
|
|
|
|
|
const CString &sSubdir = asDirsToTry[i];
|
|
|
|
|
CString sDir = sRootDir + sSubdir + "/";
|
2005-04-24 23:06:15 +00:00
|
|
|
|
2005-04-24 23:23:32 +00:00
|
|
|
Profile profile;
|
|
|
|
|
Profile::LoadResult res = profile.LoadEditableDataFromDir( sDir );
|
|
|
|
|
if( res == Profile::success )
|
|
|
|
|
{
|
|
|
|
|
sName = profile.GetDisplayName();
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
else if( res != Profile::failed_no_profile )
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return false;
|
2005-04-24 23:06:15 +00:00
|
|
|
}
|
|
|
|
|
|
2004-07-20 01:31:23 +00:00
|
|
|
void ProfileManager::SaveAllProfiles() const
|
|
|
|
|
{
|
|
|
|
|
this->SaveMachineProfile();
|
|
|
|
|
|
|
|
|
|
FOREACH_HumanPlayer( pn )
|
|
|
|
|
{
|
2004-10-07 19:57:51 +00:00
|
|
|
if( !IsUsingProfile(pn) )
|
2004-07-20 01:31:23 +00:00
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
this->SaveProfile( pn );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2004-02-22 02:01:40 +00:00
|
|
|
bool ProfileManager::SaveProfile( PlayerNumber pn ) const
|
2003-09-08 03:26:58 +00:00
|
|
|
{
|
|
|
|
|
if( m_sProfileDir[pn].empty() )
|
2003-11-01 19:36:52 +00:00
|
|
|
return false;
|
2003-09-08 03:26:58 +00:00
|
|
|
|
2004-06-06 02:41:16 +00:00
|
|
|
bool b = m_Profile[pn].SaveAllToDir( m_sProfileDir[pn], PREFSMAN->m_bSignProfileData );
|
|
|
|
|
|
|
|
|
|
return b;
|
2003-11-01 19:36:52 +00:00
|
|
|
}
|
2003-09-14 20:34:33 +00:00
|
|
|
|
2003-11-01 19:36:52 +00:00
|
|
|
void ProfileManager::UnloadProfile( PlayerNumber pn )
|
|
|
|
|
{
|
|
|
|
|
m_sProfileDir[pn] = "";
|
2005-04-24 19:39:54 +00:00
|
|
|
m_sProfileDirImportedFrom[pn] = "";
|
2004-01-03 03:42:40 +00:00
|
|
|
m_bWasLoadedFromMemoryCard[pn] = false;
|
2004-10-06 08:39:38 +00:00
|
|
|
m_bLastLoadWasTamperedOrCorrupt[pn] = false;
|
2004-10-07 19:57:51 +00:00
|
|
|
m_bLastLoadWasFromLastGood[pn] = false;
|
2004-02-10 09:42:01 +00:00
|
|
|
m_Profile[pn].InitAll();
|
2003-09-08 07:21:41 +00:00
|
|
|
}
|
|
|
|
|
|
2004-02-10 10:06:34 +00:00
|
|
|
const Profile* ProfileManager::GetProfile( PlayerNumber pn ) const
|
2003-09-08 07:21:41 +00:00
|
|
|
{
|
2004-02-23 08:16:40 +00:00
|
|
|
ASSERT( pn >= 0 && pn<NUM_PLAYERS );
|
|
|
|
|
|
2003-11-01 19:36:52 +00:00
|
|
|
if( m_sProfileDir[pn].empty() )
|
|
|
|
|
return NULL;
|
|
|
|
|
else
|
|
|
|
|
return &m_Profile[pn];
|
2003-09-08 07:21:41 +00:00
|
|
|
}
|
2003-09-08 03:26:58 +00:00
|
|
|
|
2004-02-22 02:01:40 +00:00
|
|
|
CString ProfileManager::GetPlayerName( PlayerNumber pn ) const
|
2003-12-17 09:42:31 +00:00
|
|
|
{
|
2004-02-22 02:01:40 +00:00
|
|
|
const Profile *prof = GetProfile( pn );
|
2004-08-06 21:01:28 +00:00
|
|
|
return prof ? prof->GetDisplayName() : CString("");
|
2003-12-17 09:42:31 +00:00
|
|
|
}
|
|
|
|
|
|
2003-09-08 07:21:41 +00:00
|
|
|
|
2003-12-07 08:19:10 +00:00
|
|
|
bool ProfileManager::CreateLocalProfile( CString sName )
|
2003-09-08 07:21:41 +00:00
|
|
|
{
|
2003-12-07 08:19:10 +00:00
|
|
|
ASSERT( !sName.empty() );
|
2003-11-01 22:04:43 +00:00
|
|
|
|
2003-09-08 07:21:41 +00:00
|
|
|
//
|
|
|
|
|
// Find a free directory name in the profiles directory
|
|
|
|
|
//
|
2003-11-01 19:36:52 +00:00
|
|
|
CString sProfileID, sProfileDir;
|
|
|
|
|
const int MAX_TRIES = 1000;
|
2003-12-07 08:19:10 +00:00
|
|
|
int i;
|
2003-11-01 23:43:22 +00:00
|
|
|
for( i=0; i<MAX_TRIES; i++ )
|
2003-09-08 07:21:41 +00:00
|
|
|
{
|
2003-11-01 19:36:52 +00:00
|
|
|
sProfileID = ssprintf("%08d",i);
|
2003-12-07 07:46:21 +00:00
|
|
|
sProfileDir = USER_PROFILES_DIR + sProfileID;
|
2003-11-01 19:36:52 +00:00
|
|
|
if( !DoesFileExist(sProfileDir) )
|
2003-09-08 07:21:41 +00:00
|
|
|
break;
|
|
|
|
|
}
|
2003-11-01 19:36:52 +00:00
|
|
|
if( i == MAX_TRIES )
|
|
|
|
|
return false;
|
2003-12-10 09:26:05 +00:00
|
|
|
sProfileDir += "/";
|
2003-09-08 07:21:41 +00:00
|
|
|
|
2004-10-07 19:57:51 +00:00
|
|
|
return Profile::CreateNewProfile( sProfileDir, sName );
|
2003-11-01 19:36:52 +00:00
|
|
|
}
|
|
|
|
|
|
2003-12-07 08:19:10 +00:00
|
|
|
bool ProfileManager::RenameLocalProfile( CString sProfileID, CString sNewName )
|
2003-11-01 19:36:52 +00:00
|
|
|
{
|
|
|
|
|
ASSERT( !sProfileID.empty() );
|
|
|
|
|
|
2003-12-07 07:46:21 +00:00
|
|
|
CString sProfileDir = USER_PROFILES_DIR + sProfileID;
|
2003-11-01 19:36:52 +00:00
|
|
|
|
|
|
|
|
Profile pro;
|
2004-10-07 19:57:51 +00:00
|
|
|
Profile::LoadResult lr;
|
|
|
|
|
lr = pro.LoadAllFromDir( sProfileDir, PREFSMAN->m_bSignProfileData );
|
|
|
|
|
if( lr != Profile::success )
|
2003-11-01 19:36:52 +00:00
|
|
|
return false;
|
2004-02-19 03:19:41 +00:00
|
|
|
pro.m_sDisplayName = sNewName;
|
2003-11-01 19:36:52 +00:00
|
|
|
|
2005-03-27 13:42:09 +00:00
|
|
|
return pro.SaveAllToDir( sProfileDir, PREFSMAN->m_bSignProfileData );
|
2003-09-08 03:26:58 +00:00
|
|
|
}
|
2003-11-01 19:36:52 +00:00
|
|
|
|
2003-12-07 08:19:10 +00:00
|
|
|
bool ProfileManager::DeleteLocalProfile( CString sProfileID )
|
2003-11-01 19:36:52 +00:00
|
|
|
{
|
|
|
|
|
// delete all files in profile dir
|
2003-12-07 07:46:21 +00:00
|
|
|
CString sProfileDir = USER_PROFILES_DIR + sProfileID;
|
2003-11-01 19:36:52 +00:00
|
|
|
CStringArray asFilesToDelete;
|
2003-12-10 09:26:05 +00:00
|
|
|
GetDirListing( sProfileDir + "/*", asFilesToDelete, false, true );
|
2003-11-01 19:36:52 +00:00
|
|
|
for( unsigned i=0; i<asFilesToDelete.size(); i++ )
|
2003-12-16 07:59:32 +00:00
|
|
|
FILEMAN->Remove( asFilesToDelete[i] );
|
2003-11-01 19:36:52 +00:00
|
|
|
|
2004-05-14 23:20:28 +00:00
|
|
|
// delete edits
|
|
|
|
|
GetDirListing( sProfileDir + "/" + EDITS_SUBDIR + "*", asFilesToDelete, false, true );
|
|
|
|
|
for( unsigned i=0; i<asFilesToDelete.size(); i++ )
|
|
|
|
|
FILEMAN->Remove( asFilesToDelete[i] );
|
|
|
|
|
|
2005-01-25 06:21:39 +00:00
|
|
|
// delete lastgood
|
|
|
|
|
GetDirListing( sProfileDir + "/" + LASTGOOD_SUBDIR + "*", asFilesToDelete, false, true );
|
|
|
|
|
for( unsigned i=0; i<asFilesToDelete.size(); i++ )
|
|
|
|
|
FILEMAN->Remove( asFilesToDelete[i] );
|
|
|
|
|
|
2004-05-14 23:20:28 +00:00
|
|
|
// remove edits dir
|
|
|
|
|
FILEMAN->Remove( sProfileDir + "/" + EDITS_SUBDIR );
|
|
|
|
|
|
2005-01-25 06:21:39 +00:00
|
|
|
// remove lastgood dir
|
|
|
|
|
FILEMAN->Remove( sProfileDir + "/" + LASTGOOD_SUBDIR );
|
|
|
|
|
|
2003-11-01 19:36:52 +00:00
|
|
|
// remove profile dir
|
2003-12-16 07:59:32 +00:00
|
|
|
return FILEMAN->Remove( sProfileDir );
|
2003-11-01 23:43:22 +00:00
|
|
|
}
|
2003-12-07 07:09:13 +00:00
|
|
|
|
2004-07-20 01:31:23 +00:00
|
|
|
void ProfileManager::SaveMachineProfile() const
|
2003-12-07 07:09:13 +00:00
|
|
|
{
|
2004-02-16 05:35:06 +00:00
|
|
|
// If the machine name has changed, make sure we use the new name.
|
|
|
|
|
// It's important that this name be applied before the Player profiles
|
|
|
|
|
// are saved, so that the Player's profiles show the right machine name.
|
2004-07-20 01:31:23 +00:00
|
|
|
const_cast<ProfileManager *> (this)->m_MachineProfile.m_sDisplayName = PREFSMAN->m_sMachineName;
|
2004-02-16 05:35:06 +00:00
|
|
|
|
2004-04-20 00:07:17 +00:00
|
|
|
m_MachineProfile.SaveAllToDir( MACHINE_PROFILE_DIR, false ); /* don't sign machine profiles */
|
2003-12-07 07:09:13 +00:00
|
|
|
}
|
|
|
|
|
|
2004-02-16 05:35:06 +00:00
|
|
|
void ProfileManager::LoadMachineProfile()
|
2003-12-07 07:09:13 +00:00
|
|
|
{
|
2004-10-07 19:57:51 +00:00
|
|
|
Profile::LoadResult lr = m_MachineProfile.LoadAllFromDir(MACHINE_PROFILE_DIR, false);
|
|
|
|
|
if( lr == Profile::failed_no_profile )
|
2003-12-08 06:41:30 +00:00
|
|
|
{
|
2004-10-07 19:57:51 +00:00
|
|
|
Profile::CreateNewProfile(MACHINE_PROFILE_DIR, "Machine");
|
2004-04-20 00:07:17 +00:00
|
|
|
m_MachineProfile.LoadAllFromDir( MACHINE_PROFILE_DIR, false );
|
2003-12-08 06:41:30 +00:00
|
|
|
}
|
2004-02-16 05:35:06 +00:00
|
|
|
|
|
|
|
|
// If the machine name has changed, make sure we use the new name
|
2004-02-19 03:19:41 +00:00
|
|
|
m_MachineProfile.m_sDisplayName = PREFSMAN->m_sMachineName;
|
2003-12-07 07:09:13 +00:00
|
|
|
}
|
|
|
|
|
|
2004-02-22 02:01:40 +00:00
|
|
|
bool ProfileManager::ProfileWasLoadedFromMemoryCard( PlayerNumber pn ) const
|
2004-01-03 03:42:40 +00:00
|
|
|
{
|
|
|
|
|
return GetProfile(pn) && m_bWasLoadedFromMemoryCard[pn];
|
|
|
|
|
}
|
2004-02-08 01:05:53 +00:00
|
|
|
|
2004-10-06 08:39:38 +00:00
|
|
|
bool ProfileManager::LastLoadWasTamperedOrCorrupt( PlayerNumber pn ) const
|
|
|
|
|
{
|
|
|
|
|
return GetProfile(pn) && m_bLastLoadWasTamperedOrCorrupt[pn];
|
|
|
|
|
}
|
|
|
|
|
|
2004-10-07 19:57:51 +00:00
|
|
|
bool ProfileManager::LastLoadWasFromLastGood( PlayerNumber pn ) const
|
|
|
|
|
{
|
|
|
|
|
return GetProfile(pn) && m_bLastLoadWasFromLastGood[pn];
|
|
|
|
|
}
|
|
|
|
|
|
2004-02-22 02:01:40 +00:00
|
|
|
CString ProfileManager::GetProfileDir( ProfileSlot slot ) const
|
2004-02-08 01:05:53 +00:00
|
|
|
{
|
|
|
|
|
switch( slot )
|
|
|
|
|
{
|
|
|
|
|
case PROFILE_SLOT_PLAYER_1:
|
|
|
|
|
case PROFILE_SLOT_PLAYER_2:
|
|
|
|
|
return m_sProfileDir[slot];
|
|
|
|
|
case PROFILE_SLOT_MACHINE:
|
|
|
|
|
return MACHINE_PROFILE_DIR;
|
|
|
|
|
default:
|
|
|
|
|
ASSERT(0);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2005-04-24 19:39:54 +00:00
|
|
|
CString ProfileManager::GetProfileDirImportedFrom( ProfileSlot slot ) const
|
|
|
|
|
{
|
|
|
|
|
switch( slot )
|
|
|
|
|
{
|
|
|
|
|
case PROFILE_SLOT_PLAYER_1:
|
|
|
|
|
case PROFILE_SLOT_PLAYER_2:
|
|
|
|
|
return m_sProfileDirImportedFrom[slot];
|
|
|
|
|
case PROFILE_SLOT_MACHINE:
|
|
|
|
|
return "";
|
|
|
|
|
default:
|
|
|
|
|
ASSERT(0);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2004-02-10 10:06:34 +00:00
|
|
|
const Profile* ProfileManager::GetProfile( ProfileSlot slot ) const
|
2004-02-09 06:26:13 +00:00
|
|
|
{
|
|
|
|
|
switch( slot )
|
|
|
|
|
{
|
|
|
|
|
case PROFILE_SLOT_PLAYER_1:
|
|
|
|
|
case PROFILE_SLOT_PLAYER_2:
|
|
|
|
|
if( m_sProfileDir[slot].empty() )
|
|
|
|
|
return NULL;
|
|
|
|
|
else
|
|
|
|
|
return &m_Profile[slot];
|
|
|
|
|
case PROFILE_SLOT_MACHINE:
|
|
|
|
|
return &m_MachineProfile;
|
|
|
|
|
default:
|
|
|
|
|
ASSERT(0);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2004-02-22 08:16:49 +00:00
|
|
|
//
|
|
|
|
|
// General
|
|
|
|
|
//
|
|
|
|
|
void ProfileManager::IncrementToastiesCount( PlayerNumber pn )
|
|
|
|
|
{
|
|
|
|
|
if( PROFILEMAN->IsUsingProfile(pn) )
|
|
|
|
|
++PROFILEMAN->GetProfile(pn)->m_iNumToasties;
|
|
|
|
|
++PROFILEMAN->GetMachineProfile()->m_iNumToasties;
|
|
|
|
|
}
|
2004-02-09 06:26:13 +00:00
|
|
|
|
2005-02-15 09:24:48 +00:00
|
|
|
void ProfileManager::AddStepTotals( PlayerNumber pn, int iNumTapsAndHolds, int iNumJumps, int iNumHolds, int iNumMines, int iNumHands, float fCaloriesBurned )
|
2004-02-22 19:51:46 +00:00
|
|
|
{
|
|
|
|
|
if( PROFILEMAN->IsUsingProfile(pn) )
|
2005-02-15 09:24:48 +00:00
|
|
|
PROFILEMAN->GetProfile(pn)->AddStepTotals( iNumTapsAndHolds, iNumJumps, iNumHolds, iNumMines, iNumHands, fCaloriesBurned );
|
|
|
|
|
PROFILEMAN->GetMachineProfile()->AddStepTotals( iNumTapsAndHolds, iNumJumps, iNumHolds, iNumMines, iNumHands, fCaloriesBurned );
|
2004-02-22 19:51:46 +00:00
|
|
|
}
|
|
|
|
|
|
2004-02-09 06:26:13 +00:00
|
|
|
//
|
|
|
|
|
// Song stats
|
|
|
|
|
//
|
2004-02-10 10:06:34 +00:00
|
|
|
int ProfileManager::GetSongNumTimesPlayed( const Song* pSong, ProfileSlot slot ) const
|
2004-02-09 06:26:13 +00:00
|
|
|
{
|
2004-02-10 09:42:01 +00:00
|
|
|
return GetProfile(slot)->GetSongNumTimesPlayed( pSong );
|
2004-02-09 06:26:13 +00:00
|
|
|
}
|
|
|
|
|
|
2004-04-22 22:01:38 +00:00
|
|
|
void ProfileManager::AddStepsScore( const Song* pSong, const Steps* pSteps, PlayerNumber pn, HighScore hs, int &iPersonalIndexOut, int &iMachineIndexOut )
|
2004-02-09 06:26:13 +00:00
|
|
|
{
|
2004-06-26 21:38:38 +00:00
|
|
|
hs.fPercentDP = max( 0, hs.fPercentDP ); // bump up negative scores
|
|
|
|
|
|
2004-06-09 08:25:08 +00:00
|
|
|
iPersonalIndexOut = -1;
|
|
|
|
|
iMachineIndexOut = -1;
|
|
|
|
|
|
|
|
|
|
// In event mode, set the score's name immediately to the Profile's last
|
2004-07-11 05:21:19 +00:00
|
|
|
// used name. If no profile last used name exists, use "EVNT".
|
2005-04-05 08:30:57 +00:00
|
|
|
if( GAMESTATE->IsEventMode() )
|
2004-06-09 08:25:08 +00:00
|
|
|
{
|
|
|
|
|
Profile* pProfile = PROFILEMAN->GetProfile(pn);
|
|
|
|
|
if( pProfile && !pProfile->m_sLastUsedHighScoreName.empty() )
|
|
|
|
|
hs.sName = pProfile->m_sLastUsedHighScoreName;
|
|
|
|
|
else
|
2004-07-11 05:21:19 +00:00
|
|
|
hs.sName = "EVNT";
|
2004-06-09 08:25:08 +00:00
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
hs.sName = RANKING_TO_FILL_IN_MARKER[pn];
|
|
|
|
|
}
|
|
|
|
|
|
2004-08-21 15:51:33 +00:00
|
|
|
//
|
|
|
|
|
// save high score
|
|
|
|
|
//
|
2004-06-08 08:15:58 +00:00
|
|
|
if( hs.fPercentDP >= PREFSMAN->m_fMinPercentageForMachineSongHighScore )
|
2004-04-22 22:01:38 +00:00
|
|
|
{
|
|
|
|
|
if( PROFILEMAN->IsUsingProfile(pn) )
|
|
|
|
|
PROFILEMAN->GetProfile(pn)->AddStepsHighScore( pSong, pSteps, hs, iPersonalIndexOut );
|
2004-04-23 02:19:45 +00:00
|
|
|
|
|
|
|
|
// don't leave machine high scores for edits
|
|
|
|
|
if( pSteps->GetDifficulty() != DIFFICULTY_EDIT )
|
|
|
|
|
PROFILEMAN->GetMachineProfile()->AddStepsHighScore( pSong, pSteps, hs, iMachineIndexOut );
|
2004-04-22 22:01:38 +00:00
|
|
|
}
|
|
|
|
|
|
2004-08-21 15:51:33 +00:00
|
|
|
//
|
|
|
|
|
// save recent score
|
|
|
|
|
//
|
2004-02-09 06:26:13 +00:00
|
|
|
if( PROFILEMAN->IsUsingProfile(pn) )
|
2004-05-08 10:12:10 +00:00
|
|
|
PROFILEMAN->GetProfile(pn)->AddStepsRecentScore( pSong, pSteps, hs );
|
|
|
|
|
PROFILEMAN->GetMachineProfile()->AddStepsRecentScore( pSong, pSteps, hs );
|
2004-02-09 06:26:13 +00:00
|
|
|
}
|
|
|
|
|
|
2004-04-18 18:42:42 +00:00
|
|
|
void ProfileManager::IncrementStepsPlayCount( const Song* pSong, const Steps* pSteps, PlayerNumber pn )
|
2004-02-09 06:26:13 +00:00
|
|
|
{
|
|
|
|
|
if( PROFILEMAN->IsUsingProfile(pn) )
|
2004-04-18 18:42:42 +00:00
|
|
|
PROFILEMAN->GetProfile(pn)->IncrementStepsPlayCount( pSong, pSteps );
|
|
|
|
|
PROFILEMAN->GetMachineProfile()->IncrementStepsPlayCount( pSong, pSteps );
|
2004-02-09 06:26:13 +00:00
|
|
|
}
|
|
|
|
|
|
2004-06-28 07:26:00 +00:00
|
|
|
HighScore ProfileManager::GetHighScoreForDifficulty( const Song *s, const Style *st, ProfileSlot slot, Difficulty dc ) const
|
2004-02-09 06:26:13 +00:00
|
|
|
{
|
|
|
|
|
// return max grade of notes in difficulty class
|
|
|
|
|
vector<Steps*> aNotes;
|
|
|
|
|
s->GetSteps( aNotes, st->m_StepsType );
|
2004-04-18 07:34:37 +00:00
|
|
|
StepsUtil::SortNotesArrayByDifficulty( aNotes );
|
2004-02-09 06:26:13 +00:00
|
|
|
|
2004-02-22 02:01:40 +00:00
|
|
|
const Steps* pSteps = s->GetStepsByDifficulty( st->m_StepsType, dc );
|
2004-02-09 06:26:13 +00:00
|
|
|
|
2004-03-11 06:31:30 +00:00
|
|
|
if( pSteps && PROFILEMAN->IsUsingProfile(slot) )
|
2004-04-18 18:42:42 +00:00
|
|
|
return PROFILEMAN->GetProfile(slot)->GetStepsHighScoreList(s,pSteps).GetTopScore();
|
2004-02-09 06:26:13 +00:00
|
|
|
else
|
|
|
|
|
return HighScore();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// Course stats
|
|
|
|
|
//
|
2004-05-23 09:17:10 +00:00
|
|
|
void ProfileManager::AddCourseScore( const Course* pCourse, const Trail* pTrail, PlayerNumber pn, HighScore hs, int &iPersonalIndexOut, int &iMachineIndexOut )
|
2004-02-09 06:26:13 +00:00
|
|
|
{
|
2004-06-26 21:38:38 +00:00
|
|
|
hs.fPercentDP = max( 0, hs.fPercentDP ); // bump up negative scores
|
|
|
|
|
|
2004-06-09 08:25:08 +00:00
|
|
|
iPersonalIndexOut = -1;
|
|
|
|
|
iMachineIndexOut = -1;
|
|
|
|
|
|
|
|
|
|
// In event mode, set the score's name immediately to the Profile's last
|
2004-07-11 05:21:19 +00:00
|
|
|
// used name. If no profile last used name exists, use "EVNT".
|
2005-04-05 08:30:57 +00:00
|
|
|
if( GAMESTATE->IsEventMode() )
|
2004-06-09 08:25:08 +00:00
|
|
|
{
|
|
|
|
|
Profile* pProfile = PROFILEMAN->GetProfile(pn);
|
|
|
|
|
if( pProfile && !pProfile->m_sLastUsedHighScoreName.empty() )
|
|
|
|
|
hs.sName = pProfile->m_sLastUsedHighScoreName;
|
|
|
|
|
else
|
2004-07-11 05:21:19 +00:00
|
|
|
hs.sName = "EVNT";
|
2004-06-09 08:25:08 +00:00
|
|
|
}
|
|
|
|
|
else
|
2004-04-22 22:01:38 +00:00
|
|
|
{
|
|
|
|
|
hs.sName = RANKING_TO_FILL_IN_MARKER[pn];
|
2004-06-09 08:25:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2004-08-21 15:51:33 +00:00
|
|
|
//
|
|
|
|
|
// save high score
|
|
|
|
|
//
|
2004-06-09 08:25:08 +00:00
|
|
|
if( hs.fPercentDP >= PREFSMAN->m_fMinPercentageForMachineCourseHighScore )
|
|
|
|
|
{
|
2004-04-22 22:01:38 +00:00
|
|
|
if( PROFILEMAN->IsUsingProfile(pn) )
|
2004-05-23 09:17:10 +00:00
|
|
|
PROFILEMAN->GetProfile(pn)->AddCourseHighScore( pCourse, pTrail, hs, iPersonalIndexOut );
|
|
|
|
|
PROFILEMAN->GetMachineProfile()->AddCourseHighScore( pCourse, pTrail, hs, iMachineIndexOut );
|
2004-04-22 22:01:38 +00:00
|
|
|
}
|
|
|
|
|
|
2004-08-21 15:51:33 +00:00
|
|
|
//
|
|
|
|
|
// save recent score
|
|
|
|
|
//
|
2004-02-09 06:26:13 +00:00
|
|
|
if( PROFILEMAN->IsUsingProfile(pn) )
|
2004-05-23 09:17:10 +00:00
|
|
|
PROFILEMAN->GetProfile(pn)->AddCourseRecentScore( pCourse, pTrail, hs );
|
|
|
|
|
PROFILEMAN->GetMachineProfile()->AddCourseRecentScore( pCourse, pTrail, hs );
|
2004-02-09 06:26:13 +00:00
|
|
|
}
|
|
|
|
|
|
2004-05-23 09:17:10 +00:00
|
|
|
void ProfileManager::IncrementCoursePlayCount( const Course* pCourse, const Trail* pTrail, PlayerNumber pn )
|
2004-02-09 06:26:13 +00:00
|
|
|
{
|
|
|
|
|
if( PROFILEMAN->IsUsingProfile(pn) )
|
2004-05-23 09:17:10 +00:00
|
|
|
PROFILEMAN->GetProfile(pn)->IncrementCoursePlayCount( pCourse, pTrail );
|
|
|
|
|
PROFILEMAN->GetMachineProfile()->IncrementCoursePlayCount( pCourse, pTrail );
|
2004-02-09 06:26:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// Category stats
|
|
|
|
|
//
|
2004-04-22 22:01:38 +00:00
|
|
|
void ProfileManager::AddCategoryScore( StepsType st, RankingCategory rc, PlayerNumber pn, HighScore hs, int &iPersonalIndexOut, int &iMachineIndexOut )
|
2004-02-09 06:26:13 +00:00
|
|
|
{
|
2004-06-08 08:15:58 +00:00
|
|
|
if( hs.fPercentDP > PREFSMAN->m_fMinPercentageForMachineSongHighScore )
|
2004-04-22 22:01:38 +00:00
|
|
|
{
|
|
|
|
|
hs.sName = RANKING_TO_FILL_IN_MARKER[pn];
|
|
|
|
|
if( PROFILEMAN->IsUsingProfile(pn) )
|
|
|
|
|
PROFILEMAN->GetProfile(pn)->AddCategoryHighScore( st, rc, hs, iPersonalIndexOut );
|
|
|
|
|
else
|
|
|
|
|
iPersonalIndexOut = -1;
|
|
|
|
|
PROFILEMAN->GetMachineProfile()->AddCategoryHighScore( st, rc, hs, iMachineIndexOut );
|
|
|
|
|
}
|
2004-02-09 06:26:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ProfileManager::IncrementCategoryPlayCount( StepsType st, RankingCategory rc, PlayerNumber pn )
|
|
|
|
|
{
|
|
|
|
|
if( PROFILEMAN->IsUsingProfile(pn) )
|
|
|
|
|
PROFILEMAN->GetProfile(pn)->IncrementCategoryPlayCount( st, rc );
|
|
|
|
|
PROFILEMAN->GetMachineProfile()->IncrementCategoryPlayCount( st, rc );
|
|
|
|
|
}
|
|
|
|
|
|
2004-04-23 02:01:44 +00:00
|
|
|
bool ProfileManager::IsUsingProfile( ProfileSlot slot ) const
|
|
|
|
|
{
|
|
|
|
|
switch( slot )
|
|
|
|
|
{
|
|
|
|
|
case PROFILE_SLOT_PLAYER_1:
|
|
|
|
|
case PROFILE_SLOT_PLAYER_2:
|
|
|
|
|
return GAMESTATE->IsHumanPlayer((PlayerNumber)slot) && !m_sProfileDir[slot].empty();
|
|
|
|
|
case PROFILE_SLOT_MACHINE:
|
|
|
|
|
return true;
|
|
|
|
|
default:
|
|
|
|
|
ASSERT(0);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2005-02-13 01:16:17 +00:00
|
|
|
// lua start
|
|
|
|
|
#include "LuaBinding.h"
|
|
|
|
|
|
|
|
|
|
template<class T>
|
|
|
|
|
class LunaProfileManager : public Luna<T>
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
LunaProfileManager() { LUA->Register( Register ); }
|
|
|
|
|
|
2005-02-17 17:14:00 +00:00
|
|
|
static int IsUsingProfile( T* p, lua_State *L ) { lua_pushboolean(L, p->IsUsingProfile((PlayerNumber)IArg(1)) ); return 1; }
|
2005-02-20 10:12:50 +00:00
|
|
|
static int GetProfile( T* p, lua_State *L ) { PlayerNumber pn = (PlayerNumber)IArg(1); Profile* pP = p->GetProfile(pn); ASSERT(pP); pP->PushSelf(L); return 1; }
|
2005-02-17 17:14:00 +00:00
|
|
|
static int GetMachineProfile( T* p, lua_State *L ) { p->GetMachineProfile()->PushSelf(L); return 1; }
|
2005-02-13 01:16:17 +00:00
|
|
|
|
|
|
|
|
static void Register(lua_State *L)
|
|
|
|
|
{
|
|
|
|
|
ADD_METHOD( IsUsingProfile )
|
2005-02-15 23:13:18 +00:00
|
|
|
ADD_METHOD( GetProfile )
|
2005-02-16 02:48:50 +00:00
|
|
|
ADD_METHOD( GetMachineProfile )
|
2005-02-13 01:16:17 +00:00
|
|
|
Luna<T>::Register( L );
|
|
|
|
|
|
|
|
|
|
// Add global singleton if constructed already. If it's not constructed yet,
|
2005-02-16 00:16:14 +00:00
|
|
|
// then we'll register it later when we reinit Lua just before
|
2005-02-13 01:16:17 +00:00
|
|
|
// initializing the display.
|
|
|
|
|
if( PROFILEMAN )
|
|
|
|
|
{
|
|
|
|
|
lua_pushstring(L, "PROFILEMAN");
|
2005-02-14 05:57:40 +00:00
|
|
|
PROFILEMAN->PushSelf( LUA->L );
|
2005-02-13 01:16:17 +00:00
|
|
|
lua_settable(L, LUA_GLOBALSINDEX);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
LUA_REGISTER_CLASS( ProfileManager )
|
|
|
|
|
// lua end
|
|
|
|
|
|
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.
|
|
|
|
|
*/
|