Consolidate wad installation to one function in the GUI
now if you install the sysmenu from a wad in the gamelist the menubar will be updated with the new sysmenu version git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7528 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
561b227b77
commit
ffea55d42a
|
@ -270,7 +270,8 @@ EVT_MENU(IDM_MEMCARD, CFrame::OnMemcard)
|
||||||
EVT_MENU(IDM_IMPORTSAVE, CFrame::OnImportSave)
|
EVT_MENU(IDM_IMPORTSAVE, CFrame::OnImportSave)
|
||||||
EVT_MENU(IDM_CHEATS, CFrame::OnShow_CheatsWindow)
|
EVT_MENU(IDM_CHEATS, CFrame::OnShow_CheatsWindow)
|
||||||
EVT_MENU(IDM_CHANGEDISC, CFrame::OnChangeDisc)
|
EVT_MENU(IDM_CHANGEDISC, CFrame::OnChangeDisc)
|
||||||
EVT_MENU(IDM_INSTALLWAD, CFrame::OnLoadWiiMenu)
|
EVT_MENU(IDM_MENU_INSTALLWAD, CFrame::OnInstallWAD)
|
||||||
|
EVT_MENU(IDM_LIST_INSTALLWAD, CFrame::OnInstallWAD)
|
||||||
EVT_MENU(IDM_LOAD_WII_MENU, CFrame::OnLoadWiiMenu)
|
EVT_MENU(IDM_LOAD_WII_MENU, CFrame::OnLoadWiiMenu)
|
||||||
EVT_MENU(IDM_FIFOPLAYER, CFrame::OnFifoPlayer)
|
EVT_MENU(IDM_FIFOPLAYER, CFrame::OnFifoPlayer)
|
||||||
|
|
||||||
|
|
|
@ -340,6 +340,7 @@ private:
|
||||||
|
|
||||||
void OnShow_CheatsWindow(wxCommandEvent& event);
|
void OnShow_CheatsWindow(wxCommandEvent& event);
|
||||||
void OnLoadWiiMenu(wxCommandEvent& event);
|
void OnLoadWiiMenu(wxCommandEvent& event);
|
||||||
|
void OnInstallWAD(wxCommandEvent& event);
|
||||||
void OnFifoPlayer(wxCommandEvent& event);
|
void OnFifoPlayer(wxCommandEvent& event);
|
||||||
void OnConnectWiimote(wxCommandEvent& event);
|
void OnConnectWiimote(wxCommandEvent& event);
|
||||||
void GameListChanged(wxCommandEvent& event);
|
void GameListChanged(wxCommandEvent& event);
|
||||||
|
|
|
@ -204,7 +204,7 @@ void CFrame::CreateMenu()
|
||||||
|
|
||||||
toolsMenu->Append(IDM_NETPLAY, _("Start &NetPlay"));
|
toolsMenu->Append(IDM_NETPLAY, _("Start &NetPlay"));
|
||||||
|
|
||||||
toolsMenu->Append(IDM_INSTALLWAD, _("Install WAD"));
|
toolsMenu->Append(IDM_MENU_INSTALLWAD, _("Install WAD"));
|
||||||
|
|
||||||
const DiscIO::INANDContentLoader & SysMenu_Loader = DiscIO::CNANDContentManager::Access().GetNANDLoader(TITLEID_SYSMENU, true);
|
const DiscIO::INANDContentLoader & SysMenu_Loader = DiscIO::CNANDContentManager::Access().GetNANDLoader(TITLEID_SYSMENU, true);
|
||||||
if (SysMenu_Loader.IsValid())
|
if (SysMenu_Loader.IsValid())
|
||||||
|
@ -212,7 +212,7 @@ void CFrame::CreateMenu()
|
||||||
int sysmenuVersion = SysMenu_Loader.GetTitleVersion();
|
int sysmenuVersion = SysMenu_Loader.GetTitleVersion();
|
||||||
char sysmenuRegion = SysMenu_Loader.GetCountryChar();
|
char sysmenuRegion = SysMenu_Loader.GetCountryChar();
|
||||||
|
|
||||||
toolsMenu->Append(IDM_LOAD_WII_MENU)->SetItemLabel(wxString::Format(_("Load Wii System Menu %d%c"), sysmenuVersion, sysmenuRegion));
|
toolsMenu->Append(IDM_LOAD_WII_MENU, wxString::Format(_("Load Wii System Menu %d%c"), sysmenuVersion, sysmenuRegion));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -220,8 +220,6 @@ void CFrame::CreateMenu()
|
||||||
toolsMenu->Enable(IDM_LOAD_WII_MENU, false);
|
toolsMenu->Enable(IDM_LOAD_WII_MENU, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
toolsMenu->Append(IDM_FIFOPLAYER, _("Fifo Player"));
|
toolsMenu->Append(IDM_FIFOPLAYER, _("Fifo Player"));
|
||||||
|
|
||||||
toolsMenu->AppendSeparator();
|
toolsMenu->AppendSeparator();
|
||||||
|
@ -1326,52 +1324,71 @@ void CFrame::OnShow_CheatsWindow(wxCommandEvent& WXUNUSED (event))
|
||||||
g_CheatsWindow->Raise();
|
g_CheatsWindow->Raise();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CFrame::OnLoadWiiMenu(wxCommandEvent& event)
|
void CFrame::OnLoadWiiMenu(wxCommandEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
if (event.GetId() == IDM_LOAD_WII_MENU)
|
HLE_IPC_CreateVirtualFATFilesystem();
|
||||||
|
BootGame(Common::CreateTitleContentPath(TITLEID_SYSMENU));
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFrame::OnInstallWAD(wxCommandEvent& event)
|
||||||
|
{
|
||||||
|
std::string fileName;
|
||||||
|
|
||||||
|
switch(event.GetId())
|
||||||
{
|
{
|
||||||
HLE_IPC_CreateVirtualFATFilesystem();
|
case IDM_LIST_INSTALLWAD:
|
||||||
BootGame(Common::CreateTitleContentPath(TITLEID_SYSMENU));
|
{
|
||||||
|
const GameListItem *iso = m_GameListCtrl->GetSelectedISO();
|
||||||
|
if (!iso)
|
||||||
|
return;
|
||||||
|
fileName = iso->GetFileName();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
else
|
case IDM_MENU_INSTALLWAD:
|
||||||
{
|
{
|
||||||
|
|
||||||
wxString path = wxFileSelector(
|
wxString path = wxFileSelector(
|
||||||
_("Select a Wii WAD file to install"),
|
_("Select a Wii WAD file to install"),
|
||||||
wxEmptyString, wxEmptyString, wxEmptyString,
|
wxEmptyString, wxEmptyString, wxEmptyString,
|
||||||
_T("Wii WAD file (*.wad)|*.wad"),
|
_T("Wii WAD file (*.wad)|*.wad"),
|
||||||
wxFD_OPEN | wxFD_PREVIEW | wxFD_FILE_MUST_EXIST,
|
wxFD_OPEN | wxFD_PREVIEW | wxFD_FILE_MUST_EXIST,
|
||||||
this);
|
this);
|
||||||
|
fileName = path.mb_str();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
wxProgressDialog dialog(_("Installing WAD..."),
|
wxProgressDialog dialog(_("Installing WAD..."),
|
||||||
_("Working..."),
|
_("Working..."),
|
||||||
1000, // range
|
1000, // range
|
||||||
this, // parent
|
this, // parent
|
||||||
wxPD_APP_MODAL |
|
wxPD_APP_MODAL |
|
||||||
|
wxPD_ELAPSED_TIME |
|
||||||
|
wxPD_ESTIMATED_TIME |
|
||||||
|
wxPD_REMAINING_TIME |
|
||||||
wxPD_SMOOTH // - makes indeterminate mode bar on WinXP very small
|
wxPD_SMOOTH // - makes indeterminate mode bar on WinXP very small
|
||||||
);
|
);
|
||||||
|
|
||||||
dialog.CenterOnParent();
|
|
||||||
u64 titleID = CBoot::Install_WiiWAD(path.mb_str());
|
|
||||||
if (titleID == TITLEID_SYSMENU)
|
|
||||||
{
|
|
||||||
const DiscIO::INANDContentLoader & SysMenu_Loader = DiscIO::CNANDContentManager::Access().GetNANDLoader(TITLEID_SYSMENU, true);
|
|
||||||
if (SysMenu_Loader.IsValid())
|
|
||||||
{
|
|
||||||
int sysmenuVersion = SysMenu_Loader.GetTitleVersion();
|
|
||||||
char sysmenuRegion = SysMenu_Loader.GetCountryChar();
|
|
||||||
|
|
||||||
GetMenuBar()->FindItem(IDM_LOAD_WII_MENU)->Enable();
|
|
||||||
GetMenuBar()->FindItem(IDM_LOAD_WII_MENU)->SetItemLabel(wxString::Format(_("Load Wii System Menu %d%c"), sysmenuVersion, sysmenuRegion));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
GetMenuBar()->FindItem(IDM_LOAD_WII_MENU)->Enable(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
dialog.CenterOnParent();
|
||||||
|
|
||||||
|
u64 titleID = CBoot::Install_WiiWAD(fileName.c_str());
|
||||||
|
if (titleID == TITLEID_SYSMENU)
|
||||||
|
{
|
||||||
|
const DiscIO::INANDContentLoader & SysMenu_Loader = DiscIO::CNANDContentManager::Access().GetNANDLoader(TITLEID_SYSMENU, true);
|
||||||
|
if (SysMenu_Loader.IsValid())
|
||||||
|
{
|
||||||
|
int sysmenuVersion = SysMenu_Loader.GetTitleVersion();
|
||||||
|
char sysmenuRegion = SysMenu_Loader.GetCountryChar();
|
||||||
|
|
||||||
|
GetMenuBar()->FindItem(IDM_LOAD_WII_MENU)->Enable();
|
||||||
|
GetMenuBar()->FindItem(IDM_LOAD_WII_MENU)->SetItemLabel(wxString::Format(_("Load Wii System Menu %d%c"), sysmenuVersion, sysmenuRegion));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
GetMenuBar()->FindItem(IDM_LOAD_WII_MENU)->Enable(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CFrame::OnFifoPlayer(wxCommandEvent& WXUNUSED (event))
|
void CFrame::OnFifoPlayer(wxCommandEvent& WXUNUSED (event))
|
||||||
|
|
|
@ -133,7 +133,6 @@ BEGIN_EVENT_TABLE(CGameListCtrl, wxListCtrl)
|
||||||
EVT_MENU(IDM_MULTICOMPRESSGCM, CGameListCtrl::OnMultiCompressGCM)
|
EVT_MENU(IDM_MULTICOMPRESSGCM, CGameListCtrl::OnMultiCompressGCM)
|
||||||
EVT_MENU(IDM_MULTIDECOMPRESSGCM, CGameListCtrl::OnMultiDecompressGCM)
|
EVT_MENU(IDM_MULTIDECOMPRESSGCM, CGameListCtrl::OnMultiDecompressGCM)
|
||||||
EVT_MENU(IDM_DELETEGCM, CGameListCtrl::OnDeleteGCM)
|
EVT_MENU(IDM_DELETEGCM, CGameListCtrl::OnDeleteGCM)
|
||||||
EVT_MENU(IDM_INSTALLWAD, CGameListCtrl::OnInstallWAD)
|
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
CGameListCtrl::CGameListCtrl(wxWindow* parent, const wxWindowID id, const
|
CGameListCtrl::CGameListCtrl(wxWindow* parent, const wxWindowID id, const
|
||||||
|
@ -1006,7 +1005,7 @@ void CGameListCtrl::OnRightClick(wxMouseEvent& event)
|
||||||
else
|
else
|
||||||
popupMenu->Append(IDM_COMPRESSGCM, _("Compress ISO..."));
|
popupMenu->Append(IDM_COMPRESSGCM, _("Compress ISO..."));
|
||||||
} else
|
} else
|
||||||
popupMenu->Append(IDM_INSTALLWAD, _("Install to Wii Menu"));
|
popupMenu->Append(IDM_LIST_INSTALLWAD, _("Install to Wii Menu"));
|
||||||
|
|
||||||
PopupMenu(popupMenu);
|
PopupMenu(popupMenu);
|
||||||
}
|
}
|
||||||
|
@ -1164,28 +1163,6 @@ void CGameListCtrl::OnWiki(wxCommandEvent& WXUNUSED (event))
|
||||||
WxUtils::Launch(wikiUrl.c_str());
|
WxUtils::Launch(wikiUrl.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CGameListCtrl::OnInstallWAD(wxCommandEvent& WXUNUSED (event))
|
|
||||||
{
|
|
||||||
const GameListItem *iso = GetSelectedISO();
|
|
||||||
if (!iso)
|
|
||||||
return;
|
|
||||||
|
|
||||||
wxProgressDialog dialog(_("Installing WAD to Wii Menu..."),
|
|
||||||
_("Working..."),
|
|
||||||
1000, // range
|
|
||||||
this, // parent
|
|
||||||
wxPD_APP_MODAL |
|
|
||||||
wxPD_ELAPSED_TIME |
|
|
||||||
wxPD_ESTIMATED_TIME |
|
|
||||||
wxPD_REMAINING_TIME |
|
|
||||||
wxPD_SMOOTH // - makes indeterminate mode bar on WinXP very small
|
|
||||||
);
|
|
||||||
|
|
||||||
dialog.CenterOnParent();
|
|
||||||
|
|
||||||
CBoot::Install_WiiWAD(iso->GetFileName().c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
void CGameListCtrl::MultiCompressCB(const char* text, float percent, void* arg)
|
void CGameListCtrl::MultiCompressCB(const char* text, float percent, void* arg)
|
||||||
{
|
{
|
||||||
percent = (((float)m_currentItem) + percent) / (float)m_numberItem;
|
percent = (((float)m_currentItem) + percent) / (float)m_numberItem;
|
||||||
|
|
|
@ -94,6 +94,8 @@ enum
|
||||||
IDM_PROPERTIES,
|
IDM_PROPERTIES,
|
||||||
IDM_GAMEWIKI,
|
IDM_GAMEWIKI,
|
||||||
IDM_LOAD_WII_MENU,
|
IDM_LOAD_WII_MENU,
|
||||||
|
IDM_MENU_INSTALLWAD,
|
||||||
|
IDM_LIST_INSTALLWAD,
|
||||||
IDM_FIFOPLAYER,
|
IDM_FIFOPLAYER,
|
||||||
IDM_CONNECT_WIIMOTE1,
|
IDM_CONNECT_WIIMOTE1,
|
||||||
IDM_CONNECT_WIIMOTE2,
|
IDM_CONNECT_WIIMOTE2,
|
||||||
|
@ -233,7 +235,6 @@ enum
|
||||||
IDM_COMPRESSGCM,
|
IDM_COMPRESSGCM,
|
||||||
IDM_MULTICOMPRESSGCM,
|
IDM_MULTICOMPRESSGCM,
|
||||||
IDM_MULTIDECOMPRESSGCM,
|
IDM_MULTIDECOMPRESSGCM,
|
||||||
IDM_INSTALLWAD,
|
|
||||||
IDM_UPDATELOGDISPLAY,
|
IDM_UPDATELOGDISPLAY,
|
||||||
IDM_UPDATEDISASMDIALOG,
|
IDM_UPDATEDISASMDIALOG,
|
||||||
IDM_UPDATEGUI,
|
IDM_UPDATEGUI,
|
||||||
|
|
|
@ -248,14 +248,13 @@ void CWiiSaveCrypted::ImportWiiSaveFiles()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int lastpos = HEADER_SZ + BK_SZ;
|
fpData_bin.Seek(HEADER_SZ + BK_SZ, SEEK_SET);
|
||||||
|
|
||||||
|
|
||||||
FileHDR _tmpFileHDR;
|
FileHDR _tmpFileHDR;
|
||||||
|
|
||||||
for(u32 i = 0; i < _numberOfFiles; i++)
|
for(u32 i = 0; i < _numberOfFiles; i++)
|
||||||
{
|
{
|
||||||
fpData_bin.Seek(lastpos, SEEK_SET);
|
|
||||||
memset(&_tmpFileHDR, 0, FILE_HDR_SZ);
|
memset(&_tmpFileHDR, 0, FILE_HDR_SZ);
|
||||||
memset(IV, 0, 0x10);
|
memset(IV, 0, 0x10);
|
||||||
_fileSize = 0;
|
_fileSize = 0;
|
||||||
|
@ -266,7 +265,6 @@ void CWiiSaveCrypted::ImportWiiSaveFiles()
|
||||||
b_valid = false;
|
b_valid = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
lastpos += FILE_HDR_SZ;
|
|
||||||
if (Common::swap32(_tmpFileHDR.magic) != FILE_HDR_MAGIC)
|
if (Common::swap32(_tmpFileHDR.magic) != FILE_HDR_MAGIC)
|
||||||
{
|
{
|
||||||
PanicAlertT("Bad File Header");
|
PanicAlertT("Bad File Header");
|
||||||
|
@ -287,7 +285,6 @@ void CWiiSaveCrypted::ImportWiiSaveFiles()
|
||||||
{
|
{
|
||||||
_fileSize = Common::swap32(_tmpFileHDR.size);
|
_fileSize = Common::swap32(_tmpFileHDR.size);
|
||||||
u32 RoundedFileSize = ROUND_UP(_fileSize, BLOCK_SZ);
|
u32 RoundedFileSize = ROUND_UP(_fileSize, BLOCK_SZ);
|
||||||
lastpos += RoundedFileSize;
|
|
||||||
_encryptedData = new u8[RoundedFileSize];
|
_encryptedData = new u8[RoundedFileSize];
|
||||||
_data = new u8[RoundedFileSize];
|
_data = new u8[RoundedFileSize];
|
||||||
if (!fpData_bin.ReadBytes(_encryptedData, RoundedFileSize))
|
if (!fpData_bin.ReadBytes(_encryptedData, RoundedFileSize))
|
||||||
|
|
Loading…
Reference in New Issue