diff --git a/gfx/drivers_context/cocoa_vk_ctx.m b/gfx/drivers_context/cocoa_vk_ctx.m index 597bbefa21..fa3727c093 100755 --- a/gfx/drivers_context/cocoa_vk_ctx.m +++ b/gfx/drivers_context/cocoa_vk_ctx.m @@ -150,11 +150,9 @@ static void cocoa_vk_gfx_ctx_check_window(void *data, bool *quit, { unsigned new_width, new_height; cocoa_vk_ctx_data_t *cocoa_ctx = (cocoa_vk_ctx_data_t*)data; - - *quit = false; - - *resize = cocoa_ctx->vk.flags & - VK_DATA_FLAG_NEED_NEW_SWAPCHAIN; + *quit = false; + *resize = (cocoa_ctx->vk.flags & + VK_DATA_FLAG_NEED_NEW_SWAPCHAIN) ? true : false; #if MAC_OS_X_VERSION_10_7 && defined(OSX) cocoa_vk_gfx_ctx_get_video_size_osx10_7_and_up(data, &new_width, &new_height); @@ -226,7 +224,7 @@ static bool cocoa_vk_gfx_ctx_set_video_mode(void *data, CocoaView *g_view = (CocoaView*)nsview_get_ptr(); #endif cocoa_vk_ctx_data_t *cocoa_ctx = (cocoa_vk_ctx_data_t*)data; - static bool + static bool has_went_fullscreen = false; cocoa_ctx->width = width; cocoa_ctx->height = height; @@ -272,7 +270,7 @@ static void *cocoa_vk_gfx_ctx_init(void *video_driver) free(cocoa_ctx); return NULL; } - + return cocoa_ctx; } #else @@ -296,7 +294,7 @@ static bool cocoa_vk_gfx_ctx_set_video_mode(void *data, return false; } - /* TODO: Maybe iOS users should be able to + /* TODO: Maybe iOS users should be able to * show/hide the status bar here? */ return true; } diff --git a/gfx/drivers_context/khr_display_ctx.c b/gfx/drivers_context/khr_display_ctx.c index 2ea166017b..5aecc32199 100644 --- a/gfx/drivers_context/khr_display_ctx.c +++ b/gfx/drivers_context/khr_display_ctx.c @@ -95,7 +95,7 @@ static void gfx_ctx_khr_display_check_window(void *data, bool *quit, bool *resize, unsigned *width, unsigned *height) { khr_display_ctx_data_t *khr = (khr_display_ctx_data_t*)data; - *resize = khr->vk.flags & VK_DATA_FLAG_NEED_NEW_SWAPCHAIN; + *resize = (khr->vk.flags & VK_DATA_FLAG_NEED_NEW_SWAPCHAIN) ? true : false; if (khr->width != *width || khr->height != *height) { diff --git a/menu/drivers/ozone.c b/menu/drivers/ozone.c index aaaa66e157..d00418a652 100644 --- a/menu/drivers/ozone.c +++ b/menu/drivers/ozone.c @@ -5336,7 +5336,7 @@ static void ozone_compute_entries_position( file_list_t *selection_buf = NULL; int entry_padding = ozone_get_entries_padding(ozone); float scale_factor = ozone->last_scale_factor; - bool want_thumbnail_bar = ozone->flags & OZONE_FLAG_WANT_THUMBNAIL_BAR; + bool want_thumbnail_bar = (ozone->flags & OZONE_FLAG_WANT_THUMBNAIL_BAR) ? true : false; bool show_thumbnail_bar = ozone->show_thumbnail_bar; if (show_thumbnail_bar != want_thumbnail_bar) @@ -7697,8 +7697,8 @@ static bool ozone_help_available(ozone_handle_t *ozone, size_t current_selection return false; return !( - (ozone->flags & OZONE_FLAG_IS_PLAYLIST) || - (ozone->flags & OZONE_FLAG_IS_EXPLORE_LIST) + (ozone->flags & OZONE_FLAG_IS_PLAYLIST) + || (ozone->flags & OZONE_FLAG_IS_EXPLORE_LIST) ); } @@ -7979,10 +7979,9 @@ static enum menu_action ozone_parse_menu_entry_action( if (ozone->flags & OZONE_FLAG_CURSOR_IN_SIDEBAR) { + char playlist_path[PATH_MAX_LENGTH]; struct menu_state *menu_st = menu_state_get_ptr(); size_t new_selection = 0; - char playlist_path[PATH_MAX_LENGTH]; - /* If cursor is active, ensure we target * an on screen category */ size_t tab_selection = (ozone->flags & OZONE_FLAG_CURSOR_MODE) @@ -8055,8 +8054,8 @@ static enum menu_action ozone_parse_menu_entry_action( if ( (ozone->flags & OZONE_FLAG_FULLSCREEN_THUMBNAILS_AVAILABLE) && (!(ozone->flags2 & OZONE_FLAG2_SHOW_FULLSCREEN_THUMBNAILS)) - && ( (ozone->flags & OZONE_FLAG_IS_STATE_SLOT) || - (ozone->is_quick_menu && !string_is_empty(ozone->savestate_thumbnail_file_path)))) + && ( (ozone->flags & OZONE_FLAG_IS_STATE_SLOT) + || (ozone->is_quick_menu && !string_is_empty(ozone->savestate_thumbnail_file_path)))) { ozone_show_fullscreen_thumbnails(ozone); ozone->flags2 |= OZONE_FLAG2_WANT_FULLSCREEN_THUMBNAILS; @@ -8874,7 +8873,7 @@ static void ozone_update_thumbnail_image(void *data) : OZONE_PENDING_THUMBNAIL_LEFT; show_thumbnail_bar = ozone->show_thumbnail_bar; - want_thumbnail_bar = ozone->flags & OZONE_FLAG_WANT_THUMBNAIL_BAR; + want_thumbnail_bar = (ozone->flags & OZONE_FLAG_WANT_THUMBNAIL_BAR) ? true : false; if (show_thumbnail_bar != want_thumbnail_bar) ozone->flags |= OZONE_FLAG_NEED_COMPUTE; } @@ -11211,8 +11210,8 @@ static void ozone_selection_changed(ozone_handle_t *ozone, bool allow_animation) /* Filebrowser image updates */ else if (ozone->flags & OZONE_FLAG_IS_FILE_LIST) { - if ((entry_type == FILE_TYPE_IMAGEVIEWER) || - (entry_type == FILE_TYPE_IMAGE)) + if ( (entry_type == FILE_TYPE_IMAGEVIEWER) + || (entry_type == FILE_TYPE_IMAGE)) { ozone_set_thumbnail_content(ozone, "imageviewer"); update_thumbnails = true; @@ -11516,7 +11515,7 @@ static void ozone_frame(void *data, video_frame_info_t *video_info) MENU_LIST_GET_SELECTION(menu_list, 0), ozone->animations.list_alpha, ozone->animations.scroll_y, - ozone->flags & OZONE_FLAG_IS_PLAYLIST, + (ozone->flags & OZONE_FLAG_IS_PLAYLIST) ? true : false, &mymat ); @@ -11534,7 +11533,7 @@ static void ozone_frame(void *data, video_frame_info_t *video_info) &ozone->selection_buf_old, ozone->animations.list_alpha, ozone->scroll_old, - ozone->flags & OZONE_FLAG_IS_PLAYLIST_OLD, + (ozone->flags & OZONE_FLAG_IS_PLAYLIST_OLD) ? true : false, &mymat ); @@ -12049,21 +12048,21 @@ static void ozone_populate_entries( * playlists, database manager lists, file lists * and savestate slots */ if ( - ((ozone->flags & OZONE_FLAG_WANT_THUMBNAIL_BAR)) + ( (ozone->flags & OZONE_FLAG_WANT_THUMBNAIL_BAR)) && ( ((ozone->flags & OZONE_FLAG_IS_PLAYLIST) && (ozone->depth == 1 || ozone->depth == 4)) || ((ozone->flags & OZONE_FLAG_IS_DB_MANAGER_LIST) && (ozone->depth >= 4)) - || (ozone->flags & OZONE_FLAG_IS_EXPLORE_LIST) - || (ozone->flags & OZONE_FLAG_IS_FILE_LIST) - || (ozone->flags & OZONE_FLAG_IS_STATE_SLOT) - || (ozone->is_quick_menu) + || (ozone->flags & OZONE_FLAG_IS_EXPLORE_LIST) + || (ozone->flags & OZONE_FLAG_IS_FILE_LIST) + || (ozone->flags & OZONE_FLAG_IS_STATE_SLOT) + || (ozone->is_quick_menu) ) ) ozone->flags |= OZONE_FLAG_FULLSCREEN_THUMBNAILS_AVAILABLE; else ozone->flags &= ~OZONE_FLAG_FULLSCREEN_THUMBNAILS_AVAILABLE; - fs_thumbnails_available = ozone->flags & OZONE_FLAG_FULLSCREEN_THUMBNAILS_AVAILABLE; - want_thumbnail_bar = ozone->flags & OZONE_FLAG_WANT_THUMBNAIL_BAR; + fs_thumbnails_available = (ozone->flags & OZONE_FLAG_FULLSCREEN_THUMBNAILS_AVAILABLE) ? true : false; + want_thumbnail_bar = (ozone->flags & OZONE_FLAG_WANT_THUMBNAIL_BAR) ? true : false; if (fs_thumbnails_available != want_thumbnail_bar) { diff --git a/menu/drivers/rgui.c b/menu/drivers/rgui.c index 10e26d9feb..30bf2bdfe2 100644 --- a/menu/drivers/rgui.c +++ b/menu/drivers/rgui.c @@ -1358,7 +1358,7 @@ static uint16_t (*argb32_to_pixel_platform_format)(uint32_t col) = argb32_to_rgb static bool rgui_set_pixel_format_function(void) { const char *driver_ident = video_driver_get_ident(); - + /* Default fallback... */ if (string_is_empty(driver_ident)) { @@ -1803,8 +1803,8 @@ static void rgui_render_border( { uint16_t dark_color = rgui->colors.border_dark_color; uint16_t light_color = rgui->colors.border_light_color; - bool thickness = rgui->flags & RGUI_FLAG_BORDER_THICKNESS; - + bool thickness = (rgui->flags & RGUI_FLAG_BORDER_THICKNESS) ? true : false; + /* Draw border */ rgui_fill_rect(data, fb_width, fb_height, 5, 5, fb_width - 10, 5, @@ -1818,12 +1818,12 @@ static void rgui_render_border( rgui_fill_rect(data, fb_width, fb_height, fb_width - 10, 5, 5, fb_height - 10, dark_color, light_color, thickness); - + /* Draw drop shadow, if required */ if (rgui->flags & RGUI_FLAG_SHADOW_ENABLE) { uint16_t shadow_color = rgui->colors.shadow_color; - + rgui_color_rect(data, fb_width, fb_height, 10, 10, 1, fb_height - 20, shadow_color); rgui_color_rect(data, fb_width, fb_height, @@ -1847,7 +1847,7 @@ static bool INLINE rgui_draw_particle( uint16_t color) { unsigned x_index, y_index; - + /* This great convoluted mess just saves us * having to perform comparisons on every * iteration of the for loops... */ @@ -1857,24 +1857,24 @@ static bool INLINE rgui_draw_particle( int y_end = y + height; int x_start = (x_start_i <= fb_width) ? x_start_i : fb_width; int y_start = (y_start_i <= fb_height) ? y_start_i : fb_height; - + if (x_end <= 0) x_end = 0; else if (x_end > (int)fb_width) x_end = fb_width; - + if (y_end <= 0) y_end = 0; else if (y_end > (int)fb_height) y_end = fb_height; - + for (y_index = (unsigned)y_start; y_index < (unsigned)y_end; y_index++) { uint16_t *data_ptr = data + (y_index * fb_width); for (x_index = (unsigned)x_start; x_index < (unsigned)x_end; x_index++) *(data_ptr + x_index) = color; } - + return (x_end > x_start) && (y_end > y_start); } @@ -1885,7 +1885,7 @@ static void rgui_init_particle_effect( size_t i; unsigned fb_width = p_disp->framebuf_width; unsigned fb_height = p_disp->framebuf_height; - + switch (rgui->particle_effect) { case RGUI_PARTICLE_EFFECT_SNOW: @@ -1894,7 +1894,7 @@ static void rgui_init_particle_effect( for (i = 0; i < RGUI_NUM_PARTICLES; i++) { rgui_particle_t *particle = &rgui->particles[i]; - + particle->a = (float)(rand() % fb_width); particle->b = (float)(rand() % fb_height); particle->c = (float)(rand() % 64 - 16) * 0.1f; @@ -1917,11 +1917,11 @@ static void rgui_init_particle_effect( unsigned num_drops = (unsigned)(0.85f * ((float)fb_width / (float)RGUI_MAX_FB_WIDTH) * (float)RGUI_NUM_PARTICLES); if (num_drops >= RGUI_NUM_PARTICLES) num_drops = RGUI_NUM_PARTICLES; - + for (i = 0; i < num_drops; i++) { rgui_particle_t *particle = &rgui->particles[i]; - + /* x pos */ particle->a = (float)(rand() % (fb_width / 3)) * 3.0f; /* y pos */ @@ -1937,11 +1937,11 @@ static void rgui_init_particle_effect( { float max_radius = (float)sqrt((double)((fb_width * fb_width) + (fb_height * fb_height))) / 2.0f; float one_degree_radians = PI / 360.0f; - + for (i = 0; i < RGUI_NUM_PARTICLES; i++) { rgui_particle_t *particle = &rgui->particles[i]; - + /* radius */ particle->a = 1.0f + (((float)rand() / (float)RAND_MAX) * max_radius); /* theta */ @@ -1958,7 +1958,7 @@ static void rgui_init_particle_effect( for (i = 0; i < RGUI_NUM_PARTICLES; i++) { rgui_particle_t *particle = &rgui->particles[i]; - + /* x pos */ particle->a = (float)(rand() % fb_width); /* y pos */ @@ -1991,7 +1991,7 @@ static void rgui_render_particle_effect( * risk of clashing with specific particle effect * implementation variables... */ float global_speed_factor = 1.0f; - + /* Check whether screensaver is currently active */ if (rgui->flags & RGUI_FLAG_SHOW_SCREENSAVER) { @@ -2003,16 +2003,16 @@ static void rgui_render_particle_effect( } else particle_color = rgui->colors.particle_color; - + /* Adjust global animation speed */ /* > Apply user configured speed multiplier */ - if (particle_effect_speed > 0.0001f) + 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 *= p_anim->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 * varies with particle effect whereas 'draw' is always @@ -2030,7 +2030,7 @@ static void rgui_render_particle_effect( * update/draw sequence here. This results in some code * repetition, but it has better performance and allows for * complete flexibility */ - + switch (rgui->particle_effect) { case RGUI_PARTICLE_EFFECT_SNOW: @@ -2038,29 +2038,29 @@ static void rgui_render_particle_effect( { unsigned particle_size; bool on_screen; - + for (i = 0; i < RGUI_NUM_PARTICLES; i++) { rgui_particle_t *particle = &rgui->particles[i]; - + /* Update particle 'speed' */ particle->c = particle->c + (float)(rand() % 16 - 9) * 0.01f; particle->d = particle->d + (float)(rand() % 16 - 7) * 0.01f; - + if (particle->c < -0.4f) particle->c = -0.4f; else if (particle->c > 0.1f) particle->c = 0.1f; - + if (particle->d < -0.1f) particle->d = -0.1f; else if (particle->d > 0.4f) particle->d = 0.4f; - + /* Update particle location */ particle->a = fmod(particle->a + (global_speed_factor * particle->c), fb_width); particle->b = fmod(particle->b + (global_speed_factor * particle->d), fb_height); - + /* Get particle size */ particle_size = 1; if (rgui->particle_effect == RGUI_PARTICLE_EFFECT_SNOW_ALT) @@ -2074,12 +2074,12 @@ static void rgui_render_particle_effect( else if ((i & 0x7) == 0x7) particle_size = 3; } - + /* Draw particle */ on_screen = rgui_draw_particle(frame_buf_data, fb_width, fb_height, (int)particle->a, (int)particle->b, particle_size, particle_size, particle_color); - + /* Reset particle if it has fallen off screen */ if (!on_screen) { @@ -2107,21 +2107,21 @@ static void rgui_render_particle_effect( unsigned num_drops = (unsigned)(0.85f * ((float)fb_width / (float)RGUI_MAX_FB_WIDTH) * (float)RGUI_NUM_PARTICLES); if (num_drops >= RGUI_NUM_PARTICLES) num_drops = RGUI_NUM_PARTICLES; - + for (i = 0; i < num_drops; i++) { rgui_particle_t *particle = &rgui->particles[i]; - + /* Draw particle */ on_screen = rgui_draw_particle( frame_buf_data, fb_width, fb_height, (int)particle->a, (int)particle->b, 2, (unsigned)particle->c, particle_color); - + /* Update y pos */ particle->b += particle->d * global_speed_factor; - - /* Reset particle if it has fallen off + + /* Reset particle if it has fallen off the bottom of the screen */ if (!on_screen) { @@ -2146,22 +2146,22 @@ static void rgui_render_particle_effect( unsigned particle_size; float r_speed, theta_speed; int x, y; - + for (i = 0; i < RGUI_NUM_PARTICLES; i++) { rgui_particle_t *particle = &rgui->particles[i]; - + /* Get particle location */ x = (int)(particle->a * cos(particle->b)) + x_centre; y = (int)(particle->a * sin(particle->b)) + y_centre; - + /* Get particle size */ particle_size = 1 + (unsigned)(((1.0f - ((max_radius - particle->a) / max_radius)) * 3.5f) + 0.5f); - + /* Draw particle */ rgui_draw_particle(frame_buf_data, fb_width, fb_height, x, y, particle_size, particle_size, particle_color); - + /* Update particle speed */ r_speed = particle->c * global_speed_factor; theta_speed = particle->d * global_speed_factor; @@ -2173,7 +2173,7 @@ static void rgui_render_particle_effect( } particle->a -= r_speed; particle->b += theta_speed; - + /* Reset particle if it has reached the centre of the screen */ if (particle->a < 0.0f) { @@ -2201,30 +2201,30 @@ static void rgui_render_particle_effect( unsigned particle_size; int x, y; bool on_screen; - + /* Based on an example found here: * https://codepen.io/nodws/pen/pejBNb */ for (i = 0; i < RGUI_NUM_PARTICLES; i++) { rgui_particle_t *particle = &rgui->particles[i]; - + /* Get particle location */ x = (int)((particle->a - (float)x_centre) * (focal_length / particle->c)); x += x_centre; - + y = (int)((particle->b - (float)y_centre) * (focal_length / particle->c)); y += y_centre; - + /* Get particle size */ particle_size = (unsigned)(focal_length / (2.0f * particle->c)); - + /* Draw particle */ on_screen = rgui_draw_particle(frame_buf_data, fb_width, fb_height, x, y, particle_size, particle_size, particle_color); - + /* Update depth */ particle->c -= particle->d * global_speed_factor; - + /* Reset particle if it has: * - Dropped off the edge of the screen * - Reached the screen depth @@ -2250,7 +2250,7 @@ static void rgui_render_particle_effect( /* Do nothing... */ break; } - + /* If border is enabled, it must be drawn *above* * particle effect * (Wastes CPU cycles, but nothing we can do about it...) */ @@ -2701,7 +2701,7 @@ static void rgui_render_fs_thumbnail( { uint16_t *frame_buf_data = rgui->frame_buf.data; uint16_t *fs_thumbnail_data = rgui->fs_thumbnail.data; - + if (rgui->fs_thumbnail.is_valid && frame_buf_data && fs_thumbnail_data) { unsigned y; @@ -2748,7 +2748,7 @@ static void rgui_render_fs_thumbnail( { src = fs_thumbnail_data + thumb_x_offset + ((y + thumb_y_offset) * fs_thumbnail_width); dst = frame_buf_data + (y + fb_y_offset) * (fb_pitch >> 1) + fb_x_offset; - + memcpy(dst, src, width * sizeof(uint16_t)); } @@ -2783,8 +2783,8 @@ static void rgui_render_fs_thumbnail( shadow_height = fb_height - fs_thumbnail_height; if (shadow_height > 2) shadow_height = 2; - shadow_width = (fs_thumbnail_width + 2 < fb_width) - ? fs_thumbnail_width + shadow_width = (fs_thumbnail_width + 2 < fb_width) + ? fs_thumbnail_width : fb_width - 2; shadow_x = fb_x_offset + 2; @@ -2826,13 +2826,13 @@ static void rgui_render_mini_thumbnail( /* Sanity check (this can never, ever happen, so just return * instead of trying to crop the thumbnail image...) */ - if ( (thumbnail_fullwidth > term_width) + if ( (thumbnail_fullwidth > term_width) || (thumbnail->height > term_height)) return; fb_x_offset = (rgui->term_layout.start_x + term_width) - (thumbnail->width + ((thumbnail_fullwidth - thumbnail->width) >> 1)); - + if ( ((thumbnail_id == GFX_THUMBNAIL_RIGHT) && !menu_rgui_swap_thumbnails) || ((thumbnail_id == GFX_THUMBNAIL_LEFT) && menu_rgui_swap_thumbnails)) fb_y_offset = rgui->term_layout.start_y + ((thumbnail->max_height - thumbnail->height) >> 1); @@ -2846,7 +2846,7 @@ static void rgui_render_mini_thumbnail( src = thumbnail->data + (y * thumbnail->width); dst = frame_buf_data + (y + fb_y_offset) * (fb_pitch >> 1) + fb_x_offset; - + memcpy(dst, src, thumbnail->width * sizeof(uint16_t)); } @@ -3191,7 +3191,7 @@ end: const rgui_theme_t *fallback_theme = ( (rgui->flags & RGUI_FLAG_TRANSPARENCY_SUPPORTED) && (rgui->flags & RGUI_FLAG_TRANSPARENCY_ENABLE)) - ? &rgui_theme_classic_green + ? &rgui_theme_classic_green : &rgui_theme_opaque_classic_green; theme_colors->normal_color = fallback_theme->normal_color; @@ -3229,7 +3229,7 @@ static void rgui_cache_background( rgui_fill_rect(background_buf->data, fb_width, fb_height, 0, 0, fb_width, fb_height, rgui->colors.bg_dark_color, rgui->colors.bg_light_color, - rgui->flags & RGUI_FLAG_BG_THICKNESS); + (rgui->flags & RGUI_FLAG_BG_THICKNESS) ? true : false); /* Draw border, if required */ if (rgui->flags & RGUI_FLAG_BORDER_ENABLE) @@ -4366,7 +4366,7 @@ static void rgui_set_blit_functions( else rgui_blit_line = rgui_blit_line_regular_shadow; #endif - + rgui_blit_symbol = rgui_blit_symbol_shadow; } else @@ -4404,7 +4404,7 @@ static void rgui_set_blit_functions( else rgui_blit_line = rgui_blit_line_regular; #endif - + rgui_blit_symbol = rgui_blit_symbol_regular; } } @@ -4484,12 +4484,12 @@ static void rgui_render_messagebox( { uint16_t border_dark_color = rgui->colors.border_dark_color; uint16_t border_light_color = rgui->colors.border_light_color; - bool border_thickness = rgui->flags & RGUI_FLAG_BORDER_THICKNESS; + bool border_thickness = (rgui->flags & RGUI_FLAG_BORDER_THICKNESS) ? true : false; rgui_fill_rect(frame_buf_data, fb_width, fb_height, x + 5, y + 5, width - 10, height - 10, rgui->colors.bg_dark_color, rgui->colors.bg_light_color, - rgui->flags & RGUI_FLAG_BG_THICKNESS); + (rgui->flags & RGUI_FLAG_BG_THICKNESS) ? true : false); /* Note: We draw borders around message boxes regardless * of the rgui->border_enable setting, because they look @@ -4608,22 +4608,22 @@ static void rgui_render_osk( unsigned fb_height) { int key_index; - + unsigned input_label_max_length; unsigned input_str_max_length; unsigned input_offset_x, input_offset_y; - + unsigned key_width, key_height; unsigned key_text_offset_x, key_text_offset_y; unsigned ptr_width, ptr_height; unsigned ptr_offset_x, ptr_offset_y; - + unsigned keyboard_width, keyboard_height; unsigned keyboard_offset_x, keyboard_offset_y; - + unsigned osk_width, osk_height; unsigned osk_x, osk_y; - + input_driver_state_t *input_st = input_state_get_ptr(); int osk_ptr = input_st->osk_ptr; char **osk_grid = input_st->osk_grid; @@ -4634,7 +4634,7 @@ static void rgui_render_osk( /* Sanity check 1 */ if (osk_ptr < 0 || osk_ptr >= 44 || !osk_grid[0]) return; - + key_text_offset_x = 8; key_text_offset_y = 6; key_width = rgui->font_width + (key_text_offset_x * 2); @@ -4655,7 +4655,7 @@ static void rgui_render_osk( osk_height = keyboard_offset_y + keyboard_height + 10; osk_x = (fb_width - osk_width) / 2; osk_y = (fb_height - osk_height) / 2; - + /* Sanity check 2 */ if ((osk_width + 2 > fb_width) || (osk_height + 2 > fb_height)) { @@ -4672,25 +4672,25 @@ static void rgui_render_osk( rgui_render_messagebox(rgui, msg, fb_width, fb_height); return; } - + /* Draw background */ rgui_fill_rect(frame_buf_data, fb_width, fb_height, osk_x + 5, osk_y + 5, osk_width - 10, osk_height - 10, rgui->colors.bg_dark_color, rgui->colors.bg_light_color, - rgui->flags & RGUI_FLAG_BG_THICKNESS); - + (rgui->flags & RGUI_FLAG_BG_THICKNESS) ? true : false); + /* Draw border */ if (rgui->flags & RGUI_FLAG_BORDER_ENABLE) { uint16_t border_dark_color = rgui->colors.border_dark_color; uint16_t border_light_color = rgui->colors.border_light_color; - bool border_thickness = rgui->flags & RGUI_FLAG_BORDER_THICKNESS; - + bool border_thickness = (rgui->flags & RGUI_FLAG_BORDER_THICKNESS) ? true : false; + /* Draw drop shadow, if required */ if (rgui->flags & RGUI_FLAG_SHADOW_ENABLE) { uint16_t shadow_color = rgui->colors.shadow_color; - + /* Frame */ rgui_color_rect(frame_buf_data, fb_width, fb_height, osk_x + 5, osk_y + 5, osk_width - 10, 1, shadow_color); @@ -4704,7 +4704,7 @@ static void rgui_render_osk( rgui_color_rect(frame_buf_data, fb_width, fb_height, osk_x + 5, osk_y + keyboard_offset_y - 5, osk_width - 10, 1, shadow_color); } - + /* Frame */ rgui_fill_rect(frame_buf_data, fb_width, fb_height, osk_x, osk_y, osk_width - 5, 5, @@ -4723,7 +4723,7 @@ static void rgui_render_osk( osk_x + 5, osk_y + keyboard_offset_y - 10, osk_width - 10, 5, border_dark_color, border_light_color, border_thickness); } - + /* Draw input label text */ if (!string_is_empty(input_label)) { @@ -4731,9 +4731,9 @@ static void rgui_render_osk( unsigned input_label_length; int input_label_x, input_label_y; unsigned ticker_x_offset = 0; - + input_label_buf[0] = '\0'; - + if (use_smooth_ticker) { ticker_smooth->selected = true; @@ -4742,7 +4742,7 @@ static void rgui_render_osk( ticker_smooth->dst_str = input_label_buf; ticker_smooth->dst_str_len = sizeof(input_label_buf); ticker_smooth->x_offset = &ticker_x_offset; - + gfx_animation_ticker_smooth(ticker_smooth); } else @@ -4751,7 +4751,7 @@ static void rgui_render_osk( ticker->len = input_label_max_length; ticker->str = input_label; ticker->selected = true; - + gfx_animation_ticker(ticker); } @@ -4759,11 +4759,11 @@ static void rgui_render_osk( input_label_x = ticker_x_offset + osk_x + input_offset_x + ((input_label_max_length * rgui->font_width_stride) - input_label_length) / 2; input_label_y = osk_y + input_offset_y; - + rgui_blit_line(rgui, fb_width, input_label_x, input_label_y, input_label_buf, rgui->colors.normal_color, rgui->colors.shadow_color); } - + /* Draw input buffer text */ { int input_str_x, input_str_y; @@ -4771,40 +4771,40 @@ static void rgui_render_osk( unsigned input_str_char_offset = 0; unsigned input_str_length = (unsigned)utf8len(input_str); const char *input_str_visible = NULL; - + if (input_str_length > input_str_max_length) { input_str_char_offset = input_str_length - input_str_max_length; input_str_length = input_str_max_length; } - + input_str_x = osk_x + input_offset_x; input_str_y = osk_y + input_offset_y + rgui->font_height_stride; input_str_visible = utf8skip(input_str, input_str_char_offset); - + if (!string_is_empty(input_str_visible)) rgui_blit_line(rgui, fb_width, input_str_x, input_str_y, input_str_visible, rgui->colors.hover_color, rgui->colors.shadow_color); - + /* Draw text cursor */ text_cursor_x = osk_x + input_offset_x + (input_str_length * rgui->font_width_stride); - + rgui_blit_symbol(rgui, fb_width, text_cursor_x, input_str_y, RGUI_SYMBOL_TEXT_CURSOR, rgui->colors.normal_color, rgui->colors.shadow_color); } - + /* Draw keyboard 'keys' */ for (key_index = 0; key_index < 44; key_index++) { unsigned key_row = (unsigned)(key_index / OSK_CHARS_PER_LINE); unsigned key_column = (unsigned)(key_index - (key_row * OSK_CHARS_PER_LINE)); - + int key_text_x = osk_x + keyboard_offset_x + key_text_offset_x + (key_column * key_width); int key_text_y = osk_y + keyboard_offset_y + key_text_offset_y + (key_row * key_height); - + const char *key_text = osk_grid[key_index]; - + /* 'Command' keys use custom symbols - have to * detect them and use rgui_blit_symbol(). Everything * else is plain text, and can be drawn directly @@ -4845,13 +4845,13 @@ static void rgui_render_osk( else rgui_blit_line(rgui, fb_width, key_text_x, key_text_y, key_text, rgui->colors.normal_color, rgui->colors.shadow_color); - + /* Draw selection pointer */ if (key_index == osk_ptr) { unsigned osk_ptr_x = osk_x + keyboard_offset_x + ptr_offset_x + (key_column * key_width); unsigned osk_ptr_y = osk_y + keyboard_offset_y + ptr_offset_y + (key_row * key_height); - + /* Draw drop shadow, if required */ if (rgui->flags & RGUI_FLAG_SHADOW_ENABLE) { @@ -4864,7 +4864,7 @@ static void rgui_render_osk( rgui_color_rect(frame_buf_data, fb_width, fb_height, osk_ptr_x + 1, osk_ptr_y + ptr_height, ptr_width, 1, rgui->colors.shadow_color); } - + /* Draw selection rectangle */ rgui_color_rect(frame_buf_data, fb_width, fb_height, osk_ptr_x, osk_ptr_y, 1, ptr_height, rgui->colors.hover_color); @@ -4956,7 +4956,7 @@ static void rgui_render( size_t i, end, fb_pitch, old_start, new_start; unsigned fb_width, fb_height; static bool display_kb = false; - static const char* const + static const char* const ticker_spacer = RGUI_TICKER_SPACER; int bottom = 0; unsigned ticker_x_offset = 0; @@ -4991,7 +4991,7 @@ static void rgui_render( bool current_display_cb = false; bool show_fs_thumbnail = - (rgui->flags & RGUI_FLAG_SHOW_FULLSCREEN_THUMBNAIL) + (rgui->flags & RGUI_FLAG_SHOW_FULLSCREEN_THUMBNAIL) && ( (rgui->flags & RGUI_FLAG_ENTRY_HAS_THUMBNAIL) || !string_is_empty(rgui->savestate_thumbnail_file_path)) && (rgui->fs_thumbnail.is_valid || (rgui->thumbnail_queue_size > 0)); @@ -5037,8 +5037,8 @@ static void rgui_render( if (MENU_ENTRIES_NEEDS_REFRESH(menu_st) && !msg_force) return; - if ( !display_kb && - !current_display_cb && + if ( !display_kb && + !current_display_cb && (is_idle || !GFX_DISPLAY_GET_UPDATE_PENDING(p_anim, p_disp))) return; } @@ -5050,7 +5050,7 @@ static void rgui_render( /* If the framebuffer changed size, or the background config has * changed, recache the background buffer */ - fb_size_changed = (rgui->last_width != fb_width) || + fb_size_changed = (rgui->last_width != fb_width) || (rgui->last_height != fb_height); #if defined(GEKKO) @@ -5128,7 +5128,7 @@ static void rgui_render( * value and determine index of last displayed entry */ old_start = menu_st->entries.begin; end = ((old_start + rgui->term_layout.height) <= entries_end) - ? old_start + rgui->term_layout.height + ? old_start + rgui->term_layout.height : entries_end; /* Do not scroll if all items are visible. */ @@ -5249,15 +5249,15 @@ static void rgui_render( title_width = (unsigned)(utf8len(thumbnail_title_buf) * rgui->font_width_stride); } - title_x = (unsigned)(rgui->term_layout.start_x - + ((rgui->term_layout.width * rgui->font_width_stride) + title_x = (unsigned)(rgui->term_layout.start_x + + ((rgui->term_layout.width * rgui->font_width_stride) - title_width) / 2); /* Draw thumbnail title background */ rgui_fill_rect(rgui->frame_buf.data, fb_width, fb_height, title_x - 5, 0, title_width + 10, rgui->font_height_stride, rgui->colors.bg_dark_color, rgui->colors.bg_light_color, - rgui->flags & RGUI_FLAG_BG_THICKNESS); + (rgui->flags & RGUI_FLAG_BG_THICKNESS) ? true : false); /* Draw thumbnail title */ rgui_blit_line(rgui, fb_width, ticker_x_offset + title_x, @@ -5341,8 +5341,8 @@ static void rgui_render( { unsigned powerstate_x; enum rgui_symbol_type powerstate_symbol; - uint16_t powerstate_color = (powerstate.percent > RGUI_BATTERY_WARN_THRESHOLD || powerstate.charging) - ? rgui->colors.title_color + uint16_t powerstate_color = (powerstate.percent > RGUI_BATTERY_WARN_THRESHOLD || powerstate.charging) + ? rgui->colors.title_color : rgui->colors.hover_color; if (powerstate.charging) @@ -5418,9 +5418,9 @@ static void rgui_render( string_to_upper(title_buf); - title_x = (unsigned)(ticker_x_offset + title_x = (unsigned)(ticker_x_offset + rgui->term_layout.start_x - + (rgui->term_layout.width - title_len) + + (rgui->term_layout.width - title_len) * rgui->font_width_stride / 2); /* Title is always centred, unless it is long enough @@ -5513,7 +5513,7 @@ static void rgui_render( entry_value_type = rgui_get_entry_value_type( entry_value, entry.setting_type, - entry.flags & MENU_ENTRY_FLAG_CHECKED, + (entry.flags & MENU_ENTRY_FLAG_CHECKED) ? true : false, rgui_switch_icons); switch (entry_value_type) @@ -5812,7 +5812,7 @@ static void rgui_render( if (rgui->flags & RGUI_FLAG_SHOW_MOUSE) { - bool cursor_visible = video_fullscreen + bool cursor_visible = video_fullscreen && menu_mouse_enable; /* Blit cursor */ @@ -5833,7 +5833,7 @@ static void rgui_framebuffer_free(frame_buf_t *framebuffer) framebuffer->width = 0; framebuffer->height = 0; - + if (framebuffer->data) free(framebuffer->data); framebuffer->data = NULL; @@ -5843,14 +5843,14 @@ static void rgui_thumbnail_free(thumbnail_t *thumbnail) { if (!thumbnail) return; - + thumbnail->max_width = 0; thumbnail->max_height = 0; thumbnail->width = 0; thumbnail->height = 0; thumbnail->is_valid = false; thumbnail->path[0] = '\0'; - + if (thumbnail->data) free(thumbnail->data); thumbnail->data = NULL; @@ -5896,10 +5896,10 @@ static void rgui_set_video_config( custom_vp->height = video_settings->viewport.height; custom_vp->x = video_settings->viewport.x; custom_vp->y = video_settings->viewport.y; - + aspectratio_lut[ASPECT_RATIO_CUSTOM].value = (float)custom_vp->width / custom_vp->height; - + if (delay_update) rgui->flags |= RGUI_FLAG_ASPECT_UPDATE_PENDING; else @@ -5927,11 +5927,11 @@ static void rgui_update_menu_viewport( #endif video_driver_get_viewport_info(&vp); - + /* Could do this once in rgui_init(), but seems cleaner to * handle all video config in one place... */ rgui->menu_video_settings.aspect_ratio_idx = ASPECT_RATIO_CUSTOM; - + /* Determine custom viewport layout */ if (fb_width > 0 && fb_height > 0 && vp.full_width > 0 && vp.full_height > 0) { @@ -5948,7 +5948,7 @@ static void rgui_update_menu_viewport( float device_aspect = (4.0f / 3.0f); #endif float desired_aspect = (float)fb_width / (float)fb_height; - + if (device_aspect > desired_aspect) { delta = (desired_aspect / device_aspect - 1.0f) / 2.0f + 0.5f; @@ -5964,15 +5964,15 @@ static void rgui_update_menu_viewport( #else /* Check whether we need to perform integer scaling */ bool do_integer_scaling = (menu_rgui_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) + unsigned scale = (width_scale <= height_scale) ? width_scale : height_scale; - + if (scale > 0) { rgui->menu_video_settings.viewport.width = scale * fb_width; @@ -5981,7 +5981,7 @@ static void rgui_update_menu_viewport( else do_integer_scaling = false; } - + /* Check whether menu should be stretched to * fill the screen, regardless of internal * aspect ratio */ @@ -5995,7 +5995,7 @@ static void rgui_update_menu_viewport( { 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) { rgui->menu_video_settings.viewport.width = vp.full_width; @@ -6008,7 +6008,7 @@ static void rgui_update_menu_viewport( } } #endif - + /* Sanity check */ if (rgui->menu_video_settings.viewport.width < 1) rgui->menu_video_settings.viewport.width = 1; @@ -6020,7 +6020,7 @@ static void rgui_update_menu_viewport( rgui->menu_video_settings.viewport.width = 1; rgui->menu_video_settings.viewport.height = 1; } - + rgui->menu_video_settings.viewport.x = (vp.full_width - rgui->menu_video_settings.viewport.width) / 2; rgui->menu_video_settings.viewport.y = (vp.full_height - rgui->menu_video_settings.viewport.height) / 2; } @@ -6061,12 +6061,12 @@ static bool rgui_set_aspect_ratio( rgui_thumbnail_free(&rgui->fs_thumbnail); rgui_thumbnail_free(&rgui->mini_thumbnail); rgui_thumbnail_free(&rgui->mini_left_thumbnail); - + /* Cache new aspect ratio */ rgui->menu_aspect_ratio = aspect_ratio; - + /* Set frame buffer dimensions: */ - + /* Frame buffer height */ #if defined(GEKKO) /* Since Wii graphics driver can change frame buffer @@ -6087,7 +6087,7 @@ static bool rgui_set_aspect_ratio( ? vp.full_height : RGUI_MIN_FB_HEIGHT; #endif - + /* Frame buffer width */ switch (rgui->menu_aspect_ratio) { @@ -6236,7 +6236,7 @@ static bool rgui_set_aspect_ratio( rgui->frame_buf.height = 200; } #endif - + /* Ensure frame buffer/terminal width is sane * - Must be less than max_frame_buf_width * (note that this is a redundant safety @@ -6256,7 +6256,7 @@ static bool rgui_set_aspect_ratio( rgui->frame_buf.width = (vp.full_width > RGUI_MIN_FB_WIDTH) ? RGUI_ROUND_FB_WIDTH(vp.full_width) : RGUI_MIN_FB_WIDTH; - + /* An annoyance: have to rescale the frame buffer * height and terminal width to maintain the correct * aspect ratio... */ @@ -6337,7 +6337,7 @@ static bool rgui_set_aspect_ratio( } } #endif - + /* Allocate frame buffer */ rgui->frame_buf.data = (uint16_t*)calloc( rgui->frame_buf.width * rgui->frame_buf.height, sizeof(uint16_t)); @@ -6349,18 +6349,18 @@ static bool rgui_set_aspect_ratio( p_disp->framebuf_width = rgui->frame_buf.width; p_disp->framebuf_height = rgui->frame_buf.height; p_disp->framebuf_pitch = rgui->frame_buf.width * sizeof(uint16_t); - + /* Determine terminal layout */ rgui->term_layout.start_x = (3 * 5) + 1; rgui->term_layout.start_y = (3 * 5) + rgui->font_height_stride; rgui->term_layout.width = (base_term_width - (2 * rgui->term_layout.start_x)) / rgui->font_width_stride; rgui->term_layout.height = (rgui->frame_buf.height - (2 * rgui->term_layout.start_y)) / rgui->font_height_stride; rgui->term_layout.value_maxlen = (unsigned)((RGUI_ENTRY_VALUE_MAXLEN_FRACTION * (float)rgui->term_layout.width) + 1.0f); - + /* > 'Start X/Y' adjustments */ rgui->term_layout.start_x = (rgui->frame_buf.width - (rgui->term_layout.width * rgui->font_width_stride)) / 2; rgui->term_layout.start_y = (rgui->frame_buf.height - (rgui->term_layout.height * rgui->font_height_stride)) / 2; - + /* Allocate background buffer */ rgui->background_buf.width = rgui->frame_buf.width; rgui->background_buf.height = rgui->frame_buf.height; @@ -6369,7 +6369,7 @@ static bool rgui_set_aspect_ratio( if (!rgui->background_buf.data) return false; - + /* Allocate thumbnail buffer */ rgui->fs_thumbnail.max_width = rgui->frame_buf.width; rgui->fs_thumbnail.max_height = rgui->frame_buf.height - (unsigned)(rgui->font_height_stride * 2.0f) - 1; @@ -6385,7 +6385,7 @@ static bool rgui_set_aspect_ratio( mini_thumbnail_term_width = 19; rgui->mini_thumbnail_max_width = mini_thumbnail_term_width * rgui->font_width_stride; rgui->mini_thumbnail_max_height = (unsigned)((rgui->term_layout.height * rgui->font_height_stride) * 0.5f) - 2; - + rgui->mini_thumbnail.max_width = rgui->mini_thumbnail_max_width; rgui->mini_thumbnail.max_height = rgui->mini_thumbnail_max_height; rgui->mini_thumbnail.data = (uint16_t*)calloc( @@ -6407,7 +6407,7 @@ static bool rgui_set_aspect_ratio( rgui->last_theme_dynamic_path[0] = '\0'; rgui->flags |= RGUI_FLAG_BG_MODIFIED | RGUI_FLAG_FORCE_REDRAW; - + /* If aspect ratio lock is enabled, notify * video driver of change */ if ( (aspect_ratio_lock != RGUI_ASPECT_RATIO_LOCK_NONE) @@ -6416,7 +6416,7 @@ static bool rgui_set_aspect_ratio( rgui_update_menu_viewport(rgui, p_disp, settings->uints.menu_rgui_aspect_ratio_lock); rgui_set_video_config(rgui, settings, &rgui->menu_video_settings, delay_update); } - + return true; } @@ -6578,7 +6578,7 @@ static void *rgui_init(void **userdata, bool video_is_threaded) * values (shoult not be necessary, but some platforms may * not handle struct initialisation correctly...) */ memset(&rgui->pointer, 0, sizeof(menu_input_pointer_t)); - + p_anim->updatetime_cb = rgui_menu_animation_update_time; return menu; @@ -6662,10 +6662,10 @@ static void rgui_set_texture(void *data) else { struct video_viewport vp; - + /* Get viewport dimensions */ video_driver_get_viewport_info(&vp); - + /* If viewport is currently the same size (or smaller) * than the menu framebuffer, no scaling is required */ if ((vp.width <= fb_width) && (vp.height <= fb_height)) @@ -6680,7 +6680,7 @@ static void rgui_set_texture(void *data) unsigned x_dst, y_dst; frame_buf_t *frame_buf = &rgui->frame_buf; frame_buf_t *upscale_buf = &rgui->upscale_buf; - + /* Determine output size */ if (internal_upscale_level == RGUI_UPSCALE_AUTO) { @@ -6692,7 +6692,7 @@ static void rgui_set_texture(void *data) out_width = internal_upscale_level * fb_width; out_height = internal_upscale_level * fb_height; } - + /* Allocate upscaling buffer, if required */ if ( (upscale_buf->width != out_width) || (upscale_buf->height != out_height) @@ -6700,13 +6700,13 @@ static void rgui_set_texture(void *data) { upscale_buf->width = out_width; upscale_buf->height = out_height; - + if (upscale_buf->data) { free(upscale_buf->data); upscale_buf->data = NULL; } - + if (!(upscale_buf->data = (uint16_t*) calloc(out_width * out_height, sizeof(uint16_t)))) { @@ -6721,7 +6721,7 @@ static void rgui_set_texture(void *data) return; } } - + /* Perform nearest neighbour upscaling * NB: We're duplicating code here, but trying to handle * this with a polymorphic function is too much of a drag... */ @@ -6737,7 +6737,7 @@ static void rgui_set_texture(void *data) upscale_buf->data[(y_dst * out_width) + x_dst] = frame_buf->data[(y_src * fb_width) + x_src]; } } - + /* Draw upscaled texture */ rgui_set_texture_frame(video_st, upscale_buf->data, false, out_width, out_height, 1.0f); @@ -6779,7 +6779,7 @@ static void rgui_load_current_thumbnails(rgui_t *rgui, struct menu_state *menu_s else rgui->flags &= ~RGUI_FLAG_ENTRY_HAS_THUMBNAIL; } - + /* Left thumbnail * (Note: there is no need to load this when viewing * fullscreen thumbnails) */ @@ -6822,7 +6822,7 @@ static void rgui_load_current_thumbnails(rgui_t *rgui, struct menu_state *menu_s /* Force a redraw (so 'entry_has_thumbnail' values are * applied immediately) */ rgui->flags |= RGUI_FLAG_FORCE_REDRAW; - + #ifdef HAVE_NETWORKING /* On demand thumbnail downloads */ if (thumbnails_missing && download_missing) @@ -6834,7 +6834,7 @@ static void rgui_load_current_thumbnails(rgui_t *rgui, struct menu_state *menu_s /* Explore list needs cached selection index */ if (rgui->flags & RGUI_FLAG_IS_EXPLORE_LIST) - selection = menu_st->thumbnail_path_data + selection = menu_st->thumbnail_path_data ? menu_st->thumbnail_path_data->playlist_index : 0; @@ -7068,7 +7068,7 @@ static void rgui_update_thumbnail_image(void *data) { rgui_t *rgui = (rgui_t*)data; - if ( (rgui->flags & RGUI_FLAG_IS_PLAYLIST) + if ( (rgui->flags & RGUI_FLAG_IS_PLAYLIST) || (rgui->flags & RGUI_FLAG_IS_EXPLORE_LIST)) rgui_scan_selected_entry_thumbnail(rgui, true); } @@ -7167,7 +7167,7 @@ static void rgui_update_menu_sublabel(rgui_t *rgui, size_t selection) if (!string_is_empty(entry.sublabel)) { size_t line_index; - static const char* const + static const char* const sublabel_spacer = RGUI_TICKER_SPACER; bool prev_line_empty = true; /* Sanitise sublabel @@ -7274,7 +7274,7 @@ static void rgui_populate_entries( #ifdef HAVE_LANGEXTRA gfx_display_t *p_disp = disp_get_ptr(); #endif - + if (!rgui) return; @@ -7289,8 +7289,8 @@ static void rgui_populate_entries( /* Update rgui_blit_line functions */ rgui_set_blit_functions( rgui->language, - rgui->flags & RGUI_FLAG_SHADOW_ENABLE, - rgui->flags & RGUI_FLAG_EXTENDED_ASCII_ENABLE); + (rgui->flags & RGUI_FLAG_SHADOW_ENABLE) ? true : false, + (rgui->flags & RGUI_FLAG_EXTENDED_ASCII_ENABLE) ? true : false); /* Need to recalculate terminal dimensions * > easiest method is to call @@ -7298,7 +7298,7 @@ static void rgui_populate_entries( rgui_set_aspect_ratio(rgui, p_disp, true); } #endif - + /* Check whether we are currently viewing a playlist */ if ( string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_PLAYLIST_LIST)) || string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_LOAD_CONTENT_HISTORY)) @@ -7338,14 +7338,14 @@ static void rgui_populate_entries( if (rgui->is_quick_menu) rgui->flags &= ~RGUI_FLAG_IS_EXPLORE_LIST; } - + /* Set menu title */ menu_entries_get_title(rgui->menu_title, sizeof(rgui->menu_title)); - + /* If dynamic themes are enabled, update the theme path */ if (rgui->color_theme == RGUI_THEME_DYNAMIC) rgui_update_dynamic_theme_path(rgui, dynamic_theme_dir); - + /* Cancel any pending thumbnail load operations */ rgui->flags &= ~RGUI_FLAG_THUMBNAIL_LOAD_PENDING; @@ -7368,9 +7368,9 @@ static void rgui_populate_entries( || remember_selection == MENU_REMEMBER_SELECTION_MAIN) menu_state_get_ptr()->selection_ptr = rgui->settings_selection_ptr; } - + rgui_navigation_set(data, true); - + /* If aspect ratio lock is enabled, must restore * content video settings when accessing the video * scaling settings menu... */ @@ -7775,7 +7775,7 @@ static void rgui_frame(void *data, video_frame_info_t *video_info) * since the flicker when switching between playlist view and * fullscreen thumbnail view is incredibly jarring...) */ if ((menu_driver_get_current_time() - rgui->thumbnail_load_trigger_time) >= - (settings->uints.menu_rgui_thumbnail_delay * 1000 * ((rgui->flags & RGUI_FLAG_SHOW_FULLSCREEN_THUMBNAIL) + (settings->uints.menu_rgui_thumbnail_delay * 1000 * ((rgui->flags & RGUI_FLAG_SHOW_FULLSCREEN_THUMBNAIL) ? 1.5f : 1.0f))) rgui_load_current_thumbnails(rgui, menu_st, @@ -7806,9 +7806,9 @@ static void rgui_toggle(void *userdata, bool menu_on) #else unsigned aspect_ratio_lock = settings ? settings->uints.menu_rgui_aspect_ratio_lock : 0; #endif - + /* TODO/FIXME - when we close RetroArch, this function - * gets called and settings is NULL at this point. + * gets called and settings is NULL at this point. * Maybe fundamentally change control flow so that on RetroArch * exit, this doesn't get called. */ if (!rgui || !settings) diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index 384f78f44c..36e8dd20b0 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -1248,8 +1248,8 @@ static unsigned menu_displaylist_parse_core_option_override_list(file_list_t *li uint32_t flags = runloop_get_flags(); bool core_has_options = !retroarch_ctl(RARCH_CTL_IS_DUMMY_CORE, NULL) && (runloop_st->core_options); - bool game_options_active = flags & RUNLOOP_FLAG_GAME_OPTIONS_ACTIVE; - bool folder_options_active = flags & RUNLOOP_FLAG_FOLDER_OPTIONS_ACTIVE; + bool game_options_active = (flags & RUNLOOP_FLAG_GAME_OPTIONS_ACTIVE) ? true : false; + bool folder_options_active = (flags & RUNLOOP_FLAG_FOLDER_OPTIONS_ACTIVE) ? true : false; bool show_core_options_flush = settings ? settings->bools.quick_menu_show_core_options_flush : false; @@ -1341,9 +1341,9 @@ static unsigned menu_displaylist_parse_remap_file_manager_list(file_list_t *list unsigned count = 0; uint32_t flags = runloop_get_flags(); bool has_content = !string_is_empty(path_get(RARCH_PATH_CONTENT)); - bool core_remap_active = flags & RUNLOOP_FLAG_REMAPS_CORE_ACTIVE; - bool content_dir_remap_active = flags & RUNLOOP_FLAG_REMAPS_CONTENT_DIR_ACTIVE; - bool game_remap_active = flags & RUNLOOP_FLAG_REMAPS_GAME_ACTIVE; + bool core_remap_active = (flags & RUNLOOP_FLAG_REMAPS_CORE_ACTIVE) ? true : false; + bool content_dir_remap_active = (flags & RUNLOOP_FLAG_REMAPS_CONTENT_DIR_ACTIVE) ? true : false; + bool game_remap_active = (flags & RUNLOOP_FLAG_REMAPS_GAME_ACTIVE) ? true : false; bool remap_save_on_exit = settings->bools.remap_save_on_exit; /* Sanity check - cannot handle remap files diff --git a/network/netplay/netplay_frontend.c b/network/netplay/netplay_frontend.c index 50d33b64f7..62d136785a 100644 --- a/network/netplay/netplay_frontend.c +++ b/network/netplay/netplay_frontend.c @@ -3729,9 +3729,9 @@ static void netplay_sync_input_post_frame(netplay_t *netplay, bool stalled) } /* Only relevant if we're connected and not in a desynching operation */ - if ((netplay->is_server && (netplay->connected_players<=1)) || - (netplay->self_mode < NETPLAY_CONNECTION_CONNECTED) || - (netplay->desync)) + if ( (netplay->is_server && (netplay->connected_players<=1)) + || (netplay->self_mode < NETPLAY_CONNECTION_CONNECTED) + || (netplay->desync)) { netplay->other_frame_count = netplay->self_frame_count; netplay->other_ptr = netplay->self_ptr; @@ -3740,7 +3740,7 @@ static void netplay_sync_input_post_frame(netplay_t *netplay, bool stalled) if (netplay->catch_up) { netplay->catch_up = false; - input_state_get_ptr()->flags &= ~INP_FLAG_NONBLOCKING; + input_state_get_ptr()->flags &= ~INP_FLAG_NONBLOCKING; driver_set_nonblock_state(); } return; diff --git a/retroarch.c b/retroarch.c index 61af9a4794..b94c4e7f23 100644 --- a/retroarch.c +++ b/retroarch.c @@ -674,7 +674,7 @@ static void driver_adjust_system_rates( * switching is enabled */ runloop_set_video_swap_interval( vrr_runloop_enable, - video_st->flags & VIDEO_FLAG_CRT_SWITCHING_ACTIVE, + (video_st->flags & VIDEO_FLAG_CRT_SWITCHING_ACTIVE) ? true : false, video_swap_interval, audio_max_timing_skew, video_refresh_rate, @@ -4963,8 +4963,8 @@ void emscripten_mainloop(void) bool input_driver_nonblock_state = input_st ? (input_st->flags & INP_FLAG_NONBLOCKING) : false; uint32_t runloop_flags = runloop_get_flags(); - bool runloop_is_slowmotion = runloop_flags & RUNLOOP_FLAG_SLOWMOTION; - bool runloop_is_paused = runloop_flags & RUNLOOP_FLAG_PAUSED; + bool runloop_is_slowmotion = (runloop_flags & RUNLOOP_FLAG_SLOWMOTION) ? true : false; + bool runloop_is_paused = (runloop_flags & RUNLOOP_FLAG_PAUSED) ? true : false; #ifdef HAVE_RWEBAUDIO RWebAudioRecalibrateTime(); @@ -6605,11 +6605,9 @@ bool retroarch_main_init(int argc, char *argv[]) input_remapping_restore_global_config(true); #ifdef HAVE_CONFIGFILE + /* Reload the original config */ if (runloop_st->flags & RUNLOOP_FLAG_OVERRIDES_ACTIVE) - { - /* Reload the original config */ config_unload_override(); - } #endif #ifdef HAVE_DYNAMIC diff --git a/runahead.c b/runahead.c index 68a59e32e1..75b26b34a6 100644 --- a/runahead.c +++ b/runahead.c @@ -1,1708 +1,1708 @@ -/* RetroArch - A frontend for libretro. - * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2023 - Daniel De Matteis - * Copyright (C) 2018-2023 - Dan Weiss - * Copyright (C) 2022-2023 - Neil Fore - * - * RetroArch is free software: you can redistribute it and/or modify it under the terms - * of the GNU General Public License as published by the Free Software Found- - * ation, either version 3 of the License, or (at your option) any later version. - * - * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with RetroArch. - * If not, see . - */ - -#include - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#include -#include -#include