parent
3f46b54139
commit
4a7bfcf6dd
19
src/main.c
19
src/main.c
|
@ -3,8 +3,9 @@
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
|
|
||||||
#include "include/main.h"
|
#include "include/main.h"
|
||||||
#include "include/globals.h"
|
|
||||||
#include "include/sdk.h"
|
#include "include/sdk.h"
|
||||||
|
#include "include/globals.h"
|
||||||
|
#include "include/hooks.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We need:
|
* We need:
|
||||||
|
@ -12,19 +13,23 @@
|
||||||
* To indicate that this function will be the entry point once injected.
|
* To indicate that this function will be the entry point once injected.
|
||||||
*/
|
*/
|
||||||
__attribute__((constructor)) void load(void) {
|
__attribute__((constructor)) void load(void) {
|
||||||
printf("hl-cheat loaded!\n");
|
printf("hl-cheat injected!\n");
|
||||||
|
|
||||||
|
/* Initialize globals/interfaces */
|
||||||
if (!globals_init()) {
|
if (!globals_init()) {
|
||||||
printf("hl-cheats: load: error loading globals, aborting\n");
|
fprintf(stderr, "hl-cheat: load: error loading globals, aborting\n");
|
||||||
self_unload();
|
self_unload();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("gp_engine: %p\n"
|
/* Hook functions */
|
||||||
"gp_client: %p\n",
|
if (!hooks_init()) {
|
||||||
gp_engine, gp_client);
|
fprintf(stderr, "hl-cheat: load: error hooking functions, aborting\n");
|
||||||
|
self_unload();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
gp_engine->pfnClientCmd("echo \"Hello from the game's console!\"");
|
gp_engine->pfnClientCmd("echo \"hl-cheat loaded successfully!\"");
|
||||||
}
|
}
|
||||||
|
|
||||||
void self_unload(void) {
|
void self_unload(void) {
|
||||||
|
|
Loading…
Reference in New Issue