engine: add MenuFactory native object

This commit is contained in:
Владислав Сухов
2026-05-13 21:41:36 +00:00
committed by a1batross
parent cae1d32c66
commit c6fb702fb1
4 changed files with 14 additions and 0 deletions

View File

@@ -16,6 +16,7 @@ Only these objects are guaranteed to be available on all targets.
|-------------|-----------|
| `VFileSystem009` | Provides C++ interface to filesystem, binary-compatible with Valve's VFileSystem009. |
| `XashFileSystemXXX` | Provides C interface to filesystem. This interface is unstable and not recommended for generic use, outside of engine internals. For more info about current version look into `filesystem.h`. |
| `MenuFactory` | Returns a `CreateInterface` function pointer (`pfnCreateInterface_t`) for the currently loaded menu library. |
#### Android-specific objects

View File

@@ -1335,6 +1335,14 @@ void UI_UnloadProgs( void )
memset( &gameui, 0, sizeof( gameui ));
}
void *UI_GetMenuFactory( void )
{
if( !gameui.hInstance )
return NULL;
return COM_GetProcAddress( gameui.hInstance, "CreateInterface" );
}
qboolean UI_LoadProgs( void )
{
static ui_enginefuncs_t gpEngfuncs;

View File

@@ -745,6 +745,7 @@ qboolean CL_DisableVisibility( void );
qboolean CL_IsRecordDemo( void );
qboolean CL_IsPlaybackDemo( void );
qboolean UI_CreditsActive( void );
void *UI_GetMenuFactory( void );
int CL_GetMaxClients( void );
#else
static inline qboolean CL_Initialized( void ) { return false; }
@@ -755,6 +756,7 @@ static inline qboolean CL_DisableVisibility( void ) { return false; }
static inline qboolean CL_IsRecordDemo( void ) { return false; }
static inline qboolean CL_IsPlaybackDemo( void ) { return false; }
static inline qboolean UI_CreditsActive( void ) { return false; }
static inline void *UI_GetMenuFactory( void ) { return NULL; }
static inline int CL_GetMaxClients( void ) { return SV_GetMaxClients(); }
#endif

View File

@@ -666,6 +666,9 @@ void *Sys_GetNativeObject( const char *obj )
if( COM_StringEmptyOrNULL( obj ))
return NULL;
if( !Q_strcmp( obj, "MenuFactory" ))
return UI_GetMenuFactory();
ptr = FS_GetNativeObject( obj );
if( ptr )