From 1ba834d13cab03ede2982b1f31d51a90d568bfe0 Mon Sep 17 00:00:00 2001 From: Techjar Date: Sun, 26 Aug 2018 22:28:23 -0400 Subject: [PATCH] NetPlay: Add additional comments for host input authority mode --- Source/Core/Core/NetPlayClient.cpp | 4 ++++ Source/Core/Core/NetPlayClient.h | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/Source/Core/Core/NetPlayClient.cpp b/Source/Core/Core/NetPlayClient.cpp index 2f091ae2b4..3d02427c59 100644 --- a/Source/Core/Core/NetPlayClient.cpp +++ b/Source/Core/Core/NetPlayClient.cpp @@ -1452,6 +1452,10 @@ bool NetPlayClient::GetNetPads(const int pad_nb, const bool batching, GCPadStatu if (m_host_input_authority && !m_local_player->IsHost()) { + // CoreTiming acts funny and causes what looks like frame skip if + // we toggle the emulation speed too quickly, so to prevent this + // we wait until the buffer has been over for at least 1 second. + const bool buffer_over_target = m_pad_buffer[pad_nb].Size() > m_target_buffer_size + 1; if (!buffer_over_target) m_buffer_under_target_last = std::chrono::steady_clock::now(); diff --git a/Source/Core/Core/NetPlayClient.h b/Source/Core/Core/NetPlayClient.h index 1b0601452a..5287d95ef5 100644 --- a/Source/Core/Core/NetPlayClient.h +++ b/Source/Core/Core/NetPlayClient.h @@ -157,6 +157,10 @@ protected: Common::Flag m_is_running{false}; Common::Flag m_do_loop{true}; + // In non-host input authority mode, this is how many packets each client should + // try to keep in-flight to the other clients. In host input authority mode, this is how + // many incoming input packets need to be queued up before the client starts + // speeding up the game to drain the buffer. unsigned int m_target_buffer_size = 20; bool m_host_input_authority = false;