-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmain.cpp
More file actions
62 lines (44 loc) · 1.75 KB
/
main.cpp
File metadata and controls
62 lines (44 loc) · 1.75 KB
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
52
53
54
55
56
57
58
59
60
61
62
#include "skse/PluginAPI.h" // super
#include "skse/skse_version.h" // What version of SKSE is running?
#include <shlobj.h> // CSIDL_MYCODUMENTS
#include "ArrayExample.h"
static PluginHandle g_pluginHandle = kPluginHandle_Invalid;
static SKSEPapyrusInterface * g_papyrus = NULL;
extern "C" {
__declspec(dllexport) bool SKSEPlugin_Query(const SKSEInterface * skse, PluginInfo * info) { // Called by SKSE to learn about this plugin and check that it's safe to load it
gLog.OpenRelative(CSIDL_MYDOCUMENTS, "\\My Games\\Skyrim\\SKSE\\SKSEWrapper.log");
gLog.SetPrintLevel(IDebugLog::kLevel_Error);
gLog.SetLogLevel(IDebugLog::kLevel_DebugMessage);
_MESSAGE("SKSEWrapper");
// populate info structure
info->infoVersion = PluginInfo::kInfoVersion;
info->name = "SKSEWrapper";
info->version = 1;
// store plugin handle so we can identify ourselves later
g_pluginHandle = skse->GetPluginHandle();
if (skse->isEditor)
{
_MESSAGE("loaded in editor, marking as incompatible");
return false;
}
else if (skse->runtimeVersion != RUNTIME_VERSION_1_9_32_0)
{
_MESSAGE("unsupported runtime version %08X", skse->runtimeVersion);
return false;
}
// ### do not do anything else in this callback
// ### only fill out PluginInfo and return true/false
// supported runtime version
return true;
}
__declspec(dllexport) bool SKSEPlugin_Load(const SKSEInterface * skse) { // Called by SKSE to load this plugin
_MESSAGE("MyScriptPlugin loaded");
g_papyrus = (SKSEPapyrusInterface *)skse->QueryInterface(kInterface_Papyrus);
//Check if the function registration was a success...
bool btest = g_papyrus->Register(MyPluginNamespace::RegisterFuncs);
if (btest) {
_MESSAGE("Register Succeeded");
}
return true;
}
};