Add enginestudio interface

Not really an interface but whatever
This commit is contained in:
8dcc 2023-07-24 16:29:19 +02:00
parent d5b8ce5b84
commit 4183a0c2f0
2 changed files with 8 additions and 4 deletions

View File

@ -12,6 +12,7 @@ void** h_client;
DECL_INTF(cl_enginefunc_t, engine);
DECL_INTF(cl_clientfunc_t, client);
DECL_INTF(playermove_t, pmove);
DECL_INTF(engine_studio_api_t, enginestudio);
DECL_INTF(StudioModelRenderer_t, studiomodelrenderer);
/* Updated in CL_CreateMove hook */
@ -39,14 +40,16 @@ bool globals_init(void) {
}
/* Get symbol addresses using dlsym and the handler we just opened */
i_engine = (cl_enginefunc_t*)dlsym(hw, "cl_enginefuncs");
i_client = (cl_clientfunc_t*)dlsym(hw, "cl_funcs");
i_pmove = *(playermove_t**)dlsym(hw, "pmove");
i_engine = (cl_enginefunc_t*)dlsym(hw, "cl_enginefuncs");
i_client = (cl_clientfunc_t*)dlsym(hw, "cl_funcs");
i_pmove = *(playermove_t**)dlsym(hw, "pmove");
i_enginestudio = (engine_studio_api_t*)dlsym(hw, "engine_studio_api");
const char* SMR_STR = "g_StudioRenderer"; /* For clang-format */
i_studiomodelrenderer = *(StudioModelRenderer_t**)dlsym(*h_client, SMR_STR);
if (!i_engine || !i_client || !i_pmove || !i_studiomodelrenderer) {
if (!i_engine || !i_client || !i_pmove || !i_enginestudio ||
!i_studiomodelrenderer) {
printf("hl-cheat: globals_init: couldn't load some symbols\n");
return false;
}

View File

@ -30,6 +30,7 @@ extern void** h_client; /* hClientDLL hander */
DECL_INTF_EXTERN(cl_enginefunc_t, engine);
DECL_INTF_EXTERN(cl_clientfunc_t, client);
DECL_INTF_EXTERN(playermove_t, pmove);
DECL_INTF_EXTERN(engine_studio_api_t, enginestudio);
DECL_INTF_EXTERN(StudioModelRenderer_t, studiomodelrenderer);
extern cl_entity_t* localplayer;