Some style nits + cleanups

This commit is contained in:
libretroadmin 2023-07-18 17:07:36 +02:00
parent 770b9920f5
commit 9337facd49
2 changed files with 138 additions and 129 deletions

View File

@ -765,8 +765,8 @@ void driver_set_nonblock_state(void)
video_nonblock = true; video_nonblock = true;
video_st->current_video->set_nonblock_state(video_st->data, video_st->current_video->set_nonblock_state(video_st->data,
video_nonblock, video_nonblock,
video_driver_test_all_flags(GFX_CTX_FLAGS_ADAPTIVE_VSYNC) && video_driver_test_all_flags(GFX_CTX_FLAGS_ADAPTIVE_VSYNC)
adaptive_vsync, swap_interval); && adaptive_vsync, swap_interval);
} }
} }
@ -878,20 +878,20 @@ void drivers_init(
float refresh_rate = av_info->timing.fps; float refresh_rate = av_info->timing.fps;
unsigned autoswitch_refresh_rate = settings->uints.video_autoswitch_refresh_rate; unsigned autoswitch_refresh_rate = settings->uints.video_autoswitch_refresh_rate;
bool exclusive_fullscreen = settings->bools.video_fullscreen && !settings->bools.video_windowed_fullscreen; bool exclusive_fullscreen = settings->bools.video_fullscreen && !settings->bools.video_windowed_fullscreen;
bool windowed_fullscreen = settings->bools.video_fullscreen && settings->bools.video_windowed_fullscreen; bool windowed_fullscreen = settings->bools.video_fullscreen && settings->bools.video_windowed_fullscreen;
bool all_fullscreen = settings->bools.video_fullscreen || settings->bools.video_windowed_fullscreen; bool all_fullscreen = settings->bools.video_fullscreen || settings->bools.video_windowed_fullscreen;
/* Making a switch from PC standard 60 Hz to NTSC 59.94 is excluded by the last condition. */ /* Making a switch from PC standard 60 Hz to NTSC 59.94 is excluded by the last condition. */
if ( refresh_rate > 0.0 if ( (refresh_rate > 0.0f)
&& !settings->uints.crt_switch_resolution && !settings->uints.crt_switch_resolution
&& !settings->bools.vrr_runloop_enable && !settings->bools.vrr_runloop_enable
&& video_display_server_has_resolution_list() && video_display_server_has_resolution_list()
&& (autoswitch_refresh_rate != AUTOSWITCH_REFRESH_RATE_OFF) && (autoswitch_refresh_rate != AUTOSWITCH_REFRESH_RATE_OFF)
&& (fabs(settings->floats.video_refresh_rate - refresh_rate) > 1)) && (fabs(settings->floats.video_refresh_rate - refresh_rate) > 1))
{ {
if (((autoswitch_refresh_rate == AUTOSWITCH_REFRESH_RATE_EXCLUSIVE_FULLSCREEN) && exclusive_fullscreen) || if ( ((autoswitch_refresh_rate == AUTOSWITCH_REFRESH_RATE_EXCLUSIVE_FULLSCREEN) && exclusive_fullscreen)
((autoswitch_refresh_rate == AUTOSWITCH_REFRESH_RATE_WINDOWED_FULLSCREEN) && windowed_fullscreen) || || ((autoswitch_refresh_rate == AUTOSWITCH_REFRESH_RATE_WINDOWED_FULLSCREEN) && windowed_fullscreen)
((autoswitch_refresh_rate == AUTOSWITCH_REFRESH_RATE_ALL_FULLSCREEN) && all_fullscreen)) || ((autoswitch_refresh_rate == AUTOSWITCH_REFRESH_RATE_ALL_FULLSCREEN) && all_fullscreen))
{ {
bool video_switch_refresh_rate = false; bool video_switch_refresh_rate = false;
@ -977,8 +977,8 @@ void drivers_init(
{ {
bool rarch_force_fullscreen = video_st->flags & bool rarch_force_fullscreen = video_st->flags &
VIDEO_FLAG_FORCE_FULLSCREEN; VIDEO_FLAG_FORCE_FULLSCREEN;
bool video_is_fullscreen = settings->bools.video_fullscreen || bool video_is_fullscreen = settings->bools.video_fullscreen
rarch_force_fullscreen; || rarch_force_fullscreen;
p_dispwidget->active= gfx_widgets_init( p_dispwidget->active= gfx_widgets_init(
p_disp, p_disp,
@ -1017,8 +1017,8 @@ void drivers_init(
/* Initialising the menu driver will also initialise /* Initialising the menu driver will also initialise
* core info - if we are not initialising the menu * core info - if we are not initialising the menu
* driver, must initialise core info 'by hand' */ * driver, must initialise core info 'by hand' */
if (!(flags & DRIVER_VIDEO_MASK) || if ( !(flags & DRIVER_VIDEO_MASK)
!(flags & DRIVER_MENU_MASK)) || !(flags & DRIVER_MENU_MASK))
{ {
command_event(CMD_EVENT_CORE_INFO_INIT, NULL); command_event(CMD_EVENT_CORE_INFO_INIT, NULL);
command_event(CMD_EVENT_LOAD_CORE_PERSIST, NULL); command_event(CMD_EVENT_LOAD_CORE_PERSIST, NULL);
@ -1967,12 +1967,12 @@ enum rarch_content_type path_is_media_type(const char *path)
string_to_lower(ext_lower); string_to_lower(ext_lower);
/* hack, to detect livestreams so the ffmpeg core can be started */ /* hack, to detect livestreams so the ffmpeg core can be started */
if (string_starts_with_size(path, "udp://", STRLEN_CONST("udp://")) || if ( string_starts_with_size(path, "udp://", STRLEN_CONST("udp://"))
string_starts_with_size(path, "http://", STRLEN_CONST("http://")) || || string_starts_with_size(path, "http://", STRLEN_CONST("http://"))
string_starts_with_size(path, "https://", STRLEN_CONST("https://")) || || string_starts_with_size(path, "https://", STRLEN_CONST("https://"))
string_starts_with_size(path, "tcp://", STRLEN_CONST("tcp://")) || || string_starts_with_size(path, "tcp://", STRLEN_CONST("tcp://"))
string_starts_with_size(path, "rtmp://", STRLEN_CONST("rtmp://")) || || string_starts_with_size(path, "rtmp://", STRLEN_CONST("rtmp://"))
string_starts_with_size(path, "rtp://", STRLEN_CONST("rtp://"))) || string_starts_with_size(path, "rtp://", STRLEN_CONST("rtp://")))
return RARCH_CONTENT_MOVIE; return RARCH_CONTENT_MOVIE;
switch (msg_hash_to_file_type(msg_hash_calculate(ext_lower))) switch (msg_hash_to_file_type(msg_hash_calculate(ext_lower)))
@ -2159,8 +2159,8 @@ void dir_check_defaults(const char *custom_ini_path)
/* Early return for people with a custom folder setup /* Early return for people with a custom folder setup
* so it doesn't create unnecessary directories */ * so it doesn't create unnecessary directories */
if (!string_is_empty(custom_ini_path) && if ( !string_is_empty(custom_ini_path)
path_is_valid(custom_ini_path)) && path_is_valid(custom_ini_path))
return; return;
for (i = 0; i < DEFAULT_DIR_LAST; i++) for (i = 0; i < DEFAULT_DIR_LAST; i++)
@ -3328,7 +3328,8 @@ bool command_event(enum event_command cmd, void *data)
audio_st->callback.callback = NULL; audio_st->callback.callback = NULL;
audio_st->callback.set_state = NULL; audio_st->callback.set_state = NULL;
if (!type || !runloop_event_init_core(settings, input_st, *type, if ( !type
|| !runloop_event_init_core(settings, input_st, *type,
p_rarch->dir_savefile, p_rarch->dir_savestate)) p_rarch->dir_savefile, p_rarch->dir_savestate))
{ {
/* If core failed to initialise, audio callback /* If core failed to initialise, audio callback
@ -3355,8 +3356,8 @@ bool command_event(enum event_command cmd, void *data)
video_st->current_video->set_nonblock_state( video_st->current_video->set_nonblock_state(
video_st->data, false, video_st->data, false,
video_driver_test_all_flags( video_driver_test_all_flags(
GFX_CTX_FLAGS_ADAPTIVE_VSYNC) && GFX_CTX_FLAGS_ADAPTIVE_VSYNC)
adaptive_vsync, swap_interval); && adaptive_vsync, swap_interval);
} }
break; break;
case CMD_EVENT_VIDEO_SET_ASPECT_RATIO: case CMD_EVENT_VIDEO_SET_ASPECT_RATIO:
@ -3526,8 +3527,9 @@ bool command_event(enum event_command cmd, void *data)
playlist_get_sort_mode(g_defaults.content_favorites); playlist_get_sort_mode(g_defaults.content_favorites);
/* New addition - need to resort if option is enabled */ /* New addition - need to resort if option is enabled */
if ((playlist_sort_alphabetical && (current_sort_mode == PLAYLIST_SORT_MODE_DEFAULT)) || if ( (playlist_sort_alphabetical
(current_sort_mode == PLAYLIST_SORT_MODE_ALPHABETICAL)) && (current_sort_mode == PLAYLIST_SORT_MODE_DEFAULT))
|| (current_sort_mode == PLAYLIST_SORT_MODE_ALPHABETICAL))
playlist_qsort(g_defaults.content_favorites); playlist_qsort(g_defaults.content_favorites);
playlist_write_file(g_defaults.content_favorites); playlist_write_file(g_defaults.content_favorites);
@ -3700,8 +3702,8 @@ bool command_event(enum event_command cmd, void *data)
if (menu_st->flags & MENU_ST_FLAG_ALIVE) if (menu_st->flags & MENU_ST_FLAG_ALIVE)
{ {
#ifdef HAVE_NETWORKING #ifdef HAVE_NETWORKING
bool menu_pause_libretro = settings->bools.menu_pause_libretro && bool menu_pause_libretro = settings->bools.menu_pause_libretro
netplay_driver_ctl(RARCH_NETPLAY_CTL_ALLOW_PAUSE, NULL); && netplay_driver_ctl(RARCH_NETPLAY_CTL_ALLOW_PAUSE, NULL);
#else #else
bool menu_pause_libretro = settings->bools.menu_pause_libretro; bool menu_pause_libretro = settings->bools.menu_pause_libretro;
#endif #endif
@ -3723,8 +3725,8 @@ bool command_event(enum event_command cmd, void *data)
else else
{ {
#ifdef HAVE_NETWORKING #ifdef HAVE_NETWORKING
bool menu_pause_libretro = settings->bools.menu_pause_libretro && bool menu_pause_libretro = settings->bools.menu_pause_libretro
netplay_driver_ctl(RARCH_NETPLAY_CTL_ALLOW_PAUSE, NULL); && netplay_driver_ctl(RARCH_NETPLAY_CTL_ALLOW_PAUSE, NULL);
#else #else
bool menu_pause_libretro = settings->bools.menu_pause_libretro; bool menu_pause_libretro = settings->bools.menu_pause_libretro;
#endif #endif
@ -3924,8 +3926,8 @@ bool command_event(enum event_command cmd, void *data)
case CMD_EVENT_NETPLAY_HOST_TOGGLE: case CMD_EVENT_NETPLAY_HOST_TOGGLE:
if (netplay_driver_ctl(RARCH_NETPLAY_CTL_IS_ENABLED, NULL)) if (netplay_driver_ctl(RARCH_NETPLAY_CTL_IS_ENABLED, NULL))
{ {
if (netplay_driver_ctl(RARCH_NETPLAY_CTL_IS_SERVER, NULL) || if ( netplay_driver_ctl(RARCH_NETPLAY_CTL_IS_SERVER, NULL)
netplay_driver_ctl(RARCH_NETPLAY_CTL_IS_CONNECTED, NULL)) || netplay_driver_ctl(RARCH_NETPLAY_CTL_IS_CONNECTED, NULL))
command_event(CMD_EVENT_NETPLAY_DISCONNECT, NULL); command_event(CMD_EVENT_NETPLAY_DISCONNECT, NULL);
} }
else else
@ -4286,8 +4288,8 @@ bool command_event(enum event_command cmd, void *data)
video_st->poke->show_mouse(video_st->data, false); video_st->poke->show_mouse(video_st->data, false);
} }
/* Ungrab only if windowed and auto mouse grab is disabled */ /* Ungrab only if windowed and auto mouse grab is disabled */
else if (!video_fullscreen && else if (!video_fullscreen
!settings->bools.input_auto_mouse_grab) && !settings->bools.input_auto_mouse_grab)
{ {
if (input_driver_ungrab_mouse()) if (input_driver_ungrab_mouse())
input_st->flags &= ~INP_FLAG_GRAB_MOUSE_STATE; input_st->flags &= ~INP_FLAG_GRAB_MOUSE_STATE;
@ -4395,7 +4397,8 @@ bool command_event(enum event_command cmd, void *data)
unsigned ai_service_mode = settings->uints.ai_service_mode; unsigned ai_service_mode = settings->uints.ai_service_mode;
#ifdef HAVE_AUDIOMIXER #ifdef HAVE_AUDIOMIXER
if (ai_service_mode == 1 && audio_driver_is_ai_service_speech_running()) if ( (ai_service_mode == 1)
&& audio_driver_is_ai_service_speech_running())
{ {
audio_driver_mixer_stop_stream(10); audio_driver_mixer_stop_stream(10);
audio_driver_mixer_remove_stream(10); audio_driver_mixer_remove_stream(10);
@ -4415,7 +4418,7 @@ bool command_event(enum event_command cmd, void *data)
if (is_accessibility_enabled( if (is_accessibility_enabled(
accessibility_enable, accessibility_enable,
access_st->enabled) access_st->enabled)
&& ai_service_mode == 2 && (ai_service_mode == 2)
&& is_narrator_running(accessibility_enable)) && is_narrator_running(accessibility_enable))
accessibility_speak_priority( accessibility_speak_priority(
accessibility_enable, accessibility_enable,
@ -4428,7 +4431,7 @@ bool command_event(enum event_command cmd, void *data)
if (data) if (data)
paused = *((bool*)data); paused = *((bool*)data);
if ( access_st->ai_service_auto == 0 if ( (access_st->ai_service_auto == 0)
&& !settings->bools.ai_service_pause) && !settings->bools.ai_service_pause)
access_st->ai_service_auto = 1; access_st->ai_service_auto = 1;
@ -5454,10 +5457,10 @@ static void retroarch_parse_input_libretro_path(const char *path)
core_ext[0] = '\0'; core_ext[0] = '\0';
if (string_is_empty(settings->paths.directory_libretro) || if ( string_is_empty(settings->paths.directory_libretro)
!frontend_driver_get_core_extension(core_ext, || !frontend_driver_get_core_extension(core_ext,
sizeof(core_ext)) || sizeof(core_ext))
!string_is_equal(path_ext, core_ext)) || !string_is_equal(path_ext, core_ext))
goto end; goto end;
fill_pathname_join_special(tmp_path, settings->paths.directory_libretro, fill_pathname_join_special(tmp_path, settings->paths.directory_libretro,
@ -5468,8 +5471,8 @@ static void retroarch_parse_input_libretro_path(const char *path)
path_stats = path_stat(tmp_path); path_stats = path_stat(tmp_path);
if ((path_stats & RETRO_VFS_STAT_IS_VALID) != 0 && if ( (path_stats & RETRO_VFS_STAT_IS_VALID) != 0
(path_stats & RETRO_VFS_STAT_IS_DIRECTORY) == 0) && (path_stats & RETRO_VFS_STAT_IS_DIRECTORY) == 0)
{ {
core_path = tmp_path; core_path = tmp_path;
core_path_matched = true; core_path_matched = true;
@ -7282,8 +7285,8 @@ void retroarch_favorites_init(void)
/* Ensure that playlist is sorted alphabetically, /* Ensure that playlist is sorted alphabetically,
* if required */ * if required */
if ((playlist_sort_alphabetical && (current_sort_mode == PLAYLIST_SORT_MODE_DEFAULT)) || if ( (playlist_sort_alphabetical && (current_sort_mode == PLAYLIST_SORT_MODE_DEFAULT))
(current_sort_mode == PLAYLIST_SORT_MODE_ALPHABETICAL)) || (current_sort_mode == PLAYLIST_SORT_MODE_ALPHABETICAL))
playlist_qsort(g_defaults.content_favorites); playlist_qsort(g_defaults.content_favorites);
} }

176
runloop.c
View File

@ -745,8 +745,8 @@ static bool dynamic_verify_hw_context(
case RETRO_HW_CONTEXT_OPENGLES3: case RETRO_HW_CONTEXT_OPENGLES3:
case RETRO_HW_CONTEXT_OPENGLES_VERSION: case RETRO_HW_CONTEXT_OPENGLES_VERSION:
case RETRO_HW_CONTEXT_OPENGL: case RETRO_HW_CONTEXT_OPENGL:
if (!string_is_equal(video_ident, "gl") && if ( !string_is_equal(video_ident, "gl")
!string_is_equal(video_ident, "glcore")) && !string_is_equal(video_ident, "glcore"))
return false; return false;
break; break;
case RETRO_HW_CONTEXT_D3D10: case RETRO_HW_CONTEXT_D3D10:
@ -1218,8 +1218,8 @@ static void runloop_init_core_options_path(
bool game_specific_options = settings->bools.game_specific_options; bool game_specific_options = settings->bools.game_specific_options;
/* Check whether game-specific options exist */ /* Check whether game-specific options exist */
if (game_specific_options && if ( game_specific_options
validate_game_specific_options(&game_options_path)) && validate_game_specific_options(&game_options_path))
{ {
/* Notify system that we have a valid core options /* Notify system that we have a valid core options
* override */ * override */
@ -1233,8 +1233,8 @@ static void runloop_init_core_options_path(
free(game_options_path); free(game_options_path);
} }
/* Check whether folder-specific options exist */ /* Check whether folder-specific options exist */
else if (game_specific_options && else if ( game_specific_options
validate_folder_specific_options( && validate_folder_specific_options(
&folder_options_path)) &folder_options_path))
{ {
/* Notify system that we have a valid core options /* Notify system that we have a valid core options
@ -1277,7 +1277,8 @@ static void runloop_init_core_options_path(
/* If not using per-core options, or if a per-core options /* If not using per-core options, or if a per-core options
* file does not yet exist, must fetch 'global' options path */ * file does not yet exist, must fetch 'global' options path */
if (!per_core_options || !per_core_options_exist) if ( !per_core_options
|| !per_core_options_exist)
{ {
const char *options_path = path_core_options; const char *options_path = path_core_options;
@ -1750,8 +1751,8 @@ bool runloop_environment_cb(unsigned cmd, void *data)
*update_display_callback = *update_display_callback =
(const struct retro_core_options_update_display_callback*)data; (const struct retro_core_options_update_display_callback*)data;
if (update_display_callback && if ( update_display_callback
update_display_callback->callback) && update_display_callback->callback)
runloop_st->core_options_callback.update_display = runloop_st->core_options_callback.update_display =
update_display_callback->callback; update_display_callback->callback;
else else
@ -1832,8 +1833,8 @@ bool runloop_environment_cb(unsigned cmd, void *data)
/* If a message is already set, only overwrite /* If a message is already set, only overwrite
* it if the new message has the same or higher * it if the new message has the same or higher
* priority */ * priority */
if (!runloop_st->core_status_msg.set || if ( !runloop_st->core_status_msg.set
(runloop_st->core_status_msg.priority <= msg->priority)) || (runloop_st->core_status_msg.priority <= msg->priority))
{ {
if (!string_is_empty(msg->msg)) if (!string_is_empty(msg->msg))
{ {
@ -1974,7 +1975,8 @@ bool runloop_environment_cb(unsigned cmd, void *data)
const char *dir_system = settings->paths.directory_system; const char *dir_system = settings->paths.directory_system;
bool systemfiles_in_content_dir = settings->bools.systemfiles_in_content_dir; bool systemfiles_in_content_dir = settings->bools.systemfiles_in_content_dir;
if (string_is_empty(dir_system) || systemfiles_in_content_dir) if ( string_is_empty(dir_system)
|| systemfiles_in_content_dir)
{ {
const char *fullpath = path_get(RARCH_PATH_CONTENT); const char *fullpath = path_get(RARCH_PATH_CONTENT);
@ -2647,15 +2649,16 @@ bool runloop_environment_cb(unsigned cmd, void *data)
video_switch_refresh_rate_maybe(&refresh_rate, &video_switch_refresh_rate); video_switch_refresh_rate_maybe(&refresh_rate, &video_switch_refresh_rate);
no_video_reinit = ( no_video_reinit = (
crt_switch_resolution == 0 (crt_switch_resolution == 0)
&& video_switch_refresh_rate == false && (video_switch_refresh_rate == false)
&& data && data
&& ((*info)->geometry.max_width == av_info->geometry.max_width) && ((*info)->geometry.max_width == av_info->geometry.max_width)
&& ((*info)->geometry.max_height == av_info->geometry.max_height)); && ((*info)->geometry.max_height == av_info->geometry.max_height));
/* First set new refresh rate and display rate, then after REINIT do /* First set new refresh rate and display rate, then after REINIT do
* another display rate change to make sure the change stays */ * another display rate change to make sure the change stays */
if (video_switch_refresh_rate && video_display_server_set_refresh_rate(refresh_rate)) if ( video_switch_refresh_rate
&& video_display_server_set_refresh_rate(refresh_rate))
video_monitor_set_refresh_rate(refresh_rate); video_monitor_set_refresh_rate(refresh_rate);
/* When not doing video reinit, we also must not do input and menu /* When not doing video reinit, we also must not do input and menu
@ -3204,7 +3207,7 @@ bool runloop_environment_cb(unsigned cmd, void *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;
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;
#ifdef HAVE_REWIND #ifdef HAVE_REWIND
@ -3221,8 +3224,8 @@ bool runloop_environment_cb(unsigned cmd, void *data)
menu_opened = menu_state_get_ptr()->flags & MENU_ST_FLAG_ALIVE; menu_opened = menu_state_get_ptr()->flags & MENU_ST_FLAG_ALIVE;
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
netplay_driver_ctl(RARCH_NETPLAY_CTL_ALLOW_PAUSE, NULL); && netplay_driver_ctl(RARCH_NETPLAY_CTL_ALLOW_PAUSE, NULL);
#else #else
core_paused = settings->bools.menu_pause_libretro; core_paused = settings->bools.menu_pause_libretro;
#endif #endif
@ -3254,15 +3257,16 @@ bool runloop_environment_cb(unsigned cmd, void *data)
} }
/* VSync overrides the mode if the rate is limited by the display. */ /* VSync overrides the mode if the rate is limited by the display. */
if (menu_opened || /* Menu currently always runs with vsync on. */ if ( menu_opened /* Menu currently always runs with vsync on. */
( settings->bools.video_vsync || (settings->bools.video_vsync
&& (!(runloop_st->flags & RUNLOOP_FLAG_FORCE_NONBLOCK)) && (!(runloop_st->flags & RUNLOOP_FLAG_FORCE_NONBLOCK))
&& !(input_state_get_ptr()->flags & INP_FLAG_NONBLOCKING))) && !(input_state_get_ptr()->flags & INP_FLAG_NONBLOCKING)))
{ {
float refresh_rate = video_driver_get_refresh_rate(); float refresh_rate = video_driver_get_refresh_rate();
if (refresh_rate == 0.0f) if (refresh_rate == 0.0f)
refresh_rate = settings->floats.video_refresh_rate; refresh_rate = settings->floats.video_refresh_rate;
if (refresh_rate < throttle_state->rate || !throttle_state->rate) if ( (refresh_rate < throttle_state->rate)
|| !throttle_state->rate)
{ {
/* Keep the mode as fast forward even if vsync limits it. */ /* Keep the mode as fast forward even if vsync limits it. */
if (refresh_rate < core_fps) if (refresh_rate < core_fps)
@ -3749,9 +3753,9 @@ static void runloop_fastmotion_override_free(runloop_state_t *runloop_st)
*video_st = video_state_get_ptr(); *video_st = video_state_get_ptr();
settings_t *settings = config_get_ptr(); settings_t *settings = config_get_ptr();
float fastforward_ratio = settings->floats.fastforward_ratio; float fastforward_ratio = settings->floats.fastforward_ratio;
bool reset_frame_limit = runloop_st->fastmotion_override.current.fastforward && bool reset_frame_limit = runloop_st->fastmotion_override.current.fastforward
(runloop_st->fastmotion_override.current.ratio >= 0.0f) && && (runloop_st->fastmotion_override.current.ratio >= 0.0f)
(runloop_st->fastmotion_override.current.ratio != fastforward_ratio); && (runloop_st->fastmotion_override.current.ratio != fastforward_ratio);
runloop_st->fastmotion_override.current.ratio = 0.0f; runloop_st->fastmotion_override.current.ratio = 0.0f;
runloop_st->fastmotion_override.current.fastforward = false; runloop_st->fastmotion_override.current.fastforward = false;
@ -3909,8 +3913,8 @@ static void runloop_apply_fastmotion_override(runloop_state_t *runloop_st, setti
float fastforward_ratio_default = settings ? float fastforward_ratio_default = settings ?
settings->floats.fastforward_ratio : 0.0f; settings->floats.fastforward_ratio : 0.0f;
float fastforward_ratio_last = float fastforward_ratio_last =
(runloop_st->fastmotion_override.current.fastforward && (runloop_st->fastmotion_override.current.fastforward
(runloop_st->fastmotion_override.current.ratio >= 0.0f)) ? && (runloop_st->fastmotion_override.current.ratio >= 0.0f)) ?
runloop_st->fastmotion_override.current.ratio : runloop_st->fastmotion_override.current.ratio :
fastforward_ratio_default; fastforward_ratio_default;
#if defined(HAVE_GFX_WIDGETS) #if defined(HAVE_GFX_WIDGETS)
@ -3962,8 +3966,8 @@ static void runloop_apply_fastmotion_override(runloop_state_t *runloop_st, setti
} }
/* Update frame limit, if required */ /* Update frame limit, if required */
fastforward_ratio_current = (runloop_st->fastmotion_override.current.fastforward && fastforward_ratio_current = (runloop_st->fastmotion_override.current.fastforward
(runloop_st->fastmotion_override.current.ratio >= 0.0f)) ? && (runloop_st->fastmotion_override.current.ratio >= 0.0f)) ?
runloop_st->fastmotion_override.current.ratio : runloop_st->fastmotion_override.current.ratio :
fastforward_ratio_default; fastforward_ratio_default;
@ -4225,7 +4229,8 @@ static bool event_init_content(
are true. are true.
*/ */
#ifdef HAVE_CHEEVOS #ifdef HAVE_CHEEVOS
if (!cheevos_enable || !cheevos_hardcore_mode_enable) if ( !cheevos_enable
|| !cheevos_hardcore_mode_enable)
#endif #endif
{ {
#ifdef HAVE_BSV_MOVIE #ifdef HAVE_BSV_MOVIE
@ -4234,7 +4239,8 @@ static bool event_init_content(
if (!(input_st->bsv_movie_state.flags & BSV_FLAG_MOVIE_START_PLAYBACK)) if (!(input_st->bsv_movie_state.flags & BSV_FLAG_MOVIE_START_PLAYBACK))
#endif #endif
{ {
if (runloop_st->entry_state_slot && !command_event_load_entry_state(settings)) if ( runloop_st->entry_state_slot
&& !command_event_load_entry_state(settings))
{ {
/* loading the state failed, reset entry slot */ /* loading the state failed, reset entry slot */
runloop_st->entry_state_slot = 0; runloop_st->entry_state_slot = 0;
@ -4918,11 +4924,11 @@ bool core_options_remove_override(bool game_specific)
* > If we have removed a game-specific config, * > If we have removed a game-specific config,
* check whether a folder-specific config * check whether a folder-specific config
* exists */ * exists */
if (game_specific && if ( game_specific
validate_folder_options( && validate_folder_options(
new_options_path, new_options_path,
sizeof(new_options_path), false) && sizeof(new_options_path), false)
path_is_valid(new_options_path)) && path_is_valid(new_options_path))
folder_options_active = true; folder_options_active = true;
/* > If a folder-specific config does not exist, /* > If a folder-specific config does not exist,
@ -4956,8 +4962,8 @@ bool core_options_remove_override(bool game_specific)
goto error; goto error;
/* > If we have a valid file, load it */ /* > If we have a valid file, load it */
if (folder_options_active || if ( folder_options_active
path_is_valid(new_options_path)) || path_is_valid(new_options_path))
{ {
size_t i, j; size_t i, j;
@ -5405,8 +5411,8 @@ static enum runloop_state_enum runloop_check_state(
#ifdef HAVE_MENU #ifdef HAVE_MENU
last_input = current_bits; last_input = current_bits;
if ( if (
((menu_toggle_gamepad_combo != INPUT_COMBO_NONE) && ((menu_toggle_gamepad_combo != INPUT_COMBO_NONE)
input_driver_button_combo( && input_driver_button_combo(
menu_toggle_gamepad_combo, menu_toggle_gamepad_combo,
current_time, current_time,
&last_input))) &last_input)))
@ -5427,7 +5433,9 @@ static enum runloop_state_enum runloop_check_state(
if (input_active || (menu_st->input_driver_flushing_input > 0)) if (input_active || (menu_st->input_driver_flushing_input > 0))
{ {
BIT256_CLEAR_ALL(current_bits); BIT256_CLEAR_ALL(current_bits);
if (runloop_paused && !runloop_paused_hotkey && settings->bools.menu_pause_libretro) if ( runloop_paused
&& !runloop_paused_hotkey
&& settings->bools.menu_pause_libretro)
BIT256_SET(current_bits, RARCH_PAUSE_TOGGLE); BIT256_SET(current_bits, RARCH_PAUSE_TOGGLE);
else if (runloop_paused_hotkey) else if (runloop_paused_hotkey)
{ {
@ -5513,8 +5521,8 @@ static enum runloop_state_enum runloop_check_state(
HOTKEY_CHECK(RARCH_OVERLAY_NEXT, CMD_EVENT_OVERLAY_NEXT, true, &check_next_rotation); HOTKEY_CHECK(RARCH_OVERLAY_NEXT, CMD_EVENT_OVERLAY_NEXT, true, &check_next_rotation);
/* Check whether video aspect has changed */ /* Check whether video aspect has changed */
if ((video_driver_width != last_width) || if ( (video_driver_width != last_width)
(video_driver_height != last_height)) || (video_driver_height != last_height))
{ {
/* Update scaling/offset factors */ /* Update scaling/offset factors */
command_event(CMD_EVENT_OVERLAY_SET_SCALE_FACTOR, NULL); command_event(CMD_EVENT_OVERLAY_SET_SCALE_FACTOR, NULL);
@ -5553,8 +5561,8 @@ static enum runloop_state_enum runloop_check_state(
unsigned video_driver_height = video_st->height; unsigned video_driver_height = video_st->height;
/* Check whether video aspect has changed */ /* Check whether video aspect has changed */
if ((video_driver_width != last_width) || if ( (video_driver_width != last_width)
(video_driver_height != last_height)) || (video_driver_height != last_height))
{ {
/* Update set aspect ratio so the full matches the current video width & height */ /* Update set aspect ratio so the full matches the current video width & height */
command_event(CMD_EVENT_VIDEO_SET_ASPECT_RATIO, NULL); command_event(CMD_EVENT_VIDEO_SET_ASPECT_RATIO, NULL);
@ -5574,9 +5582,9 @@ static enum runloop_state_enum runloop_check_state(
current_bits, RARCH_QUIT_KEY); current_bits, RARCH_QUIT_KEY);
trig_quit_key = quit_key && !old_quit_key; trig_quit_key = quit_key && !old_quit_key;
/* Check for quit gamepad combo */ /* Check for quit gamepad combo */
if (!trig_quit_key && if ( !trig_quit_key
((quit_gamepad_combo != INPUT_COMBO_NONE) && && ((quit_gamepad_combo != INPUT_COMBO_NONE)
input_driver_button_combo( && input_driver_button_combo(
quit_gamepad_combo, quit_gamepad_combo,
current_time, current_time,
&current_bits))) &current_bits)))
@ -5585,7 +5593,8 @@ static enum runloop_state_enum runloop_check_state(
quit_press_twice = settings->bools.quit_press_twice; quit_press_twice = settings->bools.quit_press_twice;
/* Check double press if enabled */ /* Check double press if enabled */
if (trig_quit_key && quit_press_twice) if ( trig_quit_key
&& quit_press_twice)
{ {
static retro_time_t quit_key_time = 0; static retro_time_t quit_key_time = 0;
retro_time_t cur_time = current_time; retro_time_t cur_time = current_time;
@ -5612,7 +5621,7 @@ static enum runloop_state_enum runloop_check_state(
#ifdef HAVE_SCREENSHOTS #ifdef HAVE_SCREENSHOTS
unsigned runloop_max_frames = runloop_st->max_frames; unsigned runloop_max_frames = runloop_st->max_frames;
if ((runloop_max_frames != 0) if ( (runloop_max_frames != 0)
&& (frame_count >= runloop_max_frames) && (frame_count >= runloop_max_frames)
&& (runloop_st->flags & RUNLOOP_FLAG_MAX_FRAMES_SCREENSHOT)) && (runloop_st->flags & RUNLOOP_FLAG_MAX_FRAMES_SCREENSHOT))
{ {
@ -5697,8 +5706,8 @@ static enum runloop_state_enum runloop_check_state(
{ {
bool rarch_force_fullscreen = video_st->flags & bool rarch_force_fullscreen = video_st->flags &
VIDEO_FLAG_FORCE_FULLSCREEN; VIDEO_FLAG_FORCE_FULLSCREEN;
bool video_is_fullscreen = settings->bools.video_fullscreen || bool video_is_fullscreen = settings->bools.video_fullscreen
rarch_force_fullscreen; || rarch_force_fullscreen;
RUNLOOP_MSG_QUEUE_LOCK(runloop_st); RUNLOOP_MSG_QUEUE_LOCK(runloop_st);
gfx_widgets_iterate( gfx_widgets_iterate(
@ -5841,8 +5850,8 @@ static enum runloop_state_enum runloop_check_state(
{ {
bool runloop_is_inited = runloop_st->flags & RUNLOOP_FLAG_IS_INITED; bool runloop_is_inited = runloop_st->flags & RUNLOOP_FLAG_IS_INITED;
#ifdef HAVE_NETWORKING #ifdef HAVE_NETWORKING
bool menu_pause_libretro = settings->bools.menu_pause_libretro && bool menu_pause_libretro = settings->bools.menu_pause_libretro
netplay_driver_ctl(RARCH_NETPLAY_CTL_ALLOW_PAUSE, NULL); && netplay_driver_ctl(RARCH_NETPLAY_CTL_ALLOW_PAUSE, NULL);
#else #else
bool menu_pause_libretro = settings->bools.menu_pause_libretro; bool menu_pause_libretro = settings->bools.menu_pause_libretro;
#endif #endif
@ -5899,8 +5908,8 @@ static enum runloop_state_enum runloop_check_state(
menu->state = 0; menu->state = 0;
} }
if (settings->bools.audio_enable_menu && if (settings->bools.audio_enable_menu
!libretro_running) && !libretro_running)
audio_driver_menu_sample(); audio_driver_menu_sample();
} }
@ -5942,8 +5951,8 @@ static enum runloop_state_enum runloop_check_state(
&& !string_is_equal(menu_driver, "null"); && !string_is_equal(menu_driver, "null");
bool core_type_is_dummy = runloop_st->current_core_type == CORE_TYPE_DUMMY; bool core_type_is_dummy = runloop_st->current_core_type == CORE_TYPE_DUMMY;
if ( (pressed && !old_pressed) || if ( (pressed && !old_pressed)
core_type_is_dummy) || core_type_is_dummy)
{ {
if (menu_st->flags & MENU_ST_FLAG_ALIVE) if (menu_st->flags & MENU_ST_FLAG_ALIVE)
{ {
@ -5977,8 +5986,8 @@ static enum runloop_state_enum runloop_check_state(
bool volume_hotkey_down = BIT256_GET( bool volume_hotkey_down = BIT256_GET(
current_bits, RARCH_VOLUME_DOWN); current_bits, RARCH_VOLUME_DOWN);
if ( (volume_hotkey_up && !volume_hotkey_down) || if ( (volume_hotkey_up && !volume_hotkey_down)
(volume_hotkey_down && !volume_hotkey_up)) || (volume_hotkey_down && !volume_hotkey_up))
{ {
if (volume_hotkey_delay > 0) if (volume_hotkey_delay > 0)
volume_hotkey_delay--; volume_hotkey_delay--;
@ -6352,8 +6361,8 @@ static enum runloop_state_enum runloop_check_state(
/* Display fast-forward notification, unless /* Display fast-forward notification, unless
* disabled via override */ * disabled via override */
if (!runloop_st->fastmotion_override.current.fastforward || if ( !runloop_st->fastmotion_override.current.fastforward
runloop_st->fastmotion_override.current.notification) || runloop_st->fastmotion_override.current.notification)
{ {
/* > Use widgets, if enabled */ /* > Use widgets, if enabled */
#if defined(HAVE_GFX_WIDGETS) #if defined(HAVE_GFX_WIDGETS)
@ -6423,9 +6432,7 @@ static enum runloop_state_enum runloop_check_state(
#ifdef HAVE_NETWORKING #ifdef HAVE_NETWORKING
if ((runloop_st->flags & RUNLOOP_FLAG_SLOWMOTION) if ((runloop_st->flags & RUNLOOP_FLAG_SLOWMOTION)
&& !netplay_driver_ctl(RARCH_NETPLAY_CTL_ALLOW_TIMESKIP, NULL)) && !netplay_driver_ctl(RARCH_NETPLAY_CTL_ALLOW_TIMESKIP, NULL))
{
runloop_st->flags &= ~RUNLOOP_FLAG_SLOWMOTION; runloop_st->flags &= ~RUNLOOP_FLAG_SLOWMOTION;
}
#endif #endif
if (runloop_st->flags & RUNLOOP_FLAG_SLOWMOTION) if (runloop_st->flags & RUNLOOP_FLAG_SLOWMOTION)
@ -6498,14 +6505,12 @@ static enum runloop_state_enum runloop_check_state(
if (check1) if (check1)
configuration_set_int(settings, settings->ints.state_slot, configuration_set_int(settings, settings->ints.state_slot,
cur_state_slot); cur_state_slot);
_len = strlcpy(msg, msg_hash_to_str(MSG_STATE_SLOT), sizeof(msg)); _len = strlcpy(msg, msg_hash_to_str(MSG_STATE_SLOT), sizeof(msg));
_len += snprintf(msg + _len, sizeof(msg) - _len,
": %d", settings->ints.state_slot);
if (cur_state_slot < 0) if (cur_state_slot < 0)
snprintf(msg + _len, sizeof(msg) - _len, strlcpy(msg + _len, " (Auto)", sizeof(msg) - _len);
": %d (Auto)", settings->ints.state_slot);
else
snprintf(msg + _len, sizeof(msg) - _len,
": %d", settings->ints.state_slot);
#ifdef HAVE_GFX_WIDGETS #ifdef HAVE_GFX_WIDGETS
if (dispwidget_get_ptr()->active) if (dispwidget_get_ptr()->active)
@ -6560,14 +6565,12 @@ static enum runloop_state_enum runloop_check_state(
if (check1) if (check1)
configuration_set_int(settings, settings->ints.replay_slot, configuration_set_int(settings, settings->ints.replay_slot,
cur_replay_slot); cur_replay_slot);
_len = strlcpy(msg, msg_hash_to_str(MSG_REPLAY_SLOT), sizeof(msg)); _len = strlcpy(msg, msg_hash_to_str(MSG_REPLAY_SLOT), sizeof(msg));
_len += snprintf(msg + _len, sizeof(msg) - _len,
": %d", settings->ints.replay_slot);
if (cur_replay_slot < 0) if (cur_replay_slot < 0)
snprintf(msg + _len, sizeof(msg) - _len, strlcpy(msg + _len, " (Auto)", sizeof(msg) - _len);
": %d (Auto)", settings->ints.replay_slot);
else
snprintf(msg + _len, sizeof(msg) - _len,
": %d", settings->ints.replay_slot);
#ifdef HAVE_GFX_WIDGETS #ifdef HAVE_GFX_WIDGETS
if (dispwidget_get_ptr()->active) if (dispwidget_get_ptr()->active)
@ -6743,8 +6746,8 @@ int runloop_iterate(void)
bool menu_pause_libretro = settings->bools.menu_pause_libretro; bool menu_pause_libretro = settings->bools.menu_pause_libretro;
#endif #endif
bool core_paused = bool core_paused =
(runloop_st->flags & RUNLOOP_FLAG_PAUSED) || (runloop_st->flags & RUNLOOP_FLAG_PAUSED)
(menu_pause_libretro && (menu_state_get_ptr()->flags & MENU_ST_FLAG_ALIVE)); || (menu_pause_libretro && (menu_state_get_ptr()->flags & MENU_ST_FLAG_ALIVE));
#else #else
bool core_paused = (runloop_st->flags & RUNLOOP_FLAG_PAUSED); bool core_paused = (runloop_st->flags & RUNLOOP_FLAG_PAUSED);
#endif #endif
@ -6774,7 +6777,7 @@ int runloop_iterate(void)
bool is_locked_fps = ( bool is_locked_fps = (
(runloop_st->flags & RUNLOOP_FLAG_PAUSED) (runloop_st->flags & RUNLOOP_FLAG_PAUSED)
|| (input_st->flags & INP_FLAG_NONBLOCKING)) || (input_st->flags & INP_FLAG_NONBLOCKING))
| !!recording_st->data; | !!recording_st->data;
retro_time_t delta = (!runloop_last_frame_time || is_locked_fps) retro_time_t delta = (!runloop_last_frame_time || is_locked_fps)
? runloop_st->frame_time.reference ? runloop_st->frame_time.reference
: (current - runloop_last_frame_time); : (current - runloop_last_frame_time);
@ -6804,9 +6807,9 @@ int runloop_iterate(void)
if (!( (runloop_st->flags & RUNLOOP_FLAG_PAUSED) if (!( (runloop_st->flags & RUNLOOP_FLAG_PAUSED)
|| !(audio_st->flags & AUDIO_FLAG_ACTIVE) || !(audio_st->flags & AUDIO_FLAG_ACTIVE)
|| !(audio_st->output_samples_buf)) || !(audio_st->output_samples_buf))
&& audio_st->current_audio->write_avail && audio_st->current_audio->write_avail
&& audio_st->context_audio_data && audio_st->context_audio_data
&& audio_st->buffer_size) && audio_st->buffer_size)
{ {
size_t audio_buf_avail; size_t audio_buf_avail;
@ -7985,12 +7988,14 @@ void runloop_path_set_redirect(settings_t *settings,
if (string_is_empty(new_savefile_dir)) if (string_is_empty(new_savefile_dir))
RARCH_LOG("Cannot resolve save file path.\n"); RARCH_LOG("Cannot resolve save file path.\n");
else if (sort_savefiles_enable || sort_savefiles_by_content_enable) else if (sort_savefiles_enable
|| sort_savefiles_by_content_enable)
RARCH_LOG("Saving files in content directory is set. This overrides other save file directory settings.\n"); RARCH_LOG("Saving files in content directory is set. This overrides other save file directory settings.\n");
} }
/* Set savestate directory if empty based on content directory */ /* Set savestate directory if empty based on content directory */
if (string_is_empty(new_savestate_dir) || savestates_in_content_dir) if ( string_is_empty(new_savestate_dir)
|| savestates_in_content_dir)
{ {
strlcpy(new_savestate_dir, strlcpy(new_savestate_dir,
runloop_st->runtime_content_path_basename, runloop_st->runtime_content_path_basename,
@ -7999,7 +8004,8 @@ void runloop_path_set_redirect(settings_t *settings,
if (string_is_empty(new_savestate_dir)) if (string_is_empty(new_savestate_dir))
RARCH_LOG("Cannot resolve save state file path.\n"); RARCH_LOG("Cannot resolve save state file path.\n");
else if (sort_savestates_enable || sort_savestates_by_content_enable) else if (sort_savestates_enable
|| sort_savestates_by_content_enable)
RARCH_LOG("Saving save states in content directory is set. This overrides other save state file directory settings.\n"); RARCH_LOG("Saving save states in content directory is set. This overrides other save state file directory settings.\n");
} }