-
Notifications
You must be signed in to change notification settings - Fork 226
/
SkyrimVM64.cpp
60 lines (45 loc) · 1.42 KB
/
SkyrimVM64.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
#include <TiltedOnlinePCH.h>
#include "TiltedOnlineApp.h"
extern std::unique_ptr<TiltedOnlineApp> g_appInstance;
#include <GameVM.h>
struct Main;
struct VMContext
{
char pad[0x680];
uint8_t inactive; // 0x680
};
TP_THIS_FUNCTION(TVMUpdate, int, VMContext, float);
TP_THIS_FUNCTION(TMainLoop, short, Main);
TP_THIS_FUNCTION(TVMDestructor, uintptr_t, void);
static TVMUpdate* VMUpdate = nullptr;
static TMainLoop* MainLoop = nullptr;
static TVMDestructor* VMDestructor = nullptr;
int TP_MAKE_THISCALL(HookVMUpdate, VMContext, float a2)
{
if (apThis->inactive == 0)
g_appInstance->Update();
return TiltedPhoques::ThisCall(VMUpdate, apThis, a2);
}
short TP_MAKE_THISCALL(HookMainLoop, Main)
{
TP_EMPTY_HOOK_PLACEHOLDER
return TiltedPhoques::ThisCall(MainLoop, apThis);
}
uintptr_t TP_MAKE_THISCALL(HookVMDestructor, void)
{
TP_EMPTY_HOOK_PLACEHOLDER
return TiltedPhoques::ThisCall(VMDestructor, apThis);
}
static TiltedPhoques::Initializer s_mainHooks(
[]()
{
POINTER_SKYRIMSE(TMainLoop, cMainLoop, 36564);
POINTER_SKYRIMSE(TVMUpdate, cVMUpdate, 53926);
POINTER_SKYRIMSE(TVMDestructor, cVMDestructor, 40412);
VMUpdate = cVMUpdate.Get();
MainLoop = cMainLoop.Get();
VMDestructor = cVMDestructor.Get();
TP_HOOK(&VMUpdate, HookVMUpdate);
TP_HOOK(&MainLoop, HookMainLoop);
TP_HOOK(&VMDestructor, HookVMDestructor);
});