Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes for initial VGUI2 support #1090

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions engine/client/cl_game.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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();
Expand Down
5 changes: 4 additions & 1 deletion engine/client/vgui/vgui_draw.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ vguiapi_t vgui =
Platform_GetClipboardText,
Platform_SetClipboardText,
Platform_GetKeyModifiers,
COM_LoadLibrary,
COM_FreeLibrary,
COM_GetProcAddress,
NULL,
NULL,
NULL,
Expand Down Expand Up @@ -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 ) )
{
Expand Down
5 changes: 4 additions & 1 deletion engine/vgui_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down