-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlibMain.cpp
More file actions
56 lines (40 loc) · 1.15 KB
/
Copy pathlibMain.cpp
File metadata and controls
56 lines (40 loc) · 1.15 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
54
55
//
// libMain.cpp
// IdleSow
//
#include "globals.h"
dlopen_t orig_dlopen = NULL;
__attribute__ ((constructor)) void sysinject(void)
{
printf("Injecting!\n");
fflush(stdout);
orig_dlopen = (dlopen_t) dlsym(RTLD_NEXT, "dlopen");
// set settings up
set_default_settings();
// Start a thread that will repeatedly poll to see if pImports and whatnot is correct
start_agent();
}
// Creates a thread that will poll structures for updates
void start_agent()
{
// Start hook thread
pthread_t threadInfo;
pthread_create( &threadInfo, NULL, &hook_thread, NULL);
}
void* hook_thread(void* arg)
{
while(true)
{
if(oImport)
if(oImport->Print) // Game has been initialized
if(oImport->R_RenderScene != &hk_R_RenderScene) // RenderScene hasn't been hooked
{
start_hook(); // Inject the hook
sleep(10); // Wait 10 sec
return NULL; // Exit this thread
}
sleep(5);
}
return NULL; // Exit the thread
}
//#include "../SDK/warsow_0.62_sdk/source/ref_gl/r_shader.h"