Add GFX_CTL_IDENT_GET

This commit is contained in:
twinaphex 2016-02-14 02:05:20 +01:00
parent 6413449944
commit 637ee33ab6
3 changed files with 20 additions and 11 deletions

View File

@ -83,13 +83,6 @@ static const gfx_ctx_driver_t *gfx_ctx_drivers[] = {
static const gfx_ctx_driver_t *current_video_context; static const gfx_ctx_driver_t *current_video_context;
static void *video_context_data; static void *video_context_data;
const char *gfx_ctx_get_ident(void)
{
if (!current_video_context)
return NULL;
return current_video_context->ident;
}
bool gfx_ctx_set_video_mode( bool gfx_ctx_set_video_mode(
unsigned width, unsigned height, unsigned width, unsigned height,
bool fullscreen) bool fullscreen)
@ -431,6 +424,14 @@ bool gfx_ctx_ctl(enum gfx_ctx_ctl_state state, void *data)
return current_video_context->suppress_screensaver( return current_video_context->suppress_screensaver(
video_context_data, *bool_data); video_context_data, *bool_data);
} }
case GFX_CTL_IDENT_GET:
{
gfx_ctx_ident_t *ident = (gfx_ctx_ident_t*)data;
ident->ident = NULL;
if (current_video_context)
ident->ident = current_video_context->ident;
}
break;
case GFX_CTL_NONE: case GFX_CTL_NONE:
default: default:
break; break;

View File

@ -78,7 +78,8 @@ enum gfx_ctx_ctl_state
GFX_CTL_TRANSLATE_ASPECT, GFX_CTL_TRANSLATE_ASPECT,
GFX_CTL_GET_METRICS, GFX_CTL_GET_METRICS,
GFX_CTL_INPUT_DRIVER, GFX_CTL_INPUT_DRIVER,
GFX_CTL_SUPPRESS_SCREENSAVER GFX_CTL_SUPPRESS_SCREENSAVER,
GFX_CTL_IDENT_GET
}; };
typedef void (*gfx_ctx_proc_t)(void); typedef void (*gfx_ctx_proc_t)(void);
@ -223,6 +224,11 @@ typedef struct gfx_ctx_proc_address
retro_proc_address_t addr; retro_proc_address_t addr;
} gfx_ctx_proc_address_t; } gfx_ctx_proc_address_t;
typedef struct gfx_ctx_ident
{
const char *ident;
} gfx_ctx_ident_t;
extern const gfx_ctx_driver_t gfx_ctx_sdl_gl; extern const gfx_ctx_driver_t gfx_ctx_sdl_gl;
extern const gfx_ctx_driver_t gfx_ctx_x_egl; extern const gfx_ctx_driver_t gfx_ctx_x_egl;
extern const gfx_ctx_driver_t gfx_ctx_wayland; extern const gfx_ctx_driver_t gfx_ctx_wayland;
@ -265,8 +271,6 @@ void gfx_ctx_get_video_size(unsigned *width, unsigned *height);
bool gfx_ctx_set_resize(unsigned width, unsigned height); bool gfx_ctx_set_resize(unsigned width, unsigned height);
const char *gfx_ctx_get_ident(void);
bool gfx_ctx_ctl(enum gfx_ctx_ctl_state state, void *data); bool gfx_ctx_ctl(enum gfx_ctx_ctl_state state, void *data);
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -441,6 +441,9 @@ static int menu_displaylist_parse_debug_info(menu_displaylist_info_t *info)
static int menu_displaylist_parse_system_info(menu_displaylist_info_t *info) static int menu_displaylist_parse_system_info(menu_displaylist_info_t *info)
{ {
int controller; int controller;
#if defined(HAVE_OPENGL) || defined(HAVE_GLES)
gfx_ctx_ident_t ident_info;
#endif
char tmp[PATH_MAX_LENGTH], feat_str[PATH_MAX_LENGTH]; char tmp[PATH_MAX_LENGTH], feat_str[PATH_MAX_LENGTH];
const char *tmp_string = NULL; const char *tmp_string = NULL;
const frontend_ctx_driver_t *frontend = frontend_get_ptr(); const frontend_ctx_driver_t *frontend = frontend_get_ptr();
@ -596,7 +599,8 @@ static int menu_displaylist_parse_system_info(menu_displaylist_info_t *info)
} }
#if defined(HAVE_OPENGL) || defined(HAVE_GLES) #if defined(HAVE_OPENGL) || defined(HAVE_GLES)
tmp_string = gfx_ctx_get_ident(); gfx_ctx_ctl(GFX_CTL_IDENT_GET, &ident_info);
tmp_string = ident_info.ident;
strlcpy(tmp, menu_hash_to_str(MENU_LABEL_VALUE_SYSTEM_INFO_VIDEO_CONTEXT_DRIVER), sizeof(tmp)); strlcpy(tmp, menu_hash_to_str(MENU_LABEL_VALUE_SYSTEM_INFO_VIDEO_CONTEXT_DRIVER), sizeof(tmp));
strlcat(tmp, ": ", sizeof(tmp)); strlcat(tmp, ": ", sizeof(tmp));