Create CORE_CTL_RUN

This commit is contained in:
twinaphex 2016-01-27 03:21:36 +01:00
parent 4843e76491
commit d1ffd1f9cc
5 changed files with 19 additions and 23 deletions

View File

@ -90,21 +90,6 @@ static bool retro_uninit_libretro_cbs(void)
return true; return true;
} }
void retro_run_core(void)
{
switch (core.poll_type)
{
case POLL_TYPE_EARLY:
input_poll();
break;
case POLL_TYPE_LATE:
input_polled = false;
break;
}
core.retro_run();
}
static void input_poll_maybe(void) static void input_poll_maybe(void)
{ {
if (core.poll_type == POLL_TYPE_NORMAL) if (core.poll_type == POLL_TYPE_NORMAL)
@ -186,6 +171,18 @@ bool core_ctl(enum core_ctl_state state, void *data)
{ {
switch (state) switch (state)
{ {
case CORE_CTL_RUN:
switch (core.poll_type)
{
case POLL_TYPE_EARLY:
input_poll();
break;
case POLL_TYPE_LATE:
input_polled = false;
break;
}
core.retro_run();
break;
case CORE_CTL_SET_CBS: case CORE_CTL_SET_CBS:
return retro_set_default_callbacks(data); return retro_set_default_callbacks(data);
case CORE_CTL_SET_CBS_REWIND: case CORE_CTL_SET_CBS_REWIND:

View File

@ -47,7 +47,10 @@ enum core_ctl_state
CORE_CTL_SET_CBS, CORE_CTL_SET_CBS,
CORE_CTL_SET_CBS_REWIND CORE_CTL_SET_CBS_REWIND,
/* Runs the core for one frame. */
CORE_CTL_RUN
}; };
typedef struct retro_callbacks typedef struct retro_callbacks
@ -61,9 +64,6 @@ typedef struct retro_callbacks
extern retro_callbacks_t retro_ctx; extern retro_callbacks_t retro_ctx;
/* Runs the core for one frame. Use instead of core.retro_run(). */
void retro_run_core(void);
bool core_ctl(enum core_ctl_state state, void *data); bool core_ctl(enum core_ctl_state state, void *data);
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -321,7 +321,7 @@ bool menu_display_ctl(enum menu_display_ctl_state state, void *data)
if (!libretro_input_is_blocked) if (!libretro_input_is_blocked)
input_driver_ctl(RARCH_INPUT_CTL_SET_LIBRETRO_INPUT_BLOCKED, NULL); input_driver_ctl(RARCH_INPUT_CTL_SET_LIBRETRO_INPUT_BLOCKED, NULL);
retro_run_core(); core_ctl(CORE_CTL_RUN, NULL);
input_driver_ctl(RARCH_INPUT_CTL_UNSET_LIBRETRO_INPUT_BLOCKED, NULL); input_driver_ctl(RARCH_INPUT_CTL_UNSET_LIBRETRO_INPUT_BLOCKED, NULL);
return true; return true;

View File

@ -77,7 +77,7 @@ static void netplay_net_post_frame(netplay_t *netplay)
#if defined(HAVE_THREADS) && !defined(RARCH_CONSOLE) #if defined(HAVE_THREADS) && !defined(RARCH_CONSOLE)
lock_autosave(); lock_autosave();
#endif #endif
retro_run_core(); core_ctl(CORE_CTL_RUN, NULL);
#if defined(HAVE_THREADS) && !defined(RARCH_CONSOLE) #if defined(HAVE_THREADS) && !defined(RARCH_CONSOLE)
unlock_autosave(); unlock_autosave();
#endif #endif

View File

@ -1423,8 +1423,7 @@ int runloop_iterate(unsigned *sleep_ms)
!input_driver_ctl(RARCH_INPUT_CTL_IS_NONBLOCK_STATE, NULL)) !input_driver_ctl(RARCH_INPUT_CTL_IS_NONBLOCK_STATE, NULL))
retro_sleep(settings->video.frame_delay); retro_sleep(settings->video.frame_delay);
/* Run libretro for one frame. */ core_ctl(CORE_CTL_RUN, NULL);
retro_run_core();
#ifdef HAVE_CHEEVOS #ifdef HAVE_CHEEVOS
/* Test the achievements. */ /* Test the achievements. */