Add a central variable g_want_determinism which controls whether to try to make things deterministic.

It now affects the GPU determinism mode as well as some miscellaneous
things that were calling IsNetPlayRunning.  Probably incomplete.

Notably, this can change while paused, if the user starts recording a
movie.  The movie code appears to have been missing locking between
setting g_playMode and doing other things, which probably had a small
chance of causing crashes or even desynced movies; fix that with
PauseAndLock.

The next commit will add a hidden config variable to override GPU
determinism mode.
This commit is contained in:
comex
2014-09-06 17:26:40 -04:00
parent 65af90669b
commit 3a2048ea57
10 changed files with 95 additions and 8 deletions

View File

@ -4,8 +4,7 @@
#include <algorithm>
#include "Core/Movie.h"
#include "Core/NetPlayProto.h"
#include "Core/Core.h"
#include "Core/IPC_HLE/WII_IPC_HLE.h"
#include "Core/IPC_HLE/WII_IPC_HLE_Device.h"
#include "Core/IPC_HLE/WII_Socket.h" // No Wii socket support while using NetPlay or TAS
@ -559,9 +558,7 @@ void WiiSockMan::AddSocket(s32 fd)
s32 WiiSockMan::NewSocket(s32 af, s32 type, s32 protocol)
{
if (NetPlay::IsNetPlayRunning() ||
Movie::IsRecordingInput() ||
Movie::IsPlayingInput())
if (Core::g_want_determinism)
{
return SO_ENOMEM;
}
@ -664,5 +661,12 @@ void WiiSockMan::Convert(sockaddr_in const & from, WiiSockAddrIn& to, s32 addrle
to.len = addrlen;
}
void WiiSockMan::UpdateWantDeterminism(bool want)
{
// If we switched into movie recording, kill existing sockets.
if (want)
Clean();
}
#undef ERRORCODE
#undef EITHER

View File

@ -242,6 +242,8 @@ public:
}
}
void UpdateWantDeterminism(bool want);
private:
WiiSockMan() = default;