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/VolumeWiiCrypted.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'Source/Core/DiscIO/VolumeWiiCrypted.cpp') diff --git a/Source/Core/DiscIO/VolumeWiiCrypted.cpp b/Source/Core/DiscIO/VolumeWiiCrypted.cpp index 5e088a9422..4086dbc9c3 100644 --- a/Source/Core/DiscIO/VolumeWiiCrypted.cpp +++ b/Source/Core/DiscIO/VolumeWiiCrypted.cpp @@ -181,13 +181,12 @@ Partition CVolumeWiiCrypted::GetGamePartition() const return m_game_partition; } -bool CVolumeWiiCrypted::GetTitleID(u64* buffer, const Partition& partition) const +std::optional CVolumeWiiCrypted::GetTitleID(const Partition& partition) const { const IOS::ES::TicketReader& ticket = GetTicket(partition); if (!ticket.IsValid()) - return false; - *buffer = ticket.GetTitleId(); - return true; + return {}; + return ticket.GetTitleId(); } const IOS::ES::TicketReader& CVolumeWiiCrypted::GetTicket(const Partition& partition) const @@ -289,11 +288,11 @@ std::vector CVolumeWiiCrypted::GetBanner(int* width, int* height) const *width = 0; *height = 0; - u64 title_id; - if (!GetTitleID(&title_id, GetGamePartition())) + const std::optional title_id = GetTitleID(GetGamePartition()); + if (!title_id) return std::vector(); - return GetWiiBanner(width, height, title_id); + return GetWiiBanner(width, height, *title_id); } u64 CVolumeWiiCrypted::GetFSTSize(const Partition& partition) const -- cgit v1.2.3