mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-06-16 12:58:33 +02:00
Mark which Wii root to use in the NAND path code.
It's used by both the GUI to do things like install WADs and check up on the system menu, in which case the global root should be used, and by /dev/es, in which case the local one should. The latter isn't *terribly* useful today, since no contents will ever be installed in temporary roots (although it's still relevant for data directories), but converting the whole thing makes sense because then it will Just Work once the entire NAND is synced. Because it would have been a bit of work to split it up (but I can if desired), this commit also contains some basic cleanup of NANDContentLoader: (1) The useless interface class INANDContentLoader is removed and the methods are changed to just return CNANDContentLoader (the only implementation); (2) CNANDContentManager is changed to use unique_ptr and cleaned up a bit.
This commit is contained in:
@ -56,34 +56,40 @@ void ShutdownWiiRoot()
|
||||
}
|
||||
}
|
||||
|
||||
std::string GetTicketFileName(u64 _titleID)
|
||||
static std::string RootUserPath(FromWhichRoot from)
|
||||
{
|
||||
int idx = from == FROM_CONFIGURED_ROOT ? D_WIIROOT_IDX : D_SESSION_WIIROOT_IDX;
|
||||
return File::GetUserPath(idx);
|
||||
}
|
||||
|
||||
std::string GetTicketFileName(u64 _titleID, FromWhichRoot from)
|
||||
{
|
||||
return StringFromFormat("%s/ticket/%08x/%08x.tik",
|
||||
File::GetUserPath(D_SESSION_WIIROOT_IDX).c_str(),
|
||||
RootUserPath(from).c_str(),
|
||||
(u32)(_titleID >> 32), (u32)_titleID);
|
||||
}
|
||||
|
||||
std::string GetTitleDataPath(u64 _titleID)
|
||||
std::string GetTitleDataPath(u64 _titleID, FromWhichRoot from)
|
||||
{
|
||||
return StringFromFormat("%s/title/%08x/%08x/data/",
|
||||
File::GetUserPath(D_SESSION_WIIROOT_IDX).c_str(),
|
||||
RootUserPath(from).c_str(),
|
||||
(u32)(_titleID >> 32), (u32)_titleID);
|
||||
}
|
||||
|
||||
std::string GetTMDFileName(u64 _titleID)
|
||||
std::string GetTMDFileName(u64 _titleID, FromWhichRoot from)
|
||||
{
|
||||
return GetTitleContentPath(_titleID) + "title.tmd";
|
||||
return GetTitleContentPath(_titleID, from) + "title.tmd";
|
||||
}
|
||||
std::string GetTitleContentPath(u64 _titleID)
|
||||
std::string GetTitleContentPath(u64 _titleID, FromWhichRoot from)
|
||||
{
|
||||
return StringFromFormat("%s/title/%08x/%08x/content/",
|
||||
File::GetUserPath(D_SESSION_WIIROOT_IDX).c_str(),
|
||||
RootUserPath(from).c_str(),
|
||||
(u32)(_titleID >> 32), (u32)_titleID);
|
||||
}
|
||||
|
||||
bool CheckTitleTMD(u64 _titleID)
|
||||
bool CheckTitleTMD(u64 _titleID, FromWhichRoot from)
|
||||
{
|
||||
const std::string TitlePath = GetTMDFileName(_titleID);
|
||||
const std::string TitlePath = GetTMDFileName(_titleID, from);
|
||||
if (File::Exists(TitlePath))
|
||||
{
|
||||
File::IOFile pTMDFile(TitlePath, "rb");
|
||||
@ -96,9 +102,9 @@ bool CheckTitleTMD(u64 _titleID)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CheckTitleTIK(u64 _titleID)
|
||||
bool CheckTitleTIK(u64 _titleID, FromWhichRoot from)
|
||||
{
|
||||
const std::string ticketFileName = Common::GetTicketFileName(_titleID);
|
||||
const std::string ticketFileName = Common::GetTicketFileName(_titleID, from);
|
||||
if (File::Exists(ticketFileName))
|
||||
{
|
||||
File::IOFile pTIKFile(ticketFileName, "rb");
|
||||
|
Reference in New Issue
Block a user