From e1a56c7fb60630592f6592ca8cb94b681f2db372 Mon Sep 17 00:00:00 2001 From: 8dcc <8dcc.git@gmail.com> Date: Thu, 27 Jul 2023 14:18:47 +0200 Subject: [PATCH] Get game_info global --- src/globals.c | 7 ++++++- src/include/globals.h | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/globals.c b/src/globals.c index 9dd286d..3f390aa 100644 --- a/src/globals.c +++ b/src/globals.c @@ -16,6 +16,9 @@ DECL_INTF(playermove_t, pmove); DECL_INTF(engine_studio_api_t, enginestudio); DECL_INTF(StudioModelRenderer_t, studiomodelrenderer); +/* Game struct with some useful info */ +game_t* game_info; + /* Updated in CL_CreateMove hook */ cl_entity_t* localplayer = NULL; @@ -46,8 +49,10 @@ bool globals_init(void) { const char* SMR_STR = "g_StudioRenderer"; /* For clang-format */ i_studiomodelrenderer = *(StudioModelRenderer_t**)dlsym(*h_client, SMR_STR); + game_info = *(game_t**)dlsym(hw, "game"); + if (!i_engine || !i_client || !i_pmove || !i_enginestudio || - !i_studiomodelrenderer) { + !i_studiomodelrenderer || !game_info) { printf("hl-cheat: globals_init: couldn't load some symbols\n"); return false; } diff --git a/src/include/globals.h b/src/include/globals.h index aa5294a..e89bdbe 100644 --- a/src/include/globals.h +++ b/src/include/globals.h @@ -33,6 +33,7 @@ DECL_INTF_EXTERN(playermove_t, pmove); DECL_INTF_EXTERN(engine_studio_api_t, enginestudio); DECL_INTF_EXTERN(StudioModelRenderer_t, studiomodelrenderer); +extern game_t* game_info; extern cl_entity_t* localplayer; /*----------------------------------------------------------------------------*/