Merge pull request #9297 from JosJuice/movie-game-id-comparison

Movie: Fix 83b9fef regressions
This commit is contained in:
Léo Lam 2020-11-29 00:09:30 +01:00 committed by GitHub
commit 738e1a6dbb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 2 deletions

View File

@ -227,7 +227,7 @@ void Init(const BootParameters& boot)
ReadHeader(); ReadHeader();
std::thread md5thread(CheckMD5); std::thread md5thread(CheckMD5);
md5thread.detach(); md5thread.detach();
if (tmpHeader.GetGameID() == SConfig::GetInstance().GetGameID()) if (strncmp(tmpHeader.gameID.data(), SConfig::GetInstance().GetGameID().c_str(), 6))
{ {
PanicAlertFmtT("The recorded game ({0}) is not the same as the selected game ({1})", PanicAlertFmtT("The recorded game ({0}) is not the same as the selected game ({1})",
tmpHeader.GetGameID(), SConfig::GetInstance().GetGameID()); tmpHeader.GetGameID(), SConfig::GetInstance().GetGameID());

View File

@ -5,6 +5,7 @@
#pragma once #pragma once
#include <array> #include <array>
#include <cstring>
#include <functional> #include <functional>
#include <optional> #include <optional>
#include <string> #include <string>
@ -64,7 +65,10 @@ static_assert(sizeof(ControllerState) == 8, "ControllerState should be 8 bytes")
#pragma pack(push, 1) #pragma pack(push, 1)
struct DTMHeader struct DTMHeader
{ {
std::string_view GetGameID() const { return {gameID.data(), gameID.size()}; } std::string_view GetGameID() const
{
return {gameID.data(), strnlen(gameID.data(), gameID.size())};
}
std::array<u8, 4> filetype; // Unique Identifier (always "DTM"0x1A) std::array<u8, 4> filetype; // Unique Identifier (always "DTM"0x1A)