DiscIO: Use std::optional for GetTitleID instead of pointer

This makes the interface slightly cleaner and a bit more consistent
with the other getters. Still not fully the same, since the others
don't really handle failures with std::optional; but at least the
value is returned by value now, as opposed to having the function
take a pointer to a u64.
This commit is contained in:
Léo Lam 2017-06-03 21:29:08 +02:00
commit 1a17c02d6f
9 changed files with 31 additions and 26 deletions

View file

@ -721,9 +721,10 @@ void SConfig::ResetRunningGameMetadata()
void SConfig::SetRunningGameMetadata(const DiscIO::IVolume& volume,
const DiscIO::Partition& partition)
{
u64 title_id = 0;
volume.GetTitleID(&title_id, partition);
SetRunningGameMetadata(volume.GetGameID(partition), title_id, volume.GetRevision(partition),
const std::optional<u64> title_id = volume.GetTitleID(partition);
if (!title_id)
return;
SetRunningGameMetadata(volume.GetGameID(partition), *title_id, volume.GetRevision(partition),
Core::TitleDatabase::TitleType::Other);
}