This repository has been archived by the owner on Feb 24, 2021. It is now read-only.
forked from GregLando113/quickloot-sse
-
Notifications
You must be signed in to change notification settings - Fork 1
/
dllmain.cpp
82 lines (65 loc) · 2.09 KB
/
dllmain.cpp
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#include <string>
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
#include <cstdio>
#include "skse64/PluginAPI.h"
#include "dbg.h"
#include "QuickLoot.h"
IDebugLog gLog("qldbg.txt");
SKSEMessagingInterface* g_messaging;
SKSEScaleformInterface* g_scaleform;
SKSETaskInterface* g_tasks;
EventDispatcher<SKSECrosshairRefEvent>* g_crosshaireventdispatcher;
#define REQUIRE(expr) if(! (expr) ) return false;
extern "C"
{
__declspec(dllexport) bool SKSEPlugin_Query(const SKSEInterface * skse, PluginInfo * info)
{
info->infoVersion = PluginInfo::kInfoVersion;
info->name = "QuickLoot SSE";
info->version = 1;
return true;
}
__declspec(dllexport) bool SKSEPlugin_Load(const SKSEInterface * skse)
{
g_messaging = (SKSEMessagingInterface*)skse->QueryInterface(kInterface_Messaging);
g_scaleform = (SKSEScaleformInterface*)skse->QueryInterface(kInterface_Scaleform);
g_tasks = (SKSETaskInterface*) skse->QueryInterface(kInterface_Task);
class ModLoadedEventSink : public BSTEventSink<SKSEModCallbackEvent>
{
public:
ModLoadedEventSink() {}
virtual EventResult ReceiveEvent(SKSEModCallbackEvent *evn, EventDispatcher<SKSEModCallbackEvent> *source) override
{
source->RemoveEventSink(this);
g_quickloot.Initialize();
return kEvent_Continue;
}
};
static ModLoadedEventSink m;
EventDispatcher<SKSEModCallbackEvent> * md = (EventDispatcher<SKSEModCallbackEvent> *)g_messaging->GetEventDispatcher(SKSEMessagingInterface::kDispatcher_ActionEvent);
if (md)
md->AddEventSink(&m);
printf("SKSEPlugin_Load skse v. = %X\n", skse->skseVersion);
TESObjectREFR* r = nullptr;
printf("GetBaseScale = %p\n", r->_GetBaseScale_GetPtr());
printf("IsOffLimits = %p\n", r->_IsOffLimits_GetPtr());
return true;
}
};
#if BLD_DEBUG
BOOL WINAPI DllMain(HMODULE hMod, DWORD dwReason, LPVOID)
{
if (dwReason == DLL_PROCESS_ATTACH)
{
AllocConsole();
freopen("CONOUT$", "w", stdout);
SetWindowPos(GetConsoleWindow(), HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
}
else if (dwReason == DLL_PROCESS_DETACH)
{
FreeConsole();
}
return TRUE;
}
#endif