blob: 95ec08b5c74602ca00fb5e0e9e1cf1f100b34a1d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
#pragma once
#include "core/tier1.h"
#include "plugins/interfaces/interface.h"
#include "plugins/interfaces/IPluginId.h"
#include "plugins/interfaces/IPluginCallbacks.h"
class Plugin
{
private:
CreateInterfaceFn m_pCreateInterface;
IPluginId* m_pluginId = 0;
IPluginCallbacks* m_callbacks = 0;
std::shared_ptr<ColoredLogger> m_logger;
bool m_valid = false;
std::string m_name;
std::string m_logName;
std::string m_dependencyName;
std::string m_location; // path of the dll
bool m_runOnServer;
bool m_runOnClient;
Color m_logColor;
public:
HMODULE m_handle;
PluginNorthstarData m_initData;
Plugin(std::string path);
bool Unload() const;
void Reload() const;
// sys
void Log(spdlog::level::level_enum level, char* msg) const;
// callbacks
bool IsValid() const;
const std::string& GetName() const;
const std::string& GetLogName() const;
const std::string& GetDependencyName() const;
const std::string& GetLocation() const;
bool ShouldRunOnServer() const;
bool ShouldRunOnClient() const;
void* CreateInterface(const char* pName, int* pStatus) const;
void Init(bool reloaded) const;
void Finalize() const;
void OnSqvmCreated(CSquirrelVM* sqvm) const;
void OnSqvmDestroying(CSquirrelVM* sqvm) const;
void OnLibraryLoaded(HMODULE module, const char* name) const;
void RunFrame() const;
};
|