From 56f8ae79d744bd35ffc14a218889acc4747efd8f Mon Sep 17 00:00:00 2001 From: Wizzard <25581244+Wizzard@users.noreply.toomuchslop.com> Date: Tue, 19 Sep 2023 10:38:01 -0400 Subject: [PATCH] Added cv_watermark --- README.org | 12 ++++++------ inject.sh | 2 +- src/cvars.c | 6 ++++-- src/globals.c | 8 ++++---- src/hooks.c | 6 ++++-- src/include/cvars.h | 1 + src/main.c | 12 ++++++------ src/util.c | 2 +- 8 files changed, 27 insertions(+), 22 deletions(-) diff --git a/README.org b/README.org index df8a524..a4006cb 100644 --- a/README.org +++ b/README.org @@ -46,19 +46,19 @@ attacking if there is no visible target. #+begin_quote *Note:* Chams color can be changed from the =h_glColor4f()= function inside -[[https://github.com/8dcc/hl-cheat/blob/main/src/hooks.c][src/hooks.c]]. Since this cheat is not hard to compile, I rather have less +[[https://github.com/8dcc/goldsource-cheat/blob/main/src/hooks.c][src/hooks.c]]. Since this cheat is not hard to compile, I rather have less console variables than more customization at runtime. #+end_quote #+begin_quote *Note:* Bullet tracer color, width and time can be changed at the bottom of the -=bullet_tracers()= function inside [[https://github.com/8dcc/hl-cheat/blob/main/src/features/misc.c][src/features/misc.c]]. See previous chams note. +=bullet_tracers()= function inside [[https://github.com/8dcc/goldsource-cheat/blob/main/src/features/misc.c][src/features/misc.c]]. See previous chams note. #+end_quote * Building #+begin_src console -$ git clone --recurse-submodules https://github.com/8dcc/hl-cheat -$ cd hl-cheat +$ git clone --recurse-submodules https://github.com/8dcc/goldsource-cheat +$ cd goldsource-cheat $ make ... #+end_src @@ -67,7 +67,7 @@ Note that you will need to clone with =--recurse-submodules= for the sdk. If you have already cloned it, you can just: #+begin_src console -$ cd hl-cheat +$ cd goldsource-cheat $ git submodule update --init --recursive #+end_src @@ -80,5 +80,5 @@ $ ./injector.sh ... -hl-cheat loaded! +goldsource-cheat loaded! #+end_src diff --git a/inject.sh b/inject.sh index 6401ba9..255374a 100755 --- a/inject.sh +++ b/inject.sh @@ -30,7 +30,7 @@ if [ "$1" == "unload" ]; then fi if grep -q "$libpath" "/proc/$pid/maps"; then - echo -e "hl-cheat already loaded. Reloading...\n"; + echo -e "goldsource-cheat already loaded. Reloading...\n"; # 0x2 -> RTLD_NOW # 0x6 -> RTLD_LAZY | RTLD_NOLOAD diff --git a/src/cvars.c b/src/cvars.c index 4dc2bb0..3c2e485 100644 --- a/src/cvars.c +++ b/src/cvars.c @@ -12,17 +12,19 @@ DECL_CVAR(chams); DECL_CVAR(crosshair); DECL_CVAR(tracers); DECL_CVAR(clmove); +DECL_CVAR(watermark); bool cvars_init(void) { REGISTER_CVAR(bhop, 1); - REGISTER_CVAR(autostrafe, 0); + REGISTER_CVAR(autostrafe, 1); REGISTER_CVAR(aimbot, 0); REGISTER_CVAR(autoshoot, 0); /* Only works with aimbot enabled */ REGISTER_CVAR(esp, 3); REGISTER_CVAR(chams, 1); REGISTER_CVAR(crosshair, 0); - REGISTER_CVAR(tracers, 0); + REGISTER_CVAR(tracers, 1); REGISTER_CVAR(clmove, 0); + REGISTER_CVAR(watermark, 1); return true; } diff --git a/src/globals.c b/src/globals.c index e466659..73b65a7 100644 --- a/src/globals.c +++ b/src/globals.c @@ -42,13 +42,13 @@ bool globals_init(void) { */ hw = dlopen("hw.so", RTLD_LAZY | RTLD_NOLOAD); if (!hw) { - printf("hl-cheat: globals_init: can't open hw.so\n"); + printf("goldsource-cheat: globals_init: can't open hw.so\n"); return false; } h_client = (void**)dlsym(hw, "hClientDLL"); if (!h_client) { - printf("hl-cheat: globals_init: can't find hClientDLL\n"); + printf("goldsource-cheat: globals_init: can't find hClientDLL\n"); return false; } @@ -67,12 +67,12 @@ bool globals_init(void) { if (!i_engine || !i_client || !i_pmove || !i_enginestudio || !i_studiomodelrenderer || !game_info) { - printf("hl-cheat: globals_init: couldn't load some symbols\n"); + printf("goldsource-cheat: globals_init: couldn't load some symbols\n"); return false; } if (!protect_addr(i_studiomodelrenderer, PROT_READ | PROT_WRITE)) { - printf("hl-cheat: globals_init: couldn't unprotect address of SMR\n"); + printf("goldsource-cheat: globals_init: couldn't unprotect address of SMR\n"); return false; } diff --git a/src/hooks.c b/src/hooks.c index 98838e9..12d3ecc 100644 --- a/src/hooks.c +++ b/src/hooks.c @@ -74,8 +74,10 @@ void h_CL_CreateMove(float frametime, usercmd_t* cmd, int active) { int h_HUD_Redraw(float time, int intermission) { int ret = ORIGINAL(HUD_Redraw, time, intermission); - /* Watermark */ - engine_draw_text(5, 5, "8dcc/hl-cheat", (rgb_t){ 255, 255, 255 }); + if (cv_watermark->value) { + /* Watermark */ + engine_draw_text(5, 5, "https://git.deadzone.lol/Wizzard/goldsource-cheat", (rgb_t){ 0, 255, 255 }); + } esp(); custom_crosshair(); diff --git a/src/include/cvars.h b/src/include/cvars.h index 640022e..0d7c64c 100644 --- a/src/include/cvars.h +++ b/src/include/cvars.h @@ -39,6 +39,7 @@ DECL_CVAR_EXTERN(chams); DECL_CVAR_EXTERN(crosshair); DECL_CVAR_EXTERN(tracers); DECL_CVAR_EXTERN(clmove); +DECL_CVAR_EXTERN(watermark); /*----------------------------------------------------------------------------*/ diff --git a/src/main.c b/src/main.c index 45e9f2a..2646507 100644 --- a/src/main.c +++ b/src/main.c @@ -13,25 +13,25 @@ static bool loaded = false; __attribute__((constructor)) /* Entry point when injected */ void load(void) { - printf("hl-cheat injected!\n"); + printf("goldsource-cheat injected!\n"); /* Initialize globals/interfaces */ if (!globals_init()) { - fprintf(stderr, "hl-cheat: load: error loading globals, aborting\n"); + fprintf(stderr, "goldsource-cheat: load: error loading globals, aborting\n"); self_unload(); return; } /* Create cvars for settings */ if (!cvars_init()) { - fprintf(stderr, "hl-cheat: load: error creating cvars, aborting\n"); + fprintf(stderr, "goldsource-cheat: load: error creating cvars, aborting\n"); self_unload(); return; } /* Hook functions */ if (!hooks_init()) { - fprintf(stderr, "hl-cheat: load: error hooking functions, aborting\n"); + fprintf(stderr, "goldsource-cheat: load: error hooking functions, aborting\n"); self_unload(); return; } @@ -39,7 +39,7 @@ void load(void) { /* Get game version after injecting */ this_game_id = get_cur_game(); - i_engine->pfnClientCmd("echo \"hl-cheat loaded successfully!\""); + i_engine->pfnClientCmd("echo \"goldsource-cheat loaded successfully!\""); loaded = true; } @@ -55,7 +55,7 @@ void unload(void) { GL_UNHOOK(glColor4f); /* Manually restore OpenGL hooks here */ } - printf("hl-cheat unloaded.\n\n"); + printf("goldsource-cheat unloaded.\n\n"); } void self_unload(void) { diff --git a/src/util.c b/src/util.c index 37c9cd5..835918f 100644 --- a/src/util.c +++ b/src/util.c @@ -271,7 +271,7 @@ bool protect_addr(void* ptr, int new_flags) { int pgsz = getpagesize(); if (mprotect(p, pgsz, new_flags) == -1) { - printf("hl-cheat: error protecting %p\n", ptr); + printf("goldsource-cheat: error protecting %p\n", ptr); return false; }