mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-30 09:39:46 -06:00
DiscIO: Use std::optional in Volume and Blob
This commit is contained in:
@ -108,10 +108,9 @@ GameListItem::GameListItem(const std::string& _rFileName, const Core::TitleDatab
|
||||
m_VolumeSize = volume->GetSize();
|
||||
|
||||
m_game_id = volume->GetGameID();
|
||||
if (std::optional<u64> title_id = volume->GetTitleID())
|
||||
m_title_id = *title_id;
|
||||
m_disc_number = volume->GetDiscNumber();
|
||||
m_Revision = volume->GetRevision();
|
||||
m_title_id = volume->GetTitleID().value_or(0);
|
||||
m_disc_number = volume->GetDiscNumber().value_or(0);
|
||||
m_Revision = volume->GetRevision().value_or(0);
|
||||
|
||||
std::vector<u32> buffer = volume->GetBanner(&m_ImageWidth, &m_ImageHeight);
|
||||
ReadVolumeBanner(buffer, m_ImageWidth, m_ImageHeight);
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
#include <algorithm>
|
||||
#include <iterator>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
@ -36,6 +37,12 @@
|
||||
|
||||
namespace
|
||||
{
|
||||
template <typename T>
|
||||
wxString OptionalToString(std::optional<T> value)
|
||||
{
|
||||
return value ? StrToWxStr(std::to_string(*value)) : wxString();
|
||||
}
|
||||
|
||||
wxArrayString GetLanguageChoiceStrings(const std::vector<DiscIO::Language>& languages)
|
||||
{
|
||||
wxArrayString available_languages;
|
||||
@ -177,7 +184,7 @@ void InfoPanel::LoadISODetails()
|
||||
m_game_id->SetValue(StrToWxStr(m_opened_iso->GetGameID()));
|
||||
m_country->SetValue(GetCountryName(m_opened_iso->GetCountry()));
|
||||
m_maker_id->SetValue("0x" + StrToWxStr(m_opened_iso->GetMakerID()));
|
||||
m_revision->SetValue(StrToWxStr(std::to_string(m_opened_iso->GetRevision())));
|
||||
m_revision->SetValue(OptionalToString(m_opened_iso->GetRevision()));
|
||||
m_date->SetValue(StrToWxStr(m_opened_iso->GetApploaderDate()));
|
||||
if (m_ios_version)
|
||||
{
|
||||
|
Reference in New Issue
Block a user