From 3eec52e79b545cc216d6c3a1d209ac180455b88b Mon Sep 17 00:00:00 2001 From: Amos <48657826+Mauler125@users.noreply.github.com> Date: Thu, 27 Jan 2022 03:55:47 +0100 Subject: [PATCH] Fix dedicated server crash for Linux (Lutris and Wine) The issue was caused by checking if a file with '//*/' in its path exist on the disk. This causes crashes on Lutris and Wine. --- r5dev/launcher/IApplication.cpp | 8 ++++++++ r5dev/launcher/IApplication.h | 2 ++ r5dev/vpc/basefilesystem.cpp | 6 ++++-- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/r5dev/launcher/IApplication.cpp b/r5dev/launcher/IApplication.cpp index dc4d7c90..f0800a15 100644 --- a/r5dev/launcher/IApplication.cpp +++ b/r5dev/launcher/IApplication.cpp @@ -1,3 +1,9 @@ +//=============================================================================// +// +// Purpose: IApplication methods +// +//=============================================================================// + #include "core/stdafx.h" #include "tier0/cvar.h" #include "launcher/IApplication.h" @@ -56,6 +62,8 @@ bool HIApplication_Create(void* a1) { g_vsvAllConVars.push_back(map.first.c_str()); } + g_bAppSystemInit = true; + return IAppSystem_Create(a1); } diff --git a/r5dev/launcher/IApplication.h b/r5dev/launcher/IApplication.h index e00d79f4..f974fd48 100644 --- a/r5dev/launcher/IApplication.h +++ b/r5dev/launcher/IApplication.h @@ -35,6 +35,8 @@ bool HIApplication_Create(void* a1); void IApplication_Attach(); void IApplication_Detach(); +inline bool g_bAppSystemInit = false; + /////////////////////////////////////////////////////////////////////////////// class HApplication : public IDetour { diff --git a/r5dev/vpc/basefilesystem.cpp b/r5dev/vpc/basefilesystem.cpp index e261bdf1..403f2a78 100644 --- a/r5dev/vpc/basefilesystem.cpp +++ b/r5dev/vpc/basefilesystem.cpp @@ -2,7 +2,9 @@ #include "core/logdef.h" #include "tier0/cvar.h" #include "vpc/basefilesystem.h" +#ifndef DEDICATED #include "gameui/IConsole.h" +#endif // !DEDICATED //--------------------------------------------------------------------------------- // Purpose: prints the output of the filesystem based on the warning level @@ -64,7 +66,7 @@ FileHandle_t HCBaseFileSystem_ReadFromVPK(void* pVpk, std::int64_t* pResults, ch // TODO: obtain 'mod' SearchPath's instead. svFilePath.insert(0, "platform\\"); - if (FileExists(svFilePath.c_str()) || FileExists(pszFilePath)) + if (FileExists(svFilePath.c_str()) /*|| FileExists(pszFilePath)*/) { *pResults = -1; return (void*)pResults; @@ -88,7 +90,7 @@ bool HCBaseFileSystem_ReadFromCache(void* pFileSystem, char* pszFilePath, void* // TODO: obtain 'mod' SearchPath's instead. svFilePath.insert(0, "platform\\"); - if (FileExists(svFilePath.c_str()) || FileExists(pszFilePath)) + if (FileExists(svFilePath.c_str()) /*|| FileExists(pszFilePath)*/) { return false; }