Added cv_watermark

This commit is contained in:
Wizzard 2023-09-19 10:38:01 -04:00
parent f9db9ff1b6
commit 56f8ae79d7
8 changed files with 27 additions and 22 deletions

View File

@ -46,19 +46,19 @@ attacking if there is no visible target.
#+begin_quote #+begin_quote
*Note:* Chams color can be changed from the =h_glColor4f()= function inside *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. console variables than more customization at runtime.
#+end_quote #+end_quote
#+begin_quote #+begin_quote
*Note:* Bullet tracer color, width and time can be changed at the bottom of the *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 #+end_quote
* Building * Building
#+begin_src console #+begin_src console
$ git clone --recurse-submodules https://github.com/8dcc/hl-cheat $ git clone --recurse-submodules https://github.com/8dcc/goldsource-cheat
$ cd hl-cheat $ cd goldsource-cheat
$ make $ make
... ...
#+end_src #+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: have already cloned it, you can just:
#+begin_src console #+begin_src console
$ cd hl-cheat $ cd goldsource-cheat
$ git submodule update --init --recursive $ git submodule update --init --recursive
#+end_src #+end_src
@ -80,5 +80,5 @@ $ ./injector.sh
... ...
hl-cheat loaded! goldsource-cheat loaded!
#+end_src #+end_src

View File

@ -30,7 +30,7 @@ if [ "$1" == "unload" ]; then
fi fi
if grep -q "$libpath" "/proc/$pid/maps"; then 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 # 0x2 -> RTLD_NOW
# 0x6 -> RTLD_LAZY | RTLD_NOLOAD # 0x6 -> RTLD_LAZY | RTLD_NOLOAD

View File

@ -12,17 +12,19 @@ DECL_CVAR(chams);
DECL_CVAR(crosshair); DECL_CVAR(crosshair);
DECL_CVAR(tracers); DECL_CVAR(tracers);
DECL_CVAR(clmove); DECL_CVAR(clmove);
DECL_CVAR(watermark);
bool cvars_init(void) { bool cvars_init(void) {
REGISTER_CVAR(bhop, 1); REGISTER_CVAR(bhop, 1);
REGISTER_CVAR(autostrafe, 0); REGISTER_CVAR(autostrafe, 1);
REGISTER_CVAR(aimbot, 0); REGISTER_CVAR(aimbot, 0);
REGISTER_CVAR(autoshoot, 0); /* Only works with aimbot enabled */ REGISTER_CVAR(autoshoot, 0); /* Only works with aimbot enabled */
REGISTER_CVAR(esp, 3); REGISTER_CVAR(esp, 3);
REGISTER_CVAR(chams, 1); REGISTER_CVAR(chams, 1);
REGISTER_CVAR(crosshair, 0); REGISTER_CVAR(crosshair, 0);
REGISTER_CVAR(tracers, 0); REGISTER_CVAR(tracers, 1);
REGISTER_CVAR(clmove, 0); REGISTER_CVAR(clmove, 0);
REGISTER_CVAR(watermark, 1);
return true; return true;
} }

View File

@ -42,13 +42,13 @@ bool globals_init(void) {
*/ */
hw = dlopen("hw.so", RTLD_LAZY | RTLD_NOLOAD); hw = dlopen("hw.so", RTLD_LAZY | RTLD_NOLOAD);
if (!hw) { 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; return false;
} }
h_client = (void**)dlsym(hw, "hClientDLL"); h_client = (void**)dlsym(hw, "hClientDLL");
if (!h_client) { 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; return false;
} }
@ -67,12 +67,12 @@ bool globals_init(void) {
if (!i_engine || !i_client || !i_pmove || !i_enginestudio || if (!i_engine || !i_client || !i_pmove || !i_enginestudio ||
!i_studiomodelrenderer || !game_info) { !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; return false;
} }
if (!protect_addr(i_studiomodelrenderer, PROT_READ | PROT_WRITE)) { 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; return false;
} }

View File

@ -74,8 +74,10 @@ void h_CL_CreateMove(float frametime, usercmd_t* cmd, int active) {
int h_HUD_Redraw(float time, int intermission) { int h_HUD_Redraw(float time, int intermission) {
int ret = ORIGINAL(HUD_Redraw, time, intermission); int ret = ORIGINAL(HUD_Redraw, time, intermission);
/* Watermark */ if (cv_watermark->value) {
engine_draw_text(5, 5, "8dcc/hl-cheat", (rgb_t){ 255, 255, 255 }); /* Watermark */
engine_draw_text(5, 5, "https://git.deadzone.lol/Wizzard/goldsource-cheat", (rgb_t){ 0, 255, 255 });
}
esp(); esp();
custom_crosshair(); custom_crosshair();

View File

@ -39,6 +39,7 @@ DECL_CVAR_EXTERN(chams);
DECL_CVAR_EXTERN(crosshair); DECL_CVAR_EXTERN(crosshair);
DECL_CVAR_EXTERN(tracers); DECL_CVAR_EXTERN(tracers);
DECL_CVAR_EXTERN(clmove); DECL_CVAR_EXTERN(clmove);
DECL_CVAR_EXTERN(watermark);
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/

View File

@ -13,25 +13,25 @@ static bool loaded = false;
__attribute__((constructor)) /* Entry point when injected */ __attribute__((constructor)) /* Entry point when injected */
void load(void) { void load(void) {
printf("hl-cheat injected!\n"); printf("goldsource-cheat injected!\n");
/* Initialize globals/interfaces */ /* Initialize globals/interfaces */
if (!globals_init()) { 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(); self_unload();
return; return;
} }
/* Create cvars for settings */ /* Create cvars for settings */
if (!cvars_init()) { 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(); self_unload();
return; return;
} }
/* Hook functions */ /* Hook functions */
if (!hooks_init()) { 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(); self_unload();
return; return;
} }
@ -39,7 +39,7 @@ void load(void) {
/* Get game version after injecting */ /* Get game version after injecting */
this_game_id = get_cur_game(); this_game_id = get_cur_game();
i_engine->pfnClientCmd("echo \"hl-cheat loaded successfully!\""); i_engine->pfnClientCmd("echo \"goldsource-cheat loaded successfully!\"");
loaded = true; loaded = true;
} }
@ -55,7 +55,7 @@ void unload(void) {
GL_UNHOOK(glColor4f); /* Manually restore OpenGL hooks here */ GL_UNHOOK(glColor4f); /* Manually restore OpenGL hooks here */
} }
printf("hl-cheat unloaded.\n\n"); printf("goldsource-cheat unloaded.\n\n");
} }
void self_unload(void) { void self_unload(void) {

View File

@ -271,7 +271,7 @@ bool protect_addr(void* ptr, int new_flags) {
int pgsz = getpagesize(); int pgsz = getpagesize();
if (mprotect(p, pgsz, new_flags) == -1) { 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; return false;
} }