-
Notifications
You must be signed in to change notification settings - Fork 4
/
main.cpp
63 lines (45 loc) · 1.72 KB
/
main.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
#include "skse64/PluginAPI.h" // super
#include "skse64_common/skse_version.h" // What version of SKSE is running?
#include <shlobj.h> // CSIDL_MYCODUMENTS
#include <skse64_common/SafeWrite.h>
#include "GameMenus.h"
#include "GameEvents.h"
/*
code in LockpickBreak()
sets Lockpick angle to 0
.text:00000001408985DD mov [rsi+0DCh], r14d
*/
static RelocAddr<uintptr_t> resetPickAngle_offset = (0x008985DD);
static PluginHandle g_pluginHandle = kPluginHandle_Invalid;
static SKSEPapyrusInterface * g_papyrus = NULL;
extern "C" {
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 Special Edition\\SKSE\\Plugin.log");
gLog.SetPrintLevel(IDebugLog::kLevel_Error);
gLog.SetLogLevel(IDebugLog::kLevel_DebugMessage);
_MESSAGE("Plugin");
// populate info structure
info->infoVersion = PluginInfo::kInfoVersion;
info->name = "Plugin";
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;
}
// ### do not do anything else in this callback
// ### only fill out PluginInfo and return true/false
// supported runtime version
return true;
}
bool SKSEPlugin_Load(const SKSEInterface * skse) { // Called by SKSE to load this plugin
_MESSAGE("Plugin loaded");
_MESSAGE("Patching LockpickBreak() function...");
SafeWrite32(resetPickAngle_offset, 0x90909090);
SafeWrite32(resetPickAngle_offset + 4, 0x90909048);
_MESSAGE("Success!");
return true;
}
};