fix infinitely recursive deletion from r7587 and actually update locations of content.map and uid.sys

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7588 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
LPFaint99 2011-06-05 07:42:40 +00:00
parent 2c4bc6d94c
commit b808af1d7f
4 changed files with 24 additions and 38 deletions

View File

@ -22,6 +22,7 @@
#include "IniFile.h"
#include "ConfigManager.h"
#include "FileUtil.h"
#include "NANDContentLoader.h"
SConfig* SConfig::m_Instance;
@ -278,6 +279,8 @@ void SConfig::LoadSettings()
ini.Get("General", "NANDRoot", &m_NANDPath);
m_NANDPath = File::GetUserPath(D_WIIROOT_IDX, m_NANDPath);
DiscIO::cUIDsys::AccessInstance().UpdateLocation();
DiscIO::CSharedContent::AccessInstance().UpdateLocation();
}
{

View File

@ -28,23 +28,18 @@
namespace DiscIO
{
CSharedContent *CSharedContent::m_Instance = NULL;
cUIDsys *cUIDsys::m_Instance = NULL;
CSharedContent CSharedContent::m_Instance;
cUIDsys cUIDsys::m_Instance;
CSharedContent& CSharedContent::AccessInstance()
CSharedContent::CSharedContent()
{
if (!m_Instance) m_Instance = new CSharedContent;
return *m_Instance;
UpdateLocation();
}
void CSharedContent::UpdateLocation()
{
delete m_Instance;
m_Instance = new CSharedContent;
}
CSharedContent::CSharedContent()
{
m_Elements.clear();
lastID = 0;
sprintf(contentMap, "%sshared1/content.map", File::GetUserPath(D_WIIUSER_IDX).c_str());
@ -58,10 +53,7 @@ CSharedContent::CSharedContent()
}
CSharedContent::~CSharedContent()
{
delete m_Instance;
m_Instance = NULL;
}
{}
std::string CSharedContent::GetFilenameFromSHA1(u8* _pHash)
{
@ -409,22 +401,16 @@ void CNANDContentLoader::RemoveTitle() const
}
}
cUIDsys& cUIDsys::AccessInstance()
cUIDsys::cUIDsys()
{
if (!m_Instance) m_Instance = new cUIDsys;
return *m_Instance;
UpdateLocation();
}
void cUIDsys::UpdateLocation()
{
delete m_Instance;
m_Instance = new cUIDsys;
}
cUIDsys::cUIDsys()
{
sprintf(uidSys, "%ssys/uid.sys", File::GetUserPath(D_WIIUSER_IDX).c_str());
m_Elements.clear();
lastUID = 0x00001000;
sprintf(uidSys, "%ssys/uid.sys", File::GetUserPath(D_WIIUSER_IDX).c_str());
File::IOFile pFile(uidSys, "rb");
SElement Element;
@ -448,10 +434,7 @@ cUIDsys::cUIDsys()
}
cUIDsys::~cUIDsys()
{
delete m_Instance;
m_Instance = NULL;
}
{}
u32 cUIDsys::GetUIDFromTitle(u64 _Title)
{

View File

@ -106,11 +106,11 @@ class CSharedContent
{
public:
static CSharedContent& AccessInstance();
static void UpdateLocation();
static CSharedContent& AccessInstance() { return m_Instance; }
std::string GetFilenameFromSHA1(u8* _pHash);
std::string AddSharedContent(u8* _pHash);
void UpdateLocation();
private:
@ -130,19 +130,19 @@ private:
u32 lastID;
char contentMap[1024];
std::vector<SElement> m_Elements;
static CSharedContent *m_Instance;
static CSharedContent m_Instance;
};
class cUIDsys
{
public:
static cUIDsys& AccessInstance();
static void UpdateLocation();
static cUIDsys& AccessInstance() { return m_Instance; }
u32 GetUIDFromTitle(u64 _Title);
void AddTitle(u64 _Title);
void GetTitleIDs(std::vector<u64>& _TitleIDs, bool _owned = false);
void UpdateLocation();
private:
@ -160,7 +160,7 @@ private:
u32 lastUID;
char uidSys[1024];
std::vector<SElement> m_Elements;
static cUIDsys *m_Instance;
static cUIDsys m_Instance;
};
}

View File

@ -1203,8 +1203,8 @@ void CConfigMain::NANDRootChanged(wxFileDirPickerEvent& WXUNUSED (event))
SConfig::GetInstance().m_NANDPath = File::GetUserPath(D_WIIROOT_IDX, std::string(NANDRoot->GetPath().mb_str()));
NANDRoot->SetPath(wxString(NANDPath.c_str(), *wxConvCurrent));
SConfig::GetInstance().m_SYSCONF->UpdateLocation();
DiscIO::cUIDsys::UpdateLocation();
DiscIO::CSharedContent::UpdateLocation();
DiscIO::cUIDsys::AccessInstance().UpdateLocation();
DiscIO::CSharedContent::AccessInstance().UpdateLocation();
main_frame->UpdateWiiMenuChoice();
}