mirror of
https://github.com/BeamMP/BeamMP-Launcher.git
synced 2025-07-03 08:26:01 +00:00
fix guest account issue and uppercase mods
This commit is contained in:
parent
8ead91c527
commit
1bf7faa34d
@ -224,10 +224,6 @@ std::string MultiDownload(SOCKET MSock,SOCKET DSock, uint64_t Size, const std::s
|
||||
memcpy(&Ret[MSize],DData,DSize);
|
||||
delete[]DData;
|
||||
|
||||
// std::string Ret = std::string(MData) + std::string(DData);
|
||||
// delete []MData;
|
||||
// delete []DData;
|
||||
|
||||
return Ret;
|
||||
}
|
||||
|
||||
@ -287,7 +283,16 @@ void SyncResources(SOCKET Sock){
|
||||
if(!fs::exists(GetGamePath() + "mods/multiplayer")){
|
||||
fs::create_directories(GetGamePath() + "mods/multiplayer");
|
||||
}
|
||||
fs::copy_file(a, GetGamePath() + "mods/multiplayer" + a.substr(a.find_last_of('/')),
|
||||
|
||||
std::string FName = a.substr(a.find_last_of('/'));
|
||||
// Linux version of the game doesnt support uppercase letters in mod names
|
||||
#if defined(__linux__)
|
||||
for(char &c : FName){
|
||||
c = ::tolower(c);
|
||||
}
|
||||
#endif
|
||||
|
||||
fs::copy_file(a, GetGamePath() + "mods/multiplayer" + FName,
|
||||
fs::copy_options::overwrite_existing);
|
||||
} catch (std::exception& e) {
|
||||
error("Failed copy to the mods folder! " + std::string(e.what()));
|
||||
@ -328,6 +333,14 @@ void SyncResources(SOCKET Sock){
|
||||
if(!fs::exists(GetGamePath() + "mods/multiplayer")){
|
||||
fs::create_directories(GetGamePath() + "mods/multiplayer");
|
||||
}
|
||||
|
||||
// Linux version of the game doesnt support uppercase letters in mod names
|
||||
#if defined(__linux__)
|
||||
for(char &c : FName){
|
||||
c = ::tolower(c);
|
||||
}
|
||||
#endif
|
||||
|
||||
fs::copy_file(a,GetGamePath() + "mods/multiplayer" + FName, fs::copy_options::overwrite_existing);
|
||||
}
|
||||
WaitForConfirm();
|
||||
|
@ -58,17 +58,17 @@ std::string Login(const std::string& fields){
|
||||
error(Buffer);
|
||||
return GetFail("Invalid answer from authentication servers, please try again later!");
|
||||
}
|
||||
if(!d["success"].IsNull() && d["success"].GetBool()){
|
||||
if(d.HasMember("success") && !d["success"].IsNull() && d["success"].GetBool()){
|
||||
LoginAuth = true;
|
||||
if(!d["private_key"].IsNull()){
|
||||
if(d.HasMember("private_key") && !d["private_key"].IsNull()){
|
||||
UpdateKey(d["private_key"].GetString());
|
||||
}
|
||||
if(!d["public_key"].IsNull()){
|
||||
if(d.HasMember("public_key") && !d["public_key"].IsNull()){
|
||||
PublicKey = d["public_key"].GetString();
|
||||
}
|
||||
info("Authentication successful!");
|
||||
}else info("Authentication failed!");
|
||||
if(!d["message"].IsNull()){
|
||||
if(d.HasMember("message") && !d["message"].IsNull()){
|
||||
d.RemoveMember("private_key");
|
||||
d.RemoveMember("public_key");
|
||||
rapidjson::StringBuffer buffer;
|
||||
@ -104,7 +104,7 @@ void CheckLocalKey(){
|
||||
info("Invalid answer from authentication servers.");
|
||||
UpdateKey(nullptr);
|
||||
}
|
||||
if(d["success"].GetBool()){
|
||||
if(d.HasMember("success") && d["success"].GetBool()){
|
||||
LoginAuth = true;
|
||||
UpdateKey(d["private_key"].GetString());
|
||||
PublicKey = d["public_key"].GetString();
|
||||
|
@ -285,7 +285,7 @@ void EnableMP(){
|
||||
//error("Failed to parse " + File); //TODO illegal formatting
|
||||
return;
|
||||
}
|
||||
if(!d["mods"].IsNull() && !d["mods"]["multiplayerbeammp"].IsNull()){
|
||||
if(d.HasMember("mods") && !d["mods"].IsNull() && d["mods"].HasMember("multiplayerbeammp") && !d["mods"]["multiplayerbeammp"].IsNull()){
|
||||
d["mods"]["multiplayerbeammp"]["active"] = true;
|
||||
rapidjson::StringBuffer buffer;
|
||||
rapidjson::Writer<rapidjson::StringBuffer> writer(buffer);
|
||||
|
Loading…
x
Reference in New Issue
Block a user