aboutsummaryrefslogtreecommitdiff
path: root/NorthstarDLL/tier0.h
blob: 5fefc69973494a01d1be43fa73f4113a0f004cac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#pragma once
namespace Tier0
{
	class IMemAlloc
	{
	  public:
		struct VTable
		{
			void* unknown[1]; // alloc debug
			void* (*Alloc)(IMemAlloc* memAlloc, size_t nSize);
			void* unknown2[1]; // realloc debug
			void* (*Realloc)(IMemAlloc* memAlloc, void* pMem, size_t nSize);
			void* unknown3[1]; // free #1
			void (*Free)(IMemAlloc* memAlloc, void* pMem);
			void* unknown4[2]; // nullsubs, maybe CrtSetDbgFlag
			size_t (*GetSize)(IMemAlloc* memAlloc, void* pMem);
			void* unknown5[9]; // they all do literally nothing
			void (*DumpStats)(IMemAlloc* memAlloc);
			void (*DumpStatsFileBase)(IMemAlloc* memAlloc, const char* pchFileBase);
			void* unknown6[4];
			int (*heapchk)(IMemAlloc* memAlloc);
		};

		VTable* m_vtable;
	};

	class CCommandLine
	{
	  public:
		// based on the defs in the 2013 source sdk, but for some reason has an extra function (may be another CreateCmdLine overload?)
		// these seem to line up with what they should be though
		virtual void CreateCmdLine(const char* commandline) {}
		virtual void CreateCmdLine(int argc, char** argv) {}
		virtual void unknown() {}
		virtual const char* GetCmdLine(void) const {}

		virtual const char* CheckParm(const char* psz, const char** ppszValue = 0) const {}
		virtual void RemoveParm() const {}
		virtual void AppendParm(const char* pszParm, const char* pszValues) {}

		virtual const char* ParmValue(const char* psz, const char* pDefaultVal = 0) const {}
		virtual int ParmValue(const char* psz, int nDefaultVal) const {}
		virtual float ParmValue(const char* psz, float flDefaultVal) const {}

		virtual int ParmCount() const {}
		virtual int FindParm(const char* psz) const {}
		virtual const char* GetParm(int nIndex) const {}
		virtual void SetParm(int nIndex, char const* pParm) {}

		// virtual const char** GetParms() const {}
	};

	extern IMemAlloc* g_pMemAllocSingleton;

	typedef void (*ErrorType)(const char* fmt, ...);
	extern ErrorType Error;

	typedef CCommandLine* (*CommandLineType)();
	extern CommandLineType CommandLine;

	typedef double (*Plat_FloatTimeType)();
	extern Plat_FloatTimeType Plat_FloatTime;

	typedef bool (*ThreadInServerFrameThreadType)();
	extern ThreadInServerFrameThreadType ThreadInServerFrameThread;
} // namespace Tier0

void TryCreateGlobalMemAlloc();