Add "Reduce Polling Rate" option to NetPlay

Normally, SI is polled at a rate defined by the game, and we have to send the pad state to other clients on every poll or else we'll desync. This can result in fairly high bandwidth usage, especially with multiple controllers, mostly due to UDP/IP overhead.

This change introduces an option to reduce the SI poll rate to once per frame, which may introduce up to one frame of additional latency, but will reduce bandwidth usage substantially, which is useful for users on very slow internet connections.

Polling SI less frequently than the game asked for did not seem to cause any problems in my testing, so this should be perfectly safe to do.
This commit is contained in:
Techjar 2018-06-29 16:48:30 -04:00
commit 5adeca4087
11 changed files with 30 additions and 5 deletions

View file

@ -11,6 +11,8 @@
#include "Common/ChunkFile.h"
#include "Common/CommonTypes.h"
#include "Common/Config/Config.h"
#include "Core/Config/MainSettings.h"
#include "Core/ConfigManager.h"
#include "Core/CoreTiming.h"
#include "Core/HW/MMIO.h"
@ -622,7 +624,11 @@ SIDevices GetDeviceType(int channel)
u32 GetPollXLines()
{
return s_poll.X;
// Returning 0 here effectively makes polling happen once per frame, as this is used to increment
// a value in VI for when the next SI poll happens. This should normally only be set during
// NetPlay, as it does not matter for a non-networked session. However, it may also be set during
// movie playback for movies recorded during NetPlay.
return Config::Get(Config::MAIN_REDUCE_POLLING_RATE) ? 0 : s_poll.X;
}
} // end of namespace SerialInterface