mirror of
https://github.com/libretro/RetroArch
synced 2025-04-10 15:45:19 +00:00
use callbacks
This commit is contained in:
parent
eb9be6409f
commit
1cc5bfbc12
@ -385,7 +385,7 @@ static void event_init_controllers(void)
|
|||||||
if (set_controller)
|
if (set_controller)
|
||||||
{
|
{
|
||||||
pad.device = device;
|
pad.device = device;
|
||||||
pad.i = i + 1;
|
pad.port = i + 1;
|
||||||
core_ctl(CORE_CTL_RETRO_SET_CONTROLLER_PORT_DEVICE, &pad);
|
core_ctl(CORE_CTL_RETRO_SET_CONTROLLER_PORT_DEVICE, &pad);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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;
|
retro_ctx_controller_info_t *pad = (retro_ctx_controller_info_t*)data;
|
||||||
if (!pad)
|
if (!pad)
|
||||||
return false;
|
return false;
|
||||||
core.retro_set_controller_port_device(pad->i, pad->device);
|
core.retro_set_controller_port_device(pad->port, pad->device);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case CORE_CTL_RETRO_GET_MEMORY:
|
case CORE_CTL_RETRO_GET_MEMORY:
|
||||||
|
@ -101,7 +101,7 @@ enum core_ctl_state
|
|||||||
|
|
||||||
typedef struct retro_ctx_controller_info
|
typedef struct retro_ctx_controller_info
|
||||||
{
|
{
|
||||||
unsigned i;
|
unsigned port;
|
||||||
unsigned device;
|
unsigned device;
|
||||||
} retro_ctx_controller_info_t;
|
} retro_ctx_controller_info_t;
|
||||||
|
|
||||||
|
@ -2183,6 +2183,7 @@ static int setting_action_start_analog_dpad_mode(void *data)
|
|||||||
|
|
||||||
static int setting_action_start_libretro_device_type(void *data)
|
static int setting_action_start_libretro_device_type(void *data)
|
||||||
{
|
{
|
||||||
|
retro_ctx_controller_info_t pad;
|
||||||
unsigned index_offset, current_device;
|
unsigned index_offset, current_device;
|
||||||
unsigned devices[128], types = 0, port = 0;
|
unsigned devices[128], types = 0, port = 0;
|
||||||
const struct retro_controller_info *desc = NULL;
|
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;
|
current_device = RETRO_DEVICE_JOYPAD;
|
||||||
|
|
||||||
settings->input.libretro_device[port] = current_device;
|
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;
|
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(
|
static int setting_action_left_libretro_device_type(
|
||||||
void *data, bool wraparound)
|
void *data, bool wraparound)
|
||||||
{
|
{
|
||||||
|
retro_ctx_controller_info_t pad;
|
||||||
unsigned current_device, current_idx, i, devices[128],
|
unsigned current_device, current_idx, i, devices[128],
|
||||||
types = 0, port = 0;
|
types = 0, port = 0;
|
||||||
const struct retro_controller_info *desc = NULL;
|
const struct retro_controller_info *desc = NULL;
|
||||||
@ -2382,7 +2387,11 @@ static int setting_action_left_libretro_device_type(
|
|||||||
[(current_idx + types - 1) % types];
|
[(current_idx + types - 1) % types];
|
||||||
|
|
||||||
settings->input.libretro_device[port] = current_device;
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -2390,6 +2399,7 @@ static int setting_action_left_libretro_device_type(
|
|||||||
static int setting_action_right_libretro_device_type(
|
static int setting_action_right_libretro_device_type(
|
||||||
void *data, bool wraparound)
|
void *data, bool wraparound)
|
||||||
{
|
{
|
||||||
|
retro_ctx_controller_info_t pad;
|
||||||
unsigned current_device, current_idx, i, devices[128],
|
unsigned current_device, current_idx, i, devices[128],
|
||||||
types = 0, port = 0;
|
types = 0, port = 0;
|
||||||
const struct retro_controller_info *desc = NULL;
|
const struct retro_controller_info *desc = NULL;
|
||||||
@ -2442,7 +2452,11 @@ static int setting_action_right_libretro_device_type(
|
|||||||
[(current_idx + 1) % types];
|
[(current_idx + 1) % types];
|
||||||
|
|
||||||
settings->input.libretro_device[port] = current_device;
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user