mirror of
https://github.com/libretro/RetroArch
synced 2025-03-29 04:20:28 +00:00
Refactor max_frames
This commit is contained in:
parent
f39ab89867
commit
adb28bb341
@ -838,7 +838,7 @@ static void parse_input(int argc, char *argv[])
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case RA_OPT_MAX_FRAMES:
|
case RA_OPT_MAX_FRAMES:
|
||||||
global->max_frames = strtoul(optarg, NULL, 10);
|
rarch_main_set_max_frames(strtoul(optarg, NULL, 10));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RA_OPT_SUBSYSTEM:
|
case RA_OPT_SUBSYSTEM:
|
||||||
|
11
runloop.c
11
runloop.c
@ -48,6 +48,8 @@ static bool main_is_idle;
|
|||||||
static bool main_is_paused;
|
static bool main_is_paused;
|
||||||
static bool main_is_slowmotion;
|
static bool main_is_slowmotion;
|
||||||
|
|
||||||
|
static unsigned main_max_frames;
|
||||||
|
|
||||||
static retro_time_t frame_limit_last_time;
|
static retro_time_t frame_limit_last_time;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -616,7 +618,7 @@ static INLINE int time_to_exit(driver_t *driver, global_t *global,
|
|||||||
bool video_alive = video && video->alive(driver->video_data);
|
bool video_alive = video && video->alive(driver->video_data);
|
||||||
bool movie_end = (global->bsv.movie_end && global->bsv.eof_exit);
|
bool movie_end = (global->bsv.movie_end && global->bsv.eof_exit);
|
||||||
uint64_t *frame_count = video_driver_get_frame_count();
|
uint64_t *frame_count = video_driver_get_frame_count();
|
||||||
bool frame_count_end = global->max_frames && (*frame_count >= global->max_frames);
|
bool frame_count_end = main_max_frames && (*frame_count >= main_max_frames);
|
||||||
|
|
||||||
if (shutdown_pressed || cmd->quit_key_pressed || frame_count_end || movie_end
|
if (shutdown_pressed || cmd->quit_key_pressed || frame_count_end || movie_end
|
||||||
|| !video_alive)
|
|| !video_alive)
|
||||||
@ -848,7 +850,7 @@ void rarch_main_state_free(void)
|
|||||||
main_is_paused = false;
|
main_is_paused = false;
|
||||||
main_is_slowmotion = false;
|
main_is_slowmotion = false;
|
||||||
frame_limit_last_time = 0.0;
|
frame_limit_last_time = 0.0;
|
||||||
g_extern.max_frames = 0;
|
main_max_frames = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void rarch_main_set_frame_limit_last_time(retro_time_t t)
|
void rarch_main_set_frame_limit_last_time(retro_time_t t)
|
||||||
@ -896,6 +898,11 @@ void rarch_main_set_slowmotion(unsigned enable)
|
|||||||
main_is_slowmotion = enable;
|
main_is_slowmotion = enable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void rarch_main_set_max_frames(unsigned val)
|
||||||
|
{
|
||||||
|
main_max_frames = val;
|
||||||
|
}
|
||||||
|
|
||||||
void rarch_main_set_pause(unsigned enable)
|
void rarch_main_set_pause(unsigned enable)
|
||||||
{
|
{
|
||||||
main_is_paused = enable;
|
main_is_paused = enable;
|
||||||
|
@ -43,8 +43,6 @@ typedef struct rarch_resolution
|
|||||||
|
|
||||||
typedef struct global
|
typedef struct global
|
||||||
{
|
{
|
||||||
unsigned max_frames;
|
|
||||||
|
|
||||||
bool verbosity;
|
bool verbosity;
|
||||||
bool perfcnt_enable;
|
bool perfcnt_enable;
|
||||||
bool force_fullscreen;
|
bool force_fullscreen;
|
||||||
@ -341,6 +339,8 @@ void rarch_main_set_pause(unsigned enable);
|
|||||||
|
|
||||||
void rarch_main_set_frame_limit_last_time(retro_time_t t);
|
void rarch_main_set_frame_limit_last_time(retro_time_t t);
|
||||||
|
|
||||||
|
void rarch_main_set_max_frames(unsigned val);
|
||||||
|
|
||||||
void rarch_main_set_idle(unsigned enable);
|
void rarch_main_set_idle(unsigned enable);
|
||||||
|
|
||||||
void rarch_main_state_free(void);
|
void rarch_main_state_free(void);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user