aboutsummaryrefslogtreecommitdiff
path: root/primedev/core/tier1.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'primedev/core/tier1.cpp')
-rw-r--r--primedev/core/tier1.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/primedev/core/tier1.cpp b/primedev/core/tier1.cpp
new file mode 100644
index 00000000..a2995496
--- /dev/null
+++ b/primedev/core/tier1.cpp
@@ -0,0 +1,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);
+}