diff options
| author | Pokechu22 <Pokechu022@gmail.com> | 2021-08-02 10:48:57 -0700 |
|---|---|---|
| committer | Pokechu22 <Pokechu022@gmail.com> | 2021-08-02 12:20:48 -0700 |
| commit | 0b86a03438933f6391a2d14e97b91937a6cd39d9 (patch) | |
| tree | 9cdfc3bd92a7db1a0d23b835a769821a672edbc9 /Source/Core/DolphinQt/Config/FilesystemWidget.cpp | |
| parent | 8a078ea43ad9bb2e5f6adc41294d94dd5521f3c8 (diff) | |
FilesystemWidget: Show more information about partitions
Diffstat (limited to 'Source/Core/DolphinQt/Config/FilesystemWidget.cpp')
| -rw-r--r-- | Source/Core/DolphinQt/Config/FilesystemWidget.cpp | 56 |
1 files changed, 55 insertions, 1 deletions
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 <future> +#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<char>(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()); |
