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:
Techjar
2018-07-04 17:01:50 -04:00
parent f5e8af7b6c
commit 4407854e9c
32 changed files with 1250 additions and 209 deletions

View File

@ -16,8 +16,10 @@
#include <QVBoxLayout>
#include "Common/CommonPaths.h"
#include "Common/Config/Config.h"
#include "Common/FileUtil.h"
#include "Core/Config/MainSettings.h"
#include "Core/ConfigManager.h"
#include "Core/Core.h"
#include "Core/HW/EXI/EXI.h"
@ -200,8 +202,8 @@ void GameCubePane::OnConfigPressed(int slot)
if (other_slot_memcard)
{
QString path_b =
QFileInfo(QString::fromStdString(slot == 0 ? SConfig::GetInstance().m_strMemoryCardB :
SConfig::GetInstance().m_strMemoryCardA))
QFileInfo(QString::fromStdString(slot == 0 ? Config::Get(Config::MAIN_MEMCARD_B_PATH) :
Config::Get(Config::MAIN_MEMCARD_A_PATH)))
.absoluteFilePath();
if (path_abs == path_b)
@ -216,8 +218,8 @@ void GameCubePane::OnConfigPressed(int slot)
if (memcard)
{
path_old =
QFileInfo(QString::fromStdString(slot == 0 ? SConfig::GetInstance().m_strMemoryCardA :
SConfig::GetInstance().m_strMemoryCardB))
QFileInfo(QString::fromStdString(slot == 0 ? Config::Get(Config::MAIN_MEMCARD_A_PATH) :
Config::Get(Config::MAIN_MEMCARD_B_PATH)))
.absoluteFilePath();
}
else
@ -231,11 +233,11 @@ void GameCubePane::OnConfigPressed(int slot)
{
if (slot == SLOT_A_INDEX)
{
SConfig::GetInstance().m_strMemoryCardA = path_abs.toStdString();
Config::SetBase(Config::MAIN_MEMCARD_A_PATH, path_abs.toStdString());
}
else
{
SConfig::GetInstance().m_strMemoryCardB = path_abs.toStdString();
Config::SetBase(Config::MAIN_MEMCARD_B_PATH, path_abs.toStdString());
}
}
else