Small cleanups
This commit is contained in:
parent
904e9fbe1d
commit
5f79c13928
70
runloop.c
70
runloop.c
|
@ -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,
|
||||
|
@ -6569,12 +6561,12 @@ static enum runloop_state_enum runloop_check_state(
|
|||
if (check2 && !check1 && replay_slot + addition < -1)
|
||||
{
|
||||
replay_slot = 1000;
|
||||
check1 = true;
|
||||
check1 = true;
|
||||
}
|
||||
}
|
||||
/* Wrap-around to -1 (Auto) */
|
||||
else if (replay_slot + addition > 999)
|
||||
replay_slot = -2;
|
||||
replay_slot = -2;
|
||||
|
||||
if (check2)
|
||||
{
|
||||
|
@ -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
|
||||
|
@ -6961,16 +6953,16 @@ int runloop_iterate(void)
|
|||
|
||||
if (dpad_mode[i] == ANALOG_DPAD_LSTICK)
|
||||
{
|
||||
x_plus = RARCH_ANALOG_LEFT_X_PLUS;
|
||||
y_plus = RARCH_ANALOG_LEFT_Y_PLUS;
|
||||
x_minus = RARCH_ANALOG_LEFT_X_MINUS;
|
||||
y_minus = RARCH_ANALOG_LEFT_Y_MINUS;
|
||||
x_plus = RARCH_ANALOG_LEFT_X_PLUS;
|
||||
y_plus = RARCH_ANALOG_LEFT_Y_PLUS;
|
||||
x_minus = RARCH_ANALOG_LEFT_X_MINUS;
|
||||
y_minus = RARCH_ANALOG_LEFT_Y_MINUS;
|
||||
}
|
||||
|
||||
for (k = RETRO_DEVICE_ID_JOYPAD_UP; k <= RETRO_DEVICE_ID_JOYPAD_RIGHT; k++)
|
||||
{
|
||||
(auto_binds)[k].orig_joyaxis = (auto_binds)[k].joyaxis;
|
||||
(general_binds)[k].orig_joyaxis = (general_binds)[k].joyaxis;
|
||||
(auto_binds)[k].orig_joyaxis = (auto_binds)[k].joyaxis;
|
||||
(general_binds)[k].orig_joyaxis = (general_binds)[k].joyaxis;
|
||||
}
|
||||
|
||||
if (!INHERIT_JOYAXIS(auto_binds))
|
||||
|
@ -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 */
|
||||
|
@ -7045,17 +7037,17 @@ int runloop_iterate(void)
|
|||
/* Reset new desired delay target */
|
||||
if (video_st->frame_delay_target != video_frame_delay)
|
||||
{
|
||||
frame_time_update = false;
|
||||
video_st->frame_delay_target = video_frame_delay_effective = video_frame_delay;
|
||||
frame_time_update = false;
|
||||
video_st->frame_delay_target = video_frame_delay_effective = video_frame_delay;
|
||||
RARCH_LOG("[Video]: Frame delay reset to %d ms.\n", video_frame_delay);
|
||||
}
|
||||
|
||||
/* Decide what should happen to effective delay */
|
||||
if (video_frame_delay_effective > 0 && frame_time_update)
|
||||
{
|
||||
video_frame_delay_auto_t vfda = {0};
|
||||
vfda.frame_time_interval = frame_time_interval;
|
||||
vfda.refresh_rate = refresh_rate;
|
||||
video_frame_delay_auto_t vfda = {0};
|
||||
vfda.frame_time_interval = frame_time_interval;
|
||||
vfda.refresh_rate = refresh_rate;
|
||||
|
||||
video_frame_delay_auto(video_st, &vfda);
|
||||
if (vfda.delay_decrease > 0)
|
||||
|
@ -7204,8 +7196,8 @@ end:
|
|||
/* if there's a fast forward limit, inject sleeps to keep from going too fast. */
|
||||
if (runloop_st->frame_limit_minimum_time)
|
||||
{
|
||||
const retro_time_t end_frame_time = cpu_features_get_time_usec();
|
||||
const retro_time_t to_sleep_ms = (
|
||||
const retro_time_t end_frame_time = cpu_features_get_time_usec();
|
||||
const retro_time_t to_sleep_ms = (
|
||||
( runloop_st->frame_limit_last_time
|
||||
+ runloop_st->frame_limit_minimum_time)
|
||||
- end_frame_time) / 1000;
|
||||
|
|
Loading…
Reference in New Issue