Make memoverride a separate lib

Else everything linked against tier0 will have to use the game's memalloc implementation, which requires it to run with the game process. Only limit this to DLL's that run with the game process.
This commit is contained in:
Kawe Mazidjatari 2023-06-28 20:00:38 +02:00
parent 939e101fe6
commit 99fe5b794a
5 changed files with 23 additions and 7 deletions

View File

@ -42,6 +42,7 @@ target_link_libraries( ${PROJECT_NAME} PRIVATE
"Rpcrt4.lib"
"vpc"
"memoverride"
"tier0"
"tier1"
"tier2"

View File

@ -14,13 +14,16 @@ end_sources( "${BUILD_OUTPUT_DIR}/bin/x64_retail/plugins/" )
target_link_libraries( ${PROJECT_NAME} PRIVATE
"tier0"
"memoverride"
"libdetours"
"libprotobuf"
"liblzham"
"libspdlog"
"SigCache_PB"
"SV_RCon_PB"
"CL_RCon_PB"
"SigCache_Pb"
"SV_RCon_Pb"
"CL_RCon_Pb"
"Rpcrt4.lib"
)

View File

@ -1,4 +1,18 @@
cmake_minimum_required( VERSION 3.16 )
# Separate lib as we aren't implementing the memalloc system!
# This library mainly interfaces the program to the game's
# internal memalloc system. Only link if its getting used or
# is using the game module!!!
add_module( "lib" "memoverride" "vpc" ${FOLDER_CONTEXT} TRUE TRUE )
add_sources( SOURCE_GROUP "Runtime"
"memstd.cpp"
"memstd.h"
)
end_sources()
add_module( "lib" "tier0" "vpc" ${FOLDER_CONTEXT} TRUE TRUE )
start_sources()
@ -22,8 +36,6 @@ add_sources( SOURCE_GROUP "Runtime"
"frametask.cpp"
"jobthread.cpp"
"memaddr.cpp"
"memstd.cpp"
"memstd.h"
"module.cpp"
"platform.cpp"
"sigcache.cpp"

View File

@ -84,7 +84,7 @@ extern "C"
InitAllocator();
MemAllocSingleton()->Free(pBlock);
}
__declspec(noinline) size_t __cdecl _msize_base(void* const pBlock)
__declspec(noinline) size_t __cdecl _msize_base(void* const pBlock) noexcept
{
InitAllocator();

View File

@ -8,7 +8,7 @@ extern "C"
__declspec(restrict) void* __cdecl _realloc_base(void* const pBlock, size_t const nSize);
__declspec(restrict) void* __cdecl _recalloc_base(void* const pBlock, size_t const nCount, size_t const nSize);
__declspec(noinline) void __cdecl _free_base(void* const pBlock);
__declspec(noinline) size_t __cdecl _msize_base(void* const pBlock);
__declspec(noinline) size_t __cdecl _msize_base(void* const pBlock) noexcept;
char* __cdecl _strdup(const char* pString);
void* __cdecl _expand(void* pBlock, size_t nSize);
}