Added Open Wii save folder menu item to GameListCtrl, fixed a few remaining path and casting problems

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3135 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
sl1nk3.s
2009-05-02 18:06:42 +00:00
parent e89af68f4d
commit 168362288c
7 changed files with 56 additions and 12 deletions

View File

@ -88,6 +88,7 @@ EVT_LIST_COL_BEGIN_DRAG(LIST_CTRL, CGameListCtrl::OnColBeginDrag)
EVT_LIST_COL_CLICK(LIST_CTRL, CGameListCtrl::OnColumnClick)
EVT_MENU(IDM_PROPERTIES, CGameListCtrl::OnProperties)
EVT_MENU(IDM_OPENCONTAININGFOLDER, CGameListCtrl::OnOpenContainingFolder)
EVT_MENU(IDM_OPENSAVEFOLDER, CGameListCtrl::OnOpenSaveFolder)
EVT_MENU(IDM_SETDEFAULTGCM, CGameListCtrl::OnSetDefaultGCM)
EVT_MENU(IDM_COMPRESSGCM, CGameListCtrl::OnCompressGCM)
EVT_MENU(IDM_MULTICOMPRESSGCM, CGameListCtrl::OnMultiCompressGCM)
@ -620,6 +621,8 @@ void CGameListCtrl::OnRightClick(wxMouseEvent& event)
wxMenu popupMenu;
popupMenu.Append(IDM_PROPERTIES, _("&Properties"));
popupMenu.AppendSeparator();
if (selected_iso->IsWii())
popupMenu.Append(IDM_OPENSAVEFOLDER, _("Open Wii &save folder"));
popupMenu.Append(IDM_OPENCONTAININGFOLDER, _("Open &containing folder"));
popupMenu.AppendCheckItem(IDM_SETDEFAULTGCM, _("Set as &default ISO"));
@ -687,6 +690,15 @@ void CGameListCtrl::OnOpenContainingFolder(wxCommandEvent& WXUNUSED (event))
WxUtils::Explore(path.c_str());
}
void CGameListCtrl::OnOpenSaveFolder(wxCommandEvent& WXUNUSED (event))
{
const GameListItem *iso = GetSelectedISO();
if (!iso)
return;
if (iso->GetWiiFSPath() != "NULL")
WxUtils::Explore(iso->GetWiiFSPath().c_str());
}
// =======================================================
// Save this file as the default file

View File

@ -79,6 +79,7 @@ private:
void OnSize(wxSizeEvent& event);
void OnProperties(wxCommandEvent& event);
void OnOpenContainingFolder(wxCommandEvent& event);
void OnOpenSaveFolder(wxCommandEvent& event);
void OnSetDefaultGCM(wxCommandEvent& event);
void OnDeleteGCM(wxCommandEvent& event);
void OnCompressGCM(wxCommandEvent& event);

View File

@ -98,6 +98,7 @@ enum
IDM_TOGGLE_CONSOLE,
IDM_NOTIFYMAPLOADED,
IDM_OPENCONTAININGFOLDER,
IDM_OPENSAVEFOLDER,
IDM_SETDEFAULTGCM,
IDM_DELETEGCM,
IDM_COMPRESSGCM,

View File

@ -206,3 +206,29 @@ const std::string& GameListItem::GetName(int index) const
return m_Name[0];
}
const std::string GameListItem::GetWiiFSPath() const
{
DiscIO::IVolume *Iso = DiscIO::CreateVolumeFromFilename(m_FileName);
if (Iso != NULL)
{
if (DiscIO::IsVolumeWiiDisc(Iso))
{
char Path[250];
u64 Title;
Iso->RAWRead((u64)0x0F8001DC, 8, (u8*)&Title);
Title = Common::swap64(Title);
sprintf(Path, FULL_WII_USER_DIR "title/%08x/%08x/data/", (u32)(Title>>32), (u32)Title);
if (!File::Exists(Path))
File::CreateFullPath(Path);
return std::string(wxGetCwd().mb_str()) + std::string(Path).substr(strlen(ROOT_DIR));
}
}
return "NULL";
}

View File

@ -33,6 +33,7 @@ public:
const std::string& GetCompany() const {return m_Company;}
const std::string& GetDescription(int index) const;
const std::string& GetUniqueID() const {return m_UniqueID;}
const std::string GetWiiFSPath() const;
DiscIO::IVolume::ECountry GetCountry() const {return m_Country;}
const std::string& GetIssues() const {return m_Issues;}
bool IsCompressed() const {return m_BlobCompressed;}