From 92a1de2e77bdc493cf0d9e8bc69d7174ce72c105 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 28 Jan 2016 04:39:38 +0100 Subject: [PATCH] Create CORE_CTL_RETRO_SET_INPUT_STATE --- libretro_version_1.h | 7 +++++++ netplay/netplay.c | 6 +++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/libretro_version_1.h b/libretro_version_1.h index dd164cb0e7..8ac55e3236 100644 --- a/libretro_version_1.h +++ b/libretro_version_1.h @@ -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; diff --git a/netplay/netplay.c b/netplay/netplay.c index 98a02c7982..f334529931 100644 --- a/netplay/netplay.c +++ b/netplay/netplay.c @@ -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); }