forked from d00telemental/LENativeExperiments
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLE1GPUCrusher.cpp
55 lines (45 loc) · 1.99 KB
/
LE1GPUCrusher.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
#include "../Interface.h"
#include "../Common.h"
SPI_PLUGINSIDE_SUPPORT(L"LE1GPUCrusher", L"0.1.0", L"d00telemental", SPI_GAME_LE1, SPI_VERSION_ANY);
SPI_PLUGINSIDE_POSTLOAD;
SPI_PLUGINSIDE_ASYNCATTACH;
#define writeln(frmt, ...) fwprintf_s(stdout, L"LE1GPUCrusher - " frmt "\n", __VA_ARGS__);
#define REFLECTIONUPDATEREQUIRED_PATTERN "48 89 5C 24 10 48 89 6C 24 18 48 89 74 24 20 57 41 54 41 55 41 56 41 57 48 83 EC 40 48 8B 01 48 8B F2 4C 8B F9 FF 50 48"
using tReflectionUpdateRequired = unsigned long (*)(void*, void*);
tReflectionUpdateRequired ReflectionUpdateRequired = nullptr;
tReflectionUpdateRequired ReflectionUpdateRequired_orig = nullptr;
unsigned long ReflectionUpdateRequired_hook(void* a, void* b)
{
// !!! DANGER !!!
return TRUE;
//const auto value = ReflectionUpdateRequired_orig(a, b);
//writeln(L"ReflectionUpdateRequired_orig => %d", value);
//return value;
}
SPI_IMPLEMENT_ATTACH
{
Common::OpenConsole();
writeln(L"Attach - hello! DO NOT USE IF YOU AREN'T WILLING TO REPLACE YOUR GPU");
if (auto rc = InterfacePtr->FindPattern((void**)&ReflectionUpdateRequired, REFLECTIONUPDATEREQUIRED_PATTERN);
rc != SPIReturn::Success)
{
writeln(L"Attach - failed to find the pattern: %d / %s", rc, SPIReturnToString(rc));
return false;
}
writeln(L"Attach - found pattern at %p!", ReflectionUpdateRequired);
if (auto rc = InterfacePtr->InstallHook("LE1GPUCrusherReflectionUpdateRequired", ReflectionUpdateRequired, ReflectionUpdateRequired_hook, (void**)&ReflectionUpdateRequired_orig);
rc != SPIReturn::Success)
{
writeln(L"Attach - failed to hook ReflectionUpdateRequired: %d / %s", rc, SPIReturnToString(rc));
return false;
}
Sleep(15 * 1000);
MessageBoxW(nullptr, L"DO NOT USE IF YOU AREN'T WILLING TO REPLACE YOUR GPU", L"DANGER", MB_OK | MB_ICONERROR);
return true;
}
// --------------------------------------------------
SPI_IMPLEMENT_DETACH
{
Common::CloseConsole();
return true;
}