mirror of
https://github.com/R2Northstar/NorthstarLauncher
synced 2026-08-23 20:26:04 -04:00
core: Remove unused SourceInterface class (#816)
Removes unused `SourceInterface` class, moves `InterfaceStatus` enum to `tier1.h`.
This commit is contained in:
parent
71349f05b6
commit
8a29c5bbd0
10 changed files with 9 additions and 38 deletions
|
|
@ -52,7 +52,6 @@ add_library(
|
|||
"core/memalloc.cpp"
|
||||
"core/memalloc.h"
|
||||
"core/sourceinterface.cpp"
|
||||
"core/sourceinterface.h"
|
||||
"core/tier0.cpp"
|
||||
"core/tier0.h"
|
||||
"core/tier1.cpp"
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
#pragma once
|
||||
#include "core/sourceinterface.h"
|
||||
#include "core/math/color.h"
|
||||
#include "cvar.h"
|
||||
#include "concommand.h"
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
#include "sourceinterface.h"
|
||||
#include "logging/sourceconsole.h"
|
||||
|
||||
// really wanted to do a modular callback system here but honestly couldn't be bothered so hardcoding stuff for now: todo later
|
||||
|
|
|
|||
|
|
@ -1,32 +0,0 @@
|
|||
#pragma once
|
||||
#include <string>
|
||||
|
||||
// interface return status
|
||||
enum class InterfaceStatus : int
|
||||
{
|
||||
IFACE_OK = 0,
|
||||
IFACE_FAILED,
|
||||
};
|
||||
|
||||
// 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; }
|
||||
};
|
||||
|
|
@ -7,6 +7,12 @@
|
|||
|
||||
#define CREATEINTERFACE_PROCNAME "CreateInterface"
|
||||
|
||||
enum class InterfaceStatus : int
|
||||
{
|
||||
IFACE_OK = 0,
|
||||
IFACE_FAILED,
|
||||
};
|
||||
|
||||
typedef void* (*CreateInterfaceFn)(const char* pName, int* pReturnCode);
|
||||
|
||||
CMemory Sys_GetFactoryPtr(const std::string& svModuleName, const std::string& svFact);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
#pragma once
|
||||
#include "core/sourceinterface.h"
|
||||
#include "spdlog/sinks/base_sink.h"
|
||||
#include <map>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
#include <string.h>
|
||||
#include "core/tier1.h"
|
||||
#include "interface.h"
|
||||
|
||||
InterfaceReg* s_pInterfaceRegs;
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
#include "core/tier1.h"
|
||||
#include "plugins/interfaces/interface.h"
|
||||
#include "ISys.h"
|
||||
#include "plugins/plugins.h"
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
#include "pluginmanager.h"
|
||||
#include "squirrel/squirrel.h"
|
||||
#include "util/wininfo.h"
|
||||
#include "core/sourceinterface.h"
|
||||
#include "logging/logging.h"
|
||||
#include "dedicated/dedicated.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#pragma once
|
||||
#include "core/sourceinterface.h"
|
||||
#include "core/tier1.h"
|
||||
#include "plugins/interfaces/interface.h"
|
||||
#include "plugins/interfaces/IPluginId.h"
|
||||
#include "plugins/interfaces/IPluginCallbacks.h"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue