Create CORE_CTL_RETRO_SET_INPUT_STATE

This commit is contained in:
twinaphex 2016-01-28 04:39:38 +01:00
parent 277f08022d
commit 92a1de2e77
2 changed files with 12 additions and 1 deletions

View File

@ -84,6 +84,8 @@ enum core_ctl_state
CORE_CTL_RETRO_CHEAT_RESET,
CORE_CTL_RETRO_SET_INPUT_STATE,
CORE_CTL_RETRO_API_VERSION,
/* Compare libretro core API version against API version
@ -108,6 +110,11 @@ enum core_ctl_state
CORE_CTL_RETRO_SET_CONTROLLER_PORT_DEVICE
};
typedef struct retro_ctx_input_state_info
{
retro_input_state_t cb;
} retro_ctx_input_state_info_t;
typedef struct retro_ctx_cheat_info
{
unsigned index;

View File

@ -1036,6 +1036,7 @@ static int16_t netplay_get_spectate_input(netplay_t *netplay, bool port,
unsigned device, unsigned idx, unsigned id)
{
int16_t inp;
retro_ctx_input_state_info_t input_info;
if (socket_receive_all_blocking(netplay->fd, (char*)&inp, sizeof(inp)))
return swap_if_big16(inp);
@ -1043,7 +1044,10 @@ static int16_t netplay_get_spectate_input(netplay_t *netplay, bool port,
RARCH_ERR("Connection with host was cut.\n");
runloop_msg_queue_push("Connection with host was cut.", 1, 180, true);
core.retro_set_input_state(netplay->cbs.state_cb);
input_info.cb = netplay->cbs.state_cb;
core_ctl(CORE_CTL_RETRO_SET_INPUT_STATE, &input_info);
return netplay->cbs.state_cb(port, device, idx, id);
}