NetPlay: Implement golf mode

This is an extension of host input authority that allows switching the
host (who has zero latency) on the fly, at the further expense of
everyone else's latency. This is useful for turn-based games where the
latency of players not on their turn doesn't matter.

To become the so-called golfer, the player simply presses a hotkey.
When the host is the golfer, latency is identical to normal host input
authority.
This commit is contained in:
Techjar
2019-04-02 08:08:27 -04:00
parent e2f1da5210
commit 1a12876330
15 changed files with 263 additions and 28 deletions

View File

@ -494,6 +494,8 @@ void MainWindow::ConnectHotkeys()
connect(m_hotkey_scheduler, &HotkeyScheduler::ExitHotkey, this, &MainWindow::close);
connect(m_hotkey_scheduler, &HotkeyScheduler::TogglePauseHotkey, this, &MainWindow::TogglePause);
connect(m_hotkey_scheduler, &HotkeyScheduler::ActivateChat, this, &MainWindow::OnActivateChat);
connect(m_hotkey_scheduler, &HotkeyScheduler::RequestGolfControl, this,
&MainWindow::OnRequestGolfControl);
connect(m_hotkey_scheduler, &HotkeyScheduler::RefreshGameListHotkey, this,
&MainWindow::RefreshGameList);
connect(m_hotkey_scheduler, &HotkeyScheduler::StopHotkey, this, &MainWindow::RequestStop);
@ -1604,6 +1606,13 @@ void MainWindow::OnActivateChat()
g_netplay_chat_ui->Activate();
}
void MainWindow::OnRequestGolfControl()
{
auto client = Settings::Instance().GetNetPlayClient();
if (client)
client->RequestGolfControl();
}
void MainWindow::ShowTASInput()
{
for (int i = 0; i < num_gc_controllers; i++)