Netplay: Fixed desynchronization issue

When the host loaded a game, the client would end up applying the input with a 1 frame offset, causing some games to eventually desync.
Pausing, loading a state, resetting, etc. would permanently fix the problem (until another game was loading)
This commit is contained in:
Sour 2020-04-22 22:30:54 -04:00
parent 243ffef4fc
commit 5d67994f08
3 changed files with 6 additions and 1 deletions

View file

@ -436,6 +436,10 @@ bool Console::Initialize(VirtualFile &romFile, VirtualFile &patchFile, bool forP
_notificationManager->SendNotification(ConsoleNotificationType::VsDualSystemStarted);
}
}
//Used by netplay to take save state after UpdateInputState() is called above, to ensure client+server are in sync
_notificationManager->SendNotification(ConsoleNotificationType::GameInitCompleted);
Resume();
return true;
} else {

View file

@ -191,12 +191,12 @@ void GameServerConnection::ProcessNotification(ConsoleNotificationType type, voi
{
switch(type) {
case ConsoleNotificationType::GamePaused:
case ConsoleNotificationType::GameLoaded:
case ConsoleNotificationType::GameResumed:
case ConsoleNotificationType::GameReset:
case ConsoleNotificationType::StateLoaded:
case ConsoleNotificationType::CheatAdded:
case ConsoleNotificationType::ConfigChanged:
case ConsoleNotificationType::GameInitCompleted:
SendGameInformation();
break;
default:

View file

@ -25,6 +25,7 @@ enum class ConsoleNotificationType
BeforeEmulationStop = 19,
VsDualSystemStarted = 20,
VsDualSystemStopped = 21,
GameInitCompleted = 22,
};
class INotificationListener