From f1d90345467dec089530ddc9af9081a1ff1a3b2e Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Sat, 6 Oct 2018 03:28:40 +0300 Subject: [PATCH] GameUI: fix menu APIs loading order --- engine/client/cl_gameui.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/engine/client/cl_gameui.c b/engine/client/cl_gameui.c index ef1444fb..7a6bc0c9 100644 --- a/engine/client/cl_gameui.c +++ b/engine/client/cl_gameui.c @@ -1101,6 +1101,20 @@ qboolean UI_LoadProgs( void ) gameui.use_text_api = false; + // make local copy of engfuncs to prevent overwrite it with user dll + memcpy( &gpEngfuncs, &gEngfuncs, sizeof( gpEngfuncs )); + + gameui.mempool = Mem_AllocPool( "Menu Pool" ); + + if( !GetMenuAPI( &gameui.dllFuncs, &gpEngfuncs, gameui.globals )) + { + COM_FreeLibrary( gameui.hInstance ); + Con_Reportf( "UI_LoadProgs: can't init menu API\n" ); + Mem_FreePool( &gameui.mempool ); + gameui.hInstance = NULL; + return false; + } + if( ( GiveTextApi = (UITEXTAPI)COM_GetProcAddress( gameui.hInstance, "GiveTextAPI" ) ) ) { MsgDev( D_NOTE, "UI_LoadProgs: extended Text API initialized\n" ); @@ -1116,20 +1130,6 @@ qboolean UI_LoadProgs( void ) MsgDev( D_NOTE, "UI_LoadProgs: AddTouchButtonToList call found\n" ); } - // make local copy of engfuncs to prevent overwrite it with user dll - memcpy( &gpEngfuncs, &gEngfuncs, sizeof( gpEngfuncs )); - - gameui.mempool = Mem_AllocPool( "Menu Pool" ); - - if( !GetMenuAPI( &gameui.dllFuncs, &gpEngfuncs, gameui.globals )) - { - COM_FreeLibrary( gameui.hInstance ); - Con_Reportf( "UI_LoadProgs: can't init menu API\n" ); - Mem_FreePool( &gameui.mempool ); - gameui.hInstance = NULL; - return false; - } - Cvar_FullSet( "host_gameuiloaded", "1", FCVAR_READ_ONLY ); // setup gameinfo