FilesystemPanel: Put partitions in separate folders when extracting all partitions

This commit is contained in:
JosJuice
2017-06-20 21:51:40 +02:00
parent 478c4fd1f3
commit a59edfe8cf
6 changed files with 56 additions and 8 deletions

View File

@ -67,10 +67,11 @@ VolumeWii::VolumeWii(std::unique_ptr<BlobReader> reader)
continue;
const u64 partition_offset = static_cast<u64>(*read_buffer) << 2;
// Check if this is the game partition
const bool is_game_partition =
m_game_partition == PARTITION_NONE &&
m_pReader->ReadSwapped<u32>(partition_table_offset + (i * 8) + 4) == u32(0);
// Read the partition type
const std::optional<u32> partition_type =
m_pReader->ReadSwapped<u32>(partition_table_offset + (i * 8) + 4);
if (!partition_type)
continue;
// Read ticket
std::vector<u8> ticket_buffer(sizeof(IOS::ES::Ticket));
@ -106,10 +107,11 @@ VolumeWii::VolumeWii(std::unique_ptr<BlobReader> reader)
// We've read everything. Time to store it! (The reason we don't store anything
// earlier is because we want to be able to skip adding the partition if an error occurs.)
const Partition partition(partition_offset);
m_partition_types[partition] = *partition_type;
m_partition_keys[partition] = std::move(aes_context);
m_partition_tickets[partition] = std::move(ticket);
m_partition_tmds[partition] = std::move(tmd);
if (is_game_partition)
if (m_game_partition == PARTITION_NONE && *partition_type == 0)
m_game_partition = partition;
}
}
@ -185,6 +187,12 @@ Partition VolumeWii::GetGamePartition() const
return m_game_partition;
}
std::optional<u32> VolumeWii::GetPartitionType(const Partition& partition) const
{
auto it = m_partition_types.find(partition);
return it != m_partition_types.end() ? it->second : std::optional<u32>();
}
std::optional<u64> VolumeWii::GetTitleID(const Partition& partition) const
{
const IOS::ES::TicketReader& ticket = GetTicket(partition);