mirror of
https://github.com/libretro/RetroArch.git
synced 2025-02-13 05:10:42 +00:00
Create core_ctl commands CORE_CTL_INIT / CORE_CTL_DEINIT
This commit is contained in:
parent
348b14f64f
commit
1a9479ed04
@ -600,7 +600,7 @@ static bool event_init_core(void)
|
||||
return false;
|
||||
|
||||
core.poll_type = settings->input.poll_type_behavior;
|
||||
retro_init_libretro_cbs(&retro_ctx);
|
||||
core_ctl(CORE_CTL_INIT, &retro_ctx);
|
||||
rarch_ctl(RARCH_CTL_INIT_SYSTEM_AV_INFO, NULL);
|
||||
|
||||
return true;
|
||||
|
2
driver.c
2
driver.c
@ -428,7 +428,7 @@ bool driver_ctl(enum driver_ctl_state state, void *data)
|
||||
#endif
|
||||
location_driver_ctl(RARCH_LOCATION_CTL_DESTROY, NULL);
|
||||
camera_driver_ctl(RARCH_CAMERA_CTL_DESTROY, NULL);
|
||||
retro_uninit_libretro_cbs();
|
||||
core_ctl(CORE_CTL_DEINIT, NULL);
|
||||
break;
|
||||
case RARCH_DRIVER_CTL_UNINIT:
|
||||
{
|
||||
|
@ -72,15 +72,20 @@ void retro_set_default_callbacks(void *data)
|
||||
cbs->poll_cb = input_poll;
|
||||
}
|
||||
|
||||
void retro_uninit_libretro_cbs(void)
|
||||
static bool retro_uninit_libretro_cbs(void)
|
||||
{
|
||||
struct retro_callbacks *cbs = (struct retro_callbacks*)&retro_ctx;
|
||||
|
||||
if (!cbs)
|
||||
return false;
|
||||
|
||||
cbs->frame_cb = NULL;
|
||||
cbs->sample_cb = NULL;
|
||||
cbs->sample_batch_cb = NULL;
|
||||
cbs->state_cb = NULL;
|
||||
cbs->poll_cb = NULL;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@ -111,7 +116,7 @@ static void input_poll_maybe(void)
|
||||
* Initializes libretro callbacks, and binds the libretro callbacks
|
||||
* to default callback functions.
|
||||
**/
|
||||
void retro_init_libretro_cbs(void *data)
|
||||
static bool retro_init_libretro_cbs(void *data)
|
||||
{
|
||||
struct retro_callbacks *cbs = (struct retro_callbacks*)data;
|
||||
#ifdef HAVE_NETPLAY
|
||||
@ -119,7 +124,7 @@ void retro_init_libretro_cbs(void *data)
|
||||
#endif
|
||||
|
||||
if (!cbs)
|
||||
return;
|
||||
return false;
|
||||
|
||||
core.retro_set_video_refresh(video_driver_frame);
|
||||
core.retro_set_audio_sample(audio_driver_sample);
|
||||
@ -131,7 +136,7 @@ void retro_init_libretro_cbs(void *data)
|
||||
|
||||
#ifdef HAVE_NETPLAY
|
||||
if (!netplay_driver_ctl(RARCH_NETPLAY_CTL_IS_DATA_INITED, NULL))
|
||||
return;
|
||||
return true;
|
||||
|
||||
/* Force normal poll type for netplay. */
|
||||
core.poll_type = POLL_TYPE_NORMAL;
|
||||
@ -151,6 +156,8 @@ void retro_init_libretro_cbs(void *data)
|
||||
core.retro_set_input_state(input_state_net);
|
||||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -177,6 +184,10 @@ bool core_ctl(enum core_ctl_state state, void *data)
|
||||
{
|
||||
switch (state)
|
||||
{
|
||||
case CORE_CTL_INIT:
|
||||
return retro_init_libretro_cbs(data);
|
||||
case CORE_CTL_DEINIT:
|
||||
return retro_uninit_libretro_cbs();
|
||||
case CORE_CTL_NONE:
|
||||
default:
|
||||
break;
|
||||
|
@ -39,7 +39,11 @@ enum
|
||||
|
||||
enum core_ctl_state
|
||||
{
|
||||
CORE_CTL_NONE = 0
|
||||
CORE_CTL_NONE = 0,
|
||||
|
||||
CORE_CTL_INIT,
|
||||
|
||||
CORE_CTL_DEINIT
|
||||
};
|
||||
|
||||
typedef struct retro_callbacks
|
||||
@ -53,15 +57,6 @@ typedef struct retro_callbacks
|
||||
|
||||
extern retro_callbacks_t retro_ctx;
|
||||
|
||||
/**
|
||||
* retro_init_libretro_cbs:
|
||||
* @data : pointer to retro_callbacks object
|
||||
*
|
||||
* Initializes libretro callbacks, and binds the libretro callbacks
|
||||
* to default callback functions.
|
||||
**/
|
||||
void retro_init_libretro_cbs(void *data);
|
||||
|
||||
/**
|
||||
* retro_set_default_callbacks:
|
||||
* @data : pointer to retro_callbacks object
|
||||
@ -81,8 +76,6 @@ void retro_set_rewind_callbacks(void);
|
||||
/* Runs the core for one frame. Use instead of core.retro_run(). */
|
||||
void retro_run_core(void);
|
||||
|
||||
void retro_uninit_libretro_cbs(void);
|
||||
|
||||
bool core_ctl(enum core_ctl_state state, void *data);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
Loading…
x
Reference in New Issue
Block a user