diff --git a/Source/Core/DolphinQt/Config/FilesystemWidget.cpp b/Source/Core/DolphinQt/Config/FilesystemWidget.cpp index c2aa1a74eb..b830a2e015 100644 --- a/Source/Core/DolphinQt/Config/FilesystemWidget.cpp +++ b/Source/Core/DolphinQt/Config/FilesystemWidget.cpp @@ -16,6 +16,8 @@ #include +#include "Common/StringUtil.h" + #include "DiscIO/DiscExtractor.h" #include "DiscIO/DiscUtils.h" #include "DiscIO/Filesystem.h" @@ -101,7 +103,7 @@ void FilesystemWidget::PopulateView() for (size_t i = 0; i < partitions.size(); i++) { - auto* item = new QStandardItem(tr("Partition %1").arg(i)); + auto* item = new QStandardItem; item->setEditable(false); item->setIcon(Resources::GetScaledIcon("isoproperties_disc")); @@ -123,6 +125,58 @@ void FilesystemWidget::PopulateView() void FilesystemWidget::PopulateDirectory(int partition_id, QStandardItem* root, const DiscIO::Partition& partition) { + auto partition_type = m_volume->GetPartitionType(partition); + auto game_id = m_volume->GetGameID(partition); + auto title_id = m_volume->GetTitleID(partition); + + QString text = root->text(); + + if (!text.isEmpty()) + text += QStringLiteral(" - "); + + if (partition_type) + { + QString partition_type_str; + switch (partition_type.value()) + { + case DiscIO::PARTITION_DATA: + partition_type_str = tr("Data Partition (%1)").arg(partition_type.value()); + break; + case DiscIO::PARTITION_UPDATE: + partition_type_str = tr("Update Partition (%1)").arg(partition_type.value()); + break; + case DiscIO::PARTITION_CHANNEL: + partition_type_str = tr("Channel Partition (%1)").arg(partition_type.value()); + break; + case DiscIO::PARTITION_INSTALL: + partition_type_str = tr("Install Partition (%1)").arg(partition_type.value()); + break; + default: + partition_type_str = + tr("Other Partition (%1)").arg(partition_type.value(), 8, 16, QLatin1Char('0')); + break; + } + text += partition_type_str + QStringLiteral(" - "); + } + + text += QString::fromStdString(game_id); + + if (title_id) + { + text += QStringLiteral(" - %1 (").arg(title_id.value(), 16, 16, QLatin1Char('0')); + for (u32 i = 0; i < 4; i++) + { + char c = static_cast(title_id.value() >> 8 * (3 - i)); + if (IsPrintableCharacter(c)) + text += QLatin1Char(c); + else + text += QLatin1Char('.'); + } + text += QLatin1Char(')'); + } + + root->setText(text); + const DiscIO::FileSystem* const file_system = m_volume->GetFileSystem(partition); if (file_system) PopulateDirectory(partition_id, root, file_system->GetRoot());