-
-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathplaytime_fixes.cpp
More file actions
53 lines (40 loc) · 1.38 KB
/
playtime_fixes.cpp
File metadata and controls
53 lines (40 loc) · 1.38 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
#include "stdafx.h"
#include "playtime_fixes.hpp"
#include "common.hpp"
#include "input_handler.hpp"
#include "logging.hpp"
#include "mgs2_linkvarbuf.hpp"
#include "mgs2_status_flags.hpp"
namespace
{
int* MGS3_GM_Configuration = nullptr;
}
void FixPlaytime::Apply()
{
if (!(eGameType & (MGS2|MGS3)))
{
return;
}
if (eGameType & MGS2)
{
MAKE_HOOK_MID(baseModule, "C7 05 ?? ?? ?? ?? 00 00 00 00 48 83 C4 ?? 5F C3 ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? 40 53", "gm_startloader", {
MGS2_LinkVarBuf::GM_Configuration |= GM_CONFIG_PLAYTIME_STOP;
});
#if !defined(RELEASE_BUILD)
g_InputHandler.RegisterHotkey(VK_NUMPAD8, "report time", []()
{
spdlog::info("MGS 2: MGS2_LinkVarBuf::GM_PlayTime: {}", MGS2_LinkVarBuf::GM_PlayTime.get());
});
#endif
}
else // eGameType & MGS3
{
MGS3_GM_Configuration = reinterpret_cast<int*>(Memory::GetRipRelativeAddress(Memory::PatternScan(baseModule, "81 25 ?? ?? ?? ?? FF FD FF FF", "MGS3: GM_Configuration"), 2, 10));
MAKE_HOOK_MID(baseModule, "E8 ?? ?? ?? ?? 48 89 43 ?? EB", "MGS3: gm_startloader", {
if (MGS3_GM_Configuration)
{
*MGS3_GM_Configuration |= 0x200;
}
});
}
}