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

@ -73,7 +73,7 @@ CWII_IPC_HLE_Device_es::CWII_IPC_HLE_Device_es(u32 _DeviceID, const std::string&
// blindly grab the titleID from the disc - it's unencrypted at:
// offset 0x0F8001DC and 0x0F80044C
VolumeHandler::RAWReadToPtr((u8*)&m_TitleID, (u64)0x0F8001DC, 8);
m_TitleID = Common::swap64(m_TitleID);
m_TitleID = Common::swap64(m_TitleID);
}
else
{
@ -92,7 +92,7 @@ CWII_IPC_HLE_Device_es::CWII_IPC_HLE_Device_es(u32 _DeviceID, const std::string&
//FindValidTitleIDs();
INFO_LOG(WII_IPC_ES, "Set default title to %08x/%08x", m_TitleID>>32, m_TitleID);
INFO_LOG(WII_IPC_ES, "Set default title to %08x/%08x", (u32)(m_TitleID>>32), (u32)m_TitleID);
}
CWII_IPC_HLE_Device_es::~CWII_IPC_HLE_Device_es()
@ -574,7 +574,7 @@ bool CWII_IPC_HLE_Device_es::IOCtlV(u32 _CommandAddress)
}
Memory::Write_U32(0, _CommandAddress + 0x4);
INFO_LOG(WII_IPC_ES, "IOCTL_ES_GETTMDVIEWS: title: %08x/%08x (buffer size: %i)", TitleID >> 32, TitleID, MaxCount);
INFO_LOG(WII_IPC_ES, "IOCTL_ES_GETTMDVIEWS: title: %08x/%08x (buffer size: %i)", (u32)(TitleID >> 32), (u32)TitleID, MaxCount);
return true;
}
break;

View File

@ -57,16 +57,19 @@ bool CWII_IPC_HLE_Device_fs::Open(u32 _CommandAddress, u32 _Mode)
// create home directory
if (VolumeHandler::IsValid())
{
u32 TitleID = VolumeHandler::Read32(0);
_dbg_assert_(WII_IPC_FILEIO, TitleID != 0);
if (TitleID == 0) TitleID = 0xF00DBEEF;
char* pTitleID = (char*)&TitleID;
char Path[260+1];
sprintf(Path, FULL_WII_USER_DIR "title/00010000/%02x%02x%02x%02x/data/nocopy/",
(u8)pTitleID[3], (u8)pTitleID[2], (u8)pTitleID[1], (u8)pTitleID[0]);
u32 TitleID, GameID;
VolumeHandler::RAWReadToPtr((u8*)&TitleID, 0x0F8001DC, 4);
TitleID = Common::swap32(TitleID);
GameID = VolumeHandler::Read32(0);
_dbg_assert_(WII_IPC_FILEIO, GameID != 0);
if (GameID == 0) GameID = 0xF00DBEEF;
if (TitleID == 0) TitleID = 0x00010000;
sprintf(Path, FULL_WII_USER_DIR "title/%08x/%08x/data/nocopy/", TitleID, GameID);
File::CreateFullPath(Path);
}

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;}