From 4a7bfcf6dd35978ae2719bfff832a3e358d6c9e6 Mon Sep 17 00:00:00 2001 From: 8dcc <8dcc.git@gmail.com> Date: Thu, 20 Jul 2023 17:44:35 +0200 Subject: [PATCH] Call hooks_init from main Fix typos Change include order --- src/main.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/main.c b/src/main.c index df5f3a7..8f477db 100644 --- a/src/main.c +++ b/src/main.c @@ -3,8 +3,9 @@ #include #include "include/main.h" -#include "include/globals.h" #include "include/sdk.h" +#include "include/globals.h" +#include "include/hooks.h" /* * We need: @@ -12,19 +13,23 @@ * To indicate that this function will be the entry point once injected. */ __attribute__((constructor)) void load(void) { - printf("hl-cheat loaded!\n"); + printf("hl-cheat injected!\n"); + /* Initialize globals/interfaces */ if (!globals_init()) { - printf("hl-cheats: load: error loading globals, aborting\n"); + fprintf(stderr, "hl-cheat: load: error loading globals, aborting\n"); self_unload(); return; } - printf("gp_engine: %p\n" - "gp_client: %p\n", - gp_engine, gp_client); + /* Hook functions */ + if (!hooks_init()) { + 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) {