diff --git a/engine/client/cl_game.c b/engine/client/cl_game.c index 6bb50705c..bd09f26cf 100644 --- a/engine/client/cl_game.c +++ b/engine/client/cl_game.c @@ -3937,11 +3937,6 @@ qboolean CL_LoadProgs( const char *name ) clgame.mempool = Mem_AllocPool( "Client Edicts Zone" ); clgame.entities = NULL; - // NOTE: important stuff! - // vgui must startup BEFORE loading client.dll to avoid get error ERROR_NOACESS - // during LoadLibrary - VGui_Startup( name, gameui.globals->scrWidth, gameui.globals->scrHeight ); - // a1ba: we need to check if client.dll has direct dependency on SDL2 // and if so, disable relative mouse mode #if XASH_WIN32 && !XASH_64BIT @@ -4042,6 +4037,8 @@ qboolean CL_LoadProgs( const char *name ) return false; } + VGui_Startup( name, gameui.globals->scrWidth, gameui.globals->scrHeight ); + Cvar_FullSet( "host_clientloaded", "1", FCVAR_READ_ONLY ); clgame.maxRemapInfos = 0; // will be alloc on first call CL_InitEdicts(); diff --git a/engine/client/vgui/vgui_draw.c b/engine/client/vgui/vgui_draw.c index cd134e249..b63157217 100644 --- a/engine/client/vgui/vgui_draw.c +++ b/engine/client/vgui/vgui_draw.c @@ -98,6 +98,9 @@ vguiapi_t vgui = Platform_GetClipboardText, Platform_SetClipboardText, Platform_GetKeyModifiers, + COM_LoadLibrary, + COM_FreeLibrary, + COM_GetProcAddress, NULL, NULL, NULL, @@ -254,7 +257,7 @@ void VGui_Startup( const char *clientlib, int width, int height ) if( vgui.initialized ) { - vgui.Startup( width, height ); + vgui.Startup( clientlib, width, height ); } else if ( COM_CheckString( clientlib ) ) { diff --git a/engine/vgui_api.h b/engine/vgui_api.h index 2ce89226d..b3d161e21 100644 --- a/engine/vgui_api.h +++ b/engine/vgui_api.h @@ -186,8 +186,11 @@ typedef struct vguiapi_s int (*GetClipboardText)( char *buffer, size_t bufferSize ); void (*SetClipboardText)( const char *text ); key_modifier_t (*GetKeyModifiers)( void ); + void *(*COM_LoadLibrary)( const char *dllname, int build_ordinals_table, qboolean directpath ); + void (*COM_FreeLibrary)( void *hInstance ); + void *(*COM_GetProcAddress)( void *hInstance, const char *name ); // called from engine side - void (*Startup)( int width, int height ); + void (*Startup)( const char *clientlib, int width, int height ); void (*Shutdown)( void ); void *(*GetPanel)( void ); void (*Paint)( void );