* Make remove Wii games safe again for ppl that don't have their games in subfolders

* Close disc after installing a game
This commit is contained in:
overjoy.psm 2012-05-04 08:04:23 +00:00
parent 1e0cc275d8
commit 9f7ef01f79
2 changed files with 21 additions and 7 deletions

View File

@ -158,20 +158,25 @@ s32 WBFS_Ext_RemoveGame(u8 *discid, char *gamepath)
char folder[MAX_FAT_PATH]; char folder[MAX_FAT_PATH];
STRCOPY(folder, gamepath); STRCOPY(folder, gamepath);
char *p = strrchr(folder, '/'); char *p = strrchr(folder, '/');
if (p) *p = 0; if(p) *p = 0;
dir_iter = opendir(folder); dir_iter = opendir(folder);
if (!dir_iter) return 0; if (!dir_iter) return 0;
while ((ent = readdir(dir_iter)) != NULL) while((ent = readdir(dir_iter)) != NULL)
{
//if(ent->d_name[0] == '.')
// continue;
if(strstr(ent->d_name, (char*)discid) != NULL)
{ {
if (ent->d_name[0] == '.') continue;
snprintf(file, sizeof(file), "%s/%s", folder, ent->d_name); snprintf(file, sizeof(file), "%s/%s", folder, ent->d_name);
//if(discid != NULL && strstr(file, (char*)discid) != NULL) //if(discid != NULL && strstr(file, (char*)discid) != NULL)
remove(file); remove(file);
} }
}
closedir(dir_iter); closedir(dir_iter);
//if(strlen(folder) > 11) if(strlen(folder) > 11)
unlink(folder); unlink(folder);
return 0; return 0;
} }

View File

@ -8,6 +8,7 @@
#include "music/SoundHandler.hpp" #include "music/SoundHandler.hpp"
#include "channel/nand.hpp" #include "channel/nand.hpp"
#include "defines.h" #include "defines.h"
#include "wdvd.h"
using namespace std; using namespace std;
@ -439,13 +440,21 @@ bool CMenu::_wbfsOp(CMenu::WBFS_OP op)
m_btnMgr.setProgress(m_wbfsPBar, m_thrdProgress); m_btnMgr.setProgress(m_wbfsPBar, m_thrdProgress);
m_btnMgr.setText(m_wbfsLblMessage, wfmt(_fmt("wbfsprogress", L"%i%%"), (int)(m_thrdProgress * 100.f))); m_btnMgr.setText(m_wbfsLblMessage, wfmt(_fmt("wbfsprogress", L"%i%%"), (int)(m_thrdProgress * 100.f)));
if (!m_thrdWorking) if (!m_thrdWorking)
{
if(op == CMenu::WO_ADD_GAME)
{
WDVD_StopMotor();
WDVD_Close();
}
m_btnMgr.show(m_wbfsBtnBack); m_btnMgr.show(m_wbfsBtnBack);
} }
} }
}
_hideWBFS(); _hideWBFS();
if (done && (op == CMenu::WO_REMOVE_GAME || op == CMenu::WO_ADD_GAME)) if (done && (op == CMenu::WO_REMOVE_GAME || op == CMenu::WO_ADD_GAME))
{ {
m_gameList.SetLanguage(m_loc.getString(m_curLanguage, "gametdb_code", "EN").c_str()); m_gameList.SetLanguage(m_loc.getString(m_curLanguage, "gametdb_code", "EN").c_str());
if(upd_dml) if(upd_dml)
UpdateCache(COVERFLOW_DML); UpdateCache(COVERFLOW_DML);