diff options
author | BobTheBob9 <for.oliver.kirkham@gmail.com> | 2022-08-16 01:12:59 +0100 |
---|---|---|
committer | BobTheBob9 <for.oliver.kirkham@gmail.com> | 2022-08-16 01:12:59 +0100 |
commit | 082f3893215797268d7ac8c1000ebe371f276af7 (patch) | |
tree | b5cc677a49635a9244559e235d4915c064c9f6c4 /NorthstarDLL/sourceinterface.h | |
parent | b30a385fc25dad05e568ae8538f5aa3656c5c8d4 (diff) | |
download | NorthstarLauncher-082f3893215797268d7ac8c1000ebe371f276af7.tar.gz NorthstarLauncher-082f3893215797268d7ac8c1000ebe371f276af7.zip |
lots of stuff idk
Diffstat (limited to 'NorthstarDLL/sourceinterface.h')
-rw-r--r-- | NorthstarDLL/sourceinterface.h | 62 |
1 files changed, 31 insertions, 31 deletions
diff --git a/NorthstarDLL/sourceinterface.h b/NorthstarDLL/sourceinterface.h index a40653ff..474e961b 100644 --- a/NorthstarDLL/sourceinterface.h +++ b/NorthstarDLL/sourceinterface.h @@ -1,31 +1,31 @@ -#pragma once
-#include <string>
-
-// literally just copied from ttf2sdk definition
-typedef void* (*CreateInterfaceFn)(const char* pName, int* pReturnCode);
-
-template <typename T> class SourceInterface
-{
- private:
- T* m_interface;
-
- public:
- SourceInterface(const std::string& moduleName, const std::string& interfaceName)
- {
- HMODULE handle = GetModuleHandleA(moduleName.c_str());
- CreateInterfaceFn createInterface = (CreateInterfaceFn)GetProcAddress(handle, "CreateInterface");
- m_interface = (T*)createInterface(interfaceName.c_str(), NULL);
- if (m_interface == nullptr)
- spdlog::error("Failed to call CreateInterface for %s in %s", interfaceName, moduleName);
- }
-
- T* operator->() const
- {
- return m_interface;
- }
-
- operator T*() const
- {
- return m_interface;
- }
-};
+#pragma once +#include <string> + +// literally just copied from ttf2sdk definition +typedef void* (*CreateInterfaceFn)(const char* pName, int* pReturnCode); + +template <typename T> class SourceInterface +{ + private: + T* m_interface; + + public: + SourceInterface(const std::string& moduleName, const std::string& interfaceName) + { + HMODULE handle = GetModuleHandleA(moduleName.c_str()); + CreateInterfaceFn createInterface = (CreateInterfaceFn)GetProcAddress(handle, "CreateInterface"); + m_interface = (T*)createInterface(interfaceName.c_str(), NULL); + if (m_interface == nullptr) + spdlog::error("Failed to call CreateInterface for %s in %s", interfaceName, moduleName); + } + + T* operator->() const + { + return m_interface; + } + + operator T*() const + { + return m_interface; + } +}; |