From 1a17c02d6f5db0413d53d84987fc666199982ed2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Lam?= Date: Sat, 3 Jun 2017 21:29:08 +0200 Subject: 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. --- Source/Core/DiscIO/VolumeWad.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'Source/Core/DiscIO/VolumeWad.cpp') diff --git a/Source/Core/DiscIO/VolumeWad.cpp b/Source/Core/DiscIO/VolumeWad.cpp index 86932f897b..d26e6c7678 100644 --- a/Source/Core/DiscIO/VolumeWad.cpp +++ b/Source/Core/DiscIO/VolumeWad.cpp @@ -107,9 +107,12 @@ std::string CVolumeWAD::GetMakerID(const Partition& partition) const return DecodeString(temp); } -bool CVolumeWAD::GetTitleID(u64* buffer, const Partition& partition) const +std::optional CVolumeWAD::GetTitleID(const Partition& partition) const { - return ReadSwapped(m_offset + 0x01DC, buffer, partition); + u64 title_id; + if (!ReadSwapped(m_offset + 0x01DC, &title_id, partition)) + return {}; + return title_id; } u16 CVolumeWAD::GetRevision(const Partition& partition) const @@ -141,11 +144,11 @@ std::vector CVolumeWAD::GetBanner(int* width, int* height) const *width = 0; *height = 0; - u64 title_id; - if (!GetTitleID(&title_id)) + const std::optional title_id = GetTitleID(); + if (!title_id) return std::vector(); - return GetWiiBanner(width, height, title_id); + return GetWiiBanner(width, height, *title_id); } BlobType CVolumeWAD::GetBlobType() const -- cgit v1.2.3