Use system time for start time in netplay.
This commit is contained in:
parent
a3f6cbfe6b
commit
e7d237f199
|
@ -12,6 +12,7 @@
|
|||
#include "Core/Core.h"
|
||||
#include "Core/CoreTiming.h"
|
||||
#include "Core/Movie.h"
|
||||
#include "Core/NetPlayProto.h"
|
||||
#include "Core/HW/EXI_DeviceIPL.h"
|
||||
#include "Core/HW/SystemTimers.h"
|
||||
|
||||
|
@ -345,15 +346,16 @@ u32 CEXIIPL::GetGCTime()
|
|||
// let's keep time moving forward, regardless of what it starts at
|
||||
ltime += CoreTiming::GetTicks() / SystemTimers::GetTicksPerSecond();
|
||||
}
|
||||
else
|
||||
else if (NetPlay::IsNetPlayRunning())
|
||||
{
|
||||
// hack in some netplay stuff
|
||||
ltime = NetPlay_GetGCTime();
|
||||
|
||||
if (0 == ltime)
|
||||
ltime = Common::Timer::GetLocalTimeSinceJan1970();
|
||||
else
|
||||
ltime += CoreTiming::GetTicks() / SystemTimers::GetTicksPerSecond();
|
||||
// let's keep time moving forward, regardless of what it starts at
|
||||
ltime += CoreTiming::GetTicks() / SystemTimers::GetTicksPerSecond();
|
||||
}
|
||||
else
|
||||
{
|
||||
ltime = Common::Timer::GetLocalTimeSinceJan1970();
|
||||
}
|
||||
|
||||
return ((u32)ltime - cJanuary2000);
|
||||
|
|
|
@ -20,7 +20,7 @@ public:
|
|||
void DoState(PointerWrap &p) override;
|
||||
|
||||
static u32 GetGCTime();
|
||||
static u32 NetPlay_GetGCTime();
|
||||
static u64 NetPlay_GetGCTime();
|
||||
|
||||
static void Descrambler(u8* data, u32 size);
|
||||
|
||||
|
|
|
@ -382,7 +382,10 @@ unsigned int NetPlayClient::OnData(sf::Packet& packet)
|
|||
packet >> tmp;
|
||||
g_NetPlaySettings.m_EXIDevice[1] = (TEXIDevices)tmp;
|
||||
|
||||
packet >> g_netplay_initial_gctime;
|
||||
u32 x, y;
|
||||
packet >> x;
|
||||
packet >> y;
|
||||
g_netplay_initial_gctime = x | ((u64)y >> 32);
|
||||
}
|
||||
|
||||
m_dialog->OnMsgStartGame();
|
||||
|
@ -1061,7 +1064,7 @@ bool WiimoteEmu::Wiimote::NetPlay_GetWiimoteData(int wiimote, u8* data, u8 size)
|
|||
|
||||
// called from ---CPU--- thread
|
||||
// so all players' games get the same time
|
||||
u32 CEXIIPL::NetPlay_GetGCTime()
|
||||
u64 CEXIIPL::NetPlay_GetGCTime()
|
||||
{
|
||||
std::lock_guard<std::mutex> lk(crit_netplay_client);
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ typedef std::vector<u8> NetWiimote;
|
|||
|
||||
#define NETPLAY_VERSION "Dolphin NetPlay 2014-01-08"
|
||||
|
||||
extern int g_netplay_initial_gctime;
|
||||
extern u64 g_netplay_initial_gctime;
|
||||
|
||||
// messages
|
||||
enum
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#include <arpa/inet.h>
|
||||
#endif
|
||||
|
||||
int g_netplay_initial_gctime = 1272737767;
|
||||
u64 g_netplay_initial_gctime = 1272737767;
|
||||
|
||||
NetPlayServer::~NetPlayServer()
|
||||
{
|
||||
|
@ -648,7 +648,7 @@ bool NetPlayServer::StartGame()
|
|||
// no change, just update with clients
|
||||
AdjustPadBufferSize(m_target_buffer_size);
|
||||
|
||||
g_netplay_initial_gctime = CEXIIPL::GetGCTime();
|
||||
g_netplay_initial_gctime = Common::Timer::GetLocalTimeSinceJan1970();
|
||||
|
||||
// tell clients to start game
|
||||
sf::Packet spac;
|
||||
|
@ -663,7 +663,8 @@ bool NetPlayServer::StartGame()
|
|||
spac << m_settings.m_OCFactor;
|
||||
spac << m_settings.m_EXIDevice[0];
|
||||
spac << m_settings.m_EXIDevice[1];
|
||||
spac << g_netplay_initial_gctime;
|
||||
spac << (u32)g_netplay_initial_gctime;
|
||||
spac << (u32)g_netplay_initial_gctime << 32;
|
||||
|
||||
std::lock_guard<std::recursive_mutex> lkp(m_crit.players);
|
||||
std::lock_guard<std::recursive_mutex> lks(m_crit.send);
|
||||
|
|
Loading…
Reference in New Issue