use callbacks

This commit is contained in:
twinaphex 2016-01-28 04:13:31 +01:00
parent eb9be6409f
commit 1cc5bfbc12
4 changed files with 20 additions and 6 deletions

View File

@ -385,7 +385,7 @@ static void event_init_controllers(void)
if (set_controller)
{
pad.device = device;
pad.i = i + 1;
pad.port = i + 1;
core_ctl(CORE_CTL_RETRO_SET_CONTROLLER_PORT_DEVICE, &pad);
}
}

View File

@ -188,7 +188,7 @@ bool core_ctl(enum core_ctl_state state, void *data)
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);
core.retro_set_controller_port_device(pad->port, pad->device);
}
break;
case CORE_CTL_RETRO_GET_MEMORY:

View File

@ -101,7 +101,7 @@ enum core_ctl_state
typedef struct retro_ctx_controller_info
{
unsigned i;
unsigned port;
unsigned device;
} retro_ctx_controller_info_t;

View File

@ -2183,6 +2183,7 @@ static int setting_action_start_analog_dpad_mode(void *data)
static int setting_action_start_libretro_device_type(void *data)
{
retro_ctx_controller_info_t pad;
unsigned index_offset, current_device;
unsigned devices[128], types = 0, port = 0;
const struct retro_controller_info *desc = NULL;
@ -2226,7 +2227,10 @@ static int setting_action_start_libretro_device_type(void *data)
current_device = RETRO_DEVICE_JOYPAD;
settings->input.libretro_device[port] = current_device;
core.retro_set_controller_port_device(port, current_device);
pad.port = port;
pad.device = current_device;
core_ctl(CORE_CTL_RETRO_SET_CONTROLLER_PORT_DEVICE, &pad);
return 0;
}
@ -2330,6 +2334,7 @@ static int setting_action_right_analog_dpad_mode(void *data, bool wraparound)
static int setting_action_left_libretro_device_type(
void *data, bool wraparound)
{
retro_ctx_controller_info_t pad;
unsigned current_device, current_idx, i, devices[128],
types = 0, port = 0;
const struct retro_controller_info *desc = NULL;
@ -2382,7 +2387,11 @@ static int setting_action_left_libretro_device_type(
[(current_idx + types - 1) % types];
settings->input.libretro_device[port] = current_device;
core.retro_set_controller_port_device(port, current_device);
pad.port = port;
pad.device = current_device;
core_ctl(CORE_CTL_RETRO_SET_CONTROLLER_PORT_DEVICE, &pad);
return 0;
}
@ -2390,6 +2399,7 @@ static int setting_action_left_libretro_device_type(
static int setting_action_right_libretro_device_type(
void *data, bool wraparound)
{
retro_ctx_controller_info_t pad;
unsigned current_device, current_idx, i, devices[128],
types = 0, port = 0;
const struct retro_controller_info *desc = NULL;
@ -2442,7 +2452,11 @@ static int setting_action_right_libretro_device_type(
[(current_idx + 1) % types];
settings->input.libretro_device[port] = current_device;
core.retro_set_controller_port_device(port, current_device);
pad.port = port;
pad.device = current_device;
core_ctl(CORE_CTL_RETRO_SET_CONTROLLER_PORT_DEVICE, &pad);
return 0;
}