From ac566d73aaafd18c686579f7eba34430e54b44c7 Mon Sep 17 00:00:00 2001 From: Amos <48657826+Mauler125@users.noreply.github.com> Date: Thu, 27 Jan 2022 04:12:41 +0100 Subject: [PATCH] Also load files from main directory Still compatible with previous commit --- r5dev/vpc/basefilesystem.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/r5dev/vpc/basefilesystem.cpp b/r5dev/vpc/basefilesystem.cpp index 403f2a78..996e943c 100644 --- a/r5dev/vpc/basefilesystem.cpp +++ b/r5dev/vpc/basefilesystem.cpp @@ -61,11 +61,19 @@ FileHandle_t HCBaseFileSystem_ReadFromVPK(void* pVpk, std::int64_t* pResults, ch { // Erase '//*/'. svFilePath.erase(0, 4); + + // Check if file exist in the main game folder. + if (FileExists(svFilePath.c_str())) + { + *pResults = -1; + return (void*)pResults; + } } // TODO: obtain 'mod' SearchPath's instead. svFilePath.insert(0, "platform\\"); + // Check if file exist in 'mod' folders. if (FileExists(svFilePath.c_str()) /*|| FileExists(pszFilePath)*/) { *pResults = -1; @@ -85,12 +93,19 @@ bool HCBaseFileSystem_ReadFromCache(void* pFileSystem, char* pszFilePath, void* { // Erase '//*/'. svFilePath.erase(0, 4); + + // Check if file exist in the main game folder. + if (FileExists(svFilePath.c_str())) + { + return false; + } } // TODO: obtain 'mod' SearchPath's instead. svFilePath.insert(0, "platform\\"); - if (FileExists(svFilePath.c_str()) /*|| FileExists(pszFilePath)*/) + // Check if file exist in 'mod' folders. + if (FileExists(svFilePath.c_str())) { return false; }