Get game_info global

This commit is contained in:
8dcc 2023-07-27 14:18:47 +02:00
parent 85233ce6e3
commit e1a56c7fb6
2 changed files with 7 additions and 1 deletions

View File

@ -16,6 +16,9 @@ DECL_INTF(playermove_t, pmove);
DECL_INTF(engine_studio_api_t, enginestudio); DECL_INTF(engine_studio_api_t, enginestudio);
DECL_INTF(StudioModelRenderer_t, studiomodelrenderer); DECL_INTF(StudioModelRenderer_t, studiomodelrenderer);
/* Game struct with some useful info */
game_t* game_info;
/* Updated in CL_CreateMove hook */ /* Updated in CL_CreateMove hook */
cl_entity_t* localplayer = NULL; cl_entity_t* localplayer = NULL;
@ -46,8 +49,10 @@ bool globals_init(void) {
const char* SMR_STR = "g_StudioRenderer"; /* For clang-format */ const char* SMR_STR = "g_StudioRenderer"; /* For clang-format */
i_studiomodelrenderer = *(StudioModelRenderer_t**)dlsym(*h_client, SMR_STR); 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 || 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"); printf("hl-cheat: globals_init: couldn't load some symbols\n");
return false; return false;
} }

View File

@ -33,6 +33,7 @@ DECL_INTF_EXTERN(playermove_t, pmove);
DECL_INTF_EXTERN(engine_studio_api_t, enginestudio); DECL_INTF_EXTERN(engine_studio_api_t, enginestudio);
DECL_INTF_EXTERN(StudioModelRenderer_t, studiomodelrenderer); DECL_INTF_EXTERN(StudioModelRenderer_t, studiomodelrenderer);
extern game_t* game_info;
extern cl_entity_t* localplayer; extern cl_entity_t* localplayer;
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/