2
0
mirror of https://github.com/rehlds/rehlds.git synced 2025-01-01 01:25:38 +03:00

Fixed issues found by Coverity in the engine

This commit is contained in:
dreamstalker 2015-06-24 22:53:29 +04:00
parent e4134d144a
commit 1463a1a2f8
23 changed files with 211 additions and 80 deletions

View File

@ -186,6 +186,11 @@ int COM_SizeofResourceList(resource_t *pList, resourceinfo_t *ri)
Q_memset(ri, 0, sizeof(*ri));
for (p = pList->pNext; p != pList; p = p->pNext)
{
#ifdef REHLDS_FIXES
//skip resources with invalid type
if (p->type >= rt_max)
continue;
#endif
nSize += p->nDownloadSize;
if (p->type != t_model || p->nIndex != 1)
{

View File

@ -822,6 +822,10 @@ uint32 MSG_ReadBits(int numbits)
{
uint32 result;
if (numbits > 32) {
rehlds_syserror("%s: invalid numbits %d\n", __FUNCTION__, numbits);
}
if (msg_badread)
{
result = 1;

View File

@ -212,7 +212,7 @@ void Draw_MiptexTexture(cachewad_t *wad, unsigned char *data)
tex->name[15] = 0;
}
#ifdef SWDS
if (pal[765] || pal[766] || pal[767] != -1)
if (pal[765] || pal[766] || pal[767] != 0xFF)
tex->name[0] = '}';
else
tex->name[0] = '{';
@ -224,7 +224,7 @@ void Draw_MiptexTexture(cachewad_t *wad, unsigned char *data)
pal[3 * i + 1] = texgammatable[pal[3 * i + 1] & 0xFF];
pal[3 * i + 2] = texgammatable[pal[3 * i + 2] & 0xFF];
}
if (pal[765] || pal[766] || pal[767] != -1)
if (pal[765] || pal[766] || pal[767] != 0xFF)
{
tex->name[0] = '}';
if (gfCustomBuild)
@ -313,7 +313,7 @@ NOXREF int Draw_DecalIndex(int id)
//Used hw -> CL_Restore
char tmp[32];
char *pName;
if (!decal_names[id])
if (!decal_names[id][0])
Sys_Error("Used decal #%d without a name\n", id);
pName = decal_names[id];
@ -481,8 +481,8 @@ void Decal_MergeInDecals(cachewad_t *pwad, const char *pathID)
pwad->basedirs = (char **)Mem_Malloc(sizeof(char *));
*decal_wad->basedirs = Mem_Strdup(pathID);
decal_wad->lumppathindices = (int *)Mem_Malloc(sizeof(int *) * decal_wad->cacheMax);
Q_memset(decal_wad->lumppathindices, 0, sizeof(int *) * decal_wad->cacheMax);
decal_wad->lumppathindices = (int *)Mem_Malloc(sizeof(int) * decal_wad->cacheMax);
Q_memset(decal_wad->lumppathindices, 0, sizeof(int) * decal_wad->cacheMax);
return;
}
@ -501,8 +501,8 @@ void Decal_MergeInDecals(cachewad_t *pwad, const char *pathID)
Draw_AllocateCacheSpace(final, final->cacheMax, 0);
final->pfnCacheBuild = decal_wad->pfnCacheBuild;
final->cacheExtra = decal_wad->cacheExtra;
final->lumppathindices = (int *)Mem_Malloc(sizeof(int *) * final->cacheMax);
Q_memset(final->lumppathindices, 0, sizeof(int *) * final->cacheMax);
final->lumppathindices = (int *)Mem_Malloc(sizeof(int) * final->cacheMax);
Q_memset(final->lumppathindices, 0, sizeof(int) * final->cacheMax);
final->numpaths = 2;
final->basedirs = (char **)Mem_Malloc(sizeof(char *) * 2);

View File

@ -10,8 +10,8 @@ uint32 DELTAJIT_CreateMask(int startBit, int endBit) {
if (endBit > 32) endBit = 32;
uint32 res = 0xFFFFFFFF;
res &= (0xFFFFFFFF << startBit);
res &= (0xFFFFFFFF >> (32 - endBit));
res &= startBit < 32 ? (0xFFFFFFFF << startBit) : 0;
res &= endBit > 0 ? (0xFFFFFFFF >> (32 - endBit)) : 0;
return res;
}
@ -102,7 +102,10 @@ void DELTAJIT_CreateDescription(delta_t* delta, deltajitdata_t &jitdesc) {
blockId++;
firstBlock = false;
}
blockField->last = true;
if (blockField) {
blockField->last = true;
}
}
}
@ -514,7 +517,7 @@ public:
private:
jitasm::Reg32 neededBits = ebx;
jitasm::Reg32 highestBit = ebp;
size_t highest_id;
size_t highest_id = 0;
};
CDeltaTestDeltaJIT::CDeltaTestDeltaJIT(deltajitdata_t *_jitdesc) : jitdesc(_jitdesc)
@ -607,6 +610,7 @@ CDeltaJit::CDeltaJit(delta_t* _delta, CDeltaClearMarkFieldsJIT* _cleanMarkCheckF
delta = _delta;
cleanMarkCheckFunc = _cleanMarkCheckFunc;
testDeltaFunc = _testDeltaFunc;
markedFieldsMaskSize = 0;
}
CDeltaJit::~CDeltaJit() {

View File

@ -325,7 +325,11 @@ int FileSystem_SetGameDirectory(const char *pDefaultDir, const char *pGameDir)
}
pchLang = CRehldsPlatformHolder::get()->SteamApps() ? CRehldsPlatformHolder::get()->SteamApps()->GetCurrentGameLanguage() : NULL;
Q_strncpy(language, pchLang ? pchLang : "english", sizeof(language));
Q_strncpy(language, pchLang ? pchLang : "english", ARRAYSIZE(language));
#ifdef REHLDS_CHECKS
language[ARRAYSIZE(language) - 1] = 0;
#endif
if (!g_bIsDedicatedServer && !IsGameSubscribed(pGameDir))
return 0;
@ -469,7 +473,10 @@ int FileSystem_AddFallbackGameDir(const char *pGameDir)
char language[128];
const char * pchLang = CRehldsPlatformHolder::get()->SteamApps() ? CRehldsPlatformHolder::get()->SteamApps()->GetCurrentGameLanguage() : NULL;
Q_strncpy(language, pchLang ? pchLang : "english", sizeof(language));
Q_strncpy(language, pchLang ? pchLang : "english", ARRAYSIZE(language));
#ifdef REHLDS_CHECKS
language[ARRAYSIZE(language) - 1] = 0;
#endif
if (strlen(language) != 0 && Q_stricmp(language, "english"))
{
@ -484,7 +491,13 @@ int FileSystem_AddFallbackGameDir(const char *pGameDir)
/* <28fd7> ../engine/filesystem.cpp:626 */
int FileSystem_Init(char *basedir, void *voidfilesystemFactory)
{
#ifdef REHLDS_CHECKS
Q_strncpy(s_pBaseDir, basedir, ARRAYSIZE(s_pBaseDir));
s_pBaseDir[ARRAYSIZE(s_pBaseDir) - 1] = 0;
#else
Q_strcpy(s_pBaseDir, basedir);
#endif
host_parms.basedir = s_pBaseDir;
if (FileSystem_LoadDLL((CreateInterfaceFn)voidfilesystemFactory))

View File

@ -339,7 +339,7 @@ void FS_Rename(const char *originalName, const char *newName)
char localPath[512];
char newPath[512];
if (FS_GetLocalPath(originalName, localPath, 512))
if (FS_GetLocalPath(originalName, localPath, ARRAYSIZE(localPath)))
{
Q_strcpy(newPath, localPath);
cut = strstr(newPath, originalName);
@ -347,7 +347,13 @@ void FS_Rename(const char *originalName, const char *newName)
if (cut)
{
*cut = 0;
#ifdef REHLDS_CHECKS
Q_strncat(newPath, newName, ARRAYSIZE(newPath) - strlen(newPath));
newPath[ARRAYSIZE(newPath) - 1] = 0;
#else
Q_strcat(newPath, newName);
#endif
rename(localPath, newPath);
}
}

View File

@ -52,12 +52,12 @@ typedef struct hash_pack_queue_s
struct hash_pack_queue_s *next;
} hash_pack_queue_t;
/* <29e0a> ../engine/hashpak.c:20 */
typedef struct hash_pack_entry_s
{
resource_t resource;
int nOffset;
int nFileLength;
/* <29e0a> ../engine/hashpak.c:20 */
typedef struct hash_pack_entry_s
{
resource_t resource;
int nOffset;
int nFileLength;
} hash_pack_entry_t;
/* <29e4e> ../engine/hashpak.c:27 */

View File

@ -233,7 +233,6 @@ void Host_Motd_f(void)
FileHandle_t pFile;
char *pFileList;
char *next;
char *now;
pFileList = motdfile.string;
if (*pFileList == '/' || Q_strstr(pFileList, ":") || Q_strstr(pFileList, "..") || Q_strstr(pFileList, "\\"))
@ -250,11 +249,12 @@ void Host_Motd_f(void)
length = FS_Size(pFile);
if (length > 0)
{
now = (char *)Mem_Malloc(length + 1);
if (now)
char* buf = (char *)Mem_Malloc(length + 1);
if (buf)
{
FS_Read(now, length, 1, pFile);
now[length] = 0;
FS_Read(buf, length, 1, pFile);
buf[length] = 0;
char* now = buf;
Con_Printf("motd:");
next = strchr(now, '\n');
while (next != NULL)
@ -264,9 +264,10 @@ void Host_Motd_f(void)
now = next + 1;
next = strchr(now, '\n');
}
if (now)
Con_Printf("%s\n", now);
Mem_Free(now);
Con_Printf("%s\n", now);
Mem_Free(buf);
}
}
FS_Close(pFile);
@ -555,9 +556,9 @@ void Host_Status_f(void)
client_t *client;
int seconds;
int minutes;
int hltv_slots;
int hltv_specs;
int hltv_delay;
int hltv_slots = 0;
int hltv_specs = 0;
int hltv_delay = 0;
char *val;
int hours;
int j;
@ -1034,7 +1035,11 @@ const char *Host_FindRecentSave(char *pNameBuf)
const char *findfn;
char basefilename[MAX_PATH];
int found;
#ifdef REHLDS_FIXES
int32 newest = 0;
#else
int32 newest;
#endif
int32 ft;
char szPath[MAX_PATH];
@ -1049,7 +1054,7 @@ const char *Host_FindRecentSave(char *pNameBuf)
{
Q_snprintf(szPath, sizeof(szPath), "%s%s", Host_SaveGameDirectory(), findfn);
ft = FS_GetFileTime(szPath);
if (ft > 0 && (!ft || newest < ft))
if (ft > 0 && (!found || newest < ft))
{
found = 1;
newest = ft;
@ -2563,7 +2568,7 @@ void Host_Say(qboolean teamonly)
for (j = 0, client = g_psvs.clients; j < g_psvs.maxclients; j++, client++)
{
if (!client || !client->active || !client->spawned || client->fakeclient)
if (!client->active || !client->spawned || client->fakeclient)
continue;
host_client = client;
@ -2630,7 +2635,7 @@ void Host_Tell_f(void)
p[Q_strlen(p) - 1] = 0;
}
j = sizeof(text) - 2 - Q_strlen(text);
j = ARRAYSIZE(text) - 2 - Q_strlen(text);
if (Q_strlen(p) > (unsigned int)j)
p[j] = 0;

View File

@ -1158,6 +1158,11 @@ void Netchan_CreateFileFragmentsFromBuffer(qboolean server, netchan_t *chan, con
else
rehlds_syserror(__FUNCTION__ "Reverse me: client-side code");
#ifdef REHLDS_FIXES
if (bCompressed) {
Mem_Free(pbuf);
}
#endif
return;
}
@ -1196,6 +1201,11 @@ void Netchan_CreateFileFragmentsFromBuffer(qboolean server, netchan_t *chan, con
p->next = wait;
}
#ifdef REHLDS_FIXES
if (bCompressed) {
Mem_Free(pbuf);
}
#endif
}
/* <66564> ../engine/net_chan.c:1500 */
@ -1224,28 +1234,24 @@ int Netchan_CreateFileFragments(qboolean server, netchan_t *chan, const char *fi
Q_snprintf(compressedfilename, sizeof compressedfilename, "%s.ztmp", filename);
compressedFileTime = FS_GetFileTime(compressedfilename);
if (compressedFileTime >= FS_GetFileTime(filename))
if (compressedFileTime >= FS_GetFileTime(filename) && (hfile = FS_Open(compressedfilename, "rb")))
{
hfile = FS_Open(compressedfilename, "rb");
if (hfile)
filesize = FS_Size(hfile);
FS_Close(hfile);
bCompressed = 1;
hfile = FS_Open(filename, "rb");
if (!hfile)
{
filesize = FS_Size(hfile);
FS_Close(hfile);
bCompressed = 1;
hfile = FS_Open(filename, "rb");
if (!hfile)
{
Con_Printf("Warning: Unable to open %s for transfer\n", filename);
return 0;
}
Con_Printf("Warning: Unable to open %s for transfer\n", filename);
return 0;
}
uncompressed_size = FS_Size(hfile);
if (uncompressed_size > sv_filetransfermaxsize.value)
{
FS_Close(hfile);
Con_Printf("Warning: File %s is too big to transfer from host %s\n", filename, NET_AdrToString(chan->remote_address));
return 0;
}
uncompressed_size = FS_Size(hfile);
if (uncompressed_size > sv_filetransfermaxsize.value)
{
FS_Close(hfile);
Con_Printf("Warning: File %s is too big to transfer from host %s\n", filename, NET_AdrToString(chan->remote_address));
return 0;
}
}
else
@ -1430,7 +1436,7 @@ qboolean Netchan_CopyFileFragments(netchan_t *chan)
char compressor[32];
fragbuf_s *n;
qboolean bCompressed;
size_t uncompressedSize;
unsigned int uncompressedSize;
if (!chan->incomingready[FRAG_FILE_STREAM])
@ -1456,7 +1462,16 @@ qboolean Netchan_CopyFileFragments(netchan_t *chan)
if (!Q_stricmp(compressor, "bz2"))
bCompressed = TRUE;
uncompressedSize = MSG_ReadLong();
uncompressedSize = (unsigned int)MSG_ReadLong();
#ifdef REHLDS_FIXES
if (uncompressedSize > 1024 * 64) {
Con_Printf("Received too large file (size=%u)\nFlushing input queue\n", uncompressedSize);
Netchan_FlushIncoming(chan, 1);
return FALSE;
}
#endif
if (Q_strlen(filename) <= 0)
{
Con_Printf("File fragment received with no filename\nFlushing input queue\n");
@ -1594,6 +1609,10 @@ qboolean Netchan_CopyFileFragments(netchan_t *chan)
{
Con_Printf("File open failed %s\n", filename);
Netchan_FlushIncoming(chan, 1);
#ifdef REHLDS_FIXES
Mem_Free(buffer);
#endif
return FALSE;
}

View File

@ -974,6 +974,10 @@ qboolean NET_QueuePacket(netsrc_t sock)
int err; // 1028
unsigned char buf[MAX_UDP_PACKET]; // 1029
#ifdef REHLDS_FIXES
ret = -1;
#endif
#ifdef _WIN32
for (protocol = 0; protocol < 2; protocol++)
#else
@ -1849,18 +1853,25 @@ void NET_GetLocalAddress(void)
else
{
if (Q_strcmp(ipname.string, "localhost"))
Q_strncpy(buff, ipname.string, 511);
Q_strncpy(buff, ipname.string, ARRAYSIZE(buff) - 1);
else
{
#ifdef _WIN32
CRehldsPlatformHolder::get()->gethostname(buff, 512);
CRehldsPlatformHolder::get()->gethostname(buff, ARRAYSIZE(buff));
#else
gethostname(buff, 512);
gethostname(buff, ARRAYSIZE(buff));
#endif // _WIN32
}
buff[511] = 0;
buff[ARRAYSIZE(buff) - 1] = 0;
#ifdef REHLDS_FIXES
//check if address is valid
if (NET_StringToAdr(buff, &net_local_adr))
{
#else
NET_StringToAdr(buff, &net_local_adr);
#endif
namelen = sizeof(address);
#ifdef _WIN32
if (CRehldsPlatformHolder::get()->getsockname((SOCKET)ip_sockets[NS_SERVER], (struct sockaddr *)&address, (socklen_t *)&namelen) == SOCKET_ERROR)
@ -1882,6 +1893,14 @@ void NET_GetLocalAddress(void)
Con_Printf("Server IP address %s\n", NET_AdrToString(net_local_adr));
Cvar_Set("net_address", va(NET_AdrToString(net_local_adr)));
}
#ifdef REHLDS_FIXES
}
else
{
Con_Printf("Could not get TCP/IP address, Invalid hostname '%s'\n", buff);
}
#endif
}
#ifdef _WIN32

View File

@ -481,8 +481,10 @@ msurface_t *SurfaceAtPoint(model_t *pModel, mnode_t *node, vec_t *start, vec_t *
if (surf)
return surf;
/* Unreachable code
if (t == s)
return NULL;
*/
for (int i = 0; i < node->numsurfaces; i++)
{
@ -2100,7 +2102,9 @@ void PF_MessageBegin_I(int msg_dest, int msg_type, const float *pOrigin, edict_t
gMsgOrigin[1] = pOrigin[1];
gMsgOrigin[2] = pOrigin[2];
}
Host_IsSinglePlayerGame();
//No idea why is it called here
//Host_IsSinglePlayerGame();
}
gMsgBuffer.flags = SIZEBUF_ALLOW_OVERFLOW;

View File

@ -167,7 +167,7 @@ NOXREF void R_AddToStudioCache(float frame, int sequence, const vec_t *angles, c
Q_memcpy(&cache_hull[nCurrentHull], pHulls, sizeof(hull_t) * numhulls);
Q_memcpy(&cache_planes[nCurrentPlane], studio_planes,sizeof(mplane_t) * 6 * numhulls);
Q_memcpy(&cache_hull_hitgroup[nCurrentHull], studio_hull_hitgroup, sizeof(int *) * numhulls);
Q_memcpy(&cache_hull_hitgroup[nCurrentHull], studio_hull_hitgroup, sizeof(int) * numhulls);
p->numhulls = numhulls;
@ -1150,8 +1150,11 @@ int R_GetStudioBounds(const char *filename, float *mins, float *maxs)
{
if (LittleLong(*(unsigned int *)pBuffer) == 'TSDI')
iret = R_StudioComputeBounds((unsigned char*)pBuffer, mins, maxs);
#ifndef REHLDS_FIXES
//wrong release memory code
else
COM_FreeFile(pBuffer);
#endif
}
if (usingReadBuffer)

View File

@ -3385,7 +3385,7 @@ void SV_ConnectionlessPacket(void)
else if (!Q_stricmp(c, "log"))
{
if (sv_logrelay.value != 0.0f && args && Q_strlen(args) > 4)
if (sv_logrelay.value != 0.0f && Q_strlen(args) > 4)
{
const char *s = &args[Q_strlen("log ")];
if (s && s[0])
@ -3515,7 +3515,7 @@ qboolean SV_FilterPacket(void)
else
{
if (i < numipfilters - 1)
Q_memcpy(curFilter, &curFilter[1], sizeof(ipfilter_t) * (numipfilters - i - 1));
memmove(curFilter, &curFilter[1], sizeof(ipfilter_t) * (numipfilters - i - 1));
--numipfilters;
}
@ -4307,7 +4307,9 @@ qboolean SV_ShouldUpdatePing(client_t *client)
return 1;
}
SV_CalcPing(client);
//useless call
//SV_CalcPing(client);
return client->lastcmd.buttons & 0x8000;
}
@ -6466,9 +6468,7 @@ qboolean IsSafeFileToDownload(const char *filename)
char lwrfilename[MAX_PATH];
if (!filename)
{
return FALSE;
}
#ifdef REHLDS_FIXES
// FIXED: Allow to download customizations
@ -6479,7 +6479,10 @@ qboolean IsSafeFileToDownload(const char *filename)
#endif // REHLDS_FIXES
// Convert to lower case
Q_strncpy(lwrfilename, filename, sizeof(lwrfilename));
Q_strncpy(lwrfilename, filename, ARRAYSIZE(lwrfilename));
#ifdef REHLDS_CHECKS
lwrfilename[ARRAYSIZE(lwrfilename) - 1] = 0;
#endif
Q_strlwr(lwrfilename);
first = Q_strchr(lwrfilename, '.');

View File

@ -52,8 +52,10 @@ const char *PM_SV_TraceTexture(int ground, vec_t *vstart, vec_t *vend)
return NULL;
edict_t *pent = &g_psv.edicts[pe->info];
/* Unreachable code
if (!pent)
return NULL;
*/
return TraceTexture(pent, vstart, vend);
}

View File

@ -2,6 +2,11 @@
class CServerRemoteAccess g_ServerRemoteAccess;
CServerRemoteAccess::CServerRemoteAccess() {
m_iBytesSent = 0;
m_iBytesReceived = 0;
}
void CServerRemoteAccess::WriteDataRequest(const void *buffer, int bufferSize)
{
WriteDataRequest_noVirt(buffer, bufferSize);
@ -153,11 +158,20 @@ void CServerRemoteAccess::GetMapList(CUtlBuffer &value)
Q_strcpy(mapwild, "maps/*.bsp");
for (findfn = Sys_FindFirst(mapwild, 0); findfn; findfn = Sys_FindNext(0))
{
Q_snprintf(curDir, MAX_PATH, "maps/%s", findfn);
FS_GetLocalPath(curDir, curDir, MAX_PATH);
Q_snprintf(curDir, ARRAYSIZE(curDir), "maps/%s", findfn);
#ifdef REHLDS_CHECKS
curDir[ARRAYSIZE(curDir) - 1] = 0;
#endif
FS_GetLocalPath(curDir, curDir, ARRAYSIZE(curDir));
if (Q_strstr(curDir, com_gamedir))
{
#ifdef REHLDS_CHECKS
Q_strncpy(mapName, findfn, ARRAYSIZE(mapName));
mapName[ARRAYSIZE(mapName) - 1] = 0;
#else
Q_strcpy(mapName, findfn);
#endif
extension = Q_strstr(mapName, ".bsp");
if (extension)
*extension = 0;

View File

@ -46,6 +46,7 @@ private:
int m_iBytesReceived;
public:
CServerRemoteAccess();
virtual ~CServerRemoteAccess() { }

View File

@ -183,22 +183,28 @@ void CSteam3Server::OnGSClientApprove(GSClientApprove_t *pGSClientSteam2Accept)
if (!cl)
return;
char msg[256];
if (SV_FilterUser(&cl->network_userid))
{
char msg[256];
Q_sprintf(msg, "You have been banned from this server\n");
SV_RejectConnection(&cl->netchan.remote_address, msg);
SV_DropClient(cl, 0, "STEAM UserID %s is in server ban list\n", SV_GetClientIDString(cl));
}
else if (SV_CheckForDuplicateSteamID(cl) != -1)
{
char msg[256];
Q_sprintf(msg, "Your UserID is already in use on this server.\n");
SV_RejectConnection(&cl->netchan.remote_address, msg);
SV_DropClient(cl, 0, "STEAM UserID %s is already\nin use on this server\n", SV_GetClientIDString(cl));
}
else
{
Q_snprintf(msg, 0x200u, "\"%s<%i><%s><>\" STEAM USERID validated\n", cl->name, cl->userid, SV_GetClientIDString(cl));
char msg[512];
Q_snprintf(msg, ARRAYSIZE(msg), "\"%s<%i><%s><>\" STEAM USERID validated\n", cl->name, cl->userid, SV_GetClientIDString(cl));
#ifdef REHLDS_CHECKS
msg[ARRAYSIZE(msg) - 1] = 0;
#endif
Con_DPrintf("%s", msg);
Log_Printf("%s", msg);
}
@ -241,6 +247,9 @@ CSteam3Server::CSteam3Server(void) :
m_CallbackLogonFailure(this, &CSteam3Server::OnLogonFailure),
m_SteamIDGS(1, 0, k_EUniverseInvalid, k_EAccountTypeInvalid)
{
m_bHasActivePlayers = false;
m_bWantToBeSecure = false;
m_bLanOnly = false;
}
/* <ee234> ../engine/sv_steam3.cpp:375 */
@ -821,7 +830,8 @@ uint64 Steam_GSGetSteamID()
/* <f1d2a> ../engine/sv_steam3.cpp:1031 */
qboolean Steam_GSBSecure(void)
{
Steam3Server();
//useless call
//Steam3Server();
return CRehldsPlatformHolder::get()->SteamGameServer()->BSecure();
}

View File

@ -126,6 +126,9 @@ void Sys_GetCDKey(char *pszCDKey, int *nLength, int *bDedicated)
else
{
CRC32_t crc;
#ifdef REHLDS_FIXES
crc = 0;
#endif
CRC32_ProcessBuffer(&crc, hostname, Q_strlen(hostname));
Q_snprintf(key, sizeof(key), "%u", crc);
}
@ -617,6 +620,7 @@ IBaseInterface *CreateCEngineAPI(void)
InterfaceReg g_CreateCEngineAPI = InterfaceReg(CreateCEngineAPI, "VENGINE_LAUNCHER_API_VERSION002");
/* <908b7> ../engine/sys_dll2.cpp:1070 */
/* Needs rechecking
NOXREF int BuildMapCycleListHints(char **hints)
{
char szMap[262];
@ -683,6 +687,7 @@ NOXREF int BuildMapCycleListHints(char **hints)
Q_strcat(*hints, szMap);
return 1;
}
*/
bool CDedicatedServerAPI::Init(char *basedir, char *cmdline, CreateInterfaceFn launcherFactory, CreateInterfaceFn filesystemFactory)
{
@ -695,7 +700,12 @@ bool CDedicatedServerAPI::Init_noVirt(char *basedir, char *cmdline, CreateInterf
if (!dedicated_)
return false;
#ifdef REHLDS_CHECKS
Q_strncpy(this->m_OrigCmd, cmdline, ARRAYSIZE(this->m_OrigCmd));
this->m_OrigCmd[ARRAYSIZE(this->m_OrigCmd) - 1] = 0;
#else
Q_strcpy(this->m_OrigCmd, cmdline);
#endif
if (!strstr(cmdline, "-nobreakpad"))
{
CRehldsPlatformHolder::get()->SteamAPI_UseBreakpadCrashHandler(va("%d", build_number()), "Aug 8 2013", "11:17:26", 0, 0, 0);

View File

@ -120,7 +120,9 @@ void Sys_ShutdownGame(void);
void ClearIOStates(void);
NOBODY class IBaseInterface *__CreateCEngineAPIIEngineAPI_interface(void);
NOXREF int BuildMapCycleListHints(char **hints);
// Needs rechecking
//NOXREF int BuildMapCycleListHints(char **hints);
NOBODY class IBaseInterface *__CreateCDedicatedServerAPIIDedicatedServerAPI_interface(void);
NOBODY void _GLOBAL__sub_I_D_SurfaceCacheForRes(void);

View File

@ -54,6 +54,10 @@ CEngine::CEngine()
m_nTrapKey = 0;
m_nTrapButtons = 0;
m_nQuitting = QUIT_NOTQUITTING;
#ifdef REHLDS_FIXES
m_fCurTime = 0.0;
#endif
}
/* <95a38> ../engine/sys_engine.cpp:164 */

View File

@ -1128,18 +1128,18 @@ void SV_SingleClipMoveToEntity(edict_t *ent, const vec_t *start, const vec_t *mi
if (rotated)
{
vec3_t right;
vec3_t forward;
vec3_t up;
vec3_t forward;
vec3_t temp;
AngleVectorsTranspose(ent->v.angles, up, right, forward);
AngleVectorsTranspose(ent->v.angles, forward, right, up);
temp[0] = trace->plane.normal[0];
temp[1] = trace->plane.normal[1];
temp[2] = trace->plane.normal[2];
trace->plane.normal[0] = _DotProduct(up, temp);
trace->plane.normal[0] = _DotProduct(forward, temp);
trace->plane.normal[1] = _DotProduct(right, temp);
trace->plane.normal[2] = _DotProduct(forward, temp);
trace->plane.normal[2] = _DotProduct(up, temp);
}
trace->endpos[0] = (end[0] - start[0]) * trace->fraction + start[0];

View File

@ -828,7 +828,7 @@
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>REHLDS_FLIGHT_REC;REHLDS_OPT_PEDANTIC;REHLDS_SELF;REHLDS_CHECKS;USE_BREAKPAD_HANDLER;DEDICATED;SWDS;_CRT_SECURE_NO_WARNINGS;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>REHLDS_FIXES;REHLDS_FLIGHT_REC;REHLDS_OPT_PEDANTIC;REHLDS_SELF;REHLDS_CHECKS;USE_BREAKPAD_HANDLER;DEDICATED;SWDS;_CRT_SECURE_NO_WARNINGS;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<FloatingPointModel>Precise</FloatingPointModel>
<AdditionalOptions>/arch:IA32 %(AdditionalOptions)</AdditionalOptions>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>

View File

@ -32,6 +32,9 @@ typedef enum
t_generic,
t_eventscript,
t_world, // Fake type for world, is really t_model
rt_unk,
rt_max
} resourcetype_t;
@ -42,7 +45,7 @@ typedef struct
typedef struct resourceinfo_s
{
_resourceinfo_t info[ 8 ];
_resourceinfo_t info[ rt_max ];
} resourceinfo_t;
#define RES_FATALIFMISSING (1<<0) // Disconnect if we can't get this file.