Explicit typecast to bool for some flag to bool conversions

This commit is contained in:
libretroadmin 2023-08-16 00:16:03 +02:00
parent 139d7f3836
commit bd7a0f7f0a
6 changed files with 45 additions and 43 deletions

View File

@ -1625,13 +1625,13 @@ bool audio_driver_callback(void)
bool runloop_paused = runloop_flags & RUNLOOP_FLAG_PAUSED; bool runloop_paused = runloop_flags & RUNLOOP_FLAG_PAUSED;
#ifdef HAVE_MENU #ifdef HAVE_MENU
#ifdef HAVE_NETWORKING #ifdef HAVE_NETWORKING
bool core_paused = runloop_paused || bool core_paused = runloop_paused
( settings->bools.menu_pause_libretro || (settings->bools.menu_pause_libretro
&& (menu_state_get_ptr()->flags & MENU_ST_FLAG_ALIVE) && (menu_state_get_ptr()->flags & MENU_ST_FLAG_ALIVE)
&& netplay_driver_ctl(RARCH_NETPLAY_CTL_ALLOW_PAUSE, NULL)); && netplay_driver_ctl(RARCH_NETPLAY_CTL_ALLOW_PAUSE, NULL));
#else #else
bool core_paused = runloop_paused || bool core_paused = runloop_paused
(settings->bools.menu_pause_libretro || (settings->bools.menu_pause_libretro
&& (menu_state_get_ptr()->flags & MENU_ST_FLAG_ALIVE)); && (menu_state_get_ptr()->flags & MENU_ST_FLAG_ALIVE));
#endif #endif
#else #else

View File

