Add CORE_CTL_SET_CBS

This commit is contained in:
twinaphex 2016-01-27 03:17:05 +01:00
parent 1a9479ed04
commit ca00274204
3 changed files with 11 additions and 13 deletions

View File

@ -58,18 +58,20 @@ static int16_t input_state_poll(unsigned port,
*
* Binds the libretro callbacks to default callback functions.
**/
void retro_set_default_callbacks(void *data)
static bool retro_set_default_callbacks(void *data)
{
struct retro_callbacks *cbs = (struct retro_callbacks*)data;
if (!cbs)
return;
return false;
cbs->frame_cb = video_driver_frame;
cbs->sample_cb = audio_driver_sample;
cbs->sample_batch_cb = audio_driver_sample_batch;
cbs->state_cb = input_state_poll;
cbs->poll_cb = input_poll;
return true;
}
static bool retro_uninit_libretro_cbs(void)
@ -132,7 +134,7 @@ static bool retro_init_libretro_cbs(void *data)
core.retro_set_input_state(input_state_poll);
core.retro_set_input_poll(input_poll_maybe);
retro_set_default_callbacks(cbs);
core_ctl(CORE_CTL_SET_CBS, cbs);
#ifdef HAVE_NETPLAY
if (!netplay_driver_ctl(RARCH_NETPLAY_CTL_IS_DATA_INITED, NULL))
@ -184,6 +186,8 @@ bool core_ctl(enum core_ctl_state state, void *data)
{
switch (state)
{
case CORE_CTL_SET_CBS:
return retro_set_default_callbacks(data);
case CORE_CTL_INIT:
return retro_init_libretro_cbs(data);
case CORE_CTL_DEINIT:

View File

@ -43,7 +43,9 @@ enum core_ctl_state
CORE_CTL_INIT,
CORE_CTL_DEINIT
CORE_CTL_DEINIT,
CORE_CTL_SET_CBS
};
typedef struct retro_callbacks
@ -57,14 +59,6 @@ typedef struct retro_callbacks
extern retro_callbacks_t retro_ctx;
/**
* retro_set_default_callbacks:
* @data : pointer to retro_callbacks object
*
* Binds the libretro callbacks to default callback functions.
**/
void retro_set_default_callbacks(void *data);
/**
* retro_set_rewind_callbacks:
*

View File

@ -1114,7 +1114,7 @@ bool init_netplay(void)
return false;
}
retro_set_default_callbacks(&cbs);
core_ctl(CORE_CTL_SET_CBS, &cbs);
if (*global->netplay.server)
{