From 3b5d72df1de6079bbfa504bd45e6b7276048c657 Mon Sep 17 00:00:00 2001 From: GAMMACASE Date: Fri, 8 Sep 2023 18:20:22 +0300 Subject: [PATCH] Obsolete KVLoadFromFile Current implementation isn't used anywhere in the s2 provider and due to the removal of MemAllocScratch & MemFreeScratch I guess this could be obsoleted --- core/provider/source2/provider_source2.cpp | 30 ---------------------- core/provider/source2/provider_source2.h | 2 -- 2 files changed, 32 deletions(-) diff --git a/core/provider/source2/provider_source2.cpp b/core/provider/source2/provider_source2.cpp index 89cbb02..5c948af 100644 --- a/core/provider/source2/provider_source2.cpp +++ b/core/provider/source2/provider_source2.cpp @@ -354,36 +354,6 @@ void LocalCommand_Meta(const CCommandContext &, const CCommand& args) } } -bool Source2Provider::KVLoadFromFile(KeyValues* kv, IFileSystem* filesystem, const char* resourceName, const char* pathID) -{ - Assert(filesystem); -#ifdef _MSC_VER - Assert(_heapchk() == _HEAPOK); -#endif - - FileHandle_t f = filesystem->Open(resourceName, "rb", pathID); - if (!f) - return false; - - // load file into a null-terminated buffer - int fileSize = filesystem->Size(f); - char* buffer = (char*)MemAllocScratch(fileSize + 1); - - Assert(buffer); - - filesystem->Read(buffer, fileSize, f); // read into local buffer - - buffer[fileSize] = 0; // null terminate file as EOF - - filesystem->Close(f); // close file after reading - - bool retOK = kv->LoadFromBuffer(resourceName, buffer, filesystem); - - MemFreeScratch(); - - return retOK; -} - void Source2Provider::Hook_StartupServer_Post(const GameSessionConfiguration_t &config, ISource2WorldSession *, const char *) { static bool bGameServerHooked = false; diff --git a/core/provider/source2/provider_source2.h b/core/provider/source2/provider_source2.h index d9f0378..f2ca942 100644 --- a/core/provider/source2/provider_source2.h +++ b/core/provider/source2/provider_source2.h @@ -72,8 +72,6 @@ public: CUtlVector *Hook_StartChangeLevel(const char*, const char*, void*); void Hook_SwitchToLoop(const char *pszLoopName, KeyValues *pKV, uint32 nId, const char *pszUnk, bool bUnk); void Hook_ClientCommand(CPlayerSlot nSlot, const CCommand& args); -private: - bool KVLoadFromFile(KeyValues *kv, IFileSystem *filesystem, const char *resourceName, const char *pathID); private: IFileSystem* baseFs = nullptr; std::string sLastMap;