/*static*/ void CGameBrowser::UnpackRecievedInGamePresenceString(CryFixedStringT<MAX_PRESENCE_STRING_SIZE> &out, const CryFixedStringT<MAX_PRESENCE_STRING_SIZE>& inString) { #if USE_CRYLOBBY_GAMESPY const int firstIntStart = inString.find(':'); const int lastIntStart = inString.rfind(':'); CryFixedStringT<MAX_PRESENCE_STRING_SIZE> stringId( inString.substr(0, firstIntStart) ); CryFixedStringT<MAX_PRESENCE_STRING_SIZE> sGameModeId(inString.substr(firstIntStart+1, lastIntStart)); CryFixedStringT<MAX_PRESENCE_STRING_SIZE> sMapId(inString.substr(lastIntStart+1, inString.length())); const uint32 gameModeId = atoi(sGameModeId.c_str()); const uint32 mapId = atoi(sMapId.c_str()); const char* gamemodeStringId = GetGameModeStringFromId(gameModeId); const char* mapIDString = GetMapStringFromId(mapId); ILocalizationManager* pLocMgr = gEnv->pSystem->GetLocalizationManager(); wstring translated; pLocMgr->LocalizeString( mapIDString, translated ); const bool haveMapString = (translated.length()) && (translated[0] != '@'); if(haveMapString) { out = inString;//CHUDUtils::LocalizeString(stringId.c_str(), gamemodeStringId, mapIDString); } else { out = inString;//CHUDUtils::LocalizeString("@mp_rp_gameplay_unknownmap", gamemodeStringId); } #else out = inString; #endif }
void CDownloadableResource::StartDownloading() { if (m_state==k_notStarted) { if (m_port==0) { GameWarning("Error tried to start downloading on unconfigured CDownloadableResource"); m_state=k_failedInternalError; } else { STCPServiceDataPtr pTransaction(NULL); m_pService=gEnv->pNetwork->GetLobby()->GetLobbyService()->GetTCPService(m_server,m_port); if (m_pService) { static const int MAX_HEADER_SIZE=300; CryFixedStringT<MAX_HEADER_SIZE> httpHeader; // For HTTP 1.0. /*httpHeader.Format( "GET /%s%s HTTP/1.0\n" "\n", m_urlPrefix.c_str(), m_url.c_str());*/ // For HTTP 1.1. Needed to download data from servers that are "multi-homed" httpHeader.Format( "GET /%s%s HTTP/1.1\n" "Host: %s:%d\n" "\n", m_urlPrefix.c_str(), m_url.c_str(), m_server.c_str(), m_port); pTransaction=new STCPServiceData(); if (pTransaction) { int len=httpHeader.length(); pTransaction->length=len; pTransaction->pData=new char[len]; if (pTransaction->pData) { memcpy(pTransaction->pData,httpHeader.c_str(),len); pTransaction->tcpServReplyCb=ReceiveDataCallback; pTransaction->pUserArg=this; // do ref counting manually for callback data this->AddRef(); #if DOWNLOAD_MGR_DBG m_downloadStarted=gEnv->pTimer->GetAsyncCurTime(); #endif m_state=k_awaitingHTTPResponse; if (!m_pService->UploadData(pTransaction)) { this->Release(); pTransaction=NULL; } } else { pTransaction=NULL; } } } if (!pTransaction) { m_state=k_failedInternalError; } } } }