mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-24 14:49:42 -06:00
Always use configured root when installing WAD
This prevents Dolphin from writing to /sys/uid.sys (on the host; root partition) when installing a WAD before starting emulation, because the session root is not initialized at that moment. Incidentally, this also gets rid of a singleton.
This commit is contained in:
@ -398,16 +398,11 @@ void CNANDContentLoader::RemoveTitle() const
|
||||
}
|
||||
}
|
||||
|
||||
cUIDsys::cUIDsys()
|
||||
{
|
||||
UpdateLocation();
|
||||
}
|
||||
|
||||
void cUIDsys::UpdateLocation()
|
||||
cUIDsys::cUIDsys(Common::FromWhichRoot root)
|
||||
{
|
||||
m_Elements.clear();
|
||||
m_LastUID = 0x00001000;
|
||||
m_UidSys = File::GetUserPath(D_SESSION_WIIROOT_IDX) + "/sys/uid.sys";
|
||||
m_UidSys = Common::RootUserPath(root) + "/sys/uid.sys";
|
||||
|
||||
File::IOFile pFile(m_UidSys, "rb");
|
||||
SElement Element;
|
||||
@ -430,10 +425,6 @@ void cUIDsys::UpdateLocation()
|
||||
}
|
||||
}
|
||||
|
||||
cUIDsys::~cUIDsys()
|
||||
{
|
||||
}
|
||||
|
||||
u32 cUIDsys::GetUIDFromTitle(u64 title_id)
|
||||
{
|
||||
for (auto& Element : m_Elements)
|
||||
@ -541,7 +532,8 @@ u64 CNANDContentManager::Install_WiiWAD(const std::string& filename)
|
||||
return 0;
|
||||
}
|
||||
|
||||
cUIDsys::AccessInstance().AddTitle(title_id);
|
||||
cUIDsys uid_sys{Common::FromWhichRoot::FROM_CONFIGURED_ROOT};
|
||||
uid_sys.AddTitle(title_id);
|
||||
|
||||
ClearCache();
|
||||
|
||||
|
@ -188,27 +188,16 @@ private:
|
||||
std::vector<SElement> m_Elements;
|
||||
};
|
||||
|
||||
class cUIDsys
|
||||
class cUIDsys final
|
||||
{
|
||||
public:
|
||||
static cUIDsys& AccessInstance()
|
||||
{
|
||||
static cUIDsys instance;
|
||||
return instance;
|
||||
}
|
||||
explicit cUIDsys(Common::FromWhichRoot root);
|
||||
|
||||
u32 GetUIDFromTitle(u64 title_id);
|
||||
void AddTitle(u64 title_id);
|
||||
void GetTitleIDs(std::vector<u64>& title_ids, bool owned = false);
|
||||
void UpdateLocation();
|
||||
|
||||
private:
|
||||
cUIDsys();
|
||||
virtual ~cUIDsys();
|
||||
|
||||
cUIDsys(cUIDsys const&) = delete;
|
||||
void operator=(cUIDsys const&) = delete;
|
||||
|
||||
#pragma pack(push, 1)
|
||||
struct SElement
|
||||
{
|
||||
|
Reference in New Issue
Block a user