diff --git a/rehlds/engine/sv_main.cpp b/rehlds/engine/sv_main.cpp index 7661635..20e150b 100644 --- a/rehlds/engine/sv_main.cpp +++ b/rehlds/engine/sv_main.cpp @@ -5204,6 +5204,10 @@ void SV_CreateGenericResources(void) data = COM_Parse(data); if (Q_strlen(com_token) <= 0) break; +#ifdef REHLDS_FIXES + char *com_token_extension = Q_strrchr(com_token, '.'); + bool successful = false; +#endif if (Q_strstr(com_token, "..")) Con_Printf("Can't precache resource with invalid relative path %s\n", com_token); @@ -5211,6 +5215,32 @@ void SV_CreateGenericResources(void) Con_Printf("Can't precache resource with absolute path %s\n", com_token); else if (Q_strstr(com_token, "\\")) Con_Printf("Can't precache resource with invalid relative path %s\n", com_token); +#ifdef REHLDS_FIXES + else if(com_token_extension) + { + if (Q_strcmp(com_token_extension, ".cfg") == 0) + Con_Printf("Can't precache .cfg files: %s\n", com_token); + else if (Q_strcmp(com_token_extension, ".lst") == 0) + Con_Printf("Can't precache .lst files: %s\n", com_token); + else if (Q_strcmp(com_token_extension, ".exe") == 0) + Con_Printf("Can't precache .exe files: %s\n", com_token); + else if (Q_strcmp(com_token_extension, ".vbs") == 0) + Con_Printf("Can't precache .vbs files: %s\n", com_token); + else if (Q_strcmp(com_token_extension, ".com") == 0) + Con_Printf("Can't precache .com files: %s\n", com_token); + else if (Q_strcmp(com_token_extension, ".bat") == 0) + Con_Printf("Can't precache .bat files: %s\n", com_token); + else if (Q_strcmp(com_token_extension, ".dll") == 0) + Con_Printf("Can't precache .dll files: %s\n", com_token); + else + successful = true; + + } + else + successful = true; + + if(successful) +#else else if (Q_strstr(com_token, ".cfg")) Con_Printf("Can't precache .cfg files: %s\n", com_token); else if (Q_strstr(com_token, ".lst")) @@ -5226,6 +5256,7 @@ void SV_CreateGenericResources(void) else if (Q_strstr(com_token, ".dll")) Con_Printf("Can't precache .dll files: %s\n", com_token); else +#endif { // In fixed version of PrecacheGeneric we don't need local copy #ifdef REHLDS_FIXES @@ -7250,6 +7281,7 @@ qboolean IsSafeFileToDownload(const char *filename) { char *first; char *last; + char lwrfilename[MAX_PATH]; if (!filename) @@ -7271,7 +7303,11 @@ qboolean IsSafeFileToDownload(const char *filename) Q_strlwr(lwrfilename); first = Q_strchr(lwrfilename, '.'); +#ifdef REHLDS_FIXES + last = Q_strrchr(first, '.'); +#else last = Q_strrchr(lwrfilename, '.'); +#endif if (lwrfilename[0] == '/' || Q_strstr(lwrfilename, "\\") @@ -7281,6 +7317,23 @@ qboolean IsSafeFileToDownload(const char *filename) || first != last || !first || Q_strlen(first) != 4 + || Q_strstr(lwrfilename, "halflife.wad") + || Q_strstr(lwrfilename, "pak0.pak") + || Q_strstr(lwrfilename, "xeno.wad") +#ifdef REHLDS_FIXES + || Q_strcmp(first, ".cfg") == 0 + || Q_strcmp(first, ".lst") == 0 + || Q_strcmp(first, ".exe") == 0 + || Q_strcmp(first, ".vbs") == 0 + || Q_strcmp(first, ".com") == 0 + || Q_strcmp(first, ".bat") == 0 + || Q_strcmp(first, ".dll") == 0 + || Q_strcmp(first, ".ini") == 0 + || Q_strcmp(first, ".log") == 0 +// || Q_strcmp(lwrfilename, ".so") == 0 // Extension length must be 4 to get here +// || Q_strcmp(lwrfilename, ".dylib") == 0 + || Q_strcmp(first, ".sys") == 0) +#else || Q_strstr(lwrfilename, ".cfg") || Q_strstr(lwrfilename, ".lst") || Q_strstr(lwrfilename, ".exe") @@ -7290,12 +7343,10 @@ qboolean IsSafeFileToDownload(const char *filename) || Q_strstr(lwrfilename, ".dll") || Q_strstr(lwrfilename, ".ini") || Q_strstr(lwrfilename, ".log") - || Q_strstr(lwrfilename, "halflife.wad") - || Q_strstr(lwrfilename, "pak0.pak") - || Q_strstr(lwrfilename, "xeno.wad") || Q_strstr(lwrfilename, ".so") || Q_strstr(lwrfilename, ".dylib") || Q_strstr(lwrfilename, ".sys")) +#endif { return FALSE; } diff --git a/rehlds/engine/sys_dll.cpp b/rehlds/engine/sys_dll.cpp index 22c6dee..9dc339a 100644 --- a/rehlds/engine/sys_dll.cpp +++ b/rehlds/engine/sys_dll.cpp @@ -941,11 +941,22 @@ void LoadEntityDLLs(const char *szBaseDir) Q_strncpy(szValue, com_argv[index + 1], sizeof(szValue) - 1); szValue[sizeof(szValue) - 1] = 0; } +#ifdef REHLDS_FIXES + char *value_extension = Q_strrchr(szValue, '.'); +#ifdef _WIN32 + if (value_extension && Q_strcmp(value_extension, ".dll") == 0) +#else // _WIN32 + if (value_extension && Q_strcmp(value_extension, ".so") == 0) +#endif // _WIN32 + +#else // REHLDS_FIXES #ifdef _WIN32 if (Q_strstr(szValue, ".dll")) #else // _WIN32 if (Q_strstr(szValue, ".so")) #endif // _WIN32 + +#endif // REHLDS_FIXES { FS_GetLocalPath(szValue, szDllFilename, sizeof(szDllFilename)); Con_DPrintf("\nAdding: %s/%s\n", szGameDir, szValue);