From 42c38cbbd3bdfefd494f60ab6a99a9dfaafa663e Mon Sep 17 00:00:00 2001 From: Anthony Serna Date: Thu, 31 Dec 2015 05:15:00 -0600 Subject: [PATCH] Blocked netplay users from desyncing by messing with savestates. --- Source/Core/Core/State.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Source/Core/Core/State.cpp b/Source/Core/Core/State.cpp index a346c2ed96..f1fd56cf7c 100644 --- a/Source/Core/Core/State.cpp +++ b/Source/Core/Core/State.cpp @@ -20,6 +20,7 @@ #include "Core/CoreTiming.h" #include "Core/Host.h" #include "Core/Movie.h" +#include "Core/NetPlayClient.h" #include "Core/State.h" #include "Core/HW/CPU.h" #include "Core/HW/DSP.h" @@ -31,6 +32,7 @@ #include "Core/PowerPC/JitCommon/JitBase.h" #include "VideoCommon/AVIDump.h" +#include "VideoCommon/OnScreenDisplay.h" #include "VideoCommon/VideoBackendBase.h" namespace State @@ -198,6 +200,12 @@ static std::string DoState(PointerWrap& p) void LoadFromBuffer(std::vector& buffer) { + if (NetPlay::IsNetPlayRunning()) + { + OSD::AddMessage("Loading savestates is disabled in Netplay to prevent desyncs"); + return; + } + bool wasUnpaused = Core::PauseAndLock(true); u8* ptr = &buffer[0]; @@ -531,7 +539,14 @@ static void LoadFileStateData(const std::string& filename, std::vector& ret_ void LoadAs(const std::string& filename) { if (!Core::IsRunning()) + { return; + } + else if (NetPlay::IsNetPlayRunning()) + { + OSD::AddMessage("Loading savestates is disabled in Netplay to prevent desyncs"); + return; + } // Stop the core while we load the state bool wasUnpaused = Core::PauseAndLock(true);