Never set disc as active title when launching channel with same ID

https://bugs.dolphin-emu.org/issues/11804
This commit is contained in:
JosJuice 2019-07-20 08:37:14 +02:00
parent da1fbbc5d5
commit 2fda104d5a
4 changed files with 22 additions and 13 deletions

View File

@ -670,7 +670,7 @@ void SConfig::SetRunningGameMetadata(const DiscIO::Volume& volume,
}
}
void SConfig::SetRunningGameMetadata(const IOS::ES::TMDReader& tmd)
void SConfig::SetRunningGameMetadata(const IOS::ES::TMDReader& tmd, DiscIO::Platform platform)
{
const u64 tmd_title_id = tmd.GetTitleId();
@ -678,12 +678,12 @@ void SConfig::SetRunningGameMetadata(const IOS::ES::TMDReader& tmd)
// the disc header instead of the TMD. They can differ.
// (IOS HLE ES calls us with a TMDReader rather than a volume when launching
// a disc game, because ES has no reason to be accessing the disc directly.)
if (!DVDInterface::UpdateRunningGameMetadata(tmd_title_id))
if (platform == DiscIO::Platform::WiiWAD ||
!DVDInterface::UpdateRunningGameMetadata(tmd_title_id))
{
// If not launching a disc game, just read everything from the TMD.
const DiscIO::Country country =
DiscIO::CountryCodeToCountry(static_cast<u8>(tmd_title_id), DiscIO::Platform::WiiWAD,
tmd.GetRegion(), tmd.GetTitleVersion());
const DiscIO::Country country = DiscIO::CountryCodeToCountry(
static_cast<u8>(tmd_title_id), platform, tmd.GetRegion(), tmd.GetTitleVersion());
SetRunningGameMetadata(tmd.GetGameID(), tmd.GetGameTDBID(), tmd_title_id, tmd.GetTitleVersion(),
country);
}
@ -902,7 +902,7 @@ struct SetGameMetadata
}
const IOS::ES::TMDReader& tmd = wad.GetTMD();
config->SetRunningGameMetadata(tmd);
config->SetRunningGameMetadata(tmd, DiscIO::Platform::WiiWAD);
config->bWii = true;
*region = tmd.GetRegion();
return true;
@ -917,7 +917,7 @@ struct SetGameMetadata
PanicAlertT("This title cannot be booted.");
return false;
}
config->SetRunningGameMetadata(tmd);
config->SetRunningGameMetadata(tmd, DiscIO::Platform::WiiWAD);
config->bWii = true;
*region = tmd.GetRegion();
return true;

View File

@ -19,6 +19,7 @@ namespace DiscIO
{
enum class Country;
enum class Language;
enum class Platform;
enum class Region;
struct Partition;
class Volume;
@ -199,7 +200,7 @@ struct SConfig
u16 GetRevision() const { return m_revision; }
void ResetRunningGameMetadata();
void SetRunningGameMetadata(const DiscIO::Volume& volume, const DiscIO::Partition& partition);
void SetRunningGameMetadata(const IOS::ES::TMDReader& tmd);
void SetRunningGameMetadata(const IOS::ES::TMDReader& tmd, DiscIO::Platform platform);
void LoadDefaults();
// Replaces NTSC-K with some other region, and doesn't replace non-NTSC-K regions

View File

@ -25,6 +25,7 @@
#include "Core/IOS/IOSC.h"
#include "Core/IOS/Uids.h"
#include "Core/IOS/VersionInfo.h"
#include "DiscIO/Enums.h"
namespace IOS::HLE::Device
{
@ -93,7 +94,8 @@ void TitleContext::DoState(PointerWrap& p)
p.Do(active);
}
void TitleContext::Update(const IOS::ES::TMDReader& tmd_, const IOS::ES::TicketReader& ticket_)
void TitleContext::Update(const IOS::ES::TMDReader& tmd_, const IOS::ES::TicketReader& ticket_,
DiscIO::Platform platform)
{
if (!tmd_.IsValid() || !ticket_.IsValid())
{
@ -108,7 +110,7 @@ void TitleContext::Update(const IOS::ES::TMDReader& tmd_, const IOS::ES::TicketR
// Interesting title changes (channel or disc game launch) always happen after an IOS reload.
if (first_change)
{
SConfig::GetInstance().SetRunningGameMetadata(tmd);
SConfig::GetInstance().SetRunningGameMetadata(tmd, platform);
first_change = false;
}
}
@ -298,7 +300,7 @@ bool ES::LaunchPPCTitle(u64 title_id, bool skip_reload)
return LaunchTitle(required_ios);
}
m_title_context.Update(tmd, ticket);
m_title_context.Update(tmd, ticket, DiscIO::Platform::WiiWAD);
INFO_LOG(IOS_ES, "LaunchPPCTitle: Title context changed: %016" PRIx64, tmd.GetTitleId());
// Note: the UID/GID is also updated for IOS titles, but since we have no guarantee IOS titles
@ -648,7 +650,7 @@ ReturnCode ES::DIVerify(const IOS::ES::TMDReader& tmd, const IOS::ES::TicketRead
if (tmd.GetTitleId() != ticket.GetTitleId())
return ES_EINVAL;
m_title_context.Update(tmd, ticket);
m_title_context.Update(tmd, ticket, DiscIO::Platform::WiiDisc);
INFO_LOG(IOS_ES, "ES_DIVerify: Title context changed: %016" PRIx64, tmd.GetTitleId());
// XXX: We are supposed to verify the TMD and ticket here, but cannot because

View File

@ -18,13 +18,19 @@
class PointerWrap;
namespace DiscIO
{
enum class Platform;
}
namespace IOS::HLE::Device
{
struct TitleContext
{
void Clear();
void DoState(PointerWrap& p);
void Update(const IOS::ES::TMDReader& tmd_, const IOS::ES::TicketReader& ticket_);
void Update(const IOS::ES::TMDReader& tmd_, const IOS::ES::TicketReader& ticket_,
DiscIO::Platform platform);
IOS::ES::TicketReader ticket;
IOS::ES::TMDReader tmd;