add GetNumSelectableAndUnlockedSongs, add GetMD5ForString
This commit is contained in:
@@ -232,7 +232,7 @@ static RString BinaryToHex( const unsigned char *string, int iNumBytes )
|
|||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
RString CryptManager::GetMD5( RString fn )
|
RString CryptManager::GetMD5ForFile( RString fn )
|
||||||
{
|
{
|
||||||
struct MD5Context md5c;
|
struct MD5Context md5c;
|
||||||
unsigned char digest[16];
|
unsigned char digest[16];
|
||||||
@@ -257,6 +257,18 @@ RString CryptManager::GetMD5( RString fn )
|
|||||||
return BinaryToHex( digest, sizeof(digest) );
|
return BinaryToHex( digest, sizeof(digest) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RString CryptManager::GetMD5ForString( RString sData )
|
||||||
|
{
|
||||||
|
struct MD5Context md5c;
|
||||||
|
unsigned char digest[16];
|
||||||
|
|
||||||
|
MD5Init(&md5c);
|
||||||
|
MD5Update(&md5c, reinterpret_cast<const unsigned char*>(sData.c_str()), sData.size());
|
||||||
|
MD5Final(digest, &md5c);
|
||||||
|
|
||||||
|
return BinaryToHex( digest, sizeof(digest) );
|
||||||
|
}
|
||||||
|
|
||||||
RString CryptManager::GetPublicKeyFileName()
|
RString CryptManager::GetPublicKeyFileName()
|
||||||
{
|
{
|
||||||
ASSERT( PREFSMAN->m_bSignProfileData );
|
ASSERT( PREFSMAN->m_bSignProfileData );
|
||||||
|
|||||||
@@ -19,7 +19,8 @@ public:
|
|||||||
static RString Sign( RString sPath );
|
static RString Sign( RString sPath );
|
||||||
static bool Verify( RString sPath, RString sSignature );
|
static bool Verify( RString sPath, RString sSignature );
|
||||||
|
|
||||||
static RString GetMD5( RString fn ); // in Hex
|
static RString GetMD5ForFile( RString fn ); // in Hex
|
||||||
|
static RString GetMD5ForString( RString sData ); // in Hex
|
||||||
|
|
||||||
static RString GetPublicKeyFileName();
|
static RString GetPublicKeyFileName();
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -871,7 +871,7 @@ void ScreenEvaluation::Input( const InputEventPlus &input )
|
|||||||
const HighScore &hs = STATSMAN->m_CurStageStats.m_player[pn].m_HighScore;
|
const HighScore &hs = STATSMAN->m_CurStageStats.m_player[pn].m_HighScore;
|
||||||
Screenshot screenshot;
|
Screenshot screenshot;
|
||||||
screenshot.sFileName = sFileName;
|
screenshot.sFileName = sFileName;
|
||||||
screenshot.sMD5 = CRYPTMAN->GetMD5( sPath );
|
screenshot.sMD5 = CRYPTMAN->GetMD5ForFile( sPath );
|
||||||
screenshot.highScore = hs;
|
screenshot.highScore = hs;
|
||||||
pProfile->AddScreenshot( screenshot );
|
pProfile->AddScreenshot( screenshot );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -559,7 +559,22 @@ int SongManager::GetNumUnlockedSongs() const
|
|||||||
int num = 0;
|
int num = 0;
|
||||||
FOREACH_CONST( Song*, m_pSongs, i )
|
FOREACH_CONST( Song*, m_pSongs, i )
|
||||||
{
|
{
|
||||||
if( !UNLOCKMAN->SongIsLocked( *i ) )
|
if( UNLOCKMAN->SongIsLocked( *i ) )
|
||||||
|
continue;
|
||||||
|
num++;
|
||||||
|
}
|
||||||
|
return num;
|
||||||
|
}
|
||||||
|
|
||||||
|
int SongManager::GetNumSelectableAndUnlockedSongs() const
|
||||||
|
{
|
||||||
|
int num = 0;
|
||||||
|
FOREACH_CONST( Song*, m_pSongs, i )
|
||||||
|
{
|
||||||
|
if( UNLOCKMAN->SongIsLocked( *i ) )
|
||||||
|
continue;
|
||||||
|
if( (*i)->m_SelectionDisplay != Song::SHOW_ALWAYS )
|
||||||
|
continue;
|
||||||
num++;
|
num++;
|
||||||
}
|
}
|
||||||
return num;
|
return num;
|
||||||
@@ -1734,6 +1749,7 @@ public:
|
|||||||
static int GetRandomCourse( T* p, lua_State *L ) { Course *pC = p->GetRandomCourse(); if(pC) pC->PushSelf(L); else lua_pushnil(L); return 1; }
|
static int GetRandomCourse( T* p, lua_State *L ) { Course *pC = p->GetRandomCourse(); if(pC) pC->PushSelf(L); else lua_pushnil(L); return 1; }
|
||||||
static int GetNumSongs( T* p, lua_State *L ) { lua_pushnumber( L, p->GetNumSongs() ); return 1; }
|
static int GetNumSongs( T* p, lua_State *L ) { lua_pushnumber( L, p->GetNumSongs() ); return 1; }
|
||||||
static int GetNumUnlockedSongs( T* p, lua_State *L ) { lua_pushnumber( L, p->GetNumUnlockedSongs() ); return 1; }
|
static int GetNumUnlockedSongs( T* p, lua_State *L ) { lua_pushnumber( L, p->GetNumUnlockedSongs() ); return 1; }
|
||||||
|
static int GetNumSelectableAndUnlockedSongs( T* p, lua_State *L ) { lua_pushnumber( L, p->GetNumSelectableAndUnlockedSongs() ); return 1; }
|
||||||
static int GetNumAdditionalSongs( T* p, lua_State *L ) { lua_pushnumber( L, p->GetNumAdditionalSongs() ); return 1; }
|
static int GetNumAdditionalSongs( T* p, lua_State *L ) { lua_pushnumber( L, p->GetNumAdditionalSongs() ); return 1; }
|
||||||
static int GetNumSongGroups( T* p, lua_State *L ) { lua_pushnumber( L, p->GetNumSongGroups() ); return 1; }
|
static int GetNumSongGroups( T* p, lua_State *L ) { lua_pushnumber( L, p->GetNumSongGroups() ); return 1; }
|
||||||
static int GetNumCourses( T* p, lua_State *L ) { lua_pushnumber( L, p->GetNumCourses() ); return 1; }
|
static int GetNumCourses( T* p, lua_State *L ) { lua_pushnumber( L, p->GetNumCourses() ); return 1; }
|
||||||
@@ -1758,6 +1774,7 @@ public:
|
|||||||
ADD_METHOD( GetRandomCourse );
|
ADD_METHOD( GetRandomCourse );
|
||||||
ADD_METHOD( GetNumSongs );
|
ADD_METHOD( GetNumSongs );
|
||||||
ADD_METHOD( GetNumUnlockedSongs );
|
ADD_METHOD( GetNumUnlockedSongs );
|
||||||
|
ADD_METHOD( GetNumSelectableAndUnlockedSongs );
|
||||||
ADD_METHOD( GetNumAdditionalSongs );
|
ADD_METHOD( GetNumAdditionalSongs );
|
||||||
ADD_METHOD( GetNumSongGroups );
|
ADD_METHOD( GetNumSongGroups );
|
||||||
ADD_METHOD( GetNumCourses );
|
ADD_METHOD( GetNumCourses );
|
||||||
|
|||||||
@@ -87,6 +87,7 @@ public:
|
|||||||
Course *FindCourse( RString sGroup, RString sName );
|
Course *FindCourse( RString sGroup, RString sName );
|
||||||
int GetNumSongs() const;
|
int GetNumSongs() const;
|
||||||
int GetNumUnlockedSongs() const;
|
int GetNumUnlockedSongs() const;
|
||||||
|
int GetNumSelectableAndUnlockedSongs() const;
|
||||||
int GetNumAdditionalSongs() const;
|
int GetNumAdditionalSongs() const;
|
||||||
int GetNumSongGroups() const;
|
int GetNumSongGroups() const;
|
||||||
int GetNumCourses() const;
|
int GetNumCourses() const;
|
||||||
|
|||||||
Reference in New Issue
Block a user