diff --git a/gfx/video_driver.c b/gfx/video_driver.c index 55e6729382..effc8edecf 100644 --- a/gfx/video_driver.c +++ b/gfx/video_driver.c @@ -2280,6 +2280,15 @@ void video_driver_build_info(video_frame_info_t *video_info) video_info->height = video_driver_height; video_info->use_rgba = video_driver_supports_rgba(); + + video_info->libretro_running = false; +#ifdef HAVE_MENU + video_info->menu_wallpaper_opacity = settings->menu.wallpaper.opacity; + + if (!settings->menu.pause_libretro) + video_info->libretro_running = (rarch_ctl(RARCH_CTL_IS_INITED, NULL) + && !rarch_ctl(RARCH_CTL_IS_DUMMY_CORE, NULL)); +#endif video_driver_threaded_unlock(); } diff --git a/gfx/video_driver.h b/gfx/video_driver.h index b08039dabd..5dd0e66cfb 100644 --- a/gfx/video_driver.h +++ b/gfx/video_driver.h @@ -86,6 +86,7 @@ typedef struct video_info typedef struct video_frame_info { + float menu_wallpaper_opacity; float refresh_rate; bool shared_context; bool black_frame_insertion; @@ -112,6 +113,7 @@ typedef struct video_frame_info float font_msg_color_g; float font_msg_color_b; bool use_rgba; + bool libretro_running; } video_frame_info_t; /* Optionally implemented interface to poke more diff --git a/menu/drivers/materialui.c b/menu/drivers/materialui.c index b3beea073d..6def8f3047 100644 --- a/menu/drivers/materialui.c +++ b/menu/drivers/materialui.c @@ -924,7 +924,8 @@ static int mui_get_core_title(char *s, size_t len) return 0; } -static void mui_draw_bg(menu_display_ctx_draw_t *draw) +static void mui_draw_bg(menu_display_ctx_draw_t *draw, + video_frame_info_t *video_info) { menu_display_blend_begin(); @@ -933,7 +934,7 @@ static void mui_draw_bg(menu_display_ctx_draw_t *draw) draw->pipeline.id = 0; draw->pipeline.active = false; - menu_display_draw_bg(draw, false); + menu_display_draw_bg(draw, video_info, false); menu_display_draw(draw); menu_display_blend_end(); } @@ -1039,7 +1040,7 @@ static void mui_frame(void *data, video_frame_info_t *video_info) uint64_t frame_count = video_info->frame_count; settings_t *settings = config_get_ptr(); bool background_rendered = false; - bool libretro_running = menu_display_libretro_running(); + bool libretro_running = video_info->libretro_running; /* Default is blue theme */ float *header_bg_color = NULL; @@ -1226,10 +1227,7 @@ static void mui_frame(void *data, video_frame_info_t *video_info) draw.vertex_count = 4; draw.prim_type = MENU_DISPLAY_PRIM_TRIANGLESTRIP; - if (!menu_display_libretro_running() && draw.texture) - draw.color = &white_bg[0]; - - mui_draw_bg(&draw); + mui_draw_bg(&draw, video_info); } else { @@ -1252,10 +1250,10 @@ static void mui_frame(void *data, video_frame_info_t *video_info) draw.vertex_count = 4; draw.prim_type = MENU_DISPLAY_PRIM_TRIANGLESTRIP; - if (!menu_display_libretro_running() && draw.texture) - draw.color = &white_bg[0]; + if (draw.texture) + draw.color = &white_bg[0]; - mui_draw_bg(&draw); + mui_draw_bg(&draw, video_info); /* Restore opacity of transposed white background */ menu_display_set_alpha(white_transp_bg, 0.90); diff --git a/menu/drivers/nuklear.c b/menu/drivers/nuklear.c index 618385a713..77c0020076 100644 --- a/menu/drivers/nuklear.c +++ b/menu/drivers/nuklear.c @@ -316,7 +316,7 @@ static void nk_menu_frame(void *data, video_frame_info_t *video_info) settings_t *settings = config_get_ptr(); unsigned width = video_info->width; unsigned height = video_info->height; - bool libretro_running = menu_display_libretro_running(); + bool libretro_running = video_info->libretro_running; float white_bg[16] = { 0.98, 0.98, 0.98, 1, 0.98, 0.98, 0.98, 1, diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c index 109c65f068..7c6c8fc956 100644 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -2424,7 +2424,7 @@ static void xmb_draw_bg( RARCH_LOG("DRAW BG %d %d \n",width,height); #endif - bool running = menu_display_libretro_running(); + bool running = video_info->libretro_running; draw.x = 0; draw.y = 0; @@ -2454,7 +2454,7 @@ static void xmb_draw_bg( else menu_display_set_alpha(draw.color, coord_white[3]); - menu_display_draw_gradient(&draw); + menu_display_draw_gradient(&draw, video_info); draw.pipeline.id = VIDEO_SHADER_MENU_2; @@ -2492,7 +2492,7 @@ static void xmb_draw_bg( menu_display_set_alpha(draw.color, coord_white[3]); if (settings->menu.xmb.menu_color_theme != XMB_THEME_WALLPAPER) - menu_display_draw_gradient(&draw); + menu_display_draw_gradient(&draw, video_info); { bool add_opacity = false; @@ -2505,7 +2505,7 @@ static void xmb_draw_bg( if (settings->menu.xmb.menu_color_theme == XMB_THEME_WALLPAPER) add_opacity = true; - menu_display_draw_bg(&draw, add_opacity); + menu_display_draw_bg(&draw, video_info, add_opacity); } } diff --git a/menu/drivers/zarch.c b/menu/drivers/zarch.c index 2581eb7a6f..0d47a9719f 100644 --- a/menu/drivers/zarch.c +++ b/menu/drivers/zarch.c @@ -970,13 +970,13 @@ static void zarch_frame(void *data, video_frame_info_t *video_info) draw.vertex_count = 4; draw.prim_type = MENU_DISPLAY_PRIM_TRIANGLESTRIP; - if (!menu_display_libretro_running() && draw.texture) - draw.color = &coord_color2[0]; + if (!video_info->libretro_running && draw.texture) + draw.color = &coord_color2[0]; menu_display_blend_begin(); draw.x = 0; draw.y = 0; - menu_display_draw_bg(&draw, false); + menu_display_draw_bg(&draw, video_info, false); menu_display_draw(&draw); menu_display_blend_end(); diff --git a/menu/menu_display.c b/menu/menu_display.c index 38171cdd5f..025957f8ee 100644 --- a/menu/menu_display.c +++ b/menu/menu_display.c @@ -495,7 +495,8 @@ void menu_display_draw_pipeline(menu_display_ctx_draw_t *draw) menu_disp->draw_pipeline(draw); } -void menu_display_draw_bg(menu_display_ctx_draw_t *draw, bool add_opacity_to_wallpaper) +void menu_display_draw_bg(menu_display_ctx_draw_t *draw, + video_frame_info_t *video_info, bool add_opacity_to_wallpaper) { static struct video_coords coords; const float *new_vertex = NULL; @@ -519,7 +520,7 @@ void menu_display_draw_bg(menu_display_ctx_draw_t *draw, bool add_opacity_to_wal draw->coords = &coords; - if (!menu_display_libretro_running() && !draw->pipeline.active) + if (!video_info->libretro_running && !draw->pipeline.active) add_opacity_to_wallpaper = true; if (add_opacity_to_wallpaper) @@ -534,13 +535,14 @@ void menu_display_draw_bg(menu_display_ctx_draw_t *draw, bool add_opacity_to_wal draw->matrix_data = (math_matrix_4x4*)menu_disp->get_default_mvp(); } -void menu_display_draw_gradient(menu_display_ctx_draw_t *draw) +void menu_display_draw_gradient(menu_display_ctx_draw_t *draw, + video_frame_info_t *video_info) { draw->texture = 0; draw->x = 0; draw->y = 0; - menu_display_draw_bg(draw, false); + menu_display_draw_bg(draw, video_info, false); menu_display_draw(draw); } diff --git a/menu/menu_display.h b/menu/menu_display.h index 0f4f5a300b..93b926b944 100644 --- a/menu/menu_display.h +++ b/menu/menu_display.h @@ -240,8 +240,13 @@ void menu_display_clear_color(menu_display_ctx_clearcolor_t *color); void menu_display_draw(menu_display_ctx_draw_t *draw); void menu_display_draw_pipeline(menu_display_ctx_draw_t *draw); -void menu_display_draw_bg(menu_display_ctx_draw_t *draw, bool add_opacity); -void menu_display_draw_gradient(menu_display_ctx_draw_t *draw); +void menu_display_draw_bg( + menu_display_ctx_draw_t *draw, + video_frame_info_t *video_info, + bool add_opacity); +void menu_display_draw_gradient( + menu_display_ctx_draw_t *draw, + video_frame_info_t *video_info); void menu_display_draw_quad(int x, int y, unsigned w, unsigned h, unsigned width, unsigned height, float *color);