diff --git a/engine/client/cl_gameui.c b/engine/client/cl_gameui.c index 21bf2bf0..6592e331 100644 --- a/engine/client/cl_gameui.c +++ b/engine/client/cl_gameui.c @@ -1185,12 +1185,27 @@ static void pfnEnableTextInput( int enable ) Key_EnableTextInput( enable, false ); } +static int pfnGetRenderers( unsigned int num, char *shortName, size_t size1, char *readableName, size_t size2 ) +{ + if( num >= ref.numRenderers ) + return 0; + + if( shortName && size1 ) + Q_strncpy( shortName, ref.shortNames[num], size1 ); + + if( readableName && size2 ) + Q_strncpy( readableName, ref.readableNames[num], size2 ); + + return 1; +} + static ui_extendedfuncs_t gExtendedfuncs = { pfnEnableTextInput, Con_UtfProcessChar, Con_UtfMoveLeft, - Con_UtfMoveRight + Con_UtfMoveRight, + pfnGetRenderers }; void UI_UnloadProgs( void ) diff --git a/engine/client/ref_common.c b/engine/client/ref_common.c index 4157ba10..e919d4ec 100644 --- a/engine/client/ref_common.c +++ b/engine/client/ref_common.c @@ -573,9 +573,8 @@ void R_CollectRendererNames( void ) ref.numRenderers = 0; - for( i = 0; i < ARRAYSIZE( ref.renderers ); i++ ) + for( i = 0; i < DEFAULT_RENDERERS_LEN; i++ ) { - ref_renderer_t *refdll = ref.renderers + ref.numRenderers; string temp; void *dll, *pfn; @@ -592,21 +591,21 @@ void R_CollectRendererNames( void ) continue; } - Q_strncpy( refdll->shortenedName, renderers[i], sizeof( refdll->shortenedName )); + Q_strncpy( ref.shortNames[i], renderers[i], sizeof( ref.shortNames[i] )); pfn = COM_GetProcAddress( dll, GET_REF_HUMANREADABLE_NAME ); if( !pfn ) // just in case { - Q_strncpy( refdll->humanReadable, renderers[i], sizeof( refdll->humanReadable )); + Q_strncpy( ref.readableNames[i], renderers[i], sizeof( ref.readableNames[i] )); } else { REF_HUMANREADABLE_NAME GetHumanReadableName = (REF_HUMANREADABLE_NAME)pfn; - GetHumanReadableName( refdll->humanReadable, sizeof( refdll->humanReadable )); + GetHumanReadableName( ref.readableNames[i], sizeof( ref.readableNames[i] )); } - Con_Printf( "Found renderer %s: %s\n", refdll->shortenedName, refdll->humanReadable ); + Con_Printf( "Found renderer %s: %s\n", ref.shortNames[i], ref.readableNames[i] ); ref.numRenderers++; COM_FreeLibrary( dll ); diff --git a/engine/client/ref_common.h b/engine/client/ref_common.h index aa07b2f0..18685017 100644 --- a/engine/client/ref_common.h +++ b/engine/client/ref_common.h @@ -20,12 +20,6 @@ GNU General Public License for more details. #define RP_LOCALCLIENT( e ) ((e) != NULL && (e)->index == ( cl.playernum + 1 ) && e->player ) -typedef struct ref_renderer_s -{ - string shortenedName; - string humanReadable; -} ref_renderer_t; - struct ref_state_s { qboolean initialized; @@ -34,7 +28,8 @@ struct ref_state_s ref_interface_t dllFuncs; int numRenderers; - ref_renderer_t renderers[DEFAULT_RENDERERS_LEN]; + string shortNames[DEFAULT_RENDERERS_LEN]; + string readableNames[DEFAULT_RENDERERS_LEN]; }; extern struct ref_state_s ref; diff --git a/engine/menu_int.h b/engine/menu_int.h index aef17560..2e622bef 100644 --- a/engine/menu_int.h +++ b/engine/menu_int.h @@ -202,6 +202,8 @@ typedef struct ui_extendedfuncs_s { int (*pfnUtfMoveRight) ( char *str, int pos, int length ); // new engine extended api start here + // returns 1 if there are more in list, otherwise 0 + int (*pfnGetRenderers)( unsigned int num, char *shortName, size_t size1, char *readableName, size_t size2 ); } ui_extendedfuncs_t; // deprecated export from old engine diff --git a/mainui b/mainui index 704012ce..c3095f47 160000 --- a/mainui +++ b/mainui @@ -1 +1 @@ -Subproject commit 704012ce4e9b31d41cc472e1d117340856301709 +Subproject commit c3095f477ff4ecfd8bc1f803c6d9e6e63ba32926 diff --git a/ref_gl/gl_context.c b/ref_gl/gl_context.c index 5bc961b4..35505a13 100644 --- a/ref_gl/gl_context.c +++ b/ref_gl/gl_context.c @@ -475,10 +475,10 @@ int EXPORT GetRefAPI( int version, ref_interface_t *funcs, ref_api_t *engfuncs, void EXPORT GetRefHumanReadableName( char *out, size_t size ) { #if defined XASH_NANOGL - Q_strncpy( out, "OpenGLES 1(NanoGL)", size ); + Q_strncpy( out, "GLES1(NanoGL)", size ); #elif defined XASH_WES - Q_strncpy( out, "OpenGLES 2(gl-wes-v2)", size ); + Q_strncpy( out, "GLES2(gl-wes-v2)", size ); #else - Q_strncpy( out, "OpenGL 1.x", size ); + Q_strncpy( out, "OpenGL", size ); #endif }