Blocked netplay users from desyncing by messing with savestates.

This commit is contained in:
Anthony Serna 2015-12-31 05:15:00 -06:00
parent 787bf156f0
commit 42c38cbbd3
1 changed files with 15 additions and 0 deletions

View File

@ -20,6 +20,7 @@
#include "Core/CoreTiming.h" #include "Core/CoreTiming.h"
#include "Core/Host.h" #include "Core/Host.h"
#include "Core/Movie.h" #include "Core/Movie.h"
#include "Core/NetPlayClient.h"
#include "Core/State.h" #include "Core/State.h"
#include "Core/HW/CPU.h" #include "Core/HW/CPU.h"
#include "Core/HW/DSP.h" #include "Core/HW/DSP.h"
@ -31,6 +32,7 @@
#include "Core/PowerPC/JitCommon/JitBase.h" #include "Core/PowerPC/JitCommon/JitBase.h"
#include "VideoCommon/AVIDump.h" #include "VideoCommon/AVIDump.h"
#include "VideoCommon/OnScreenDisplay.h"
#include "VideoCommon/VideoBackendBase.h" #include "VideoCommon/VideoBackendBase.h"
namespace State namespace State
@ -198,6 +200,12 @@ static std::string DoState(PointerWrap& p)
void LoadFromBuffer(std::vector<u8>& buffer) void LoadFromBuffer(std::vector<u8>& buffer)
{ {
if (NetPlay::IsNetPlayRunning())
{
OSD::AddMessage("Loading savestates is disabled in Netplay to prevent desyncs");
return;
}
bool wasUnpaused = Core::PauseAndLock(true); bool wasUnpaused = Core::PauseAndLock(true);
u8* ptr = &buffer[0]; u8* ptr = &buffer[0];
@ -531,7 +539,14 @@ static void LoadFileStateData(const std::string& filename, std::vector<u8>& ret_
void LoadAs(const std::string& filename) void LoadAs(const std::string& filename)
{ {
if (!Core::IsRunning()) if (!Core::IsRunning())
{
return; 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 // Stop the core while we load the state
bool wasUnpaused = Core::PauseAndLock(true); bool wasUnpaused = Core::PauseAndLock(true);