Create CORE_CTL_RETRO_SET_CONTROLLER_PORT_DEVICE

This commit is contained in:
twinaphex 2016-01-27 19:13:15 +01:00
parent 87176df22a
commit f6fcb95dea
3 changed files with 25 additions and 9 deletions

View File

@ -330,6 +330,7 @@ static void event_init_controllers(void)
for (i = 0; i < MAX_USERS; i++)
{
retro_ctx_controller_info_t pad;
const char *ident = NULL;
bool set_controller = false;
const struct retro_controller_description *desc = NULL;
@ -379,16 +380,14 @@ static void event_init_controllers(void)
}
if (set_controller)
core.retro_set_controller_port_device(i, device);
{
pad.device = device;
pad.i = i + 1;
core_ctl(CORE_CTL_RETRO_SET_CONTROLLER_PORT_DEVICE, &pad);
}
}
}
static void event_deinit_core_interfaces(void)
{
video_driver_callback_destroy_context();
video_driver_unset_callback();
}
static void event_deinit_core(bool reinit)
{
#ifdef HAVE_CHEEVOS
@ -396,7 +395,8 @@ static void event_deinit_core(bool reinit)
cheevos_unload();
#endif
event_deinit_core_interfaces();
video_driver_callback_destroy_context();
video_driver_unset_callback();
core_ctl(CORE_CTL_RETRO_UNLOAD_GAME, NULL);
core_ctl(CORE_CTL_RETRO_DEINIT, NULL);

View File

@ -174,6 +174,14 @@ bool core_ctl(enum core_ctl_state state, void *data)
switch (state)
{
case CORE_CTL_RETRO_SET_CONTROLLER_PORT_DEVICE:
{
retro_ctx_controller_info_t *pad = (retro_ctx_controller_info_t*)data;
if (!pad)
return false;
core.retro_set_controller_port_device(pad->i, pad->device);
}
break;
case CORE_CTL_RETRO_GET_MEMORY:
{
retro_ctx_memory_info_t *info = (retro_ctx_memory_info_t*)data;

View File

@ -92,9 +92,17 @@ enum core_ctl_state
CORE_CTL_RETRO_GET_SYSTEM_INFO,
CORE_CTL_RETRO_LOAD_GAME
CORE_CTL_RETRO_LOAD_GAME,
CORE_CTL_RETRO_SET_CONTROLLER_PORT_DEVICE
};
typedef struct retro_ctx_controller_info
{
unsigned i;
unsigned device;
} retro_ctx_controller_info_t;
typedef struct retro_ctx_memory_info
{
void *data;