Small cleanups

This commit is contained in:
libretroadmin 2023-08-12 18:59:29 +02:00
parent 904e9fbe1d
commit 5f79c13928
1 changed files with 112 additions and 120 deletions

View File

@ -1212,41 +1212,36 @@ static void runloop_init_core_options_path(
char *path, size_t len,
char *src_path, size_t src_len)
{
char *game_options_path = NULL;
char *folder_options_path = NULL;
char *options_path = NULL;
runloop_state_t *runloop_st = &runloop_state;
bool game_specific_options = settings->bools.game_specific_options;
/* Check whether game-specific options exist */
if ( game_specific_options
&& validate_game_specific_options(&game_options_path))
&& validate_game_specific_options(&options_path))
{
/* Notify system that we have a valid core options
* override */
path_set(RARCH_PATH_CORE_OPTIONS, game_options_path);
path_set(RARCH_PATH_CORE_OPTIONS, options_path);
runloop_st->flags &= ~RUNLOOP_FLAG_FOLDER_OPTIONS_ACTIVE;
runloop_st->flags |= RUNLOOP_FLAG_GAME_OPTIONS_ACTIVE;
/* Copy options path */
strlcpy(path, game_options_path, len);
free(game_options_path);
strlcpy(path, options_path, len);
free(options_path);
}
/* Check whether folder-specific options exist */
else if ( game_specific_options
&& validate_folder_specific_options(
&folder_options_path))
&options_path))
{
/* Notify system that we have a valid core options
* override */
path_set(RARCH_PATH_CORE_OPTIONS, folder_options_path);
path_set(RARCH_PATH_CORE_OPTIONS, options_path);
runloop_st->flags &= ~RUNLOOP_FLAG_GAME_OPTIONS_ACTIVE;
runloop_st->flags |= RUNLOOP_FLAG_FOLDER_OPTIONS_ACTIVE;
/* Copy options path */
strlcpy(path, folder_options_path, len);
free(folder_options_path);
strlcpy(path, options_path, len);
free(options_path);
}
else
{
@ -1358,9 +1353,10 @@ static void runloop_core_msg_queue_push(
struct retro_system_av_info *av_info,
const struct retro_message_ext *msg)
{
double fps;
unsigned duration_frames;
enum message_queue_category category;
/* Get duration in frames */
double fps = (av_info && (av_info->timing.fps > 0)) ? av_info->timing.fps : 60.0;
unsigned duration_frames = (unsigned)((fps * (float)msg->duration / 1000.0f) + 0.5f);
/* Assign category */
switch (msg->level)
@ -1378,10 +1374,6 @@ static void runloop_core_msg_queue_push(
break;
}
/* Get duration in frames */
fps = (av_info && (av_info->timing.fps > 0)) ? av_info->timing.fps : 60.0;
duration_frames = (unsigned)((fps * (float)msg->duration / 1000.0f) + 0.5f);
/* Note: Do not flush the message queue here - a core
* may need to send multiple notifications simultaneously */
runloop_msg_queue_push(msg->msg,
@ -6886,8 +6878,8 @@ int runloop_iterate(void)
#ifdef HAVE_NETWORKING
#ifdef HAVE_MENU
/* FIXME: This is an ugly way to tell Netplay this... */
if (menu_pause_libretro &&
netplay_driver_ctl(RARCH_NETPLAY_CTL_IS_ENABLED, NULL)
if ( menu_pause_libretro
&& netplay_driver_ctl(RARCH_NETPLAY_CTL_IS_ENABLED, NULL)
)
netplay_driver_ctl(RARCH_NETPLAY_CTL_PAUSE, NULL);
#endif
@ -7010,9 +7002,9 @@ int runloop_iterate(void)
static bool skip_delay_prev = false;
bool frame_time_update =
/* Skip some initial frames for stabilization */
video_st->frame_count > frame_time_interval &&
video_st->frame_count > frame_time_interval
/* Only update when there are enough frames for averaging */
video_st->frame_count % frame_time_interval == 0;
&& video_st->frame_count % frame_time_interval == 0;
/* A few frames must be ignored after slow+fastmotion/pause
* is disabled or geometry change is triggered */