@ -2586,9 +2586,9 @@ void video_driver_build_info(video_frame_info_t *video_info)
#if defined(HAVE_GFX_WIDGETS) #if defined(HAVE_GFX_WIDGETS)
video_info->widgets_userdata = p_dispwidget; video_info->widgets_userdata = p_dispwidget;
video_info->widgets_is_paused = video_st->flags & VIDEO_FLAG_WIDGETS_PAUSED; video_info->widgets_is_paused = (video_st->flags & VIDEO_FLAG_WIDGETS_PAUSED) ? true : false;
video_info->widgets_is_fast_forwarding = video_st->flags & VIDEO_FLAG_WIDGETS_FAST_FORWARD; video_info->widgets_is_fast_forwarding = (video_st->flags & VIDEO_FLAG_WIDGETS_FAST_FORWARD) ? true : false;
video_info->widgets_is_rewinding = video_st->flags & VIDEO_FLAG_WIDGETS_REWINDING; video_info->widgets_is_rewinding = (video_st->flags & VIDEO_FLAG_WIDGETS_REWINDING) ? true : false;
#else #else
video_info->widgets_userdata = NULL; video_info->widgets_userdata = NULL;
video_info->widgets_is_paused = false; video_info->widgets_is_paused = false;
@ -2599,7 +2599,7 @@ void video_driver_build_info(video_frame_info_t *video_info)
video_info->width = video_st->width; video_info->width = video_st->width;
video_info->height = video_st->height; video_info->height = video_st->height;
video_info->use_rgba = video_st->flags & VIDEO_FLAG_USE_RGBA; video_info->use_rgba = (video_st->flags & VIDEO_FLAG_USE_RGBA) ? true : false;
video_info->hdr_enable = settings->bools.video_hdr_enable; video_info->hdr_enable = settings->bools.video_hdr_enable;
video_info->libretro_running = false; video_info->libretro_running = false;
@ -2609,8 +2609,8 @@ void video_driver_build_info(video_frame_info_t *video_info)
video_info->memory_update_interval = settings->uints.memory_update_interval; video_info->memory_update_interval = settings->uints.memory_update_interval;
#ifdef HAVE_MENU #ifdef HAVE_MENU
video_info->menu_is_alive = menu_st->flags & MENU_ST_FLAG_ALIVE; video_info->menu_is_alive = (menu_st->flags & MENU_ST_FLAG_ALIVE) ? true : false;
video_info->menu_screensaver_active = menu_st->flags & MENU_ST_FLAG_SCREENSAVER_ACTIVE; video_info->menu_screensaver_active = (menu_st->flags & MENU_ST_FLAG_SCREENSAVER_ACTIVE) ? true : false;
video_info->menu_footer_opacity = settings->floats.menu_footer_opacity; video_info->menu_footer_opacity = settings->floats.menu_footer_opacity;
video_info->menu_header_opacity = settings->floats.menu_header_opacity; video_info->menu_header_opacity = settings->floats.menu_header_opacity;
video_info->materialui_color_theme = settings->uints.menu_materialui_color_theme; video_info->materialui_color_theme = settings->uints.menu_materialui_color_theme;
@ -2645,8 +2645,8 @@ void video_driver_build_info(video_frame_info_t *video_info)
#endif #endif
video_info->msg_queue_delay = runloop_st->msg_queue_delay; video_info->msg_queue_delay = runloop_st->msg_queue_delay;
video_info->runloop_is_paused = runloop_st->flags & RUNLOOP_FLAG_PAUSED; video_info->runloop_is_paused = (runloop_st->flags & RUNLOOP_FLAG_PAUSED) ? true : false;
video_info->runloop_is_slowmotion = runloop_st->flags & RUNLOOP_FLAG_SLOWMOTION; video_info->runloop_is_slowmotion = (runloop_st->flags & RUNLOOP_FLAG_SLOWMOTION) ? true : false;
video_info->fastforward_frameskip = settings->bools.fastforward_frameskip; video_info->fastforward_frameskip = settings->bools.fastforward_frameskip;
#ifdef _WIN32 #ifdef _WIN32
@ -2663,7 +2663,7 @@ void video_driver_build_info(video_frame_info_t *video_info)
#endif #endif
video_info->input_driver_nonblock_state = input_st ? (input_st->flags & INP_FLAG_NONBLOCKING) : false; video_info->input_driver_nonblock_state = input_st ? (input_st->flags & INP_FLAG_NONBLOCKING) : false;
video_info->input_driver_grab_mouse_state = (input_st->flags & INP_FLAG_GRAB_MOUSE_STATE); video_info->input_driver_grab_mouse_state = (input_st->flags & INP_FLAG_GRAB_MOUSE_STATE) ? true : false;
video_info->disp_userdata = disp_get_ptr(); video_info->disp_userdata = disp_get_ptr();
video_info->userdata = VIDEO_DRIVER_GET_PTR_INTERNAL(video_st); video_info->userdata = VIDEO_DRIVER_GET_PTR_INTERNAL(video_st);
@ -3378,7 +3378,7 @@ void video_driver_frame(const void *data, unsigned width,
const enum retro_pixel_format const enum retro_pixel_format
video_driver_pix_fmt = video_st->pix_fmt; video_driver_pix_fmt = video_st->pix_fmt;
bool runloop_idle = (runloop_st->flags & RUNLOOP_FLAG_IDLE) ? true : false; bool runloop_idle = (runloop_st->flags & RUNLOOP_FLAG_IDLE) ? true : false;
bool video_driver_active = (video_st->flags & VIDEO_FLAG_ACTIVE) ? true : false; bool video_driver_active = (video_st->flags & VIDEO_FLAG_ACTIVE) ? true : false;
#if defined(HAVE_GFX_WIDGETS) #if defined(HAVE_GFX_WIDGETS)
dispgfx_widget_t *p_dispwidget = dispwidget_get_ptr(); dispgfx_widget_t *p_dispwidget = dispwidget_get_ptr();
bool widgets_active = p_dispwidget->active; bool widgets_active = p_dispwidget->active;

View File

@ -3056,8 +3056,8 @@ const char *video_shader_get_current_shader_preset(void)
bool video_shader_enable = settings->bools.video_shader_enable; bool video_shader_enable = settings->bools.video_shader_enable;
unsigned video_shader_delay = settings->uints.video_shader_delay; unsigned video_shader_delay = settings->uints.video_shader_delay;
bool auto_shaders_enable = settings->bools.auto_shaders_enable; bool auto_shaders_enable = settings->bools.auto_shaders_enable;
bool cli_shader_disable = video_st->flags & bool cli_shader_disable = (video_st->flags &
VIDEO_FLAG_CLI_SHADER_DISABLE; VIDEO_FLAG_CLI_SHADER_DISABLE) ? true : false;
if (!video_shader_enable) if (!video_shader_enable)
return NULL; return NULL;

View File

@ -1535,7 +1535,7 @@ static int16_t input_state_internal(
bool input_blocked = (menu_st->input_driver_flushing_input > 0) bool input_blocked = (menu_st->input_driver_flushing_input > 0)
|| (input_st->flags & INP_FLAG_BLOCK_LIBRETRO_INPUT); || (input_st->flags & INP_FLAG_BLOCK_LIBRETRO_INPUT);
#else #else
bool input_blocked = (input_st->flags & INP_FLAG_BLOCK_LIBRETRO_INPUT); bool input_blocked = (input_st->flags & INP_FLAG_BLOCK_LIBRETRO_INPUT) ? true : false;
#endif #endif
bool bitmask_enabled = false; bool bitmask_enabled = false;
unsigned max_users = settings->uints.input_max_users; unsigned max_users = settings->uints.input_max_users;

View File

@ -766,9 +766,9 @@ void driver_set_nonblock_state(void)
bool adaptive_vsync = settings->bools.video_adaptive_vsync; bool adaptive_vsync = settings->bools.video_adaptive_vsync;
unsigned swap_interval = runloop_get_video_swap_interval( unsigned swap_interval = runloop_get_video_swap_interval(
settings->uints.video_swap_interval); settings->uints.video_swap_interval);
bool video_driver_active = video_st->flags & VIDEO_FLAG_ACTIVE; bool video_driver_active = (video_st->flags & VIDEO_FLAG_ACTIVE) ? true : false;
bool audio_driver_active = audio_st->flags & AUDIO_FLAG_ACTIVE; bool audio_driver_active = (audio_st->flags & AUDIO_FLAG_ACTIVE) ? true : false;
bool runloop_force_nonblock = runloop_st->flags & RUNLOOP_FLAG_FORCE_NONBLOCK; bool runloop_force_nonblock = (runloop_st->flags & RUNLOOP_FLAG_FORCE_NONBLOCK) ? true : false;
/* Only apply non-block-state for video if we're using vsync. */ /* Only apply non-block-state for video if we're using vsync. */
if (video_driver_active && VIDEO_DRIVER_GET_PTR_INTERNAL(video_st)) if (video_driver_active && VIDEO_DRIVER_GET_PTR_INTERNAL(video_st))
@ -990,8 +990,8 @@ void drivers_init(
&& video_st->current_video->gfx_widgets_enabled && video_st->current_video->gfx_widgets_enabled
&& video_st->current_video->gfx_widgets_enabled(video_st->data)) && video_st->current_video->gfx_widgets_enabled(video_st->data))
{ {
bool rarch_force_fullscreen = video_st->flags & bool rarch_force_fullscreen = (video_st->flags &
VIDEO_FLAG_FORCE_FULLSCREEN; VIDEO_FLAG_FORCE_FULLSCREEN) ? true : false;
bool video_is_fullscreen = settings->bools.video_fullscreen bool video_is_fullscreen = settings->bools.video_fullscreen
|| rarch_force_fullscreen; || rarch_force_fullscreen;
@ -3668,7 +3668,7 @@ bool command_event(enum event_command cmd, void *data)
break; break;
case CMD_EVENT_PAUSE_TOGGLE: case CMD_EVENT_PAUSE_TOGGLE:
{ {
bool paused = runloop_st->flags & RUNLOOP_FLAG_PAUSED; bool paused = (runloop_st->flags & RUNLOOP_FLAG_PAUSED) ? true : false;
#ifdef HAVE_ACCESSIBILITY #ifdef HAVE_ACCESSIBILITY
bool accessibility_enable bool accessibility_enable
= settings->bools.accessibility_enable; = settings->bools.accessibility_enable;
@ -3969,8 +3969,8 @@ bool command_event(enum event_command cmd, void *data)
*input_st = input_state_get_ptr(); *input_st = input_state_get_ptr();
bool *userdata = (bool*)data; bool *userdata = (bool*)data;
bool video_fullscreen = settings->bools.video_fullscreen; bool video_fullscreen = settings->bools.video_fullscreen;
bool ra_is_forced_fs = video_st->flags & bool ra_is_forced_fs = (video_st->flags &
VIDEO_FLAG_FORCE_FULLSCREEN; VIDEO_FLAG_FORCE_FULLSCREEN) ? true : false;
bool new_fullscreen_state = !video_fullscreen && !ra_is_forced_fs; bool new_fullscreen_state = !video_fullscreen && !ra_is_forced_fs;
if (!video_driver_has_windowed()) if (!video_driver_has_windowed())
@ -4439,7 +4439,7 @@ bool command_event(enum event_command cmd, void *data)
else else
#endif #endif
{ {
bool paused = runloop_st->flags & RUNLOOP_FLAG_PAUSED; bool paused = (runloop_st->flags & RUNLOOP_FLAG_PAUSED) ? true : false;
if (data) if (data)
paused = *((bool*)data); paused = *((bool*)data);
@ -4688,7 +4688,7 @@ static void global_free(struct rarch_state *p_rarch)
runloop_st->current_core.flags &= ~(RETRO_CORE_FLAG_HAS_SET_INPUT_DESCRIPTORS runloop_st->current_core.flags &= ~(RETRO_CORE_FLAG_HAS_SET_INPUT_DESCRIPTORS
| RETRO_CORE_FLAG_HAS_SET_SUBSYSTEMS); | RETRO_CORE_FLAG_HAS_SET_SUBSYSTEMS);
global = global_get_ptr(); global = global_get_ptr();
path_clear_all(); path_clear_all();
dir_clear_all(); dir_clear_all();

View File

@ -3213,7 +3213,7 @@ bool runloop_environment_cb(unsigned cmd, void *data)
= (struct retro_throttle_state *)data; = (struct retro_throttle_state *)data;
bool menu_opened = false; bool menu_opened = false;
bool core_paused = runloop_st->flags & RUNLOOP_FLAG_PAUSED; bool core_paused = (runloop_st->flags & RUNLOOP_FLAG_PAUSED) ? true : false;
bool no_audio = ((audio_st->flags & AUDIO_FLAG_SUSPENDED) bool no_audio = ((audio_st->flags & AUDIO_FLAG_SUSPENDED)
|| !(audio_st->flags & AUDIO_FLAG_ACTIVE)); || !(audio_st->flags & AUDIO_FLAG_ACTIVE));
float core_fps = (float)video_st->av_info.timing.fps; float core_fps = (float)video_st->av_info.timing.fps;
@ -3229,7 +3229,7 @@ bool runloop_environment_cb(unsigned cmd, void *data)
#endif #endif
#ifdef HAVE_MENU #ifdef HAVE_MENU
menu_opened = menu_state_get_ptr()->flags & MENU_ST_FLAG_ALIVE; menu_opened = (menu_state_get_ptr()->flags & MENU_ST_FLAG_ALIVE) ? true : false;
if (menu_opened) if (menu_opened)
#ifdef HAVE_NETWORKING #ifdef HAVE_NETWORKING
core_paused = settings->bools.menu_pause_libretro core_paused = settings->bools.menu_pause_libretro
@ -3907,8 +3907,8 @@ static retro_time_t runloop_core_runtime_tick(
video_driver_state_t *video_st = video_state_get_ptr(); video_driver_state_t *video_st = video_state_get_ptr();
retro_time_t frame_time = retro_time_t frame_time =
(1.0 / video_st->av_info.timing.fps) * 1000000; (1.0 / video_st->av_info.timing.fps) * 1000000;
bool runloop_slowmotion = runloop_st->flags & RUNLOOP_FLAG_SLOWMOTION; bool runloop_slowmotion = (runloop_st->flags & RUNLOOP_FLAG_SLOWMOTION) ? true : false;
bool runloop_fastmotion = runloop_st->flags & RUNLOOP_FLAG_FASTMOTION; bool runloop_fastmotion = (runloop_st->flags & RUNLOOP_FLAG_FASTMOTION) ? true : false;
/* Account for slow motion */ /* Account for slow motion */
if (runloop_slowmotion) if (runloop_slowmotion)
@ -4768,8 +4768,8 @@ void runloop_pause_checks(void)
#endif #endif
video_driver_state_t *video_st = video_state_get_ptr(); video_driver_state_t *video_st = video_state_get_ptr();
runloop_state_t *runloop_st = &runloop_state; runloop_state_t *runloop_st = &runloop_state;
bool is_paused = runloop_st->flags & RUNLOOP_FLAG_PAUSED; bool is_paused = (runloop_st->flags & RUNLOOP_FLAG_PAUSED) ? true : false;
bool is_idle = runloop_st->flags & RUNLOOP_FLAG_IDLE; bool is_idle = (runloop_st->flags & RUNLOOP_FLAG_IDLE) ? true : false;
#if defined(HAVE_GFX_WIDGETS) #if defined(HAVE_GFX_WIDGETS)
dispgfx_widget_t *p_dispwidget = dispwidget_get_ptr(); dispgfx_widget_t *p_dispwidget = dispwidget_get_ptr();
bool widgets_active = p_dispwidget->active; bool widgets_active = p_dispwidget->active;
@ -4935,13 +4935,15 @@ bool core_options_create_override(bool game_specific)
path_set(RARCH_PATH_CORE_OPTIONS, options_path); path_set(RARCH_PATH_CORE_OPTIONS, options_path);
if (game_specific) if (game_specific)
{
runloop_st->flags |= RUNLOOP_FLAG_GAME_OPTIONS_ACTIVE; runloop_st->flags |= RUNLOOP_FLAG_GAME_OPTIONS_ACTIVE;
else
runloop_st->flags &= ~RUNLOOP_FLAG_GAME_OPTIONS_ACTIVE;
if (!game_specific)
runloop_st->flags |= RUNLOOP_FLAG_FOLDER_OPTIONS_ACTIVE;
else
runloop_st->flags &= ~RUNLOOP_FLAG_FOLDER_OPTIONS_ACTIVE; runloop_st->flags &= ~RUNLOOP_FLAG_FOLDER_OPTIONS_ACTIVE;
}
else
{
runloop_st->flags &= ~RUNLOOP_FLAG_GAME_OPTIONS_ACTIVE;
runloop_st->flags |= RUNLOOP_FLAG_FOLDER_OPTIONS_ACTIVE;
}
config_file_free(conf); config_file_free(conf);
return true; return true;
@ -5326,7 +5328,7 @@ static bool display_menu_libretro(
bool libretro_running, bool libretro_running,
retro_time_t current_time) retro_time_t current_time)
{ {
bool runloop_idle = runloop_st->flags & RUNLOOP_FLAG_IDLE; bool runloop_idle = (runloop_st->flags & RUNLOOP_FLAG_IDLE) ? true : false;
video_driver_state_t*video_st = video_state_get_ptr(); video_driver_state_t*video_st = video_state_get_ptr();
if ( video_st->poke if ( video_st->poke
@ -5434,8 +5436,8 @@ static enum runloop_state_enum runloop_check_state(
bool is_alive = false; bool is_alive = false;
uint64_t frame_count = 0; uint64_t frame_count = 0;
bool focused = true; bool focused = true;
bool rarch_is_initialized = runloop_st->flags & RUNLOOP_FLAG_IS_INITED; bool rarch_is_initialized = (runloop_st->flags & RUNLOOP_FLAG_IS_INITED) ? true : false;
bool runloop_paused = runloop_st->flags & RUNLOOP_FLAG_PAUSED; bool runloop_paused = (runloop_st->flags & RUNLOOP_FLAG_PAUSED) ? true : false;
bool pause_nonactive = settings->bools.pause_nonactive; bool pause_nonactive = settings->bools.pause_nonactive;
unsigned quit_gamepad_combo = settings->uints.input_quit_gamepad_combo; unsigned quit_gamepad_combo = settings->uints.input_quit_gamepad_combo;
#ifdef HAVE_MENU #ifdef HAVE_MENU
@ -5780,8 +5782,8 @@ static enum runloop_state_enum runloop_check_state(
#if defined(HAVE_GFX_WIDGETS) #if defined(HAVE_GFX_WIDGETS)
if (widgets_active) if (widgets_active)
{ {
bool rarch_force_fullscreen = video_st->flags & bool rarch_force_fullscreen = (video_st->flags &
VIDEO_FLAG_FORCE_FULLSCREEN; VIDEO_FLAG_FORCE_FULLSCREEN) ? true : false;
bool video_is_fullscreen = settings->bools.video_fullscreen bool video_is_fullscreen = settings->bools.video_fullscreen
|| rarch_force_fullscreen; || rarch_force_fullscreen;