From 4c4d605d10109e02708984755405bbe0947ef5c4 Mon Sep 17 00:00:00 2001 From: BobTheBob <32057864+BobTheBob9@users.noreply.github.com> Date: Thu, 8 Jul 2021 15:33:31 +0100 Subject: initial commit --- NorthstarDedicatedTest/sourceinterface.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 NorthstarDedicatedTest/sourceinterface.cpp (limited to 'NorthstarDedicatedTest/sourceinterface.cpp') diff --git a/NorthstarDedicatedTest/sourceinterface.cpp b/NorthstarDedicatedTest/sourceinterface.cpp new file mode 100644 index 00000000..49a2f164 --- /dev/null +++ b/NorthstarDedicatedTest/sourceinterface.cpp @@ -0,0 +1,13 @@ +#include "pch.h" +#include "sourceinterface.h" +#include +#include "tier0.h" + +template SourceInterface::SourceInterface(const std::string& moduleName, const std::string& interfaceName) +{ + HMODULE handle = GetModuleHandleA(moduleName.c_str()); + CreateInterfaceFn createInterface = (CreateInterfaceFn)GetProcAddress(handle, interfaceName.c_str()); + m_interface = (T*)createInterface(interfaceName.c_str(), NULL); + if (m_interface == nullptr) + Error("Failed to call CreateInterface for %s in %s", interfaceName, moduleName); +} \ No newline at end of file -- cgit v1.2.3