fix netplay paused spam

This commit is contained in:
radius 2019-05-26 15:17:31 -05:00 committed by twinaphex
parent 7a8d87f24a
commit 370b9681b8
2 changed files with 16 additions and 4 deletions

View File

@ -912,6 +912,7 @@ static bool netplay_get_cmd(netplay_t *netplay,
uint32_t cmd;
uint32_t cmd_size;
ssize_t recvd;
static bool previous_frame_paused = false;
/* We don't handle the initial handshake here */
if (connection->mode < NETPLAY_CONNECTION_CONNECTED)
@ -1787,12 +1788,19 @@ static bool netplay_get_cmd(netplay_t *netplay,
{
snprintf(msg, sizeof(msg)-1, msg_hash_to_str(MSG_NETPLAY_PEER_PAUSED), nick);
}
RARCH_LOG("[netplay] %s\n", msg);
runloop_msg_queue_push(msg, 1, 180, false, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
if (!previous_frame_paused)
{
RARCH_LOG("[netplay] %s\n", msg);
runloop_msg_queue_push(msg, 1, 180, false, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
}
previous_frame_paused = true;
break;
}
case NETPLAY_CMD_RESUME:
RARCH_LOG("[netplay] resumed\n");
previous_frame_paused = false;
remote_unpaused(netplay, connection);
break;

View File

@ -4520,10 +4520,14 @@ int runloop_iterate(unsigned *sleep_ms)
*sleep_ms = 10;
return 1;
case RUNLOOP_STATE_END:
runloop_netplay_pause();
if (netplay_driver_ctl(RARCH_NETPLAY_CTL_IS_ENABLED, NULL)
&& settings->bools.menu_pause_libretro)
{
runloop_netplay_pause();
}
goto end;
case RUNLOOP_STATE_MENU_ITERATE:
runloop_netplay_pause();
runloop_netplay_pause();
return 0;
case RUNLOOP_STATE_ITERATE:
break;