mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
* All libraries have been isolated from each other, and build into separate artifacts. * Project has been restructured to support isolating libraries. * CCrashHandler now calls a callback on crash (setup from core/dllmain.cpp, this can be setup in any way for any project. This callback is getting called when the apllication crashes. Useful for flushing buffers before closing handles to logging files for example). * Tier0 'CoreMsgV' function now calls a callback sink, which could be set by the user (currently setup to the SDK's internal logger in core/dllmain.cpp). TODO: * Add a batch file to autogenerate all projects. * Add support for dedicated server. * Add support for client dll. Bugs: * Game crashes on the title screen after the UI script compiler has finished (root cause unknown). * Curl error messages are getting logged twice for the dedicated server due to the removal of all "DEDICATED" preprocessor directives to support isolating projects. This has to be fixed properly!
47 lines
1.4 KiB
C++
47 lines
1.4 KiB
C++
#ifndef TIER0_MEMALLOC_H
|
|
#define TIER0_MEMALLOC_H
|
|
|
|
#if defined(MSVC) && ( defined(_DEBUG) || defined(USE_MEM_DEBUG) )
|
|
|
|
#pragma warning(disable:4290)
|
|
#pragma warning(push)
|
|
//#include <typeinfo.h>
|
|
|
|
// MEM_DEBUG_CLASSNAME is opt-in.
|
|
// Note: typeid().name() is not threadsafe, so if the project needs to access it in multiple threads
|
|
// simultaneously, it'll need a mutex.
|
|
|
|
#define MEM_ALLOC_CREDIT_(tag) ((void)0) // Stubbed for now.
|
|
|
|
#if defined(_CPPRTTI) && defined(MEM_DEBUG_CLASSNAME)
|
|
|
|
template <typename T> const char* MemAllocClassName(T* p)
|
|
{
|
|
static const char* pszName = typeid(*p).name(); // @TODO: support having debug heap ignore certain allocations, and ignore memory allocated here [5/7/2009 tom]
|
|
return pszName;
|
|
}
|
|
|
|
#define MEM_ALLOC_CREDIT_CLASS() MEM_ALLOC_CREDIT_( MemAllocClassName( this ) )
|
|
#define MEM_ALLOC_CLASSNAME(type) (typeid((type*)(0)).name())
|
|
#else
|
|
#define MEM_ALLOC_CREDIT_CLASS() MEM_ALLOC_CREDIT_( __FILE__ )
|
|
#define MEM_ALLOC_CLASSNAME(type) (__FILE__)
|
|
#endif
|
|
|
|
// MEM_ALLOC_CREDIT_FUNCTION is used when no this pointer is available ( inside 'new' overloads, for example )
|
|
#ifdef _MSC_VER
|
|
#define MEM_ALLOC_CREDIT_FUNCTION() MEM_ALLOC_CREDIT_( __FUNCTION__ )
|
|
#else
|
|
#define MEM_ALLOC_CREDIT_FUNCTION() (__FILE__)
|
|
#endif
|
|
|
|
#pragma warning(pop)
|
|
#else
|
|
#define MEM_ALLOC_CREDIT_CLASS()
|
|
#define MEM_ALLOC_CLASSNAME(type) NULL
|
|
#define MEM_ALLOC_CREDIT_FUNCTION()
|
|
#endif
|
|
|
|
#define MEM_ALLOC_CREDIT() // Stubbed
|
|
|
|
#endif /* TIER0_MEMALLOC_H */ |