summaryrefslogtreecommitdiff
path: root/Source/Core/Common
diff options
context:
space:
mode:
authorflacs <tilkax@gmail.com>2015-10-16 16:49:34 +0200
committerflacs <tilkax@gmail.com>2015-10-16 16:49:34 +0200
commit05e339a605be5f5ccd0f710af774fa08eadd65a2 (patch)
tree4f16122b86951c8f0940a6d94718012ce503fd4a /Source/Core/Common
parentd12b026ecbf421c02005e3ee4ade0b7e34056ddb (diff)
parentc22d1d68ab8675edc9969e0c819eccf021cfca28 (diff)
Merge pull request #3139 from JosJuice/fix-wii-root
Mark which Wii root to use in the NAND path code
Diffstat (limited to 'Source/Core/Common')
-rw-r--r--Source/Core/Common/NandPaths.cpp30
-rw-r--r--Source/Core/Common/NandPaths.h18
2 files changed, 30 insertions, 18 deletions
diff --git a/Source/Core/Common/NandPaths.cpp b/Source/Core/Common/NandPaths.cpp
index d4c9f8a151..4048979c3c 100644
--- a/Source/Core/Common/NandPaths.cpp
+++ b/Source/Core/Common/NandPaths.cpp
@@ -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");
diff --git a/Source/Core/Common/NandPaths.h b/Source/Core/Common/NandPaths.h
index 6a79abf3bf..7d33477d76 100644
--- a/Source/Core/Common/NandPaths.h
+++ b/Source/Core/Common/NandPaths.h
@@ -21,11 +21,17 @@ namespace Common
void InitializeWiiRoot(bool use_temporary);
void ShutdownWiiRoot();
- std::string GetTicketFileName(u64 _titleID);
- std::string GetTMDFileName(u64 _titleID);
- std::string GetTitleDataPath(u64 _titleID);
- std::string GetTitleContentPath(u64 _titleID);
- bool CheckTitleTMD(u64 _titleID);
- bool CheckTitleTIK(u64 _titleID);
+ enum FromWhichRoot
+ {
+ FROM_CONFIGURED_ROOT, // not related to currently running game - use D_WIIROOT_IDX
+ FROM_SESSION_ROOT, // request from currently running game - use D_SESSION_WIIROOT_IDX
+ };
+
+ std::string GetTicketFileName(u64 _titleID, FromWhichRoot from);
+ std::string GetTMDFileName(u64 _titleID, FromWhichRoot from);
+ std::string GetTitleDataPath(u64 _titleID, FromWhichRoot from);
+ std::string GetTitleContentPath(u64 _titleID, FromWhichRoot from);
+ bool CheckTitleTMD(u64 _titleID, FromWhichRoot from);
+ bool CheckTitleTIK(u64 _titleID, FromWhichRoot from);
void ReadReplacements(replace_v& replacements);
}