mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-26 07:39:45 -06:00
NetPlay save data synchronization
This adds the functionality of sending the host's save data (raw memory cards, as well as GCI files and Wii saves with a matching GameID) to all other clients. The data is compressed using LZO1X to greatly reduce its size while keeping compression/decompression fast. Save synchronization is enabled by default, and toggleable with a checkbox in the NetPlay dialog. On clicking start, if the option is enabled, game boot will be delayed until all players have received the save data sent by the host. If any player fails to receive it properly, boot will be cancelled to prevent desyncs.
This commit is contained in:
@ -36,6 +36,7 @@ add_library(common
|
||||
QoSSession.cpp
|
||||
Random.cpp
|
||||
SDCardUtil.cpp
|
||||
SFMLHelper.cpp
|
||||
SettingsHandler.cpp
|
||||
StringUtil.cpp
|
||||
SymbolDB.cpp
|
||||
|
@ -147,6 +147,7 @@
|
||||
<ClInclude Include="Result.h" />
|
||||
<ClInclude Include="ScopeGuard.h" />
|
||||
<ClInclude Include="SDCardUtil.h" />
|
||||
<ClInclude Include="SFMLHelper.h" />
|
||||
<ClInclude Include="Semaphore.h" />
|
||||
<ClInclude Include="SettingsHandler.h" />
|
||||
<ClInclude Include="SPSCQueue.h" />
|
||||
@ -210,6 +211,7 @@
|
||||
<ClCompile Include="QoSSession.cpp" />
|
||||
<ClCompile Include="Random.cpp" />
|
||||
<ClCompile Include="SDCardUtil.cpp" />
|
||||
<ClCompile Include="SFMLHelper.cpp" />
|
||||
<ClCompile Include="SettingsHandler.cpp" />
|
||||
<ClCompile Include="StringUtil.cpp" />
|
||||
<ClCompile Include="SymbolDB.cpp" />
|
||||
|
@ -68,6 +68,7 @@
|
||||
<ClInclude Include="Result.h" />
|
||||
<ClInclude Include="ScopeGuard.h" />
|
||||
<ClInclude Include="SDCardUtil.h" />
|
||||
<ClInclude Include="SFMLHelper.h" />
|
||||
<ClInclude Include="SettingsHandler.h" />
|
||||
<ClInclude Include="SPSCQueue.h" />
|
||||
<ClInclude Include="StringUtil.h" />
|
||||
@ -299,6 +300,7 @@
|
||||
<ClCompile Include="Profiler.cpp" />
|
||||
<ClCompile Include="Random.cpp" />
|
||||
<ClCompile Include="SDCardUtil.cpp" />
|
||||
<ClCompile Include="SFMLHelper.cpp" />
|
||||
<ClCompile Include="SettingsHandler.cpp" />
|
||||
<ClCompile Include="StringUtil.cpp" />
|
||||
<ClCompile Include="SymbolDB.cpp" />
|
||||
|
@ -109,6 +109,7 @@
|
||||
#define GC_SRAM "SRAM.raw"
|
||||
#define GC_MEMCARDA "MemoryCardA"
|
||||
#define GC_MEMCARDB "MemoryCardB"
|
||||
#define GC_MEMCARD_NETPLAY "NetPlayTemp"
|
||||
|
||||
#define WII_STATE "state.dat"
|
||||
|
||||
|
38
Source/Core/Common/SFMLHelper.cpp
Normal file
38
Source/Core/Common/SFMLHelper.cpp
Normal file
@ -0,0 +1,38 @@
|
||||
// Copyright 2018 Dolphin Emulator Project
|
||||
// Licensed under GPLv2+
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include "Common/SFMLHelper.h"
|
||||
|
||||
#include <SFML/Network/Packet.hpp>
|
||||
|
||||
namespace Common
|
||||
{
|
||||
// This only exists as a helper for BigEndianValue
|
||||
u16 PacketReadU16(sf::Packet& packet)
|
||||
{
|
||||
u16 tmp;
|
||||
packet >> tmp;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
// This only exists as a helper for BigEndianValue
|
||||
u32 PacketReadU32(sf::Packet& packet)
|
||||
{
|
||||
u32 tmp;
|
||||
packet >> tmp;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
u64 PacketReadU64(sf::Packet& packet)
|
||||
{
|
||||
u32 low, high;
|
||||
packet >> low >> high;
|
||||
return low | (static_cast<u64>(high) << 32);
|
||||
}
|
||||
|
||||
void PacketWriteU64(sf::Packet& packet, const u64 value)
|
||||
{
|
||||
packet << static_cast<u32>(value) << static_cast<u32>(value >> 32);
|
||||
}
|
||||
} // namespace Common
|
23
Source/Core/Common/SFMLHelper.h
Normal file
23
Source/Core/Common/SFMLHelper.h
Normal file
@ -0,0 +1,23 @@
|
||||
// Copyright 2018 Dolphin Emulator Project
|
||||
// Licensed under GPLv2+
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Common/CommonTypes.h"
|
||||
|
||||
namespace sf
|
||||
{
|
||||
class Packet;
|
||||
}
|
||||
|
||||
namespace Common
|
||||
{
|
||||
template <typename value_type>
|
||||
struct BigEndianValue;
|
||||
|
||||
u16 PacketReadU16(sf::Packet& packet);
|
||||
u32 PacketReadU32(sf::Packet& packet);
|
||||
u64 PacketReadU64(sf::Packet& packet);
|
||||
void PacketWriteU64(sf::Packet& packet, u64 value);
|
||||
} // namespace Common
|
Reference in New Issue
Block a user