Rewrite netplay checks

This commit is contained in:
twinaphex 2017-05-21 14:18:10 +02:00
parent 759b963c2f
commit aeddb18e31
2 changed files with 17 additions and 9 deletions

View File

@ -1311,11 +1311,8 @@ bool netplay_driver_ctl(enum rarch_netplay_ctl_state state, void *data)
ret = netplay_pre_frame(netplay_data);
goto done;
case RARCH_NETPLAY_CTL_FLIP_PLAYERS:
{
bool *state = (bool*)data;
if (netplay_data->is_server && *state)
netplay_flip_users(netplay_data);
}
if (netplay_data->is_server)
netplay_flip_users(netplay_data);
break;
case RARCH_NETPLAY_CTL_GAME_WATCH:
netplay_toggle_play_spectate(netplay_data);

View File

@ -2502,12 +2502,23 @@ static enum runloop_state runloop_check_state(
command_event(CMD_EVENT_VOLUME_DOWN, NULL);
#ifdef HAVE_NETWORKING
/* Check Netplay */
{
bool tmp = runloop_cmd_triggered(trigger_input, RARCH_NETPLAY_FLIP);
netplay_driver_ctl(RARCH_NETPLAY_CTL_FLIP_PLAYERS, &tmp);
tmp = runloop_cmd_triggered(trigger_input, RARCH_NETPLAY_GAME_WATCH);
if (tmp)
static bool old_netplay_flip = false;
static bool old_netplay_watch = false;
bool netplay_flip = runloop_cmd_press(
current_input, RARCH_NETPLAY_FLIP);
bool netplay_watch = runloop_cmd_press(
current_input, RARCH_NETPLAY_GAME_WATCH);
if (netplay_flip && !old_netplay_flip)
netplay_driver_ctl(RARCH_NETPLAY_CTL_FLIP_PLAYERS, NULL);
if (netplay_watch && !old_netplay_watch)
netplay_driver_ctl(RARCH_NETPLAY_CTL_GAME_WATCH, NULL);
old_netplay_flip = netplay_flip;
old_netplay_watch = netplay_watch;
}
#endif