summaryrefslogtreecommitdiff
path: root/Source/Core/DolphinWX/ISOProperties/FilesystemPanel.cpp
diff options
context:
space:
mode:
authorJosJuice <josjuice@gmail.com>2017-05-16 23:06:32 +0200
committerGitHub <noreply@github.com>2017-05-16 23:06:32 +0200
commitfa06d10f4a09ec5f16c0653f6e3e2cbbc043e925 (patch)
tree56ee1ce35f3a7128467289ff180cd6fd56af2f50 /Source/Core/DolphinWX/ISOProperties/FilesystemPanel.cpp
parentf4e8a01d166378bda874fdfd7063b2fcce1ac89e (diff)
parent2bcad57225b9b0a4635d62eeabbbb138d71386bf (diff)
Merge pull request #2353 from JosJuice/wii-partition-cleanup
VolumeWiiCrypted: Replace ChangePartition with a partition parameter
Diffstat (limited to 'Source/Core/DolphinWX/ISOProperties/FilesystemPanel.cpp')
-rw-r--r--Source/Core/DolphinWX/ISOProperties/FilesystemPanel.cpp61
1 files changed, 25 insertions, 36 deletions
diff --git a/Source/Core/DolphinWX/ISOProperties/FilesystemPanel.cpp b/Source/Core/DolphinWX/ISOProperties/FilesystemPanel.cpp
index bd1fc44f3b..e6d94f8a6d 100644
--- a/Source/Core/DolphinWX/ISOProperties/FilesystemPanel.cpp
+++ b/Source/Core/DolphinWX/ISOProperties/FilesystemPanel.cpp
@@ -33,32 +33,31 @@ namespace
class WiiPartition final : public wxTreeItemData
{
public:
- WiiPartition(std::unique_ptr<DiscIO::IVolume> volume_,
- std::unique_ptr<DiscIO::IFileSystem> filesystem_)
- : volume{std::move(volume_)}, filesystem{std::move(filesystem_)}
+ WiiPartition(std::unique_ptr<DiscIO::IFileSystem> filesystem_)
+ : filesystem{std::move(filesystem_)}
{
}
- std::unique_ptr<DiscIO::IVolume> volume;
std::unique_ptr<DiscIO::IFileSystem> filesystem;
};
class IntegrityCheckThread final : public wxThread
{
public:
- explicit IntegrityCheckThread(const WiiPartition& partition)
- : wxThread{wxTHREAD_JOINABLE}, m_partition{partition}
+ explicit IntegrityCheckThread(const DiscIO::IVolume* volume, DiscIO::Partition partition)
+ : wxThread{wxTHREAD_JOINABLE}, m_volume{volume}, m_partition{partition}
{
Create();
}
ExitCode Entry() override
{
- return reinterpret_cast<ExitCode>(m_partition.volume->CheckIntegrity());
+ return reinterpret_cast<ExitCode>(m_volume->CheckIntegrity(m_partition));
}
private:
- const WiiPartition& m_partition;
+ const DiscIO::IVolume* const m_volume;
+ const DiscIO::Partition m_partition;
};
enum : int
@@ -156,9 +155,9 @@ WiiPartition* FindWiiPartition(wxTreeCtrl* tree_ctrl, const wxString& label)
}
} // Anonymous namespace
-FilesystemPanel::FilesystemPanel(wxWindow* parent, wxWindowID id, const GameListItem& item,
+FilesystemPanel::FilesystemPanel(wxWindow* parent, wxWindowID id,
const std::unique_ptr<DiscIO::IVolume>& opened_iso)
- : wxPanel{parent, id}, m_game_list_item{item}, m_opened_iso{opened_iso}
+ : wxPanel{parent, id}, m_opened_iso{opened_iso}
{
CreateGUI();
BindEvents();
@@ -217,7 +216,7 @@ void FilesystemPanel::PopulateFileSystemTree()
void FilesystemPanel::PopulateFileSystemTreeGC()
{
- m_filesystem = DiscIO::CreateFileSystem(m_opened_iso.get());
+ m_filesystem = DiscIO::CreateFileSystem(m_opened_iso.get(), DiscIO::PARTITION_NONE);
if (!m_filesystem)
return;
@@ -226,34 +225,23 @@ void FilesystemPanel::PopulateFileSystemTreeGC()
void FilesystemPanel::PopulateFileSystemTreeWii() const
{
- u32 partition_count = 0;
-
- for (u32 group = 0; group < 4; group++)
+ std::vector<DiscIO::Partition> partitions = m_opened_iso->GetPartitions();
+ for (size_t i = 0; i < partitions.size(); ++i)
{
- // yes, technically there can be OVER NINE THOUSAND partitions...
- for (u32 i = 0; i < 0xFFFFFFFF; i++)
+ std::unique_ptr<DiscIO::IFileSystem> file_system(
+ DiscIO::CreateFileSystem(m_opened_iso.get(), partitions[i]));
+ if (file_system)
{
- auto volume = DiscIO::CreateVolumeFromFilename(m_game_list_item.GetFileName(), group, i);
- if (volume == nullptr)
- break;
-
- auto file_system = DiscIO::CreateFileSystem(volume.get());
- if (file_system != nullptr)
- {
- auto* const partition = new WiiPartition(std::move(volume), std::move(file_system));
+ wxTreeItemId partition_root = m_tree_ctrl->AppendItem(
+ m_tree_ctrl->GetRootItem(), wxString::Format(_("Partition %i"), i), ICON_DISC);
- const wxTreeItemId partition_root = m_tree_ctrl->AppendItem(
- m_tree_ctrl->GetRootItem(), wxString::Format(_("Partition %u"), partition_count),
- ICON_DISC);
+ WiiPartition* const partition = new WiiPartition(std::move(file_system));
- m_tree_ctrl->SetItemData(partition_root, partition);
- CreateDirectoryTree(m_tree_ctrl, partition_root, partition->filesystem->GetFileList());
+ m_tree_ctrl->SetItemData(partition_root, partition);
+ CreateDirectoryTree(m_tree_ctrl, partition_root, partition->filesystem->GetFileList());
- if (partition_count == 1)
- m_tree_ctrl->Expand(partition_root);
-
- partition_count++;
- }
+ if (i == 1)
+ m_tree_ctrl->Expand(partition_root);
}
}
}
@@ -382,8 +370,9 @@ void FilesystemPanel::OnCheckPartitionIntegrity(wxCommandEvent& WXUNUSED(event))
wxPD_APP_MODAL | wxPD_ELAPSED_TIME | wxPD_SMOOTH);
const auto selection = m_tree_ctrl->GetSelection();
-
- IntegrityCheckThread thread(*static_cast<WiiPartition*>(m_tree_ctrl->GetItemData(selection)));
+ WiiPartition* partition =
+ static_cast<WiiPartition*>(m_tree_ctrl->GetItemData(m_tree_ctrl->GetSelection()));
+ IntegrityCheckThread thread(m_opened_iso.get(), partition->filesystem->GetPartition());
thread.Run();
while (thread.IsAlive())