From 36b9e3dd35a7fb4430d4d95300ce5eb30b4f2d6e Mon Sep 17 00:00:00 2001 From: JosJuice Date: Sat, 6 May 2017 17:45:08 +0200 Subject: Don't duplicate code for getting paths based on title IDs I've seen the expression (u32)(title_id >> 32), (u32)title_id a few more times in my life than I would've liked to... --- Source/Core/Common/NandPaths.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'Source/Core/Common/NandPaths.cpp') diff --git a/Source/Core/Common/NandPaths.cpp b/Source/Core/Common/NandPaths.cpp index 5ab7c2afdd..22afa30c7c 100644 --- a/Source/Core/Common/NandPaths.cpp +++ b/Source/Core/Common/NandPaths.cpp @@ -36,20 +36,25 @@ std::string GetTicketFileName(u64 _titleID, FromWhichRoot from) (u32)(_titleID >> 32), (u32)_titleID); } +std::string GetTitlePath(u64 title_id, FromWhichRoot from) +{ + return StringFromFormat("%s/title/%08x/%08x/", RootUserPath(from).c_str(), + static_cast(title_id >> 32), static_cast(title_id)); +} + std::string GetTitleDataPath(u64 _titleID, FromWhichRoot from) { - return StringFromFormat("%s/title/%08x/%08x/data/", RootUserPath(from).c_str(), - (u32)(_titleID >> 32), (u32)_titleID); + return GetTitlePath(_titleID, from) + "data/"; } std::string GetTMDFileName(u64 _titleID, FromWhichRoot from) { return GetTitleContentPath(_titleID, from) + "title.tmd"; } + std::string GetTitleContentPath(u64 _titleID, FromWhichRoot from) { - return StringFromFormat("%s/title/%08x/%08x/content/", RootUserPath(from).c_str(), - (u32)(_titleID >> 32), (u32)_titleID); + return GetTitlePath(_titleID, from) + "content/"; } std::string EscapeFileName(const std::string& filename) -- cgit v1.2.3 From 40653a66073a180fc4036aed0721cd3741911cfb Mon Sep 17 00:00:00 2001 From: JosJuice Date: Sat, 6 May 2017 17:51:50 +0200 Subject: NandPaths: Make .h function order match .cpp --- Source/Core/Common/NandPaths.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'Source/Core/Common/NandPaths.cpp') diff --git a/Source/Core/Common/NandPaths.cpp b/Source/Core/Common/NandPaths.cpp index 22afa30c7c..5afa5ef3f1 100644 --- a/Source/Core/Common/NandPaths.cpp +++ b/Source/Core/Common/NandPaths.cpp @@ -47,14 +47,14 @@ std::string GetTitleDataPath(u64 _titleID, FromWhichRoot from) return GetTitlePath(_titleID, from) + "data/"; } -std::string GetTMDFileName(u64 _titleID, FromWhichRoot from) +std::string GetTitleContentPath(u64 _titleID, FromWhichRoot from) { - return GetTitleContentPath(_titleID, from) + "title.tmd"; + return GetTitlePath(_titleID, from) + "content/"; } -std::string GetTitleContentPath(u64 _titleID, FromWhichRoot from) +std::string GetTMDFileName(u64 _titleID, FromWhichRoot from) { - return GetTitlePath(_titleID, from) + "content/"; + return GetTitleContentPath(_titleID, from) + "title.tmd"; } std::string EscapeFileName(const std::string& filename) -- cgit v1.2.3