Make netplay's "same game" check more robust

Instead of comparing the game ID, revision, disc number and name,
we can compare a hash of important parts of the disc including
all the aforementioned data but also additional data such as the
FST. The primary reason why I'm making this change is to let us
catch more desyncs before they happen, but this should also fix
https://bugs.dolphin-emu.org/issues/12115. As a bonus, the UI can
now distinguish the case where a client doesn't have the game at
all from the case where a client has the wrong version of the game.
This commit is contained in:
JosJuice
2020-06-07 22:58:03 +02:00
parent 25ebc3c07c
commit a41166bb37
34 changed files with 502 additions and 148 deletions

View File

@ -4,11 +4,13 @@
#pragma once
#include <array>
#include <map>
#include <string>
#include <vector>
#include "Common/CommonTypes.h"
#include "Core/SyncIdentifier.h"
#include "DiscIO/Blob.h"
#include "DiscIO/Enums.h"
@ -80,7 +82,16 @@ public:
u16 GetRevision() const { return m_revision; }
// 0 is the first disc, 1 is the second disc
u8 GetDiscNumber() const { return m_disc_number; }
std::string GetUniqueIdentifier() const;
std::string GetNetPlayName() const;
// This function is slow
std::array<u8, 20> GetSyncHash() const;
// This function is slow
NetPlay::SyncIdentifier GetSyncIdentifier() const;
// This function is slow if all of game_id, revision, disc_number, is_datel are identical
NetPlay::SyncIdentifierComparison
CompareSyncIdentifier(const NetPlay::SyncIdentifier& sync_identifier) const;
std::string GetWiiFSPath() const;
DiscIO::Region GetRegion() const { return m_region; }
DiscIO::Country GetCountry() const { return m_country; }