mirror of
https://github.com/rehlds/rehlds.git
synced 2025-02-27 14:01:18 +03:00
Added cvar syserror_logfile
Changed in some places rehlds_syserror on Sys_Error for log.
This commit is contained in:
parent
212e9638d6
commit
381a4c0ab2
@ -33,6 +33,7 @@ Archive's bin directory contains 2 subdirectories, 'bugfixed' and 'pure'
|
|||||||
Bugfixed version of rehlds contains an additional cvars:
|
Bugfixed version of rehlds contains an additional cvars:
|
||||||
<ul>
|
<ul>
|
||||||
<li>listipcfgfile <filename> // File for permanent ip bans. Default: listip.cfg
|
<li>listipcfgfile <filename> // File for permanent ip bans. Default: listip.cfg
|
||||||
|
<li>syserror_logfile <filename> // File for the system error log. Default: rehlds_error.log
|
||||||
<li>sv_auto_precache_sounds_in_models <1|0> // Automatically precache sounds attached to models. Deault: 0
|
<li>sv_auto_precache_sounds_in_models <1|0> // Automatically precache sounds attached to models. Deault: 0
|
||||||
<li>sv_delayed_spray_upload <1|0> // Upload custom sprays after entering the game instead of when connecting. It increases upload speed. Default: 0
|
<li>sv_delayed_spray_upload <1|0> // Upload custom sprays after entering the game instead of when connecting. It increases upload speed. Default: 0
|
||||||
<li>sv_echo_unknown_cmd <1|0> // Echo in the console when trying execute an uncknown command. Default: 0
|
<li>sv_echo_unknown_cmd <1|0> // Echo in the console when trying execute an uncknown command. Default: 0
|
||||||
|
@ -810,9 +810,11 @@ uint32 MSG_ReadBits(int numbits)
|
|||||||
{
|
{
|
||||||
uint32 result;
|
uint32 result;
|
||||||
|
|
||||||
|
#ifdef REHLDS_FIXES
|
||||||
if (numbits > 32) {
|
if (numbits > 32) {
|
||||||
rehlds_syserror("%s: invalid numbits %d\n", __FUNCTION__, numbits);
|
Sys_Error(__FUNCTION__ ": invalid numbits %d\n", numbits);
|
||||||
}
|
}
|
||||||
|
#endif // REHLDS_FIXES
|
||||||
|
|
||||||
if (msg_badread)
|
if (msg_badread)
|
||||||
{
|
{
|
||||||
@ -2122,12 +2124,17 @@ unsigned char* EXT_FUNC COM_LoadFile(const char *path, int usehunk, int *pLength
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
#ifdef REHLDS_FIXES
|
||||||
|
FS_Close(hFile);
|
||||||
|
#endif
|
||||||
Sys_Error(__FUNCTION__ ": bad usehunk");
|
Sys_Error(__FUNCTION__ ": bad usehunk");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!buf)
|
if (!buf)
|
||||||
{
|
{
|
||||||
|
#ifdef REHLDS_FIXES
|
||||||
FS_Close(hFile);
|
FS_Close(hFile);
|
||||||
|
#endif
|
||||||
Sys_Error(__FUNCTION__ ": not enough space for %s", path);
|
Sys_Error(__FUNCTION__ ": not enough space for %s", path);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2197,7 +2204,12 @@ NOXREF unsigned char *COM_LoadFileLimit(char *path, int pos, int cbmax, int *pcb
|
|||||||
|
|
||||||
len = FS_Size(hFile);
|
len = FS_Size(hFile);
|
||||||
if (len < pos)
|
if (len < pos)
|
||||||
Sys_Error("COM_LoadFileLimit: invalid seek position for %s", path);
|
{
|
||||||
|
#ifdef REHLDS_FIXES
|
||||||
|
FS_Close(hFile);
|
||||||
|
#endif
|
||||||
|
Sys_Error(__FUNCTION__ ": invalid seek position for %s", path);
|
||||||
|
}
|
||||||
|
|
||||||
FS_Seek(hFile, pos, FILESYSTEM_SEEK_HEAD);
|
FS_Seek(hFile, pos, FILESYSTEM_SEEK_HEAD);
|
||||||
|
|
||||||
@ -2215,7 +2227,12 @@ NOXREF unsigned char *COM_LoadFileLimit(char *path, int pos, int cbmax, int *pcb
|
|||||||
if (!buf)
|
if (!buf)
|
||||||
{
|
{
|
||||||
if (path)
|
if (path)
|
||||||
Sys_Error("COM_LoadFileLimit: not enough space for %s", path);
|
{
|
||||||
|
#ifdef REHLDS_FIXES
|
||||||
|
FS_Close(hFile);
|
||||||
|
#endif
|
||||||
|
Sys_Error(__FUNCTION__ ": not enough space for %s", path);
|
||||||
|
}
|
||||||
|
|
||||||
FS_Close(hFile);
|
FS_Close(hFile);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -78,7 +78,12 @@ void Draw_CacheWadInitFromFile(FileHandle_t hFile, int len, char *name, int cach
|
|||||||
|
|
||||||
FS_Read(&header, sizeof(wadinfo_t), 1, hFile);
|
FS_Read(&header, sizeof(wadinfo_t), 1, hFile);
|
||||||
if (*(uint32 *)header.identification != MAKEID('W', 'A', 'D', '3'))
|
if (*(uint32 *)header.identification != MAKEID('W', 'A', 'D', '3'))
|
||||||
|
{
|
||||||
|
#ifdef REHLDS_FIXES
|
||||||
|
FS_Close(hFile);
|
||||||
|
#endif
|
||||||
Sys_Error("Wad file %s doesn't have WAD3 id\n", name);
|
Sys_Error("Wad file %s doesn't have WAD3 id\n", name);
|
||||||
|
}
|
||||||
|
|
||||||
wad->lumps = (lumpinfo_s *)Mem_Malloc(len - header.infotableofs);
|
wad->lumps = (lumpinfo_s *)Mem_Malloc(len - header.infotableofs);
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ unsigned int DELTAJIT_GetFieldSize(delta_description_t* desc) {
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
rehlds_syserror("%s: Unknown delta field type %d", __FUNCTION__, desc->fieldType);
|
Sys_Error(__FUNCTION__ ": Unknown delta field type %d", desc->fieldType);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -54,15 +54,13 @@ void DELTAJIT_CreateDescription(delta_t* delta, deltajitdata_t &jitdesc) {
|
|||||||
numMemBlocks++;
|
numMemBlocks++;
|
||||||
}
|
}
|
||||||
|
|
||||||
//sanity checks & pre-clean
|
// sanity checks & pre-clean
|
||||||
if (numMemBlocks > DELTAJIT_MAX_BLOCKS) {
|
if (numMemBlocks > DELTAJIT_MAX_BLOCKS) {
|
||||||
rehlds_syserror("%s: numMemBlocks > DELTAJIT_MAX_BLOCKS (%d > %d)", __FUNCTION__, numMemBlocks, DELTAJIT_MAX_BLOCKS);
|
Sys_Error(__FUNCTION__ ": numMemBlocks > DELTAJIT_MAX_BLOCKS (%d > %d)", numMemBlocks, DELTAJIT_MAX_BLOCKS);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (delta->fieldCount > DELTAJIT_MAX_FIELDS) {
|
if (delta->fieldCount > DELTAJIT_MAX_FIELDS) {
|
||||||
rehlds_syserror("%s: fieldCount > DELTAJIT_MAX_FIELDS (%d > %d)", __FUNCTION__, delta->fieldCount, DELTAJIT_MAX_FIELDS);
|
Sys_Error(__FUNCTION__ ": fieldCount > DELTAJIT_MAX_FIELDS (%d > %d)", delta->fieldCount, DELTAJIT_MAX_FIELDS);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Q_memset(&jitdesc, 0, sizeof(jitdesc));
|
Q_memset(&jitdesc, 0, sizeof(jitdesc));
|
||||||
@ -678,8 +676,7 @@ CDeltaJit* DELTAJit_LookupDeltaJit(const char* callsite, delta_t *pFields) {
|
|||||||
#ifndef REHLDS_FIXES
|
#ifndef REHLDS_FIXES
|
||||||
// only for testing
|
// only for testing
|
||||||
if (!deltaJit) {
|
if (!deltaJit) {
|
||||||
rehlds_syserror("%s: JITted delta encoder not found for delta %p", callsite, pFields);
|
Sys_Error("%s: JITted delta encoder not found for delta %p", callsite, pFields);
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
#endif // REHLDS_FIXES
|
#endif // REHLDS_FIXES
|
||||||
|
|
||||||
|
@ -105,7 +105,7 @@ NOXREF void Host_EndGame(const char *message, ...)
|
|||||||
Q_vsnprintf(string, sizeof(string), message, argptr);
|
Q_vsnprintf(string, sizeof(string), message, argptr);
|
||||||
va_end(argptr);
|
va_end(argptr);
|
||||||
|
|
||||||
Con_DPrintf("Host_EndGame: %s\n", string);
|
Con_DPrintf(__FUNCTION__ ": %s\n", string);
|
||||||
|
|
||||||
oldn = g_pcls.demonum;
|
oldn = g_pcls.demonum;
|
||||||
|
|
||||||
@ -116,7 +116,7 @@ NOXREF void Host_EndGame(const char *message, ...)
|
|||||||
|
|
||||||
if (!g_pcls.state)
|
if (!g_pcls.state)
|
||||||
{
|
{
|
||||||
Sys_Error("Host_EndGame: %s\n", string);
|
Sys_Error(__FUNCTION__ ": %s\n", string);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (oldn != -1)
|
if (oldn != -1)
|
||||||
@ -143,7 +143,7 @@ void __declspec(noreturn) Host_Error(const char *error, ...)
|
|||||||
va_start(argptr, error);
|
va_start(argptr, error);
|
||||||
|
|
||||||
if (inerror)
|
if (inerror)
|
||||||
Sys_Error("Host_Error: recursively entered");
|
Sys_Error(__FUNCTION__ ": recursively entered");
|
||||||
|
|
||||||
inerror = TRUE;
|
inerror = TRUE;
|
||||||
SCR_EndLoadingPlaque();
|
SCR_EndLoadingPlaque();
|
||||||
@ -153,7 +153,7 @@ void __declspec(noreturn) Host_Error(const char *error, ...)
|
|||||||
if (g_psv.active && developer.value != 0.0 )
|
if (g_psv.active && developer.value != 0.0 )
|
||||||
CL_WriteMessageHistory(0, 0);
|
CL_WriteMessageHistory(0, 0);
|
||||||
|
|
||||||
Con_Printf("Host_Error: %s\n", string);
|
Con_Printf(__FUNCTION__ ": %s\n", string);
|
||||||
if (g_psv.active)
|
if (g_psv.active)
|
||||||
Host_ShutdownServer(FALSE);
|
Host_ShutdownServer(FALSE);
|
||||||
|
|
||||||
@ -164,7 +164,7 @@ void __declspec(noreturn) Host_Error(const char *error, ...)
|
|||||||
inerror = FALSE;
|
inerror = FALSE;
|
||||||
longjmp(host_abortserver, 1);
|
longjmp(host_abortserver, 1);
|
||||||
}
|
}
|
||||||
Sys_Error("Host_Error: %s\n", string);
|
Sys_Error(__FUNCTION__ ": %s\n", string);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* <35d12> ../engine/host.c:297 */
|
/* <35d12> ../engine/host.c:297 */
|
||||||
|
@ -1370,7 +1370,8 @@ qboolean SaveGameSlot(const char *pSaveName, const char *pSaveComment)
|
|||||||
Host_SaveAgeList(pSaveName, 1);
|
Host_SaveAgeList(pSaveName, 1);
|
||||||
|
|
||||||
pFile = FS_OpenPathID(name, "wb", "GAMECONFIG");
|
pFile = FS_OpenPathID(name, "wb", "GAMECONFIG");
|
||||||
tag = MAKEID('J','S','A','V');
|
|
||||||
|
tag = SAVEGAME_HEADER;
|
||||||
FS_Write(&tag, sizeof(int), 1, pFile);
|
FS_Write(&tag, sizeof(int), 1, pFile);
|
||||||
tag = SAVEGAME_VERSION;
|
tag = SAVEGAME_VERSION;
|
||||||
FS_Write(&tag, sizeof(int), 1, pFile);
|
FS_Write(&tag, sizeof(int), 1, pFile);
|
||||||
@ -1451,7 +1452,7 @@ int SaveReadHeader(FileHandle_t pFile, GAME_HEADER *pHeader, int readGlobalState
|
|||||||
SAVERESTOREDATA *pSaveData;
|
SAVERESTOREDATA *pSaveData;
|
||||||
|
|
||||||
FS_Read(&tag, sizeof(int), 1, pFile);
|
FS_Read(&tag, sizeof(int), 1, pFile);
|
||||||
if (tag != MAKEID('J','S','A','V'))
|
if (tag != SAVEGAME_HEADER)
|
||||||
{
|
{
|
||||||
FS_Close(pFile);
|
FS_Close(pFile);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1502,7 +1502,6 @@ void NET_SendPacket(netsrc_t sock, int length, void *data, const netadr_t& to)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
Sys_Error(__FUNCTION__ ": bad address type");
|
Sys_Error(__FUNCTION__ ": bad address type");
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NetadrToSockadr(&to, &addr);
|
NetadrToSockadr(&to, &addr);
|
||||||
|
@ -475,6 +475,7 @@ extern cvar_t logsdir;
|
|||||||
extern cvar_t bannedcfgfile;
|
extern cvar_t bannedcfgfile;
|
||||||
#ifdef REHLDS_FIXES
|
#ifdef REHLDS_FIXES
|
||||||
extern cvar_t listipcfgfile;
|
extern cvar_t listipcfgfile;
|
||||||
|
extern cvar_t syserror_logfile;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern decalname_t sv_decalnames[MAX_BASE_DECALS];
|
extern decalname_t sv_decalnames[MAX_BASE_DECALS];
|
||||||
|
@ -304,6 +304,7 @@ cvar_t sv_auto_precache_sounds_in_models = { "sv_auto_precache_sounds_in_models"
|
|||||||
cvar_t sv_delayed_spray_upload = { "sv_delayed_spray_upload", "0", 0, 0.0f, nullptr };
|
cvar_t sv_delayed_spray_upload = { "sv_delayed_spray_upload", "0", 0, 0.0f, nullptr };
|
||||||
cvar_t sv_rehlds_force_dlmax = { "sv_rehlds_force_dlmax", "0", 0, 0.0f, nullptr };
|
cvar_t sv_rehlds_force_dlmax = { "sv_rehlds_force_dlmax", "0", 0, 0.0f, nullptr };
|
||||||
cvar_t listipcfgfile = { "listipcfgfile", "listip.cfg", 0, 0.0f, nullptr };
|
cvar_t listipcfgfile = { "listipcfgfile", "listip.cfg", 0, 0.0f, nullptr };
|
||||||
|
cvar_t syserror_logfile = { "syserror_logfile", "rehlds_error.log", 0, 0.0f, nullptr };
|
||||||
cvar_t sv_rehlds_hull_centering = { "sv_rehlds_hull_centering", "0", 0, 0.0f, nullptr };
|
cvar_t sv_rehlds_hull_centering = { "sv_rehlds_hull_centering", "0", 0, 0.0f, nullptr };
|
||||||
cvar_t sv_rcon_condebug = { "sv_rcon_condebug", "1", 0, 1.0f, nullptr };
|
cvar_t sv_rcon_condebug = { "sv_rcon_condebug", "1", 0, 1.0f, nullptr };
|
||||||
cvar_t sv_rehlds_userinfo_transmitted_fields = { "sv_rehlds_userinfo_transmitted_fields", "", 0, 0.0f, nullptr };
|
cvar_t sv_rehlds_userinfo_transmitted_fields = { "sv_rehlds_userinfo_transmitted_fields", "", 0, 0.0f, nullptr };
|
||||||
@ -1854,7 +1855,6 @@ int EXT_FUNC SV_CheckProtocol_internal(netadr_t *adr, int nProtocol)
|
|||||||
if (adr == NULL)
|
if (adr == NULL)
|
||||||
{
|
{
|
||||||
Sys_Error(__FUNCTION__ ": Null address\n");
|
Sys_Error(__FUNCTION__ ": Null address\n");
|
||||||
return FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nProtocol == PROTOCOL_VERSION)
|
if (nProtocol == PROTOCOL_VERSION)
|
||||||
@ -7824,6 +7824,7 @@ void SV_Init(void)
|
|||||||
Cvar_RegisterVariable(&bannedcfgfile);
|
Cvar_RegisterVariable(&bannedcfgfile);
|
||||||
#ifdef REHLDS_FIXES
|
#ifdef REHLDS_FIXES
|
||||||
Cvar_RegisterVariable(&listipcfgfile);
|
Cvar_RegisterVariable(&listipcfgfile);
|
||||||
|
Cvar_RegisterVariable(&syserror_logfile);
|
||||||
#endif
|
#endif
|
||||||
Cvar_RegisterVariable(&sv_rcon_minfailures);
|
Cvar_RegisterVariable(&sv_rcon_minfailures);
|
||||||
Cvar_RegisterVariable(&sv_rcon_maxfailures);
|
Cvar_RegisterVariable(&sv_rcon_maxfailures);
|
||||||
|
@ -34,7 +34,6 @@ int(*Launcher_MP3subsys_Suspend_Audio)(void);
|
|||||||
void(*Launcher_MP3subsys_Resume_Audio)(void);
|
void(*Launcher_MP3subsys_Resume_Audio)(void);
|
||||||
void(*VID_FlipScreen)(void);
|
void(*VID_FlipScreen)(void);
|
||||||
|
|
||||||
|
|
||||||
//double curtime;
|
//double curtime;
|
||||||
//double lastcurtime;
|
//double lastcurtime;
|
||||||
//qboolean sc_return_on_enter;
|
//qboolean sc_return_on_enter;
|
||||||
@ -65,7 +64,6 @@ extensiondll_t g_rgextdll[50];
|
|||||||
int g_iextdllMac;
|
int g_iextdllMac;
|
||||||
modinfo_t gmodinfo;
|
modinfo_t gmodinfo;
|
||||||
qboolean gfBackground;
|
qboolean gfBackground;
|
||||||
//extern jmp_buf host_abortserver;
|
|
||||||
//int starttime;
|
//int starttime;
|
||||||
//qboolean Win32AtLeastV4;
|
//qboolean Win32AtLeastV4;
|
||||||
//int lowshift;
|
//int lowshift;
|
||||||
@ -92,8 +90,6 @@ double g_PerfCounterSlice;
|
|||||||
double g_CurrentTime;
|
double g_CurrentTime;
|
||||||
double g_StartTime;
|
double g_StartTime;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int g_WinNTOrHigher;
|
int g_WinNTOrHigher;
|
||||||
#endif // _WIN32
|
#endif // _WIN32
|
||||||
|
|
||||||
@ -474,6 +470,26 @@ void __declspec(noreturn) Sys_Error(const char *error, ...)
|
|||||||
|
|
||||||
Log_Printf("FATAL ERROR (shutting down): %s\n", text);
|
Log_Printf("FATAL ERROR (shutting down): %s\n", text);
|
||||||
|
|
||||||
|
#ifdef REHLDS_FIXES
|
||||||
|
if (syserror_logfile.string[0] != '\0')
|
||||||
|
{
|
||||||
|
auto pFile = FS_Open(syserror_logfile.string, "a");
|
||||||
|
if (pFile)
|
||||||
|
{
|
||||||
|
tm *today;
|
||||||
|
time_t ltime;
|
||||||
|
char szDate[32];
|
||||||
|
|
||||||
|
time(<ime);
|
||||||
|
today = localtime(<ime);
|
||||||
|
strftime(szDate, ARRAYSIZE(szDate) - 1, "L %d/%m/%Y - %H:%M:%S:", today);
|
||||||
|
|
||||||
|
FS_FPrintf(pFile, "%s (map \"%s\") %s\n", szDate, &pr_strings[gGlobalVariables.mapname], text);
|
||||||
|
FS_Close(pFile);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif // REHLDS_FIXES
|
||||||
|
|
||||||
if (g_bIsDedicatedServer)
|
if (g_bIsDedicatedServer)
|
||||||
{
|
{
|
||||||
if (Launcher_ConsolePrintf)
|
if (Launcher_ConsolePrintf)
|
||||||
|
@ -189,6 +189,4 @@
|
|||||||
|
|
||||||
#define EXT_FUNC FORCE_STACK_ALIGN
|
#define EXT_FUNC FORCE_STACK_ALIGN
|
||||||
|
|
||||||
extern void __declspec(noreturn) rehlds_syserror(const char* fmt, ...);
|
|
||||||
|
|
||||||
#endif // _OSCONFIG_H
|
#endif // _OSCONFIG_H
|
||||||
|
@ -44,7 +44,7 @@ private:
|
|||||||
// this was a root node
|
// this was a root node
|
||||||
unsigned int rootId = GetRoodNodeId(node->key);
|
unsigned int rootId = GetRoodNodeId(node->key);
|
||||||
if (m_RootNodes[rootId] != node) {
|
if (m_RootNodes[rootId] != node) {
|
||||||
util_syserror("%s: invlid root node", __FUNCTION__);
|
Sys_Error(__FUNCTION__ ": invalid root node");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define SAVEFILE_HEADER MAKEID('V','A','L','V') // little-endian "VALV"
|
#define SAVEFILE_HEADER MAKEID('V','A','L','V') // little-endian "VALV"
|
||||||
|
#define SAVEGAME_HEADER MAKEID('J','S','A','V') // little-endian "JSAV"
|
||||||
#define SAVEGAME_VERSION 0x0071 // Version 0.71
|
#define SAVEGAME_VERSION 0x0071 // Version 0.71
|
||||||
|
|
||||||
#endif // SAVEGAME_VERSION_H
|
#endif // SAVEGAME_VERSION_H
|
||||||
|
@ -22,7 +22,7 @@ CRehldsFlightRecorder::CRehldsFlightRecorder() {
|
|||||||
m_DataRegion = (uint8*) sys_allocmem(DATA_REGION_SIZE);
|
m_DataRegion = (uint8*) sys_allocmem(DATA_REGION_SIZE);
|
||||||
|
|
||||||
if (!m_MetaRegion || !m_DataRegion) {
|
if (!m_MetaRegion || !m_DataRegion) {
|
||||||
rehlds_syserror("%s: direct allocation failed", __FUNCTION__);
|
Sys_Error(__FUNCTION__ ": direct allocation failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
//initialize meta region header
|
//initialize meta region header
|
||||||
@ -36,7 +36,7 @@ CRehldsFlightRecorder::CRehldsFlightRecorder() {
|
|||||||
metaPos += sizeof(recorder_state);
|
metaPos += sizeof(recorder_state);
|
||||||
|
|
||||||
if ((metaPos - (char*)m_MetaRegion) > META_REGION_HEADER) {
|
if ((metaPos - (char*)m_MetaRegion) > META_REGION_HEADER) {
|
||||||
rehlds_syserror("%s: Meta header overflow", __FUNCTION__);
|
Sys_Error(__FUNCTION__ ": Meta header overflow");
|
||||||
}
|
}
|
||||||
|
|
||||||
//initialize data region header
|
//initialize data region header
|
||||||
@ -48,7 +48,7 @@ CRehldsFlightRecorder::CRehldsFlightRecorder() {
|
|||||||
dataPos += sizeof(data_header);
|
dataPos += sizeof(data_header);
|
||||||
|
|
||||||
if ((dataPos - (char*)m_pDataHeader) > DATA_REGION_HEADER) {
|
if ((dataPos - (char*)m_pDataHeader) > DATA_REGION_HEADER) {
|
||||||
rehlds_syserror("%s: Data header overflow", __FUNCTION__);
|
Sys_Error(__FUNCTION__ ": Data header overflow");
|
||||||
}
|
}
|
||||||
|
|
||||||
InitHeadersContent();
|
InitHeadersContent();
|
||||||
@ -93,7 +93,7 @@ void CRehldsFlightRecorder::MoveToStart() {
|
|||||||
|
|
||||||
void CRehldsFlightRecorder::StartMessage(uint16 msg, bool entrance) {
|
void CRehldsFlightRecorder::StartMessage(uint16 msg, bool entrance) {
|
||||||
if (msg == 0 || msg > m_pMetaHeader->numMessages) {
|
if (msg == 0 || msg > m_pMetaHeader->numMessages) {
|
||||||
rehlds_syserror("%s: Invalid message id %u", __FUNCTION__, msg);
|
Sys_Error(__FUNCTION__ ": Invalid message id %u", msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (entrance) {
|
if (entrance) {
|
||||||
@ -101,7 +101,7 @@ void CRehldsFlightRecorder::StartMessage(uint16 msg, bool entrance) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (m_pRecorderState->curMessage != 0) {
|
if (m_pRecorderState->curMessage != 0) {
|
||||||
rehlds_syserror("%s: overlapping messages", __FUNCTION__);
|
Sys_Error(__FUNCTION__ ": overlapping messages");
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int sz = DATA_REGION_MAIN_SIZE - m_pRecorderState->wpos;
|
unsigned int sz = DATA_REGION_MAIN_SIZE - m_pRecorderState->wpos;
|
||||||
@ -121,7 +121,7 @@ void CRehldsFlightRecorder::EndMessage(uint16 msg, bool entrance) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (m_pRecorderState->curMessage != msg) {
|
if (m_pRecorderState->curMessage != msg) {
|
||||||
rehlds_syserror("%s: invalid message %u", __FUNCTION__, msg);
|
Sys_Error(__FUNCTION__ ": invalid message %u", msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int freeSz = DATA_REGION_MAIN_SIZE - m_pRecorderState->wpos;
|
unsigned int freeSz = DATA_REGION_MAIN_SIZE - m_pRecorderState->wpos;
|
||||||
@ -131,7 +131,7 @@ void CRehldsFlightRecorder::EndMessage(uint16 msg, bool entrance) {
|
|||||||
|
|
||||||
unsigned int msgSize = m_pRecorderState->wpos - m_pRecorderState->lastMsgBeginPos;
|
unsigned int msgSize = m_pRecorderState->wpos - m_pRecorderState->lastMsgBeginPos;
|
||||||
if (msgSize > MSG_MAX_SIZE) {
|
if (msgSize > MSG_MAX_SIZE) {
|
||||||
rehlds_syserror("%s: too big message %u; size%u", __FUNCTION__, msg, msgSize);
|
Sys_Error(__FUNCTION__ ": too big message %u; size %u", msg, msgSize);
|
||||||
}
|
}
|
||||||
*(uint16*)(m_DataRegionPtr + m_pRecorderState->wpos) = msgSize;
|
*(uint16*)(m_DataRegionPtr + m_pRecorderState->wpos) = msgSize;
|
||||||
m_pRecorderState->wpos += 2;
|
m_pRecorderState->wpos += 2;
|
||||||
@ -142,13 +142,13 @@ void CRehldsFlightRecorder::EndMessage(uint16 msg, bool entrance) {
|
|||||||
void CRehldsFlightRecorder::CheckSize(unsigned int wantToWriteLen) {
|
void CRehldsFlightRecorder::CheckSize(unsigned int wantToWriteLen) {
|
||||||
unsigned int msgSize = m_pRecorderState->wpos - m_pRecorderState->lastMsgBeginPos;
|
unsigned int msgSize = m_pRecorderState->wpos - m_pRecorderState->lastMsgBeginPos;
|
||||||
if (msgSize + wantToWriteLen > MSG_MAX_SIZE) {
|
if (msgSize + wantToWriteLen > MSG_MAX_SIZE) {
|
||||||
rehlds_syserror("%s: too big message %u; size%u", __FUNCTION__, m_pRecorderState->curMessage, msgSize);
|
Sys_Error(__FUNCTION__ ": too big message %u; size %u", m_pRecorderState->curMessage, msgSize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CRehldsFlightRecorder::WriteBuffer(const void* data, unsigned int len) {
|
void CRehldsFlightRecorder::WriteBuffer(const void* data, unsigned int len) {
|
||||||
if (m_pRecorderState->curMessage == 0) {
|
if (m_pRecorderState->curMessage == 0) {
|
||||||
rehlds_syserror("%s: Could not write, invalid state", __FUNCTION__);
|
Sys_Error(__FUNCTION__ ": Could not write, invalid state");
|
||||||
}
|
}
|
||||||
|
|
||||||
CheckSize(len);
|
CheckSize(len);
|
||||||
@ -207,7 +207,7 @@ void CRehldsFlightRecorder::WriteDouble(double v) {
|
|||||||
|
|
||||||
uint16 CRehldsFlightRecorder::RegisterMessage(const char* module, const char *message, unsigned int version, bool inOut) {
|
uint16 CRehldsFlightRecorder::RegisterMessage(const char* module, const char *message, unsigned int version, bool inOut) {
|
||||||
if (m_pMetaHeader->numMessages >= MSG_MAX_ID) {
|
if (m_pMetaHeader->numMessages >= MSG_MAX_ID) {
|
||||||
rehlds_syserror("%s: can't register message; limit exceeded", __FUNCTION__);
|
Sys_Error(__FUNCTION__ ": can't register message; limit exceeded");
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16 msgId = ++m_pMetaHeader->numMessages;
|
uint16 msgId = ++m_pMetaHeader->numMessages;
|
||||||
|
@ -79,7 +79,7 @@ private:
|
|||||||
template<typename T>
|
template<typename T>
|
||||||
void WritePrimitive(T v) {
|
void WritePrimitive(T v) {
|
||||||
if (m_pRecorderState->curMessage == 0) {
|
if (m_pRecorderState->curMessage == 0) {
|
||||||
rehlds_syserror("%s: Could not write, invalid state", __FUNCTION__);
|
Sys_Error(__FUNCTION__ ": Could not write, invalid state");
|
||||||
}
|
}
|
||||||
|
|
||||||
CheckSize(sizeof(T));
|
CheckSize(sizeof(T));
|
||||||
|
@ -40,7 +40,7 @@ public:
|
|||||||
IHookChainImpl(void** hooks, origfunc_t orig) : m_Hooks(hooks), m_OriginalFunc(orig)
|
IHookChainImpl(void** hooks, origfunc_t orig) : m_Hooks(hooks), m_OriginalFunc(orig)
|
||||||
{
|
{
|
||||||
if (orig == NULL)
|
if (orig == NULL)
|
||||||
rehlds_syserror("Non-void HookChain without original function.");
|
Sys_Error(__FUNCTION__ ": Non-void HookChain without original function.");
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ~IHookChainImpl() {}
|
virtual ~IHookChainImpl() {}
|
||||||
|
@ -121,3 +121,5 @@ public:
|
|||||||
static IReHLDSPlatform* get();
|
static IReHLDSPlatform* get();
|
||||||
static void set(IReHLDSPlatform* p);
|
static void set(IReHLDSPlatform* p);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
extern void __declspec(noreturn) rehlds_syserror(const char* fmt, ...);
|
||||||
|
@ -285,7 +285,7 @@ IGameClient* GetRehldsApiClient(client_t* cl)
|
|||||||
int idx = cl - g_psvs.clients;
|
int idx = cl - g_psvs.clients;
|
||||||
if (idx < 0 || idx >= g_psvs.maxclients)
|
if (idx < 0 || idx >= g_psvs.maxclients)
|
||||||
{
|
{
|
||||||
rehlds_syserror(__FUNCTION__": Invalid client index %d", idx);
|
Sys_Error(__FUNCTION__": Invalid client index %d", idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
return g_GameClients[idx];
|
return g_GameClients[idx];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user