Merge pull request #7970 from Techjar/netplay-mii-sync

NetPlay: Synchronize Mii data
This commit is contained in:
Connor McLaughlin 2019-04-27 13:26:55 +10:00 committed by GitHub
commit 664cfb2ca5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 111 additions and 8 deletions

View file

@ -48,6 +48,7 @@
#include "Core/IOS/ES/ES.h"
#include "Core/IOS/FS/FileSystem.h"
#include "Core/IOS/IOS.h"
#include "Core/IOS/Uids.h"
#include "Core/NetPlayClient.h" //for NetPlayUI
#include "DiscIO/Enums.h"
#include "InputCommon/ControllerEmu/ControlGroup/Attachments.h"
@ -1518,6 +1519,28 @@ bool NetPlayServer::SyncSaveData()
sf::Packet pac;
pac << static_cast<MessageId>(NP_MSG_SYNC_SAVE_DATA);
pac << static_cast<MessageId>(SYNC_SAVE_DATA_WII);
// Shove the Mii data into the start the packet
{
auto file = configured_fs->OpenFile(IOS::PID_KERNEL, IOS::PID_KERNEL,
Common::GetMiiDatabasePath(), IOS::HLE::FS::Mode::Read);
if (file)
{
pac << true;
std::vector<u8> file_data(file->GetStatus()->size);
if (!file->Read(file_data.data(), file_data.size()))
return false;
if (!CompressBufferIntoPacket(file_data, pac))
return false;
}
else
{
pac << false; // no mii data
}
}
// Carry on with the save files
pac << static_cast<u32>(saves.size());
for (const auto& pair : saves)