mirror of
https://github.com/libretro/RetroArch
synced 2025-02-21 09:39:56 +00:00
Create rarch_main_ctl
This commit is contained in:
parent
905ad40ebf
commit
cc4a918296
@ -594,6 +594,7 @@ void audio_driver_set_nonblocking_state(bool enable)
|
|||||||
**/
|
**/
|
||||||
bool audio_driver_flush(const int16_t *data, size_t samples)
|
bool audio_driver_flush(const int16_t *data, size_t samples)
|
||||||
{
|
{
|
||||||
|
bool is_slowmotion;
|
||||||
static struct retro_perf_counter audio_convert_s16 = {0};
|
static struct retro_perf_counter audio_convert_s16 = {0};
|
||||||
static struct retro_perf_counter audio_convert_float = {0};
|
static struct retro_perf_counter audio_convert_float = {0};
|
||||||
static struct retro_perf_counter audio_dsp = {0};
|
static struct retro_perf_counter audio_dsp = {0};
|
||||||
@ -655,7 +656,10 @@ bool audio_driver_flush(const int16_t *data, size_t samples)
|
|||||||
audio_driver_readjust_input_rate();
|
audio_driver_readjust_input_rate();
|
||||||
|
|
||||||
src_data.ratio = audio_data.src_ratio;
|
src_data.ratio = audio_data.src_ratio;
|
||||||
if (rarch_main_is_slowmotion())
|
|
||||||
|
rarch_main_ctl(RARCH_MAIN_CTL_IS_SLOWMOTION, &is_slowmotion);
|
||||||
|
|
||||||
|
if (is_slowmotion)
|
||||||
src_data.ratio *= settings->slowmotion_ratio;
|
src_data.ratio *= settings->slowmotion_ratio;
|
||||||
|
|
||||||
rarch_perf_init(&resampler_proc, "resampler_proc");
|
rarch_perf_init(&resampler_proc, "resampler_proc");
|
||||||
|
@ -1632,6 +1632,7 @@ static bool gl_frame(void *data, const void *frame,
|
|||||||
uint64_t frame_count,
|
uint64_t frame_count,
|
||||||
unsigned pitch, const char *msg)
|
unsigned pitch, const char *msg)
|
||||||
{
|
{
|
||||||
|
bool is_slowmotion;
|
||||||
unsigned width, height;
|
unsigned width, height;
|
||||||
struct gfx_tex_info feedback_info;
|
struct gfx_tex_info feedback_info;
|
||||||
static struct retro_perf_counter frame_run = {0};
|
static struct retro_perf_counter frame_run = {0};
|
||||||
@ -1838,10 +1839,12 @@ static bool gl_frame(void *data, const void *frame,
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
rarch_main_ctl(RARCH_MAIN_CTL_IS_SLOWMOTION, &is_slowmotion);
|
||||||
|
|
||||||
/* Disable BFI during fast forward, slow-motion,
|
/* Disable BFI during fast forward, slow-motion,
|
||||||
* and pause to prevent flicker. */
|
* and pause to prevent flicker. */
|
||||||
if (settings->video.black_frame_insertion &&
|
if (settings->video.black_frame_insertion &&
|
||||||
!driver->nonblock_state && (!(rarch_main_is_slowmotion()))
|
!driver->nonblock_state && !is_slowmotion
|
||||||
&& !rarch_main_is_paused())
|
&& !rarch_main_is_paused())
|
||||||
{
|
{
|
||||||
gfx_ctx_swap_buffers(gl);
|
gfx_ctx_swap_buffers(gl);
|
||||||
|
@ -829,10 +829,13 @@ void video_driver_get_video_output_prev(void)
|
|||||||
**/
|
**/
|
||||||
void video_driver_cached_frame(void)
|
void video_driver_cached_frame(void)
|
||||||
{
|
{
|
||||||
|
bool is_idle;
|
||||||
driver_t *driver = driver_get_ptr();
|
driver_t *driver = driver_get_ptr();
|
||||||
void *recording = driver ? driver->recording_data : NULL;
|
void *recording = driver ? driver->recording_data : NULL;
|
||||||
|
|
||||||
if (rarch_main_is_idle())
|
rarch_main_ctl(RARCH_MAIN_CTL_IS_IDLE, &is_idle);
|
||||||
|
|
||||||
|
if (is_idle)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* Cannot allow recording when pushing duped frames. */
|
/* Cannot allow recording when pushing duped frames. */
|
||||||
|
@ -432,10 +432,13 @@ static void rgui_render(void)
|
|||||||
|
|
||||||
if (!rgui->force_redraw)
|
if (!rgui->force_redraw)
|
||||||
{
|
{
|
||||||
|
bool is_idle;
|
||||||
if (menu_entries_needs_refresh() && menu_driver_alive() && !disp->msg_force)
|
if (menu_entries_needs_refresh() && menu_driver_alive() && !disp->msg_force)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (rarch_main_is_idle())
|
rarch_main_ctl(RARCH_MAIN_CTL_IS_IDLE, &is_idle);
|
||||||
|
|
||||||
|
if (is_idle)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!menu_display_ctl(MENU_DISPLAY_CTL_UPDATE_PENDING, NULL))
|
if (!menu_display_ctl(MENU_DISPLAY_CTL_UPDATE_PENDING, NULL))
|
||||||
|
@ -542,6 +542,7 @@ end:
|
|||||||
|
|
||||||
int menu_iterate_render(void)
|
int menu_iterate_render(void)
|
||||||
{
|
{
|
||||||
|
bool is_idle;
|
||||||
const menu_ctx_driver_t *driver = menu_ctx_driver_get_ptr();
|
const menu_ctx_driver_t *driver = menu_ctx_driver_get_ptr();
|
||||||
menu_handle_t *menu = menu_driver_get_ptr();
|
menu_handle_t *menu = menu_driver_get_ptr();
|
||||||
|
|
||||||
@ -573,7 +574,9 @@ int menu_iterate_render(void)
|
|||||||
driver->render();
|
driver->render();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (menu_driver_alive() && !rarch_main_is_idle())
|
rarch_main_ctl(RARCH_MAIN_CTL_IS_IDLE, &is_idle);
|
||||||
|
|
||||||
|
if (menu_driver_alive() && !is_idle)
|
||||||
menu_display_ctl(MENU_DISPLAY_CTL_LIBRETRO, NULL);
|
menu_display_ctl(MENU_DISPLAY_CTL_LIBRETRO, NULL);
|
||||||
|
|
||||||
menu_driver_set_texture();
|
menu_driver_set_texture();
|
||||||
|
27
runloop.c
27
runloop.c
@ -901,14 +901,29 @@ bool rarch_main_is_paused(void)
|
|||||||
return main_is_paused;
|
return main_is_paused;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool rarch_main_is_idle(void)
|
bool rarch_main_ctl(enum rarch_main_ctl_state state, void *data)
|
||||||
{
|
{
|
||||||
return main_is_idle;
|
switch (state)
|
||||||
}
|
{
|
||||||
|
case RARCH_MAIN_CTL_IS_IDLE:
|
||||||
|
{
|
||||||
|
bool *ptr = (bool*)data;
|
||||||
|
if (!ptr)
|
||||||
|
return false;
|
||||||
|
*ptr = main_is_idle;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
case RARCH_MAIN_CTL_IS_SLOWMOTION:
|
||||||
|
{
|
||||||
|
bool *ptr = (bool*)data;
|
||||||
|
if (!ptr)
|
||||||
|
return false;
|
||||||
|
*ptr = main_is_slowmotion;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool rarch_main_is_slowmotion(void)
|
return false;
|
||||||
{
|
|
||||||
return main_is_slowmotion;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool rarch_main_cmd_get_state_menu_toggle_button_combo(
|
static bool rarch_main_cmd_get_state_menu_toggle_button_combo(
|
||||||
|
10
runloop.h
10
runloop.h
@ -33,6 +33,12 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
enum rarch_main_ctl_state
|
||||||
|
{
|
||||||
|
RARCH_MAIN_CTL_IS_IDLE = 0,
|
||||||
|
RARCH_MAIN_CTL_IS_SLOWMOTION
|
||||||
|
};
|
||||||
|
|
||||||
typedef struct rarch_resolution
|
typedef struct rarch_resolution
|
||||||
{
|
{
|
||||||
unsigned idx;
|
unsigned idx;
|
||||||
@ -327,9 +333,7 @@ bool rarch_main_verbosity(void);
|
|||||||
|
|
||||||
FILE *rarch_main_log_file(void);
|
FILE *rarch_main_log_file(void);
|
||||||
|
|
||||||
bool rarch_main_is_idle(void);
|
bool rarch_main_ctl(enum rarch_main_ctl_state state, void *data);
|
||||||
|
|
||||||
bool rarch_main_is_slowmotion(void);
|
|
||||||
|
|
||||||
bool rarch_main_is_paused(void);
|
bool rarch_main_is_paused(void);
|
||||||
|
|
||||||
|
@ -60,6 +60,7 @@ static void rarch_disable_ui(void)
|
|||||||
static void rarch_draw_observer(CFRunLoopObserverRef observer,
|
static void rarch_draw_observer(CFRunLoopObserverRef observer,
|
||||||
CFRunLoopActivity activity, void *info)
|
CFRunLoopActivity activity, void *info)
|
||||||
{
|
{
|
||||||
|
bool is_idle;
|
||||||
unsigned sleep_ms = 0;
|
unsigned sleep_ms = 0;
|
||||||
int ret = rarch_main_iterate(&sleep_ms);
|
int ret = rarch_main_iterate(&sleep_ms);
|
||||||
|
|
||||||
@ -74,7 +75,9 @@ static void rarch_draw_observer(CFRunLoopObserverRef observer,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rarch_main_is_idle())
|
rarch_main_ctl(RARCH_MAIN_CTL_IS_IDLE, &is_idle);
|
||||||
|
|
||||||
|
if (is_idle)
|
||||||
return;
|
return;
|
||||||
CFRunLoopWakeUp(CFRunLoopGetMain());
|
CFRunLoopWakeUp(CFRunLoopGetMain());
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user