aboutsummaryrefslogtreecommitdiff
path: root/primedev/core/tier1.cpp
blob: a299549609643c3505865a8629e172a659114ca7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include "tier1.h"

// Note: this file is tier1/interface.cpp in primedev, but given that tier0 is yet to be split
// I am following the existing "pattern" and putting this here

CMemoryAddress Sys_GetFactoryPtr(const std::string& svModuleName, const std::string& svFactoryName)
{
	HMODULE hModule = GetModuleHandleA(svModuleName.c_str());

	if (!hModule)
	{
		spdlog::error("Failed to get module handle of '{}'!", svModuleName.c_str());
		exit(EXIT_FAILURE);
	}

	CreateInterfaceFn fnCreateInterface = reinterpret_cast<CreateInterfaceFn>(GetProcAddress(hModule, CREATEINTERFACE_PROCNAME));

	return fnCreateInterface(svFactoryName.c_str(), NULL);
}