MCPcopy Create free account
hub / github.com/StrongPC123/Far-Cry-1-Source-Full / ServerCreateFileProbe

Method ServerCreateFileProbe

CryNetwork/DefenceWall.cpp:204–248  ·  view source on GitHub ↗

/////////////////////////////////////////////////////////////////////

Source from the content-addressed store, hash-verified

202
203//////////////////////////////////////////////////////////////////////////
204bool CDefenceWall::ServerCreateFileProbe( const char *sFilename,SClientCheckContext &ctx,bool bRandomPart )
205{
206#if !defined(LINUX)
207 // Get current language.
208 ICVar *pLanguage=m_pSystem->GetIConsole()->GetCVar("g_language");
209 if (pLanguage && pLanguage->GetString())
210 {
211 // Skip validation of language specific paks.
212 char fname[_MAX_FNAME];
213 _splitpath( sFilename,NULL,NULL,fname,NULL );
214 if (strnicmp(fname,pLanguage->GetString(),strlen(pLanguage->GetString())) == 0)
215 {
216 // This is language pak... skip checking it.
217 return false;
218 }
219 }
220
221 string file = sFilename;
222 GetRelativeFilename(file);
223
224 ctx.nRequestCode = DEFWALL_CHECK_PAK;
225 ctx.bExecutableCode = false;
226 ctx.probe.sFilename = file;
227 ctx.nFilenameHash = m_pSystem->GetIDataProbe()->GetHash( file.c_str() );
228 if (bRandomPart)
229 {
230 ctx.probe.nCodeInfo = rand()%3;
231 if (!m_pSystem->GetIDataProbe()->GetRandomFileProbe( ctx.probe,true ))
232 return false;
233 if (!m_pSystem->GetIDataProbe()->GetCode( ctx.probe ))
234 return false;
235 }
236 else
237 {
238 ctx.probe.nCodeInfo = rand()%3;
239 ctx.probe.nSize = 0xFFFFFFFF;
240 if (!m_pSystem->GetIDataProbe()->GetCode( ctx.probe ))
241 return false;
242 }
243#ifdef LOGEVENTS
244 if (m_bLog) CryLog( "<DefenceWall> CreatedFileProbe[%d] %s %I64x",ctx.nRequestId,ctx.probe.sFilename.c_str(),ctx.probe.nCode );
245#endif
246#endif
247 return true;
248}
249
250//////////////////////////////////////////////////////////////////////////
251void CDefenceWall::FirstTimeClientValidation( ClientInfo *pClientInfo )

Callers

nothing calls this directly

Calls 10

CryLogFunction · 0.85
GetCVarMethod · 0.80
GetIConsoleMethod · 0.80
GetIDataProbeMethod · 0.80
GetRandomFileProbeMethod · 0.80
GetCodeMethod · 0.80
strnicmpFunction · 0.50
GetStringMethod · 0.45
GetHashMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected