mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-14 21:37:52 -07:00
DolphinWX: Use title ID from ISOFile when possible
This skips creating volume objects, which can take a while.
This commit is contained in:
parent
c36d24a851
commit
71d105e545
@ -1227,9 +1227,7 @@ void CFrame::OnUninstallWAD(wxCommandEvent&)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto volume = DiscIO::CreateVolumeFromFilename(file->GetFileName());
|
u64 title_id = file->GetTitleID();
|
||||||
u64 title_id;
|
|
||||||
volume->GetTitleID(&title_id);
|
|
||||||
if (!DiscIO::CNANDContentManager::Access().RemoveTitle(title_id, Common::FROM_CONFIGURED_ROOT))
|
if (!DiscIO::CNANDContentManager::Access().RemoveTitle(title_id, Common::FROM_CONFIGURED_ROOT))
|
||||||
{
|
{
|
||||||
PanicAlertT("Failed to remove this title from the NAND.");
|
PanicAlertT("Failed to remove this title from the NAND.");
|
||||||
|
@ -959,15 +959,10 @@ void CGameListCtrl::OnLeftClick(wxMouseEvent& event)
|
|||||||
event.Skip();
|
event.Skip();
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool IsWADInstalled(const std::string& wad_path)
|
static bool IsWADInstalled(const GameListItem& wad)
|
||||||
{
|
{
|
||||||
const auto volume = DiscIO::CreateVolumeFromFilename(wad_path);
|
|
||||||
u64 title_id;
|
|
||||||
if (!volume || !volume->GetTitleID(&title_id))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
const std::string content_dir =
|
const std::string content_dir =
|
||||||
Common::GetTitleContentPath(title_id, Common::FromWhichRoot::FROM_CONFIGURED_ROOT);
|
Common::GetTitleContentPath(wad.GetTitleID(), Common::FromWhichRoot::FROM_CONFIGURED_ROOT);
|
||||||
|
|
||||||
if (!File::IsDirectory(content_dir))
|
if (!File::IsDirectory(content_dir))
|
||||||
return false;
|
return false;
|
||||||
@ -1055,7 +1050,7 @@ void CGameListCtrl::OnRightClick(wxMouseEvent& event)
|
|||||||
for (auto* menu_item : {install_wad_item, uninstall_wad_item})
|
for (auto* menu_item : {install_wad_item, uninstall_wad_item})
|
||||||
menu_item->Enable(!Core::IsRunning() || !SConfig::GetInstance().bWii);
|
menu_item->Enable(!Core::IsRunning() || !SConfig::GetInstance().bWii);
|
||||||
|
|
||||||
if (!IsWADInstalled(selected_iso->GetFileName()))
|
if (!IsWADInstalled(*selected_iso))
|
||||||
uninstall_wad_item->Enable(false);
|
uninstall_wad_item->Enable(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1140,15 +1135,8 @@ void CGameListCtrl::OnOpenSaveFolder(wxCommandEvent& WXUNUSED(event))
|
|||||||
void CGameListCtrl::OnExportSave(wxCommandEvent& WXUNUSED(event))
|
void CGameListCtrl::OnExportSave(wxCommandEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
const GameListItem* iso = GetSelectedISO();
|
const GameListItem* iso = GetSelectedISO();
|
||||||
if (!iso)
|
if (iso)
|
||||||
return;
|
CWiiSaveCrypted::ExportWiiSave(iso->GetTitleID());
|
||||||
|
|
||||||
u64 title_id;
|
|
||||||
std::unique_ptr<DiscIO::IVolume> volume(DiscIO::CreateVolumeFromFilename(iso->GetFileName()));
|
|
||||||
if (volume && volume->GetTitleID(&title_id))
|
|
||||||
{
|
|
||||||
CWiiSaveCrypted::ExportWiiSave(title_id);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Save this file as the default file
|
// Save this file as the default file
|
||||||
|
@ -361,18 +361,11 @@ std::vector<DiscIO::Language> GameListItem::GetLanguages() const
|
|||||||
|
|
||||||
const std::string GameListItem::GetWiiFSPath() const
|
const std::string GameListItem::GetWiiFSPath() const
|
||||||
{
|
{
|
||||||
std::unique_ptr<DiscIO::IVolume> iso(DiscIO::CreateVolumeFromFilename(m_FileName));
|
|
||||||
std::string ret;
|
std::string ret;
|
||||||
|
|
||||||
if (iso == nullptr)
|
if (m_Platform != DiscIO::Platform::GAMECUBE_DISC)
|
||||||
return ret;
|
|
||||||
|
|
||||||
if (iso->GetVolumeType() != DiscIO::Platform::GAMECUBE_DISC)
|
|
||||||
{
|
{
|
||||||
u64 title_id = 0;
|
const std::string path = Common::GetTitleDataPath(m_title_id, Common::FROM_CONFIGURED_ROOT);
|
||||||
iso->GetTitleID(&title_id);
|
|
||||||
|
|
||||||
const std::string path = Common::GetTitleDataPath(title_id, Common::FROM_CONFIGURED_ROOT);
|
|
||||||
|
|
||||||
if (!File::Exists(path))
|
if (!File::Exists(path))
|
||||||
File::CreateFullPath(path);
|
File::CreateFullPath(path);
|
||||||
|
@ -46,6 +46,7 @@ public:
|
|||||||
std::string GetCompany() const { return m_company; }
|
std::string GetCompany() const { return m_company; }
|
||||||
u16 GetRevision() const { return m_Revision; }
|
u16 GetRevision() const { return m_Revision; }
|
||||||
const std::string& GetGameID() const { return m_game_id; }
|
const std::string& GetGameID() const { return m_game_id; }
|
||||||
|
u64 GetTitleID() const { return m_title_id; }
|
||||||
const std::string GetWiiFSPath() const;
|
const std::string GetWiiFSPath() const;
|
||||||
DiscIO::Region GetRegion() const { return m_region; }
|
DiscIO::Region GetRegion() const { return m_region; }
|
||||||
DiscIO::Country GetCountry() const { return m_Country; }
|
DiscIO::Country GetCountry() const { return m_Country; }
|
||||||
@ -70,7 +71,7 @@ private:
|
|||||||
std::string m_company;
|
std::string m_company;
|
||||||
|
|
||||||
std::string m_game_id;
|
std::string m_game_id;
|
||||||
u64 m_title_id;
|
u64 m_title_id = 0;
|
||||||
|
|
||||||
std::string m_issues;
|
std::string m_issues;
|
||||||
int m_emu_state;
|
int m_emu_state;
|
||||||
|
Loading…
Reference in New Issue
Block a user