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:
1 parent
25ebc3c07c
commit
a41166bb37
34 files changed
+502
-148
No files matched your search
@@ -245,19 +245,26 @@ bool ExportBI2Data(const Volume& volume, const Partition& partition,
|
||||
return ExportData(volume, partition, 0x440, 0x2000, export_filename);
|
||||
}
|
||||
|
||||
std::optional<u64> GetApploaderSize(const Volume& volume, const Partition& partition)
|
||||
{
|
||||
constexpr u64 header_size = 0x20;
|
||||
const std::optional<u32> apploader_size = volume.ReadSwapped<u32>(0x2440 + 0x14, partition);
|
||||
const std::optional<u32> trailer_size = volume.ReadSwapped<u32>(0x2440 + 0x18, partition);
|
||||
if (!apploader_size || !trailer_size)
|
||||
return std::nullopt;
|
||||
|
||||
return header_size + *apploader_size + *trailer_size;
|
||||
}
|
||||
|
||||
bool ExportApploader(const Volume& volume, const Partition& partition,
|
||||
const std::string& export_filename)
|
||||
{
|
||||
if (!IsDisc(volume.GetVolumeType()))
|
||||
return false;
|
||||
|
||||
std::optional<u32> apploader_size = volume.ReadSwapped<u32>(0x2440 + 0x14, partition);
|
||||
const std::optional<u32> trailer_size = volume.ReadSwapped<u32>(0x2440 + 0x18, partition);
|
||||
constexpr u32 header_size = 0x20;
|
||||
if (!apploader_size || !trailer_size)
|
||||
const std::optional<u64> apploader_size = GetApploaderSize(volume, partition);
|
||||
if (!apploader_size)
|
||||
return false;
|
||||
*apploader_size += *trailer_size + header_size;
|
||||
DEBUG_LOG(DISCIO, "Apploader size -> %x", *apploader_size);
|
||||
|
||||
return ExportData(volume, partition, 0x2440, *apploader_size, export_filename);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user