Volume: Return volume type as an enum

ISOFile and GameFile were using IsWiiDisc() and IsWadFile() to set
an enum value. The volume might as well return an enum directly.

I increased the Qt CACHE_REVISION because m_platform now is saved as u32
instead of int, but increasing the wx CACHE_REVISION is not necessary.
This commit is contained in:
JosJuice
2015-06-04 16:26:36 +02:00
parent f5b0468179
commit 0ed3118141
21 changed files with 98 additions and 112 deletions

View File

@ -189,16 +189,17 @@ CISOProperties::CISOProperties(const std::string fileName, wxWindow* parent, wxW
m_FST->SetValue(wxString::Format("%u", OpenISO->GetFSTSize()));
// Here we set all the info to be shown + we set the window title
ChangeBannerDetails(SConfig::GetInstance().m_LocalCoreStartupParameter.GetCurrentLanguage(OpenISO->IsWadFile() || OpenISO->IsWiiDisc()));
bool wii = OpenISO->GetVolumeType() != DiscIO::IVolume::GAMECUBE_DISC;
ChangeBannerDetails(SConfig::GetInstance().m_LocalCoreStartupParameter.GetCurrentLanguage(wii));
m_Banner->SetBitmap(OpenGameListItem->GetBitmap());
m_Banner->Bind(wxEVT_RIGHT_DOWN, &CISOProperties::RightClickOnBanner, this);
// Filesystem browser/dumper
// TODO : Should we add a way to browse the wad file ?
if (!OpenISO->IsWadFile())
if (OpenISO->GetVolumeType() != DiscIO::IVolume::WII_WAD)
{
if (OpenISO->IsWiiDisc())
if (OpenISO->GetVolumeType() == DiscIO::IVolume::WII_DISC)
{
int partition_count = 0;
for (int group = 0; group < 4; group++)
@ -239,7 +240,7 @@ CISOProperties::CISOProperties(const std::string fileName, wxWindow* parent, wxW
CISOProperties::~CISOProperties()
{
if (!OpenISO->IsWiiDisc() && !OpenISO->IsWadFile() && pFileSystem)
if (OpenISO->GetVolumeType() == DiscIO::IVolume::GAMECUBE_DISC && pFileSystem)
delete pFileSystem;
delete OpenGameListItem;
delete OpenISO;
@ -400,7 +401,7 @@ void CISOProperties::CreateGUIControls()
sbCoreOverrides->Add(sGPUDeterminism, 0, wxEXPAND|wxALL, 5);
wxStaticBoxSizer * const sbWiiOverrides = new wxStaticBoxSizer(wxVERTICAL, m_GameConfig, _("Wii Console"));
if (!OpenISO->IsWiiDisc() && !OpenISO->IsWadFile())
if (OpenISO->GetVolumeType() == DiscIO::IVolume::GAMECUBE_DISC)
{
sbWiiOverrides->ShowItems(false);
EnableWideScreen->Hide();
@ -488,7 +489,8 @@ void CISOProperties::CreateGUIControls()
wxStaticText* const m_LangText = new wxStaticText(m_Information, wxID_ANY, _("Show Language:"));
DiscIO::IVolume::ELanguage preferred_language = SConfig::GetInstance().m_LocalCoreStartupParameter.GetCurrentLanguage(OpenISO->IsWadFile() || OpenISO->IsWiiDisc());
bool wii = OpenISO->GetVolumeType() != DiscIO::IVolume::GAMECUBE_DISC;
DiscIO::IVolume::ELanguage preferred_language = SConfig::GetInstance().m_LocalCoreStartupParameter.GetCurrentLanguage(wii);
std::vector<DiscIO::IVolume::ELanguage> languages = OpenGameListItem->GetLanguages();
int preferred_language_index = 0;
@ -598,7 +600,7 @@ void CISOProperties::CreateGUIControls()
sInfoPage->Add(sbBannerDetails, 0, wxEXPAND|wxALL, 5);
m_Information->SetSizer(sInfoPage);
if (!OpenISO->IsWadFile())
if (OpenISO->GetVolumeType() != DiscIO::IVolume::WII_WAD)
{
wxPanel* const m_Filesystem = new wxPanel(m_Notebook, ID_FILESYSTEM);
m_Notebook->AddPage(m_Filesystem, _("Filesystem"));
@ -705,7 +707,7 @@ void CISOProperties::OnRightClickOnTree(wxTreeEvent& event)
popupMenu.Append(IDM_EXTRACTALL, _("Extract All Files..."));
if (!OpenISO->IsWiiDisc() ||
if (OpenISO->GetVolumeType() != DiscIO::IVolume::WII_DISC ||
(m_Treectrl->GetItemImage(m_Treectrl->GetSelection()) == 0 &&
m_Treectrl->GetFirstVisibleItem() != m_Treectrl->GetSelection()))
{
@ -748,7 +750,7 @@ void CISOProperties::OnExtractFile(wxCommandEvent& WXUNUSED (event))
m_Treectrl->SelectItem(m_Treectrl->GetItemParent(m_Treectrl->GetSelection()));
}
if (OpenISO->IsWiiDisc())
if (OpenISO->GetVolumeType() == DiscIO::IVolume::WII_DISC)
{
const wxTreeItemId tree_selection = m_Treectrl->GetSelection();
WiiPartition* partition = reinterpret_cast<WiiPartition*>(m_Treectrl->GetItemData(tree_selection));
@ -764,7 +766,7 @@ void CISOProperties::OnExtractFile(wxCommandEvent& WXUNUSED (event))
void CISOProperties::ExportDir(const std::string& _rFullPath, const std::string& _rExportFolder, const WiiPartition* partition)
{
DiscIO::IFileSystem* const fs = OpenISO->IsWiiDisc() ? partition->FileSystem : pFileSystem;
DiscIO::IFileSystem* const fs = OpenISO->GetVolumeType() == DiscIO::IVolume::WII_DISC ? partition->FileSystem : pFileSystem;
const std::vector<DiscIO::SFileInfo>& fst = fs->GetFileList();
@ -778,7 +780,7 @@ void CISOProperties::ExportDir(const std::string& _rFullPath, const std::string&
size = (u32)fst.size();
fs->ExportApploader(_rExportFolder);
if (!OpenISO->IsWiiDisc())
if (OpenISO->GetVolumeType() != DiscIO::IVolume::WII_DISC)
fs->ExportDOL(_rExportFolder);
}
else
@ -863,7 +865,7 @@ void CISOProperties::OnExtractDir(wxCommandEvent& event)
if (event.GetId() == IDM_EXTRACTALL)
{
if (OpenISO->IsWiiDisc())
if (OpenISO->GetVolumeType() == DiscIO::IVolume::WII_DISC)
{
wxTreeItemIdValue cookie;
wxTreeItemId root = m_Treectrl->GetRootItem();
@ -892,7 +894,7 @@ void CISOProperties::OnExtractDir(wxCommandEvent& event)
Directory += DIR_SEP_CHR;
if (OpenISO->IsWiiDisc())
if (OpenISO->GetVolumeType() == DiscIO::IVolume::WII_DISC)
{
const wxTreeItemId tree_selection = m_Treectrl->GetSelection();
WiiPartition* partition = reinterpret_cast<WiiPartition*>(m_Treectrl->GetItemData(tree_selection));
@ -914,7 +916,7 @@ void CISOProperties::OnExtractDataFromHeader(wxCommandEvent& event)
if (Path.empty())
return;
if (OpenISO->IsWiiDisc())
if (OpenISO->GetVolumeType() == DiscIO::IVolume::WII_DISC)
{
WiiPartition* partition = reinterpret_cast<WiiPartition*>(m_Treectrl->GetItemData(m_Treectrl->GetSelection()));
FS = partition->FileSystem;
@ -960,7 +962,7 @@ void CISOProperties::CheckPartitionIntegrity(wxCommandEvent& event)
{
// Normally we can't enter this function if we aren't analyzing a Wii disc
// anyway, but let's still check to be sure.
if (!OpenISO->IsWiiDisc())
if (OpenISO->GetVolumeType() != DiscIO::IVolume::WII_DISC)
return;
wxProgressDialog dialog(_("Checking integrity..."), _("Working..."), 1000, this,