mirror of
https://github.com/rehlds/rechecker.git
synced 2024-12-27 04:45:29 +03:00
Fix date from logs
Added prevfiles at logs
This commit is contained in:
parent
107c92c7a0
commit
d76230de9e
@ -141,9 +141,9 @@ typedef IVoidHookChainRegistry<edict_t *, int, const char *, float, float, int,
|
|||||||
typedef IVoidHookChain<IGameClient *, char *, size_t, sizebuf_t *, IGameClient *> IRehldsHook_SV_WriteFullClientUpdate;
|
typedef IVoidHookChain<IGameClient *, char *, size_t, sizebuf_t *, IGameClient *> IRehldsHook_SV_WriteFullClientUpdate;
|
||||||
typedef IVoidHookChainRegistry<IGameClient *, char *, size_t, sizebuf_t *, IGameClient *> IRehldsHookRegistry_SV_WriteFullClientUpdate;
|
typedef IVoidHookChainRegistry<IGameClient *, char *, size_t, sizebuf_t *, IGameClient *> IRehldsHookRegistry_SV_WriteFullClientUpdate;
|
||||||
|
|
||||||
//SV_CheckConsistencyResponce hook
|
//SV_CheckConsistencyResponse hook
|
||||||
typedef IHookChain<bool, IGameClient *, resource_t *, uint32> IRehldsHook_SV_CheckConsistencyResponce;
|
typedef IHookChain<bool, IGameClient *, resource_t *, uint32> IRehldsHook_SV_CheckConsistencyResponse;
|
||||||
typedef IHookChainRegistry<bool, IGameClient *, resource_t *, uint32> IRehldsHookRegistry_SV_CheckConsistencyResponce;
|
typedef IHookChainRegistry<bool, IGameClient *, resource_t *, uint32> IRehldsHookRegistry_SV_CheckConsistencyResponse;
|
||||||
|
|
||||||
//SV_DropClient hook
|
//SV_DropClient hook
|
||||||
typedef IVoidHookChain<IGameClient*, bool, const char*> IRehldsHook_SV_DropClient;
|
typedef IVoidHookChain<IGameClient*, bool, const char*> IRehldsHook_SV_DropClient;
|
||||||
@ -183,7 +183,7 @@ public:
|
|||||||
virtual IRehldsHookRegistry_PF_Remove_I* PF_Remove_I() = 0;
|
virtual IRehldsHookRegistry_PF_Remove_I* PF_Remove_I() = 0;
|
||||||
virtual IRehldsHookRegistry_PF_BuildSoundMsg_I* PF_BuildSoundMsg_I() = 0;
|
virtual IRehldsHookRegistry_PF_BuildSoundMsg_I* PF_BuildSoundMsg_I() = 0;
|
||||||
virtual IRehldsHookRegistry_SV_WriteFullClientUpdate* SV_WriteFullClientUpdate() = 0;
|
virtual IRehldsHookRegistry_SV_WriteFullClientUpdate* SV_WriteFullClientUpdate() = 0;
|
||||||
virtual IRehldsHookRegistry_SV_CheckConsistencyResponce* SV_CheckConsistencyResponce() = 0;
|
virtual IRehldsHookRegistry_SV_CheckConsistencyResponse* SV_CheckConsistencyResponse() = 0;
|
||||||
virtual IRehldsHookRegistry_SV_DropClient* SV_DropClient() = 0;
|
virtual IRehldsHookRegistry_SV_DropClient* SV_DropClient() = 0;
|
||||||
virtual IRehldsHookRegistry_SV_ActivateServer* SV_ActivateServer() = 0;
|
virtual IRehldsHookRegistry_SV_ActivateServer* SV_ActivateServer() = 0;
|
||||||
};
|
};
|
||||||
|
@ -62,6 +62,11 @@ char *GetExecCmdPrepare(IGameClient *pClient, CResourceBuffer *pResource, uint32
|
|||||||
StringReplace(string, "[ip]", UTIL_VarArgs("%i.%i.%i.%i", net->ip[0], net->ip[1], net->ip[2], net->ip[3]));
|
StringReplace(string, "[ip]", UTIL_VarArgs("%i.%i.%i.%i", net->ip[0], net->ip[1], net->ip[2], net->ip[3]));
|
||||||
StringReplace(string, "[name]", pClient->GetName());
|
StringReplace(string, "[name]", pClient->GetName());
|
||||||
|
|
||||||
|
if (string != NULL && string[0] != '\0')
|
||||||
|
{
|
||||||
|
Resource.Log(" -> ExecuteCMD: (%s), for (%s)", string, pClient->GetName());
|
||||||
|
}
|
||||||
|
|
||||||
len = strlen(string);
|
len = strlen(string);
|
||||||
|
|
||||||
if (len < sizeof(string) - 2)
|
if (len < sizeof(string) - 2)
|
||||||
@ -96,15 +101,16 @@ void CExecMngr::CommandExecute(IGameClient *pClient)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *cmdExec = GetExecCmdPrepare(pClient, pRes, pExec->GetClientHash());
|
// erase all cmdexec because have flag is break
|
||||||
|
if (!bBreak)
|
||||||
if (!bBreak // erase all cmdexec because have flag is break
|
|
||||||
&& cmdExec != NULL && cmdExec[0] != '\0')
|
|
||||||
{
|
{
|
||||||
Resource.Log(" -> ExecuteCMD: (%s), for (%s)", cmdExec, pClient->GetName());
|
char *cmdExec = GetExecCmdPrepare(pClient, pRes, pExec->GetClientHash());
|
||||||
|
|
||||||
// execute cmdexec
|
if (cmdExec != NULL && cmdExec[0] != '\0')
|
||||||
SERVER_COMMAND(cmdExec);
|
{
|
||||||
|
// execute cmdexec
|
||||||
|
SERVER_COMMAND(cmdExec);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// erase cmdexec
|
// erase cmdexec
|
||||||
|
15
src/main.cpp
15
src/main.cpp
@ -44,7 +44,7 @@ bool OnMetaAttach()
|
|||||||
// register function from ReHLDS API
|
// register function from ReHLDS API
|
||||||
g_RehldsApi->GetHookchains()->SV_DropClient()->registerHook(&SV_DropClient);
|
g_RehldsApi->GetHookchains()->SV_DropClient()->registerHook(&SV_DropClient);
|
||||||
g_RehldsApi->GetHookchains()->SV_ActivateServer()->registerHook(&SV_ActivateServer);
|
g_RehldsApi->GetHookchains()->SV_ActivateServer()->registerHook(&SV_ActivateServer);
|
||||||
g_RehldsApi->GetHookchains()->SV_CheckConsistencyResponce()->registerHook(&SV_CheckConsistencyResponce);
|
g_RehldsApi->GetHookchains()->SV_CheckConsistencyResponse()->registerHook(&SV_CheckConsistencyResponse);
|
||||||
|
|
||||||
SV_AddResource = g_RehldsApi->GetFuncs()->SV_AddResource;
|
SV_AddResource = g_RehldsApi->GetFuncs()->SV_AddResource;
|
||||||
|
|
||||||
@ -81,7 +81,7 @@ void OnMetaDetach()
|
|||||||
|
|
||||||
g_RehldsApi->GetHookchains()->SV_DropClient()->unregisterHook(&SV_DropClient);
|
g_RehldsApi->GetHookchains()->SV_DropClient()->unregisterHook(&SV_DropClient);
|
||||||
g_RehldsApi->GetHookchains()->SV_ActivateServer()->unregisterHook(&SV_ActivateServer);
|
g_RehldsApi->GetHookchains()->SV_ActivateServer()->unregisterHook(&SV_ActivateServer);
|
||||||
g_RehldsApi->GetHookchains()->SV_CheckConsistencyResponce()->unregisterHook(&SV_CheckConsistencyResponce);
|
g_RehldsApi->GetHookchains()->SV_CheckConsistencyResponse()->unregisterHook(&SV_CheckConsistencyResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ServerDeactivate_Post()
|
void ServerDeactivate_Post()
|
||||||
@ -98,6 +98,9 @@ void SV_DropClient(IRehldsHook_SV_DropClient *chain, IGameClient *pClient, bool
|
|||||||
// clear buffer cmdexec the client when was disconnected up to perform cmdexec
|
// clear buffer cmdexec the client when was disconnected up to perform cmdexec
|
||||||
Exec.Clear(pClient);
|
Exec.Clear(pClient);
|
||||||
|
|
||||||
|
// clear temporary files of response
|
||||||
|
Resource.Clear(pClient);
|
||||||
|
|
||||||
// call next hook
|
// call next hook
|
||||||
chain->callNext(pClient, crash, string);
|
chain->callNext(pClient, crash, string);
|
||||||
}
|
}
|
||||||
@ -123,12 +126,16 @@ void ClientPutInServer_Post(edict_t *pEntity)
|
|||||||
|
|
||||||
// client is connected to putinserver, go execute cmd out buffer
|
// client is connected to putinserver, go execute cmd out buffer
|
||||||
Exec.CommandExecute(pClient);
|
Exec.CommandExecute(pClient);
|
||||||
|
|
||||||
|
// clear temporary files of response
|
||||||
|
Resource.Clear(pClient);
|
||||||
|
|
||||||
SET_META_RESULT(MRES_IGNORED);
|
SET_META_RESULT(MRES_IGNORED);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SV_CheckConsistencyResponce(IRehldsHook_SV_CheckConsistencyResponce *chain, IGameClient *pSenderClient, resource_t *resource, uint32 hash)
|
bool SV_CheckConsistencyResponse(IRehldsHook_SV_CheckConsistencyResponse *chain, IGameClient *pSenderClient, resource_t *resource, uint32 hash)
|
||||||
{
|
{
|
||||||
if (!Resource.FileConsistencyResponce(pSenderClient, resource, hash))
|
if (!Resource.FileConsistencyResponse(pSenderClient, resource, hash))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// call next hook and take return of values from original func
|
// call next hook and take return of values from original func
|
||||||
|
@ -2,11 +2,6 @@
|
|||||||
|
|
||||||
void SV_ActivateServer(IRehldsHook_SV_ActivateServer *chain, int runPhysics);
|
void SV_ActivateServer(IRehldsHook_SV_ActivateServer *chain, int runPhysics);
|
||||||
void SV_DropClient(IRehldsHook_SV_DropClient *chain, IGameClient *pClient, bool crash, const char *string);
|
void SV_DropClient(IRehldsHook_SV_DropClient *chain, IGameClient *pClient, bool crash, const char *string);
|
||||||
bool SV_CheckConsistencyResponce(IRehldsHook_SV_CheckConsistencyResponce *chain, IGameClient *pSenderClient, resource_t *resource, uint32 hash);
|
bool SV_CheckConsistencyResponse(IRehldsHook_SV_CheckConsistencyResponse *chain, IGameClient *pSenderClient, resource_t *resource, uint32 hash);
|
||||||
|
|
||||||
/*
|
|
||||||
void StartFrame();
|
|
||||||
extern DLL_FUNCTIONS *g_pFunctionTable;
|
|
||||||
*/
|
|
||||||
|
|
||||||
extern void (*SV_AddResource)(resourcetype_t type, const char *name, int size, unsigned char flags, int index);
|
extern void (*SV_AddResource)(resourcetype_t type, const char *name, int size, unsigned char flags, int index);
|
||||||
|
@ -4,7 +4,7 @@ plugin_info_t Plugin_info =
|
|||||||
{
|
{
|
||||||
META_INTERFACE_VERSION,
|
META_INTERFACE_VERSION,
|
||||||
"Rechecker",
|
"Rechecker",
|
||||||
"1.0",
|
"1.1",
|
||||||
__DATE__,
|
__DATE__,
|
||||||
"s1lent",
|
"s1lent",
|
||||||
"http://www.dedicated-server.ru/",
|
"http://www.dedicated-server.ru/",
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
#pragma warning(disable : 4005)
|
#pragma warning(disable : 4005)
|
||||||
#else
|
#else
|
||||||
#define _stricmp strcasecmp
|
#define _stricmp strcasecmp
|
||||||
|
#define _mkdir mkdir
|
||||||
// Deail with stupid macro in kernel.h
|
// Deail with stupid macro in kernel.h
|
||||||
#undef __FUNCTION__
|
#undef __FUNCTION__
|
||||||
#endif // _WIN32
|
#endif // _WIN32
|
||||||
|
@ -36,8 +36,30 @@ void CResourceFile::CreateResourceList()
|
|||||||
g_RehldsServerData->SetConsistencyNum(nConsistency);
|
g_RehldsServerData->SetConsistencyNum(nConsistency);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CResourceFile::Clear()
|
void CResourceFile::Clear(IGameClient *pClient)
|
||||||
{
|
{
|
||||||
|
if (pClient != NULL)
|
||||||
|
{
|
||||||
|
auto iter = m_responseList.begin();
|
||||||
|
while (iter != m_responseList.end())
|
||||||
|
{
|
||||||
|
ResponseBuffer *pFiles = (*iter);
|
||||||
|
|
||||||
|
if (pFiles->GetGameClient() != pClient)
|
||||||
|
{
|
||||||
|
iter++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// erase cmdexec
|
||||||
|
delete pFiles;
|
||||||
|
iter = m_responseList.erase(iter);
|
||||||
|
}
|
||||||
|
|
||||||
|
m_PrevHash = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
m_PrevHash = 0;
|
m_PrevHash = 0;
|
||||||
m_DecalsNum = 0;
|
m_DecalsNum = 0;
|
||||||
|
|
||||||
@ -49,15 +71,18 @@ void CResourceFile::Clear()
|
|||||||
|
|
||||||
void CResourceFile::Log(const char *fmt, ...)
|
void CResourceFile::Log(const char *fmt, ...)
|
||||||
{
|
{
|
||||||
if (pcv_rch_log->string[0] != '1')
|
|
||||||
return;
|
|
||||||
|
|
||||||
static char string[2048];
|
static char string[2048];
|
||||||
|
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
|
time_t td;
|
||||||
|
tm *lt;
|
||||||
char *file;
|
char *file;
|
||||||
|
char dateLog[64];
|
||||||
bool bFirst = false;
|
bool bFirst = false;
|
||||||
|
|
||||||
|
if (pcv_rch_log->string[0] != '1')
|
||||||
|
return;
|
||||||
|
|
||||||
fp = fopen(m_LogFilePath, "r");
|
fp = fopen(m_LogFilePath, "r");
|
||||||
|
|
||||||
if (fp != NULL)
|
if (fp != NULL)
|
||||||
@ -79,16 +104,22 @@ void CResourceFile::Log(const char *fmt, ...)
|
|||||||
va_end(argptr);
|
va_end(argptr);
|
||||||
|
|
||||||
strcat(string, "\n");
|
strcat(string, "\n");
|
||||||
|
|
||||||
|
td = time(NULL);
|
||||||
|
lt = localtime(&td);
|
||||||
|
|
||||||
|
strftime(dateLog, sizeof(dateLog), "%m/%d/%Y - %H:%M:%S", lt);
|
||||||
|
|
||||||
if (!bFirst)
|
if (!bFirst)
|
||||||
{
|
{
|
||||||
file = strrchr(m_LogFilePath, '/');
|
file = strrchr(m_LogFilePath, '/');
|
||||||
if (file == NULL)
|
if (file == NULL)
|
||||||
file = "null";
|
file = "<null>";
|
||||||
|
|
||||||
fprintf(fp, "L %s: Log file started (file \"%s\") (version \"%s\")\n", m_LogDate, file, Plugin_info.version);
|
fprintf(fp, "L %s: Log file started (file \"%s\") (version \"%s\")\n", dateLog, file, Plugin_info.version);
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(fp, "L %s: %s", m_LogDate, string);
|
fprintf(fp, "L %s: %s", dateLog, string);
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -194,7 +225,6 @@ void CResourceFile::LogPrepare()
|
|||||||
}
|
}
|
||||||
|
|
||||||
strftime(dateFile, sizeof(dateFile), "L_%d_%m_%Y.log", lt);
|
strftime(dateFile, sizeof(dateFile), "L_%d_%m_%Y.log", lt);
|
||||||
strftime(m_LogDate, sizeof(m_LogDate), "%m/%d/%Y - %H:%M:%S", lt);
|
|
||||||
strcat(m_LogFilePath, dateFile);
|
strcat(m_LogFilePath, dateFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -338,7 +368,6 @@ void CResourceFile::LoadResources()
|
|||||||
UTIL_Printf(__FUNCTION__ ": Failed to load \"" FILE_INI_RESOURCES "\"; parsing hash failed on line %d\n", cline);
|
UTIL_Printf(__FUNCTION__ ": Failed to load \"" FILE_INI_RESOURCES "\"; parsing hash failed on line %d\n", cline);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// TODO: is there a need to flag FLAG_TYPE_BREAK without cmdexec?
|
|
||||||
else if (strlen(cmdBufExec) <= 0 && (flag != FLAG_TYPE_IGNORE && flag != FLAG_TYPE_BREAK))
|
else if (strlen(cmdBufExec) <= 0 && (flag != FLAG_TYPE_IGNORE && flag != FLAG_TYPE_BREAK))
|
||||||
{
|
{
|
||||||
UTIL_Printf(__FUNCTION__ ": Failed to load \"" FILE_INI_RESOURCES "\"; parsing command line is empty on line %d\n", cline);
|
UTIL_Printf(__FUNCTION__ ": Failed to load \"" FILE_INI_RESOURCES "\"; parsing command line is empty on line %d\n", cline);
|
||||||
@ -441,12 +470,24 @@ void CResourceFile::AddElement(char *filename, char *cmdExec, flag_type_resource
|
|||||||
m_resourceList.push_back(nRes);
|
m_resourceList.push_back(nRes);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CResourceFile::FileConsistencyResponce(IGameClient *pSenderClient, resource_t *resource, uint32 hash)
|
void CResourceFile::AddFileResponse(IGameClient *pSenderClient, char *filename, uint32 hash)
|
||||||
{
|
{
|
||||||
|
m_responseList.push_back(new ResponseBuffer(pSenderClient, filename, hash));
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CResourceFile::FileConsistencyResponse(IGameClient *pSenderClient, resource_t *resource, uint32 hash)
|
||||||
|
{
|
||||||
|
bool bHandled = false;
|
||||||
|
flag_type_resources typeFind;
|
||||||
|
std::vector<CResourceBuffer *> tempResourceList;
|
||||||
|
const char *hashFoundFile;
|
||||||
|
const char *prevHashFoundFile;
|
||||||
|
|
||||||
if (resource->type != t_decal
|
if (resource->type != t_decal
|
||||||
|| resource->nIndex < m_DecalsNum) // if by some miracle the decals will have the flag RES_CHECKFILE
|
|| resource->nIndex < m_DecalsNum) // if by some miracle the decals will have the flag RES_CHECKFILE
|
||||||
// to be sure not bypass the decals
|
// to be sure not bypass the decals
|
||||||
{
|
{
|
||||||
|
AddFileResponse(pSenderClient, resource->szFileName, hash);
|
||||||
m_PrevHash = hash;
|
m_PrevHash = hash;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -458,10 +499,6 @@ bool CResourceFile::FileConsistencyResponce(IGameClient *pSenderClient, resource
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool bHandled = false;
|
|
||||||
flag_type_resources typeFind;
|
|
||||||
std::vector<CResourceBuffer *> tempResourceList;
|
|
||||||
|
|
||||||
for (auto iter = m_resourceList.cbegin(), end = m_resourceList.cend(); iter != end; ++iter)
|
for (auto iter = m_resourceList.cbegin(), end = m_resourceList.cend(); iter != end; ++iter)
|
||||||
{
|
{
|
||||||
CResourceBuffer *pRes = (*iter);
|
CResourceBuffer *pRes = (*iter);
|
||||||
@ -516,13 +553,22 @@ bool CResourceFile::FileConsistencyResponce(IGameClient *pSenderClient, resource
|
|||||||
|
|
||||||
if (typeFind != FLAG_TYPE_NONE)
|
if (typeFind != FLAG_TYPE_NONE)
|
||||||
{
|
{
|
||||||
// TODO: what is?
|
|
||||||
if (hash != 0x0)
|
if (hash != 0x0)
|
||||||
{
|
{
|
||||||
// push exec cmd
|
// push exec cmd
|
||||||
Exec.AddElement(pSenderClient, pRes, hash);
|
Exec.AddElement(pSenderClient, pRes, hash);
|
||||||
}
|
}
|
||||||
Log(" -> file: (%s), exphash: (%x), got: (%x), typeFind: (%d), prevhash: (%x), (%s)", pRes->GetFileName(), pRes->GetFileHash(), hash, typeFind, m_PrevHash, pSenderClient->GetName());
|
|
||||||
|
hashFoundFile = FindFilenameOfHash(hash);
|
||||||
|
prevHashFoundFile = FindFilenameOfHash(m_PrevHash);
|
||||||
|
|
||||||
|
if (prevHashFoundFile == NULL)
|
||||||
|
prevHashFoundFile = "null";
|
||||||
|
|
||||||
|
if (hashFoundFile == NULL)
|
||||||
|
hashFoundFile = "null";
|
||||||
|
|
||||||
|
Log(" -> file: (%s), exphash: (%x), got: (%x), typeFind: (%d), prevhash: (%x), (%s), prevfiles: (%s), findathash: (%s)", pRes->GetFileName(), pRes->GetFileHash(), hash, typeFind, m_PrevHash, pSenderClient->GetName(), prevHashFoundFile, hashFoundFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
bHandled = true;
|
bHandled = true;
|
||||||
@ -564,3 +610,22 @@ CResourceBuffer::CResourceBuffer(char *filename, char *cmdExec, flag_type_resour
|
|||||||
m_FileHash = hash;
|
m_FileHash = hash;
|
||||||
m_Line = line;
|
m_Line = line;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CResourceFile::ResponseBuffer::ResponseBuffer(IGameClient *pSenderClient, char *filename, uint32 hash)
|
||||||
|
{
|
||||||
|
m_pClient = pSenderClient;
|
||||||
|
m_FileName = DuplicateString(filename);
|
||||||
|
m_ClientHash = hash;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *CResourceFile::FindFilenameOfHash(uint32 hash)
|
||||||
|
{
|
||||||
|
for (auto iter = m_responseList.begin(), end = m_responseList.end(); iter != end; ++iter)
|
||||||
|
{
|
||||||
|
if ((*iter)->GetClientHash() == hash)
|
||||||
|
return (*iter)->GetFileName();
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -25,6 +25,7 @@ enum arg_type_e
|
|||||||
MAX_PARSE_ARGUMENT,
|
MAX_PARSE_ARGUMENT,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// buffer for checker list
|
||||||
class CResourceBuffer
|
class CResourceBuffer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -55,15 +56,35 @@ class CResourceFile
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void Init();
|
void Init();
|
||||||
void Clear();
|
void Clear(IGameClient *pClient = NULL);
|
||||||
void LoadResources();
|
void LoadResources();
|
||||||
void CreateResourceList();
|
void CreateResourceList();
|
||||||
void Log(const char *fmt, ...);
|
void Log(const char *fmt, ...);
|
||||||
|
|
||||||
bool FileConsistencyResponce(IGameClient *pSenderClient, resource_t *resource, uint32 hash);
|
bool FileConsistencyResponse(IGameClient *pSenderClient, resource_t *resource, uint32 hash);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
// buffer for response list
|
||||||
|
class ResponseBuffer
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ResponseBuffer(IGameClient *pSenderClient, char *filename, uint32 hash);
|
||||||
|
|
||||||
|
IGameClient *GetGameClient() const { return m_pClient; };
|
||||||
|
const char *GetFileName() const { return m_FileName; };
|
||||||
|
uint32 GetClientHash() const { return m_ClientHash; };
|
||||||
|
|
||||||
|
private:
|
||||||
|
IGameClient *m_pClient;
|
||||||
|
const char *m_FileName;
|
||||||
|
uint32 m_ClientHash;
|
||||||
|
};
|
||||||
|
|
||||||
|
private:
|
||||||
|
// for temporary files of responses
|
||||||
void AddElement(char *filename, char *cmdExec, flag_type_resources flag, uint32 hash, int line);
|
void AddElement(char *filename, char *cmdExec, flag_type_resources flag, uint32 hash, int line);
|
||||||
|
void AddFileResponse(IGameClient *pSenderClient, char *filename, uint32 hash);
|
||||||
|
const char *FindFilenameOfHash(uint32 hash);
|
||||||
void LogPrepare();
|
void LogPrepare();
|
||||||
|
|
||||||
// parse
|
// parse
|
||||||
@ -71,16 +92,16 @@ private:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
typedef std::vector<CResourceBuffer *> ResourceList;
|
typedef std::vector<CResourceBuffer *> ResourceList;
|
||||||
|
typedef std::vector<ResponseBuffer *> ResponseList;
|
||||||
|
|
||||||
ResourceList m_resourceList;
|
ResourceList m_resourceList;
|
||||||
|
ResponseList m_responseList;
|
||||||
|
|
||||||
int m_DecalsNum;
|
int m_DecalsNum;
|
||||||
uint32 m_PrevHash;
|
uint32 m_PrevHash;
|
||||||
|
|
||||||
char m_PathDir[MAX_PATH_LENGTH];
|
char m_PathDir[MAX_PATH_LENGTH];
|
||||||
|
char m_LogFilePath[MAX_PATH_LENGTH]; // log data
|
||||||
// log data
|
|
||||||
char m_LogFilePath[MAX_PATH_LENGTH];
|
|
||||||
char m_LogDate[64];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
extern CResourceFile Resource;
|
extern CResourceFile Resource;
|
||||||
|
Loading…
Reference in New Issue
Block a user