mirror of
https://github.com/libretro/RetroArch
synced 2025-02-12 00:40:26 +00:00
Cleanups
This commit is contained in:
parent
c2ca8b3a2d
commit
d8b3132a3c
@ -361,7 +361,7 @@ void ozone_draw_entries(ozone_handle_t *ozone, video_frame_info_t *video_info,
|
||||
float sidebar_offset, bottom_boundary, invert, alpha_anim;
|
||||
unsigned video_info_height, video_info_width, entry_width, button_height;
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
bool use_smooth_ticker = settings->bools.menu_ticker_smooth;
|
||||
bool old_list = selection_buf == ozone->selection_buf_old;
|
||||
int x_offset = 0;
|
||||
size_t selection_y = 0; /* 0 means no selection (we assume that no entry has y = 0) */
|
||||
@ -369,6 +369,9 @@ void ozone_draw_entries(ozone_handle_t *ozone, video_frame_info_t *video_info,
|
||||
int entry_padding = ozone_get_entries_padding(ozone, old_list);
|
||||
|
||||
float scale_factor = ozone->last_scale_factor;
|
||||
enum gfx_animation_ticker_type
|
||||
menu_ticker_type = (enum gfx_animation_ticker_type)
|
||||
settings->uints.menu_ticker_type;
|
||||
|
||||
menu_entries_ctl(MENU_ENTRIES_CTL_START_GET, &i);
|
||||
|
||||
@ -464,17 +467,18 @@ border_iterate:
|
||||
|
||||
for (i = 0; i < entries_end; i++)
|
||||
{
|
||||
char rich_label[255];
|
||||
char entry_value_ticker[255];
|
||||
char wrapped_sublabel_str[MENU_SUBLABEL_MAX_LENGTH];
|
||||
uintptr_t tex;
|
||||
menu_entry_t entry;
|
||||
gfx_animation_ctx_ticker_t ticker;
|
||||
gfx_animation_ctx_ticker_smooth_t ticker_smooth;
|
||||
static const char* const ticker_spacer = OZONE_TICKER_SPACER;
|
||||
unsigned ticker_x_offset = 0;
|
||||
unsigned ticker_str_width = 0;
|
||||
int value_x_offset = 0;
|
||||
char rich_label[255];
|
||||
char entry_value_ticker[255];
|
||||
char wrapped_sublabel_str[MENU_SUBLABEL_MAX_LENGTH];
|
||||
static const char* const
|
||||
ticker_spacer = OZONE_TICKER_SPACER;
|
||||
const char *sublabel_str = NULL;
|
||||
ozone_node_t *node = NULL;
|
||||
const char *entry_rich_label = NULL;
|
||||
@ -482,7 +486,6 @@ border_iterate:
|
||||
bool entry_selected = false;
|
||||
int text_offset = -ozone->dimensions.entry_icon_padding - ozone->dimensions.entry_icon_size;
|
||||
float *icon_color = NULL;
|
||||
bool use_smooth_ticker = settings->bools.menu_ticker_smooth;
|
||||
|
||||
/* Initial ticker configuration */
|
||||
if (use_smooth_ticker)
|
||||
@ -490,7 +493,7 @@ border_iterate:
|
||||
ticker_smooth.idx = gfx_animation_get_ticker_pixel_idx();
|
||||
ticker_smooth.font = ozone->fonts.entries_label;
|
||||
ticker_smooth.font_scale = 1.0f;
|
||||
ticker_smooth.type_enum = (enum gfx_animation_ticker_type)settings->uints.menu_ticker_type;
|
||||
ticker_smooth.type_enum = menu_ticker_type;
|
||||
ticker_smooth.spacer = ticker_spacer;
|
||||
ticker_smooth.x_offset = &ticker_x_offset;
|
||||
ticker_smooth.dst_str_width = &ticker_str_width;
|
||||
@ -498,12 +501,13 @@ border_iterate:
|
||||
else
|
||||
{
|
||||
ticker.idx = gfx_animation_get_ticker_idx();
|
||||
ticker.type_enum = (enum gfx_animation_ticker_type)settings->uints.menu_ticker_type;
|
||||
ticker.type_enum = menu_ticker_type;
|
||||
ticker.spacer = ticker_spacer;
|
||||
}
|
||||
|
||||
entry_selected = selection == i;
|
||||
node = (ozone_node_t*) file_list_get_userdata_at_offset(selection_buf, i);
|
||||
node = (ozone_node_t*)
|
||||
file_list_get_userdata_at_offset(selection_buf, i);
|
||||
|
||||
menu_entry_init(&entry);
|
||||
entry.path_enabled = false;
|
||||
@ -822,6 +826,9 @@ void ozone_draw_thumbnail_bar(ozone_handle_t *ozone, video_frame_info_t *video_i
|
||||
settings_t *settings = config_get_ptr();
|
||||
bool scroll_content_metadata = settings->bools.ozone_scroll_content_metadata;
|
||||
bool use_smooth_ticker = settings->bools.menu_ticker_smooth;
|
||||
enum gfx_animation_ticker_type
|
||||
menu_ticker_type = (enum gfx_animation_ticker_type)
|
||||
settings->uints.menu_ticker_type;
|
||||
unsigned y = (unsigned)left_thumbnail_y_position;
|
||||
unsigned separator_padding = ozone->dimensions.sidebar_entry_icon_padding*2;
|
||||
unsigned column_x = x_position + separator_padding;
|
||||
@ -833,8 +840,7 @@ void ozone_draw_thumbnail_bar(ozone_handle_t *ozone, video_frame_info_t *video_i
|
||||
{
|
||||
ticker_smooth.idx = gfx_animation_get_ticker_pixel_idx();
|
||||
ticker_smooth.font_scale = 1.0f;
|
||||
ticker_smooth.type_enum = (enum gfx_animation_ticker_type)
|
||||
settings->uints.menu_ticker_type;
|
||||
ticker_smooth.type_enum = menu_ticker_type;
|
||||
ticker_smooth.spacer = ticker_spacer;
|
||||
ticker_smooth.x_offset = &ticker_x_offset;
|
||||
ticker_smooth.dst_str_width = NULL;
|
||||
@ -848,7 +854,7 @@ void ozone_draw_thumbnail_bar(ozone_handle_t *ozone, video_frame_info_t *video_i
|
||||
else
|
||||
{
|
||||
ticker.idx = gfx_animation_get_ticker_idx();
|
||||
ticker.type_enum = (enum gfx_animation_ticker_type)settings->uints.menu_ticker_type;
|
||||
ticker.type_enum = menu_ticker_type;
|
||||
ticker.spacer = ticker_spacer;
|
||||
|
||||
ticker.selected = true;
|
||||
|
@ -117,6 +117,8 @@ void ozone_draw_sidebar(ozone_handle_t *ozone, video_frame_info_t *video_info)
|
||||
uint32_t text_alpha = ozone->animations.sidebar_text_alpha * 255.0f;
|
||||
bool use_smooth_ticker = settings->bools.menu_ticker_smooth;
|
||||
float scale_factor = ozone->last_scale_factor;
|
||||
enum gfx_animation_ticker_type
|
||||
menu_ticker_type = (enum gfx_animation_ticker_type)settings->uints.menu_ticker_type;
|
||||
|
||||
/* Initial ticker configuration */
|
||||
if (use_smooth_ticker)
|
||||
@ -124,7 +126,7 @@ void ozone_draw_sidebar(ozone_handle_t *ozone, video_frame_info_t *video_info)
|
||||
ticker_smooth.idx = gfx_animation_get_ticker_pixel_idx();
|
||||
ticker_smooth.font = ozone->fonts.sidebar;
|
||||
ticker_smooth.font_scale = 1.0f;
|
||||
ticker_smooth.type_enum = (enum gfx_animation_ticker_type)settings->uints.menu_ticker_type;
|
||||
ticker_smooth.type_enum = menu_ticker_type;
|
||||
ticker_smooth.spacer = ticker_spacer;
|
||||
ticker_smooth.x_offset = &ticker_x_offset;
|
||||
ticker_smooth.dst_str_width = NULL;
|
||||
@ -132,7 +134,7 @@ void ozone_draw_sidebar(ozone_handle_t *ozone, video_frame_info_t *video_info)
|
||||
else
|
||||
{
|
||||
ticker.idx = gfx_animation_get_ticker_idx();
|
||||
ticker.type_enum = (enum gfx_animation_ticker_type)settings->uints.menu_ticker_type;
|
||||
ticker.type_enum = menu_ticker_type;
|
||||
ticker.spacer = ticker_spacer;
|
||||
}
|
||||
|
||||
@ -373,6 +375,7 @@ void ozone_sidebar_update_collapse(ozone_handle_t *ozone, bool allow_animation)
|
||||
settings_t *settings = config_get_ptr();
|
||||
bool is_playlist = ozone_is_playlist(ozone, false);
|
||||
gfx_animation_ctx_tag tag = (uintptr_t) &ozone->sidebar_collapsed;
|
||||
bool collapse_sidebar = settings->bools.ozone_collapse_sidebar;
|
||||
|
||||
entry.easing_enum = EASING_OUT_QUAD;
|
||||
entry.tag = tag;
|
||||
@ -382,7 +385,7 @@ void ozone_sidebar_update_collapse(ozone_handle_t *ozone, bool allow_animation)
|
||||
gfx_animation_kill_by_tag(&tag);
|
||||
|
||||
/* Collapse it */
|
||||
if (settings->bools.ozone_collapse_sidebar || (is_playlist && !ozone->cursor_in_sidebar))
|
||||
if (collapse_sidebar || (is_playlist && !ozone->cursor_in_sidebar))
|
||||
{
|
||||
if (allow_animation)
|
||||
{
|
||||
@ -408,7 +411,7 @@ void ozone_sidebar_update_collapse(ozone_handle_t *ozone, bool allow_animation)
|
||||
}
|
||||
}
|
||||
/* Show it */
|
||||
else if (ozone->cursor_in_sidebar || (!is_playlist && !settings->bools.ozone_collapse_sidebar))
|
||||
else if (ozone->cursor_in_sidebar || (!is_playlist && !collapse_sidebar))
|
||||
{
|
||||
if (allow_animation)
|
||||
{
|
||||
@ -439,20 +442,17 @@ void ozone_sidebar_update_collapse(ozone_handle_t *ozone, bool allow_animation)
|
||||
ozone_entries_update_thumbnail_bar(ozone, is_playlist, allow_animation);
|
||||
}
|
||||
|
||||
static float ozone_sidebar_get_scroll_y(ozone_handle_t *ozone, unsigned video_height)
|
||||
static float ozone_sidebar_get_scroll_y(
|
||||
ozone_handle_t *ozone, unsigned video_height)
|
||||
{
|
||||
float scroll_y = ozone->animations.scroll_y_sidebar;
|
||||
float selected_position_y;
|
||||
float current_selection_middle_onscreen;
|
||||
float bottom_boundary;
|
||||
float entries_middle;
|
||||
float entries_height;
|
||||
|
||||
selected_position_y = ozone_get_selected_sidebar_y_position(ozone);
|
||||
current_selection_middle_onscreen = ozone->dimensions.header_height + ozone->dimensions.spacer_1px + ozone->animations.scroll_y_sidebar + selected_position_y + ozone->dimensions.sidebar_entry_height / 2.0f;
|
||||
bottom_boundary = (float)video_height - (ozone->dimensions.header_height + ozone->dimensions.spacer_1px) - ozone->dimensions.footer_height;
|
||||
entries_middle = (float)video_height / 2.0f;
|
||||
entries_height = ozone_get_sidebar_height(ozone);
|
||||
float selected_position_y =
|
||||
ozone_get_selected_sidebar_y_position(ozone);
|
||||
float current_selection_middle_onscreen =
|
||||
ozone->dimensions.header_height + ozone->dimensions.spacer_1px + ozone->animations.scroll_y_sidebar + selected_position_y + ozone->dimensions.sidebar_entry_height / 2.0f;
|
||||
float bottom_boundary = (float)video_height - (ozone->dimensions.header_height + ozone->dimensions.spacer_1px) - ozone->dimensions.footer_height;
|
||||
float entries_middle = (float)video_height / 2.0f;
|
||||
float entries_height = ozone_get_sidebar_height(ozone);
|
||||
|
||||
if (current_selection_middle_onscreen != entries_middle)
|
||||
scroll_y = ozone->animations.scroll_y_sidebar - (current_selection_middle_onscreen - entries_middle);
|
||||
@ -461,7 +461,7 @@ static float ozone_sidebar_get_scroll_y(ozone_handle_t *ozone, unsigned video_he
|
||||
scroll_y = bottom_boundary - entries_height - ozone->dimensions.sidebar_padding_vertical;
|
||||
|
||||
if (scroll_y > 0.0f)
|
||||
scroll_y = 0.0f;
|
||||
return 0.0f;
|
||||
|
||||
return scroll_y;
|
||||
}
|
||||
@ -470,12 +470,10 @@ void ozone_sidebar_goto(ozone_handle_t *ozone, unsigned new_selection)
|
||||
{
|
||||
unsigned video_info_height;
|
||||
struct gfx_animation_ctx_entry entry;
|
||||
gfx_animation_ctx_tag tag;
|
||||
gfx_animation_ctx_tag tag = (uintptr_t)ozone;
|
||||
|
||||
video_driver_get_size(NULL, &video_info_height);
|
||||
|
||||
tag = (uintptr_t)ozone;
|
||||
|
||||
if (ozone->categories_selection_ptr != new_selection)
|
||||
{
|
||||
ozone->categories_active_idx_old = ozone->categories_selection_ptr;
|
||||
@ -533,6 +531,7 @@ void ozone_refresh_sidebars(ozone_handle_t *ozone, unsigned video_height)
|
||||
gfx_animation_ctx_tag thumbnail_tag = (uintptr_t)&ozone->show_thumbnail_bar;
|
||||
gfx_animation_ctx_tag scroll_tag = (uintptr_t)ozone;
|
||||
bool is_playlist = ozone_is_playlist(ozone, false);
|
||||
bool collapse_sidebar = settings->bools.ozone_collapse_sidebar;
|
||||
|
||||
/* Kill any existing animations */
|
||||
gfx_animation_kill_by_tag(&collapsed_tag);
|
||||
@ -542,13 +541,13 @@ void ozone_refresh_sidebars(ozone_handle_t *ozone, unsigned video_height)
|
||||
gfx_animation_kill_by_tag(&scroll_tag);
|
||||
|
||||
/* Set sidebar width */
|
||||
if (settings->bools.ozone_collapse_sidebar || (is_playlist && !ozone->cursor_in_sidebar))
|
||||
if (collapse_sidebar || (is_playlist && !ozone->cursor_in_sidebar))
|
||||
{
|
||||
ozone->animations.sidebar_text_alpha = 0.0f;
|
||||
ozone->dimensions.sidebar_width = ozone->dimensions.sidebar_width_collapsed;
|
||||
ozone->sidebar_collapsed = true;
|
||||
}
|
||||
else if (ozone->cursor_in_sidebar || (!is_playlist && !settings->bools.ozone_collapse_sidebar))
|
||||
else if (ozone->cursor_in_sidebar || (!is_playlist && !collapse_sidebar))
|
||||
{
|
||||
ozone->animations.sidebar_text_alpha = 1.0f;
|
||||
ozone->dimensions.sidebar_width = ozone->dimensions.sidebar_width_normal;
|
||||
@ -624,19 +623,19 @@ void ozone_init_horizontal_list(ozone_handle_t *ozone)
|
||||
{
|
||||
menu_displaylist_info_t info;
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
const char *dir_playlist = settings->paths.directory_playlist;
|
||||
bool menu_content_show_playlists = settings->bools.menu_content_show_playlists;
|
||||
menu_displaylist_info_init(&info);
|
||||
|
||||
info.list = ozone->horizontal_list;
|
||||
info.path = strdup(
|
||||
settings->paths.directory_playlist);
|
||||
info.path = strdup(dir_playlist);
|
||||
info.label = strdup(
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_PLAYLISTS_TAB));
|
||||
info.exts = strdup("lpl");
|
||||
info.type_default = FILE_TYPE_PLAIN;
|
||||
info.enum_idx = MENU_ENUM_LABEL_PLAYLISTS_TAB;
|
||||
|
||||
if (settings->bools.menu_content_show_playlists && !string_is_empty(info.path))
|
||||
if (menu_content_show_playlists && !string_is_empty(info.path))
|
||||
{
|
||||
if (menu_displaylist_ctl(DISPLAYLIST_DATABASE_PLAYLISTS_HORIZONTAL, &info))
|
||||
menu_displaylist_process(&info);
|
||||
@ -674,7 +673,6 @@ void ozone_context_reset_horizontal_list(ozone_handle_t *ozone)
|
||||
char *chr;
|
||||
bool hyphen_found;
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
size_t list_size = ozone_list_get_size(ozone, MENU_LIST_HORIZONTAL);
|
||||
|
||||
for (i = 0; i < list_size; i++)
|
||||
@ -788,6 +786,9 @@ void ozone_context_reset_horizontal_list(ozone_handle_t *ozone)
|
||||
chr = title_noext;
|
||||
hyphen_found = false;
|
||||
|
||||
/* TODO/FIXME - why is there a while loop here?
|
||||
* Does 'something' set ozone_truncate_playlist_name
|
||||
* ever to false while this is running? */
|
||||
while (settings->bools.ozone_truncate_playlist_name)
|
||||
{
|
||||
/* Check for "- " */
|
||||
|
@ -1353,23 +1353,25 @@ static void rgui_render_particle_effect(rgui_t *rgui)
|
||||
/* Give speed factor a long, awkward name to minimise
|
||||
* risk of clashing with specific particle effect
|
||||
* implementation variables... */
|
||||
float global_speed_factor;
|
||||
float global_speed_factor = 1.0f;
|
||||
settings_t *settings = config_get_ptr();
|
||||
float particle_effect_speed = settings ? settings->floats.menu_rgui_particle_effect_speed : 0.0f;
|
||||
|
||||
/* Sanity check */
|
||||
if (!rgui || !rgui_frame_buf.data || !settings)
|
||||
if (!rgui || !rgui_frame_buf.data)
|
||||
return;
|
||||
|
||||
gfx_display_get_fb_size(&fb_width, &fb_height, &fb_pitch);
|
||||
|
||||
/* Adjust global animation speed */
|
||||
/* > Apply user configured speed multiplier */
|
||||
global_speed_factor =
|
||||
(settings->floats.menu_rgui_particle_effect_speed > 0.0001f) ?
|
||||
settings->floats.menu_rgui_particle_effect_speed : 1.0f;
|
||||
if (particle_effect_speed > 0.0001f)
|
||||
global_speed_factor = particle_effect_speed ;
|
||||
|
||||
/* > Account for non-standard frame times
|
||||
* (high/low refresh rates, or frame drops) */
|
||||
global_speed_factor *= gfx_animation_get_delta_time() / particle_effect_period;
|
||||
global_speed_factor *= gfx_animation_get_delta_time()
|
||||
/ particle_effect_period;
|
||||
|
||||
/* Note: It would be more elegant to have 'update' and 'draw'
|
||||
* as separate functions, since 'update' is the part that
|
||||
@ -1696,11 +1698,13 @@ static bool request_thumbnail(
|
||||
static bool downscale_thumbnail(rgui_t *rgui, unsigned max_width, unsigned max_height,
|
||||
struct texture_image *image_src, struct texture_image *image_dst)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
/* Determine output dimensions */
|
||||
float display_aspect_ratio = (float)max_width / (float)max_height;
|
||||
float aspect_ratio = (float)image_src->width / (float)image_src->height;
|
||||
float aspect_ratio = (float)image_src->width
|
||||
/ (float)image_src->height;
|
||||
settings_t *settings = config_get_ptr();
|
||||
unsigned thumbnail_downscaler = settings->uints.menu_rgui_thumbnail_downscaler;
|
||||
|
||||
if (aspect_ratio > display_aspect_ratio)
|
||||
{
|
||||
image_dst->width = max_width;
|
||||
@ -1724,7 +1728,7 @@ static bool downscale_thumbnail(rgui_t *rgui, unsigned max_width, unsigned max_h
|
||||
return false;
|
||||
|
||||
/* Determine scaling method */
|
||||
if (settings->uints.menu_rgui_thumbnail_downscaler == RGUI_THUMB_SCALE_POINT)
|
||||
if (thumbnail_downscaler == RGUI_THUMB_SCALE_POINT)
|
||||
{
|
||||
uint32_t x_ratio, y_ratio;
|
||||
unsigned x_src, y_src;
|
||||
@ -1762,7 +1766,7 @@ static bool downscale_thumbnail(rgui_t *rgui, unsigned max_width, unsigned max_h
|
||||
rgui->image_scaler.out_stride = image_dst->width * sizeof(uint32_t);
|
||||
rgui->image_scaler.out_fmt = SCALER_FMT_ARGB8888;
|
||||
|
||||
rgui->image_scaler.scaler_type = (settings->uints.menu_rgui_thumbnail_downscaler == RGUI_THUMB_SCALE_SINC) ?
|
||||
rgui->image_scaler.scaler_type = (thumbnail_downscaler == RGUI_THUMB_SCALE_SINC) ?
|
||||
SCALER_TYPE_SINC : SCALER_TYPE_BILINEAR;
|
||||
|
||||
/* This reset is redundant, since scaler_ctx_gen_filter()
|
||||
@ -1852,9 +1856,7 @@ static bool rgui_load_image(void *userdata, void *data, enum menu_image_type typ
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
if (!rgui || !settings)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!data)
|
||||
{
|
||||
@ -1862,15 +1864,19 @@ static bool rgui_load_image(void *userdata, void *data, enum menu_image_type typ
|
||||
* data, but we still have to decrement any thumbnail
|
||||
* queues (otherwise further thumbnail processing will
|
||||
* be blocked) */
|
||||
if (type == MENU_IMAGE_THUMBNAIL)
|
||||
switch (type)
|
||||
{
|
||||
case MENU_IMAGE_THUMBNAIL:
|
||||
if (rgui->thumbnail_queue_size > 0)
|
||||
rgui->thumbnail_queue_size--;
|
||||
}
|
||||
else if (type == MENU_IMAGE_LEFT_THUMBNAIL)
|
||||
{
|
||||
break;
|
||||
case MENU_IMAGE_LEFT_THUMBNAIL:
|
||||
if (rgui->left_thumbnail_queue_size > 0)
|
||||
rgui->left_thumbnail_queue_size--;
|
||||
break;
|
||||
case MENU_IMAGE_NONE:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return false;
|
||||
@ -2188,9 +2194,10 @@ static void load_custom_theme(rgui_t *rgui, rgui_theme_t *theme_colors, const ch
|
||||
char *wallpaper_key = NULL;
|
||||
settings_t *settings = config_get_ptr();
|
||||
bool success = false;
|
||||
unsigned rgui_aspect_ratio = settings->uints.menu_rgui_aspect_ratio;
|
||||
|
||||
/* Determine which type of wallpaper to load */
|
||||
switch (settings->uints.menu_rgui_aspect_ratio)
|
||||
switch (rgui_aspect_ratio)
|
||||
{
|
||||
case RGUI_ASPECT_RATIO_16_9:
|
||||
case RGUI_ASPECT_RATIO_16_9_CENTRE:
|
||||
@ -2339,13 +2346,17 @@ static void rgui_cache_background(rgui_t *rgui)
|
||||
static void prepare_rgui_colors(rgui_t *rgui, settings_t *settings)
|
||||
{
|
||||
rgui_theme_t theme_colors;
|
||||
rgui->color_theme = settings->uints.menu_rgui_color_theme;
|
||||
unsigned rgui_color_theme = settings->uints.menu_rgui_color_theme;
|
||||
const char *rgui_theme_preset = settings->paths.path_rgui_theme_preset;
|
||||
|
||||
rgui->color_theme = rgui_color_theme;
|
||||
rgui->show_wallpaper = false;
|
||||
|
||||
if (rgui->color_theme == RGUI_THEME_CUSTOM)
|
||||
{
|
||||
memcpy(rgui->theme_preset_path, settings->paths.path_rgui_theme_preset, sizeof(rgui->theme_preset_path));
|
||||
load_custom_theme(rgui, &theme_colors, settings->paths.path_rgui_theme_preset);
|
||||
memcpy(rgui->theme_preset_path,
|
||||
rgui_theme_preset, sizeof(rgui->theme_preset_path));
|
||||
load_custom_theme(rgui, &theme_colors, rgui_theme_preset);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -2361,6 +2372,7 @@ static void prepare_rgui_colors(rgui_t *rgui, settings_t *settings)
|
||||
theme_colors.shadow_color = current_theme->shadow_color;
|
||||
theme_colors.particle_color = current_theme->particle_color;
|
||||
}
|
||||
|
||||
rgui->colors.hover_color = argb32_to_pixel_platform_format(theme_colors.hover_color);
|
||||
rgui->colors.normal_color = argb32_to_pixel_platform_format(theme_colors.normal_color);
|
||||
rgui->colors.title_color = argb32_to_pixel_platform_format(theme_colors.title_color);
|
||||
@ -3204,20 +3216,32 @@ static void rgui_render(void *data,
|
||||
{
|
||||
gfx_animation_ctx_ticker_t ticker;
|
||||
gfx_animation_ctx_ticker_smooth_t ticker_smooth;
|
||||
static const char* const ticker_spacer = RGUI_TICKER_SPACER;
|
||||
bool use_smooth_ticker;
|
||||
unsigned x, y;
|
||||
size_t i, end, fb_pitch, old_start, new_start;
|
||||
unsigned fb_width, fb_height;
|
||||
int bottom;
|
||||
static bool display_kb = false;
|
||||
static const char* const
|
||||
ticker_spacer = RGUI_TICKER_SPACER;
|
||||
int bottom = 0;
|
||||
unsigned ticker_x_offset = 0;
|
||||
size_t entries_end = menu_entries_get_size();
|
||||
bool msg_force = false;
|
||||
bool fb_size_changed = false;
|
||||
settings_t *settings = config_get_ptr();
|
||||
rgui_t *rgui = (rgui_t*)data;
|
||||
|
||||
static bool display_kb = false;
|
||||
enum gfx_animation_ticker_type
|
||||
menu_ticker_type = (enum gfx_animation_ticker_type)
|
||||
settings->uints.menu_ticker_type;
|
||||
bool rgui_inline_thumbnails = settings->bools.menu_rgui_inline_thumbnails;
|
||||
bool menu_battery_level_enable = settings->bools.menu_battery_level_enable;
|
||||
bool use_smooth_ticker = settings->bools.menu_ticker_smooth;
|
||||
bool rgui_swap_thumbnails = settings->bools.menu_rgui_swap_thumbnails;
|
||||
bool rgui_full_width_layout = settings->bools.menu_rgui_full_width_layout;
|
||||
bool menu_show_sublabels = settings->bools.menu_show_sublabels;
|
||||
bool video_fullscreen = settings->bools.video_fullscreen;
|
||||
bool menu_mouse_enable = settings->bools.menu_mouse_enable;
|
||||
bool menu_core_enable = settings->bools.menu_core_enable;
|
||||
bool menu_timedate_enable = settings->bools.menu_timedate_enable;
|
||||
bool current_display_cb = false;
|
||||
|
||||
bool show_fs_thumbnail =
|
||||
@ -3226,7 +3250,7 @@ static void rgui_render(void *data,
|
||||
(fs_thumbnail.is_valid || (rgui->thumbnail_queue_size > 0));
|
||||
|
||||
/* Sanity check */
|
||||
if (!rgui || !rgui_frame_buf.data || !settings)
|
||||
if (!rgui || !rgui_frame_buf.data)
|
||||
return;
|
||||
|
||||
/* Apply pending aspect ratio update */
|
||||
@ -3246,7 +3270,9 @@ static void rgui_render(void *data,
|
||||
&& !msg_force)
|
||||
return;
|
||||
|
||||
if (!display_kb && !current_display_cb && (is_idle || !gfx_display_get_update_pending()))
|
||||
if ( !display_kb &&
|
||||
!current_display_cb &&
|
||||
(is_idle || !gfx_display_get_update_pending()))
|
||||
return;
|
||||
}
|
||||
|
||||
@ -3257,7 +3283,8 @@ static void rgui_render(void *data,
|
||||
|
||||
/* If the framebuffer changed size, or the background config has
|
||||
* changed, recache the background buffer */
|
||||
fb_size_changed = (rgui->last_width != fb_width) || (rgui->last_height != fb_height);
|
||||
fb_size_changed = (rgui->last_width != fb_width) ||
|
||||
(rgui->last_height != fb_height);
|
||||
|
||||
#if defined(GEKKO)
|
||||
/* Wii gfx driver changes menu framebuffer size at
|
||||
@ -3273,7 +3300,8 @@ static void rgui_render(void *data,
|
||||
rgui_cache_background(rgui);
|
||||
|
||||
/* Reinitialise particle effect, if required */
|
||||
if (fb_size_changed && (rgui->particle_effect != RGUI_PARTICLE_EFFECT_NONE))
|
||||
if (fb_size_changed &&
|
||||
(rgui->particle_effect != RGUI_PARTICLE_EFFECT_NONE))
|
||||
rgui_init_particle_effect(rgui);
|
||||
|
||||
rgui->last_width = fb_width;
|
||||
@ -3291,6 +3319,7 @@ static void rgui_render(void *data,
|
||||
/* Get offset of bottommost entry */
|
||||
bottom = (int)(entries_end - rgui_term_layout.height);
|
||||
menu_entries_ctl(MENU_ENTRIES_CTL_START_GET, &old_start);
|
||||
|
||||
if (old_start > (unsigned)bottom)
|
||||
{
|
||||
/* MENU_ENTRIES_CTL_SET_START requires a pointer of
|
||||
@ -3355,21 +3384,19 @@ static void rgui_render(void *data,
|
||||
|
||||
/* We use a single ticker for all text animations,
|
||||
* with the following configuration: */
|
||||
use_smooth_ticker = settings->bools.menu_ticker_smooth;
|
||||
if (use_smooth_ticker)
|
||||
{
|
||||
ticker_smooth.idx = gfx_animation_get_ticker_pixel_idx();
|
||||
ticker_smooth.font = NULL;
|
||||
ticker_smooth.glyph_width = FONT_WIDTH_STRIDE;
|
||||
ticker_smooth.type_enum = (enum gfx_animation_ticker_type)
|
||||
settings->uints.menu_ticker_type;
|
||||
ticker_smooth.type_enum = menu_ticker_type;
|
||||
ticker_smooth.spacer = ticker_spacer;
|
||||
ticker_smooth.dst_str_width = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
ticker.idx = gfx_animation_get_ticker_idx();
|
||||
ticker.type_enum = (enum gfx_animation_ticker_type)settings->uints.menu_ticker_type;
|
||||
ticker.type_enum = menu_ticker_type;
|
||||
ticker.spacer = ticker_spacer;
|
||||
}
|
||||
|
||||
@ -3449,7 +3476,7 @@ static void rgui_render(void *data,
|
||||
unsigned term_end_x = rgui_term_layout.start_x + (rgui_term_layout.width * FONT_WIDTH_STRIDE);
|
||||
unsigned timedate_x = term_end_x - (5 * FONT_WIDTH_STRIDE);
|
||||
unsigned core_name_len = ((timedate_x - rgui_term_layout.start_x) / FONT_WIDTH_STRIDE) - 3;
|
||||
bool show_mini_thumbnails = rgui->is_playlist && settings->bools.menu_rgui_inline_thumbnails;
|
||||
bool show_mini_thumbnails = rgui->is_playlist && rgui_inline_thumbnails;
|
||||
bool show_thumbnail = false;
|
||||
bool show_left_thumbnail = false;
|
||||
unsigned thumbnail_panel_width = 0;
|
||||
@ -3481,7 +3508,7 @@ static void rgui_render(void *data,
|
||||
}
|
||||
|
||||
/* Show battery indicator, if required */
|
||||
if (settings->bools.menu_battery_level_enable)
|
||||
if (menu_battery_level_enable)
|
||||
{
|
||||
gfx_display_ctx_powerstate_t powerstate;
|
||||
char percent_str[12];
|
||||
@ -3501,8 +3528,9 @@ static void rgui_render(void *data,
|
||||
{
|
||||
unsigned powerstate_x;
|
||||
enum rgui_symbol_type powerstate_symbol;
|
||||
uint16_t powerstate_color = (powerstate.percent > BATTERY_WARN_THRESHOLD || powerstate.charging) ?
|
||||
rgui->colors.title_color : rgui->colors.hover_color;
|
||||
uint16_t powerstate_color = (powerstate.percent > BATTERY_WARN_THRESHOLD || powerstate.charging)
|
||||
? rgui->colors.title_color
|
||||
: rgui->colors.hover_color;
|
||||
|
||||
if (powerstate.charging)
|
||||
powerstate_symbol = RGUI_SYMBOL_CHARGING;
|
||||
@ -3632,8 +3660,9 @@ static void rgui_render(void *data,
|
||||
/* If showing mini thumbnails, reduce title field length accordingly */
|
||||
if (show_mini_thumbnails)
|
||||
{
|
||||
unsigned term_offset = settings->bools.menu_rgui_swap_thumbnails ?
|
||||
(unsigned)(rgui_term_layout.height - (i - new_start) - 1) : (i - new_start);
|
||||
unsigned term_offset = rgui_swap_thumbnails
|
||||
? (unsigned)(rgui_term_layout.height - (i - new_start) - 1)
|
||||
: (i - new_start);
|
||||
unsigned thumbnail_width = 0;
|
||||
|
||||
/* Note:
|
||||
@ -3668,7 +3697,7 @@ static void rgui_render(void *data,
|
||||
/* Determine whether entry has a value component */
|
||||
if (!string_is_empty(entry_value))
|
||||
{
|
||||
if (settings->bools.menu_rgui_full_width_layout)
|
||||
if (rgui_full_width_layout)
|
||||
{
|
||||
/* Resize fields according to actual length of value string */
|
||||
entry_value_len = (unsigned)strlen(entry_value);
|
||||
@ -3763,7 +3792,7 @@ static void rgui_render(void *data,
|
||||
}
|
||||
|
||||
/* Print menu sublabel/core name (if required) */
|
||||
if (settings->bools.menu_show_sublabels && !string_is_empty(rgui->menu_sublabel))
|
||||
if (menu_show_sublabels && !string_is_empty(rgui->menu_sublabel))
|
||||
{
|
||||
char sublabel_buf[MENU_SUBLABEL_MAX_LENGTH];
|
||||
sublabel_buf[0] = '\0';
|
||||
@ -3796,7 +3825,7 @@ static void rgui_render(void *data,
|
||||
rgui_term_layout.start_y + 2, sublabel_buf,
|
||||
rgui->colors.hover_color, rgui->colors.shadow_color);
|
||||
}
|
||||
else if (settings->bools.menu_core_enable)
|
||||
else if (menu_core_enable)
|
||||
{
|
||||
char core_title[64];
|
||||
char core_title_buf[64];
|
||||
@ -3834,7 +3863,7 @@ static void rgui_render(void *data,
|
||||
}
|
||||
|
||||
/* Print clock (if required) */
|
||||
if (settings->bools.menu_timedate_enable)
|
||||
if (menu_timedate_enable)
|
||||
{
|
||||
gfx_display_ctx_datetime_t datetime;
|
||||
char timedate[16];
|
||||
@ -3865,10 +3894,9 @@ static void rgui_render(void *data,
|
||||
|
||||
if (rgui->mouse_show)
|
||||
{
|
||||
bool cursor_visible = settings->bools.video_fullscreen ||
|
||||
!video_driver_has_windowed();
|
||||
bool cursor_visible = video_fullscreen || !video_driver_has_windowed();
|
||||
|
||||
if (settings->bools.menu_mouse_enable && cursor_visible)
|
||||
if (menu_mouse_enable && cursor_visible)
|
||||
rgui_blit_cursor(rgui);
|
||||
}
|
||||
}
|
||||
@ -3910,7 +3938,8 @@ static void rgui_thumbnail_free(thumbnail_t *thumbnail)
|
||||
thumbnail->data = NULL;
|
||||
}
|
||||
|
||||
bool rgui_is_video_config_equal(rgui_video_settings_t *config_a, rgui_video_settings_t *config_b)
|
||||
bool rgui_is_video_config_equal(
|
||||
rgui_video_settings_t *config_a, rgui_video_settings_t *config_b)
|
||||
{
|
||||
return (config_a->aspect_ratio_idx == config_b->aspect_ratio_idx) &&
|
||||
(config_a->viewport.width == config_b->viewport.width) &&
|
||||
@ -3936,7 +3965,8 @@ static void rgui_get_video_config(rgui_video_settings_t *video_settings)
|
||||
video_settings->viewport.y = custom_vp->y;
|
||||
}
|
||||
|
||||
static void rgui_set_video_config(rgui_t *rgui, rgui_video_settings_t *video_settings, bool delay_update)
|
||||
static void rgui_set_video_config(rgui_t *rgui,
|
||||
rgui_video_settings_t *video_settings, bool delay_update)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
/* Could use settings->video_viewport_custom directly,
|
||||
@ -3968,10 +3998,12 @@ static void rgui_set_video_config(rgui_t *rgui, rgui_video_settings_t *video_set
|
||||
* lock is enabled */
|
||||
static void rgui_update_menu_viewport(rgui_t *rgui)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
size_t fb_pitch;
|
||||
unsigned fb_width, fb_height;
|
||||
struct video_viewport vp;
|
||||
unsigned fb_width, fb_height;
|
||||
bool do_integer_scaling = false;
|
||||
settings_t *settings = config_get_ptr();
|
||||
unsigned aspect_ratio_lock = settings ? settings->uints.menu_rgui_aspect_ratio_lock : 0;
|
||||
|
||||
if (!settings)
|
||||
return;
|
||||
@ -3990,6 +4022,7 @@ static void rgui_update_menu_viewport(rgui_t *rgui)
|
||||
/* The Wii is a special case, since it uses anamorphic
|
||||
* widescreen. The display aspect ratio cannot therefore
|
||||
* be determined simply by dividing viewport width by height */
|
||||
float delta;
|
||||
#ifdef HW_RVL
|
||||
float device_aspect = (CONF_GetAspectRatio() == CONF_ASPECT_4_3) ?
|
||||
(4.0f / 3.0f) : (16.0f / 9.0f);
|
||||
@ -3997,7 +4030,6 @@ static void rgui_update_menu_viewport(rgui_t *rgui)
|
||||
float device_aspect = (4.0f / 3.0f);
|
||||
#endif
|
||||
float desired_aspect = (float)fb_width / (float)fb_height;
|
||||
float delta;
|
||||
|
||||
if (device_aspect > desired_aspect)
|
||||
{
|
||||
@ -4013,13 +4045,16 @@ static void rgui_update_menu_viewport(rgui_t *rgui)
|
||||
}
|
||||
#else
|
||||
/* Check whether we need to perform integer scaling */
|
||||
bool do_integer_scaling = (settings->uints.menu_rgui_aspect_ratio_lock == RGUI_ASPECT_RATIO_LOCK_INTEGER);
|
||||
do_integer_scaling = (aspect_ratio_lock
|
||||
== RGUI_ASPECT_RATIO_LOCK_INTEGER);
|
||||
|
||||
if (do_integer_scaling)
|
||||
{
|
||||
unsigned width_scale = (vp.full_width / fb_width);
|
||||
unsigned height_scale = (vp.full_height / fb_height);
|
||||
unsigned scale = (width_scale <= height_scale) ? width_scale : height_scale;
|
||||
unsigned scale = (width_scale <= height_scale)
|
||||
? width_scale
|
||||
: height_scale;
|
||||
|
||||
if (scale > 0)
|
||||
{
|
||||
@ -4032,8 +4067,10 @@ static void rgui_update_menu_viewport(rgui_t *rgui)
|
||||
|
||||
if (!do_integer_scaling)
|
||||
{
|
||||
float display_aspect_ratio = (float)vp.full_width / (float)vp.full_height;
|
||||
float aspect_ratio = (float)fb_width / (float)fb_height;
|
||||
float display_aspect_ratio = (float)vp.full_width
|
||||
/ (float)vp.full_height;
|
||||
float aspect_ratio = (float)fb_width
|
||||
/ (float)fb_height;
|
||||
|
||||
if (aspect_ratio > display_aspect_ratio)
|
||||
{
|
||||
@ -4049,10 +4086,14 @@ static void rgui_update_menu_viewport(rgui_t *rgui)
|
||||
#endif
|
||||
|
||||
/* Sanity check */
|
||||
rgui->menu_video_settings.viewport.width = (rgui->menu_video_settings.viewport.width < 1) ?
|
||||
1 : rgui->menu_video_settings.viewport.width;
|
||||
rgui->menu_video_settings.viewport.height = (rgui->menu_video_settings.viewport.height < 1) ?
|
||||
1 : rgui->menu_video_settings.viewport.height;
|
||||
rgui->menu_video_settings.viewport.width =
|
||||
(rgui->menu_video_settings.viewport.width < 1)
|
||||
? 1
|
||||
: rgui->menu_video_settings.viewport.width;
|
||||
rgui->menu_video_settings.viewport.height =
|
||||
(rgui->menu_video_settings.viewport.height < 1)
|
||||
? 1
|
||||
: rgui->menu_video_settings.viewport.height;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -4068,6 +4109,8 @@ static bool rgui_set_aspect_ratio(rgui_t *rgui, bool delay_update)
|
||||
{
|
||||
unsigned base_term_width;
|
||||
settings_t *settings = config_get_ptr();
|
||||
unsigned rgui_aspect_ratio = settings->uints.menu_rgui_aspect_ratio;
|
||||
unsigned aspect_ratio_lock = settings->uints.menu_rgui_aspect_ratio_lock;
|
||||
|
||||
rgui_framebuffer_free();
|
||||
rgui_background_free();
|
||||
@ -4076,7 +4119,7 @@ static bool rgui_set_aspect_ratio(rgui_t *rgui, bool delay_update)
|
||||
rgui_thumbnail_free(&mini_left_thumbnail);
|
||||
|
||||
/* Cache new aspect ratio */
|
||||
rgui->menu_aspect_ratio = settings->uints.menu_rgui_aspect_ratio;
|
||||
rgui->menu_aspect_ratio = rgui_aspect_ratio;
|
||||
|
||||
#if defined(GEKKO)
|
||||
{
|
||||
@ -4096,7 +4139,8 @@ static bool rgui_set_aspect_ratio(rgui_t *rgui, bool delay_update)
|
||||
if (rgui_frame_buf.height == 240)
|
||||
rgui_frame_buf.width = 424;
|
||||
else
|
||||
rgui_frame_buf.width = (unsigned)((16.0f / 9.0f) * (float)rgui_frame_buf.height) & ~3;
|
||||
rgui_frame_buf.width = (unsigned)
|
||||
((16.0f / 9.0f) * (float)rgui_frame_buf.height) & ~3;
|
||||
base_term_width = rgui_frame_buf.width;
|
||||
break;
|
||||
case RGUI_ASPECT_RATIO_16_9_CENTRE:
|
||||
@ -4107,15 +4151,18 @@ static bool rgui_set_aspect_ratio(rgui_t *rgui, bool delay_update)
|
||||
}
|
||||
else
|
||||
{
|
||||
rgui_frame_buf.width = (unsigned)((16.0f / 9.0f) * (float)rgui_frame_buf.height) & ~3;
|
||||
base_term_width = (unsigned)(( 4.0f / 3.0f) * (float)rgui_frame_buf.height) & ~3;
|
||||
rgui_frame_buf.width = (unsigned)
|
||||
((16.0f / 9.0f) * (float)rgui_frame_buf.height) & ~3;
|
||||
base_term_width = (unsigned)
|
||||
(( 4.0f / 3.0f) * (float)rgui_frame_buf.height) & ~3;
|
||||
}
|
||||
break;
|
||||
case RGUI_ASPECT_RATIO_16_10:
|
||||
if (rgui_frame_buf.height == 240)
|
||||
rgui_frame_buf.width = 384;
|
||||
else
|
||||
rgui_frame_buf.width = (unsigned)((16.0f / 10.0f) * (float)rgui_frame_buf.height) & ~3;
|
||||
rgui_frame_buf.width = (unsigned)
|
||||
((16.0f / 10.0f) * (float)rgui_frame_buf.height) & ~3;
|
||||
base_term_width = rgui_frame_buf.width;
|
||||
break;
|
||||
case RGUI_ASPECT_RATIO_16_10_CENTRE:
|
||||
@ -4126,8 +4173,10 @@ static bool rgui_set_aspect_ratio(rgui_t *rgui, bool delay_update)
|
||||
}
|
||||
else
|
||||
{
|
||||
rgui_frame_buf.width = (unsigned)((16.0f / 10.0f) * (float)rgui_frame_buf.height) & ~3;
|
||||
base_term_width = (unsigned)(( 4.0f / 3.0f) * (float)rgui_frame_buf.height) & ~3;
|
||||
rgui_frame_buf.width = (unsigned)
|
||||
((16.0f / 10.0f) * (float)rgui_frame_buf.height) & ~3;
|
||||
base_term_width = (unsigned)
|
||||
(( 4.0f / 3.0f) * (float)rgui_frame_buf.height) & ~3;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@ -4135,7 +4184,8 @@ static bool rgui_set_aspect_ratio(rgui_t *rgui, bool delay_update)
|
||||
if (rgui_frame_buf.height == 240)
|
||||
rgui_frame_buf.width = 320;
|
||||
else
|
||||
rgui_frame_buf.width = (unsigned)(( 4.0f / 3.0f) * (float)rgui_frame_buf.height) & ~3;
|
||||
rgui_frame_buf.width = (unsigned)
|
||||
(( 4.0f / 3.0f) * (float)rgui_frame_buf.height) & ~3;
|
||||
base_term_width = rgui_frame_buf.width;
|
||||
break;
|
||||
}
|
||||
@ -4194,7 +4244,7 @@ static bool rgui_set_aspect_ratio(rgui_t *rgui, bool delay_update)
|
||||
|
||||
/* Allocate background buffer */
|
||||
rgui_background_buf.width = rgui_frame_buf.width;
|
||||
rgui_background_buf.height = rgui_frame_buf.height;
|
||||
rgui_background_buf.height= rgui_frame_buf.height;
|
||||
rgui_background_buf.data = (uint16_t*)calloc(
|
||||
rgui_background_buf.width * rgui_background_buf.height, sizeof(uint16_t));
|
||||
|
||||
@ -4216,14 +4266,16 @@ static bool rgui_set_aspect_ratio(rgui_t *rgui, bool delay_update)
|
||||
mini_thumbnail.max_width = mini_thumbnail_max_width;
|
||||
mini_thumbnail.max_height = mini_thumbnail_max_height;
|
||||
mini_thumbnail.data = (uint16_t*)calloc(
|
||||
mini_thumbnail.max_width * mini_thumbnail.max_height, sizeof(uint16_t));
|
||||
mini_thumbnail.max_width * mini_thumbnail.max_height,
|
||||
sizeof(uint16_t));
|
||||
if (!mini_thumbnail.data)
|
||||
return false;
|
||||
|
||||
mini_left_thumbnail.max_width = mini_thumbnail_max_width;
|
||||
mini_left_thumbnail.max_height = mini_thumbnail_max_height;
|
||||
mini_left_thumbnail.data = (uint16_t*)calloc(
|
||||
mini_left_thumbnail.max_width * mini_left_thumbnail.max_height, sizeof(uint16_t));
|
||||
mini_left_thumbnail.max_width * mini_left_thumbnail.max_height,
|
||||
sizeof(uint16_t));
|
||||
if (!mini_left_thumbnail.data)
|
||||
return false;
|
||||
|
||||
@ -4234,7 +4286,7 @@ static bool rgui_set_aspect_ratio(rgui_t *rgui, bool delay_update)
|
||||
|
||||
/* If aspect ratio lock is enabled, notify
|
||||
* video driver of change */
|
||||
if (settings->uints.menu_rgui_aspect_ratio_lock != RGUI_ASPECT_RATIO_LOCK_NONE)
|
||||
if (aspect_ratio_lock != RGUI_ASPECT_RATIO_LOCK_NONE)
|
||||
{
|
||||
rgui_update_menu_viewport(rgui);
|
||||
rgui_set_video_config(rgui, &rgui->menu_video_settings, delay_update);
|
||||
@ -4253,10 +4305,11 @@ static void rgui_menu_animation_update_time(
|
||||
static void *rgui_init(void **userdata, bool video_is_threaded)
|
||||
{
|
||||
unsigned new_font_height;
|
||||
size_t start;
|
||||
struct video_viewport vp;
|
||||
size_t start = 0;
|
||||
rgui_t *rgui = NULL;
|
||||
settings_t *settings = config_get_ptr();
|
||||
unsigned aspect_ratio_lock = settings->uints.menu_rgui_aspect_ratio_lock;
|
||||
menu_handle_t *menu = (menu_handle_t*)calloc(1, sizeof(*menu));
|
||||
|
||||
if (!menu)
|
||||
@ -4300,7 +4353,7 @@ static void *rgui_init(void **userdata, bool video_is_threaded)
|
||||
/* Set aspect ratio
|
||||
* - Allocates frame buffer
|
||||
* - Configures variable 'menu display' settings */
|
||||
rgui->menu_aspect_ratio_lock = settings->uints.menu_rgui_aspect_ratio_lock;
|
||||
rgui->menu_aspect_ratio_lock = aspect_ratio_lock;
|
||||
rgui->aspect_update_pending = false;
|
||||
if (!rgui_set_aspect_ratio(rgui, false))
|
||||
goto error;
|
||||
@ -4313,7 +4366,6 @@ static void *rgui_init(void **userdata, bool video_is_threaded)
|
||||
rgui->theme_preset_path[0] = '\0';
|
||||
prepare_rgui_colors(rgui, settings);
|
||||
|
||||
start = 0;
|
||||
menu_entries_ctl(MENU_ENTRIES_CTL_SET_START, &start);
|
||||
rgui->scroll_y = 0;
|
||||
|
||||
@ -4341,7 +4393,8 @@ static void *rgui_init(void **userdata, bool video_is_threaded)
|
||||
|
||||
/* Set initial 'blit_line/symbol' functions */
|
||||
rgui_set_blit_functions(
|
||||
settings->bools.menu_rgui_shadows, settings->bools.menu_rgui_extended_ascii);
|
||||
settings->bools.menu_rgui_shadows,
|
||||
settings->bools.menu_rgui_extended_ascii);
|
||||
|
||||
rgui->thumbnail_path_data = gfx_thumbnail_path_init();
|
||||
if (!rgui->thumbnail_path_data)
|
||||
@ -4405,6 +4458,7 @@ static void rgui_set_texture(void)
|
||||
size_t fb_pitch;
|
||||
unsigned fb_width, fb_height;
|
||||
settings_t *settings = config_get_ptr();
|
||||
unsigned internal_upscale_level = settings->uints.menu_rgui_internal_upscale_level;
|
||||
|
||||
if (!gfx_display_get_framebuffer_dirty_flag())
|
||||
return;
|
||||
@ -4414,7 +4468,7 @@ static void rgui_set_texture(void)
|
||||
|
||||
gfx_display_unset_framebuffer_dirty_flag();
|
||||
|
||||
if (settings->uints.menu_rgui_internal_upscale_level == RGUI_UPSCALE_NONE)
|
||||
if (internal_upscale_level == RGUI_UPSCALE_NONE)
|
||||
{
|
||||
video_driver_set_texture_frame(rgui_frame_buf.data,
|
||||
false, fb_width, fb_height, 1.0f);
|
||||
@ -4441,19 +4495,21 @@ static void rgui_set_texture(void)
|
||||
unsigned x_dst, y_dst;
|
||||
|
||||
/* Determine output size */
|
||||
if (settings->uints.menu_rgui_internal_upscale_level == RGUI_UPSCALE_AUTO)
|
||||
if (internal_upscale_level == RGUI_UPSCALE_AUTO)
|
||||
{
|
||||
out_width = ((vp.width / fb_width) + 1) * fb_width;
|
||||
out_height = ((vp.height / fb_height) + 1) * fb_height;
|
||||
}
|
||||
else
|
||||
{
|
||||
out_width = settings->uints.menu_rgui_internal_upscale_level * fb_width;
|
||||
out_height = settings->uints.menu_rgui_internal_upscale_level * fb_height;
|
||||
out_width = internal_upscale_level * fb_width;
|
||||
out_height = internal_upscale_level * fb_height;
|
||||
}
|
||||
|
||||
/* Allocate upscaling buffer, if required */
|
||||
if ((rgui_upscale_buf.width != out_width) || (rgui_upscale_buf.height != out_height) || !rgui_upscale_buf.data)
|
||||
if ( (rgui_upscale_buf.width != out_width) ||
|
||||
(rgui_upscale_buf.height != out_height) ||
|
||||
!rgui_upscale_buf.data)
|
||||
{
|
||||
rgui_upscale_buf.width = out_width;
|
||||
rgui_upscale_buf.height = out_height;
|
||||
@ -4464,13 +4520,15 @@ static void rgui_set_texture(void)
|
||||
rgui_upscale_buf.data = NULL;
|
||||
}
|
||||
|
||||
rgui_upscale_buf.data = (uint16_t*)calloc(out_width * out_height, sizeof(uint16_t));
|
||||
rgui_upscale_buf.data = (uint16_t*)
|
||||
calloc(out_width * out_height, sizeof(uint16_t));
|
||||
if (!rgui_upscale_buf.data)
|
||||
{
|
||||
/* Uh oh... This could mean we don't have enough
|
||||
* memory, so disable upscaling and draw the usual
|
||||
* framebuffer... */
|
||||
settings->uints.menu_rgui_internal_upscale_level = RGUI_UPSCALE_NONE;
|
||||
settings->uints.menu_rgui_internal_upscale_level =
|
||||
RGUI_UPSCALE_NONE;
|
||||
video_driver_set_texture_frame(rgui_frame_buf.data,
|
||||
false, fb_width, fb_height, 1.0f);
|
||||
return;
|
||||
@ -4502,12 +4560,11 @@ static void rgui_set_texture(void)
|
||||
|
||||
static void rgui_navigation_clear(void *data, bool pending_push)
|
||||
{
|
||||
size_t start;
|
||||
size_t start = 0;
|
||||
rgui_t *rgui = (rgui_t*)data;
|
||||
if (!rgui)
|
||||
return;
|
||||
|
||||
start = 0;
|
||||
menu_entries_ctl(MENU_ENTRIES_CTL_SET_START, &start);
|
||||
rgui->scroll_y = 0;
|
||||
}
|
||||
@ -4591,16 +4648,16 @@ static void rgui_scan_selected_entry_thumbnail(rgui_t *rgui, bool force_load)
|
||||
{
|
||||
bool has_thumbnail = false;
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
if (!settings)
|
||||
return;
|
||||
|
||||
bool rgui_inline_thumbnails = settings->bools.menu_rgui_inline_thumbnails;
|
||||
unsigned menu_rgui_thumbnail_delay= settings->uints.menu_rgui_thumbnail_delay;
|
||||
bool network_on_demand_thumbnails = settings->bools.network_on_demand_thumbnails;
|
||||
rgui->entry_has_thumbnail = false;
|
||||
rgui->entry_has_left_thumbnail = false;
|
||||
rgui->thumbnail_load_pending = false;
|
||||
|
||||
/* Update thumbnail content/path */
|
||||
if ((rgui->show_fs_thumbnail || settings->bools.menu_rgui_inline_thumbnails) && rgui->is_playlist)
|
||||
if ((rgui->show_fs_thumbnail || rgui_inline_thumbnails)
|
||||
&& rgui->is_playlist)
|
||||
{
|
||||
if (gfx_thumbnail_set_content_playlist(rgui->thumbnail_path_data,
|
||||
playlist_get_cached(), menu_navigation_get_selection()))
|
||||
@ -4608,7 +4665,7 @@ static void rgui_scan_selected_entry_thumbnail(rgui_t *rgui, bool force_load)
|
||||
if (gfx_thumbnail_is_enabled(rgui->thumbnail_path_data, GFX_THUMBNAIL_RIGHT))
|
||||
has_thumbnail = gfx_thumbnail_update_path(rgui->thumbnail_path_data, GFX_THUMBNAIL_RIGHT);
|
||||
|
||||
if (settings->bools.menu_rgui_inline_thumbnails &&
|
||||
if (rgui_inline_thumbnails &&
|
||||
gfx_thumbnail_is_enabled(rgui->thumbnail_path_data, GFX_THUMBNAIL_LEFT))
|
||||
has_thumbnail = gfx_thumbnail_update_path(rgui->thumbnail_path_data, GFX_THUMBNAIL_LEFT) ||
|
||||
has_thumbnail;
|
||||
@ -4619,8 +4676,8 @@ static void rgui_scan_selected_entry_thumbnail(rgui_t *rgui, bool force_load)
|
||||
if (has_thumbnail)
|
||||
{
|
||||
/* Check whether thumbnails should be loaded immediately */
|
||||
if ((settings->uints.menu_rgui_thumbnail_delay == 0) || force_load)
|
||||
rgui_load_current_thumbnails(rgui, settings->bools.network_on_demand_thumbnails);
|
||||
if ((menu_rgui_thumbnail_delay == 0) || force_load)
|
||||
rgui_load_current_thumbnails(rgui, network_on_demand_thumbnails);
|
||||
else
|
||||
{
|
||||
/* Schedule a delayed load */
|
||||
@ -4634,7 +4691,9 @@ static void rgui_update_thumbnail_image(void *userdata)
|
||||
{
|
||||
rgui_t *rgui = (rgui_t*)userdata;
|
||||
settings_t *settings = config_get_ptr();
|
||||
if (!rgui || !settings)
|
||||
bool rgui_inline_thumbnails = settings->bools.menu_rgui_inline_thumbnails;
|
||||
|
||||
if (!rgui)
|
||||
return;
|
||||
|
||||
rgui->show_fs_thumbnail = !rgui->show_fs_thumbnail;
|
||||
@ -4644,7 +4703,7 @@ static void rgui_update_thumbnail_image(void *userdata)
|
||||
* inline thumbnails, then 'fs_thumbnail' and 'mini_thumbnail'
|
||||
* can get mixed up. To avoid this, we simply 'reset' the
|
||||
* currently inactive right thumbnail. */
|
||||
if (settings->bools.menu_rgui_inline_thumbnails)
|
||||
if (rgui_inline_thumbnails)
|
||||
{
|
||||
if (rgui->show_fs_thumbnail)
|
||||
{
|
||||
@ -4673,11 +4732,12 @@ static void rgui_refresh_thumbnail_image(void *userdata, unsigned i)
|
||||
{
|
||||
rgui_t *rgui = (rgui_t*)userdata;
|
||||
settings_t *settings = config_get_ptr();
|
||||
bool rgui_inline_thumbnails = settings ? settings->bools.menu_rgui_inline_thumbnails : false;
|
||||
if (!rgui || !settings)
|
||||
return;
|
||||
|
||||
/* Only refresh thumbnails if thumbnails are enabled */
|
||||
if ((rgui->show_fs_thumbnail || settings->bools.menu_rgui_inline_thumbnails) &&
|
||||
if ((rgui->show_fs_thumbnail || rgui_inline_thumbnails) &&
|
||||
(gfx_thumbnail_is_enabled(rgui->thumbnail_path_data, GFX_THUMBNAIL_RIGHT) ||
|
||||
gfx_thumbnail_is_enabled(rgui->thumbnail_path_data, GFX_THUMBNAIL_LEFT)))
|
||||
{
|
||||
@ -4709,10 +4769,11 @@ static void rgui_update_menu_sublabel(rgui_t *rgui)
|
||||
{
|
||||
size_t selection = menu_navigation_get_selection();
|
||||
settings_t *settings = config_get_ptr();
|
||||
bool menu_show_sublabels = settings->bools.menu_show_sublabels;
|
||||
|
||||
rgui->menu_sublabel[0] = '\0';
|
||||
|
||||
if (settings->bools.menu_show_sublabels && selection < menu_entries_get_size())
|
||||
if (menu_show_sublabels && selection < menu_entries_get_size())
|
||||
{
|
||||
menu_entry_t entry;
|
||||
const char *sublabel = NULL;
|
||||
@ -4728,15 +4789,15 @@ static void rgui_update_menu_sublabel(rgui_t *rgui)
|
||||
|
||||
if (!string_is_empty(sublabel))
|
||||
{
|
||||
static const char* const sublabel_spacer = RGUI_TICKER_SPACER;
|
||||
struct string_list *list = NULL;
|
||||
size_t line_index;
|
||||
static const char* const
|
||||
sublabel_spacer = RGUI_TICKER_SPACER;
|
||||
bool prev_line_empty = true;
|
||||
|
||||
/* Sanitise sublabel
|
||||
* > Replace newline characters with standard delimiter
|
||||
* > Remove whitespace surrounding each sublabel line */
|
||||
list = string_split(sublabel, "\n");
|
||||
struct string_list *list = string_split(sublabel, "\n");
|
||||
|
||||
if (list)
|
||||
{
|
||||
for (line_index = 0; line_index < list->size; line_index++)
|
||||
@ -4745,8 +4806,10 @@ static void rgui_update_menu_sublabel(rgui_t *rgui)
|
||||
if (!string_is_empty(line))
|
||||
{
|
||||
if (!prev_line_empty)
|
||||
strlcat(rgui->menu_sublabel, sublabel_spacer, sizeof(rgui->menu_sublabel));
|
||||
strlcat(rgui->menu_sublabel, line, sizeof(rgui->menu_sublabel));
|
||||
strlcat(rgui->menu_sublabel,
|
||||
sublabel_spacer, sizeof(rgui->menu_sublabel));
|
||||
strlcat(rgui->menu_sublabel,
|
||||
line, sizeof(rgui->menu_sublabel));
|
||||
prev_line_empty = false;
|
||||
}
|
||||
}
|
||||
@ -4819,8 +4882,9 @@ static void rgui_populate_entries(void *data,
|
||||
{
|
||||
rgui_t *rgui = (rgui_t*)data;
|
||||
settings_t *settings = config_get_ptr();
|
||||
unsigned aspect_ratio_lock = settings->uints.menu_rgui_aspect_ratio_lock;
|
||||
|
||||
if (!rgui || !settings)
|
||||
if (!rgui)
|
||||
return;
|
||||
|
||||
/* Check whether we are currently viewing a playlist */
|
||||
@ -4839,7 +4903,7 @@ static void rgui_populate_entries(void *data,
|
||||
/* If aspect ratio lock is enabled, must restore
|
||||
* content video settings when accessing the video
|
||||
* settings menu... */
|
||||
if (settings->uints.menu_rgui_aspect_ratio_lock != RGUI_ASPECT_RATIO_LOCK_NONE)
|
||||
if (aspect_ratio_lock != RGUI_ASPECT_RATIO_LOCK_NONE)
|
||||
{
|
||||
if (string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_VIDEO_SETTINGS_LIST)))
|
||||
{
|
||||
@ -4847,7 +4911,8 @@ static void rgui_populate_entries(void *data,
|
||||
* the video settings menu are preserved */
|
||||
rgui_video_settings_t current_video_settings = {0};
|
||||
rgui_get_video_config(¤t_video_settings);
|
||||
if (rgui_is_video_config_equal(¤t_video_settings, &rgui->menu_video_settings))
|
||||
if (rgui_is_video_config_equal(¤t_video_settings,
|
||||
&rgui->menu_video_settings))
|
||||
{
|
||||
rgui_set_video_config(rgui, &rgui->content_video_settings, false);
|
||||
/* Menu viewport has been overridden - must ignore
|
||||
@ -4958,24 +5023,28 @@ static void rgui_frame(void *data, video_frame_info_t *video_info)
|
||||
{
|
||||
rgui_t *rgui = (rgui_t*)data;
|
||||
settings_t *settings = config_get_ptr();
|
||||
bool bg_filler_thickness_enable = settings->bools.menu_rgui_background_filler_thickness_enable;
|
||||
bool border_filler_thickness_enable = settings->bools.menu_rgui_border_filler_thickness_enable;
|
||||
unsigned aspect_ratio_lock = settings->uints.menu_rgui_aspect_ratio_lock;
|
||||
bool border_filler_enable = settings->bools.menu_rgui_border_filler_enable;
|
||||
|
||||
if (settings->bools.menu_rgui_background_filler_thickness_enable != rgui->bg_thickness)
|
||||
if (bg_filler_thickness_enable != rgui->bg_thickness)
|
||||
{
|
||||
rgui->bg_thickness = settings->bools.menu_rgui_background_filler_thickness_enable;
|
||||
rgui->bg_thickness = bg_filler_thickness_enable;
|
||||
rgui->bg_modified = true;
|
||||
rgui->force_redraw = true;
|
||||
}
|
||||
|
||||
if (settings->bools.menu_rgui_border_filler_thickness_enable != rgui->border_thickness)
|
||||
if (border_filler_thickness_enable != rgui->border_thickness)
|
||||
{
|
||||
rgui->border_thickness = settings->bools.menu_rgui_border_filler_thickness_enable;
|
||||
rgui->border_thickness = border_filler_thickness_enable;
|
||||
rgui->bg_modified = true;
|
||||
rgui->force_redraw = true;
|
||||
}
|
||||
|
||||
if (settings->bools.menu_rgui_border_filler_enable != rgui->border_enable)
|
||||
if (border_filler_enable != rgui->border_enable)
|
||||
{
|
||||
rgui->border_enable = settings->bools.menu_rgui_border_filler_enable;
|
||||
rgui->border_enable = border_filler_enable;
|
||||
rgui->bg_modified = true;
|
||||
rgui->force_redraw = true;
|
||||
}
|
||||
@ -4983,7 +5052,8 @@ static void rgui_frame(void *data, video_frame_info_t *video_info)
|
||||
if (settings->bools.menu_rgui_shadows != rgui->shadow_enable)
|
||||
{
|
||||
rgui_set_blit_functions(
|
||||
settings->bools.menu_rgui_shadows, settings->bools.menu_rgui_extended_ascii);
|
||||
settings->bools.menu_rgui_shadows,
|
||||
settings->bools.menu_rgui_extended_ascii);
|
||||
|
||||
rgui->shadow_enable = settings->bools.menu_rgui_shadows;
|
||||
rgui->bg_modified = true;
|
||||
@ -5006,7 +5076,8 @@ static void rgui_frame(void *data, video_frame_info_t *video_info)
|
||||
if (settings->bools.menu_rgui_extended_ascii != rgui->extended_ascii_enable)
|
||||
{
|
||||
rgui_set_blit_functions(
|
||||
settings->bools.menu_rgui_shadows, settings->bools.menu_rgui_extended_ascii);
|
||||
settings->bools.menu_rgui_shadows,
|
||||
settings->bools.menu_rgui_extended_ascii);
|
||||
|
||||
rgui->extended_ascii_enable = settings->bools.menu_rgui_extended_ascii;
|
||||
rgui->force_redraw = true;
|
||||
@ -5046,14 +5117,12 @@ static void rgui_frame(void *data, video_frame_info_t *video_info)
|
||||
}
|
||||
|
||||
/* > Check for changes in aspect ratio lock setting */
|
||||
if (settings->uints.menu_rgui_aspect_ratio_lock != rgui->menu_aspect_ratio_lock)
|
||||
if (aspect_ratio_lock != rgui->menu_aspect_ratio_lock)
|
||||
{
|
||||
rgui->menu_aspect_ratio_lock = settings->uints.menu_rgui_aspect_ratio_lock;
|
||||
rgui->menu_aspect_ratio_lock = aspect_ratio_lock;
|
||||
|
||||
if (settings->uints.menu_rgui_aspect_ratio_lock == RGUI_ASPECT_RATIO_LOCK_NONE)
|
||||
{
|
||||
if (aspect_ratio_lock == RGUI_ASPECT_RATIO_LOCK_NONE)
|
||||
rgui_set_video_config(rgui, &rgui->content_video_settings, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
rgui_update_menu_viewport(rgui);
|
||||
@ -5071,7 +5140,7 @@ static void rgui_frame(void *data, video_frame_info_t *video_info)
|
||||
if ((rgui->window_width != video_info->width) ||
|
||||
(rgui->window_height != video_info->height))
|
||||
{
|
||||
if ((settings->uints.menu_rgui_aspect_ratio_lock != RGUI_ASPECT_RATIO_LOCK_NONE) &&
|
||||
if ((aspect_ratio_lock != RGUI_ASPECT_RATIO_LOCK_NONE) &&
|
||||
!rgui->ignore_resize_events)
|
||||
{
|
||||
rgui_update_menu_viewport(rgui);
|
||||
@ -5091,11 +5160,13 @@ static void rgui_frame(void *data, video_frame_info_t *video_info)
|
||||
* fullscreen thumbnail view is incredibly jarring...) */
|
||||
if ((cpu_features_get_time_usec() - rgui->thumbnail_load_trigger_time) >=
|
||||
(settings->uints.menu_rgui_thumbnail_delay * 1000 * (rgui->show_fs_thumbnail ? 1.5f : 1.0f)))
|
||||
rgui_load_current_thumbnails(rgui, settings->bools.network_on_demand_thumbnails);
|
||||
rgui_load_current_thumbnails(rgui,
|
||||
settings->bools.network_on_demand_thumbnails);
|
||||
}
|
||||
|
||||
/* Read pointer input */
|
||||
if (settings->bools.menu_mouse_enable || settings->bools.menu_pointer_enable)
|
||||
if ( settings->bools.menu_mouse_enable ||
|
||||
settings->bools.menu_pointer_enable)
|
||||
{
|
||||
menu_input_get_pointer_state(&rgui->pointer);
|
||||
|
||||
@ -5111,6 +5182,7 @@ static void rgui_toggle(void *userdata, bool menu_on)
|
||||
{
|
||||
rgui_t *rgui = (rgui_t*)userdata;
|
||||
settings_t *settings = config_get_ptr();
|
||||
unsigned aspect_ratio_lock = settings ? settings->uints.menu_rgui_aspect_ratio_lock : 0;
|
||||
|
||||
/* TODO/FIXME - when we close RetroArch, this function
|
||||
* gets called and settings is NULL at this point.
|
||||
@ -5119,7 +5191,7 @@ static void rgui_toggle(void *userdata, bool menu_on)
|
||||
if (!rgui || !settings)
|
||||
return;
|
||||
|
||||
if (settings->uints.menu_rgui_aspect_ratio_lock != RGUI_ASPECT_RATIO_LOCK_NONE)
|
||||
if (aspect_ratio_lock != RGUI_ASPECT_RATIO_LOCK_NONE)
|
||||
{
|
||||
if (menu_on)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user