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); ret = netplay_pre_frame(netplay_data);
goto done; goto done;
case RARCH_NETPLAY_CTL_FLIP_PLAYERS: case RARCH_NETPLAY_CTL_FLIP_PLAYERS:
{ if (netplay_data->is_server)
bool *state = (bool*)data; netplay_flip_users(netplay_data);
if (netplay_data->is_server && *state)
netplay_flip_users(netplay_data);
}
break; break;
case RARCH_NETPLAY_CTL_GAME_WATCH: case RARCH_NETPLAY_CTL_GAME_WATCH:
netplay_toggle_play_spectate(netplay_data); 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); command_event(CMD_EVENT_VOLUME_DOWN, NULL);
#ifdef HAVE_NETWORKING #ifdef HAVE_NETWORKING
/* Check Netplay */
{ {
bool tmp = runloop_cmd_triggered(trigger_input, RARCH_NETPLAY_FLIP); static bool old_netplay_flip = false;
netplay_driver_ctl(RARCH_NETPLAY_CTL_FLIP_PLAYERS, &tmp); static bool old_netplay_watch = false;
tmp = runloop_cmd_triggered(trigger_input, RARCH_NETPLAY_GAME_WATCH); bool netplay_flip = runloop_cmd_press(
if (tmp) 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); netplay_driver_ctl(RARCH_NETPLAY_CTL_GAME_WATCH, NULL);
old_netplay_flip = netplay_flip;
old_netplay_watch = netplay_watch;
} }
#endif #endif