Online protocol improvements (#1393)

* Chartkey generation

* Simfile filehash generation

* Read filehash on NSCRSG. Add FLU packets and friendlist vectors. Add
getserverversion method. Send chartkey, filehash and rate on start request.

* Use filehash to find the selected song if it is not empty.

* Friendlist update broadcast.

* Send note row size if it's bigger than 1

* Used for chartkey generation

* Define the ReportScore function with numNotes when WITHOUT_NETWORKING is defined
This commit is contained in:
Nickito12
2017-02-10 04:57:59 -08:00
committed by Colby Klein
parent 854410599f
commit 6225e114ad
11 changed files with 274 additions and 8 deletions
+28
View File
@@ -40,6 +40,8 @@
#include <set>
#include <float.h>
//-Nick12 Used for song file hashing
#include <CryptManager.h>
/**
* @brief The internal version of the cache for StepMania.
@@ -1592,6 +1594,32 @@ vector<RString> Song::GetFGChanges1ToVectorString() const
return this->GetChangesToVectorString(this->GetForegroundChanges());
}
RString Song::GetFileHash()
{
if (m_sFileHash.empty()) {
RString sPath = SetExtension(GetSongFilePath(), "sm");
if (!IsAFile(sPath))
sPath = SetExtension(GetSongFilePath(), "dwi");
if (!IsAFile(sPath))
sPath = SetExtension(GetSongFilePath(), "sma");
if (!IsAFile(sPath))
sPath = SetExtension(GetSongFilePath(), "bms");
if (!IsAFile(sPath))
sPath = SetExtension(GetSongFilePath(), "ksf");
if (!IsAFile(sPath))
sPath = SetExtension(GetSongFilePath(), "json");
if (!IsAFile(sPath))
sPath = SetExtension(GetSongFilePath(), "jso");
if (!IsAFile(sPath))
sPath = SetExtension(GetSongFilePath(), "ssc");
if (IsAFile(sPath))
m_sFileHash = BinaryToHex(CRYPTMAN->GetSHA1ForFile(sPath));
else
m_sFileHash = "";
}
return m_sFileHash;
}
vector<RString> Song::GetInstrumentTracksToVectorString() const
{
vector<RString> ret;