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...
This commit is contained in:
JosJuice
2017-05-06 17:45:08 +02:00
parent 2261224980
commit 36b9e3dd35
10 changed files with 31 additions and 29 deletions

View File

@ -58,8 +58,8 @@ IPCCommandResult ES::OpenTitleContent(u32 uid, const IOCtlVRequest& request)
s32 CFD = OpenTitleContent(m_AccessIdentID++, TitleID, Index);
INFO_LOG(IOS_ES, "IOCTL_ES_OPENTITLECONTENT: TitleID: %08x/%08x Index %i -> got CFD %x",
(u32)(TitleID >> 32), (u32)TitleID, Index, CFD);
INFO_LOG(IOS_ES, "IOCTL_ES_OPENTITLECONTENT: TitleID: %016" PRIx64 " Index %i -> got CFD %x",
TitleID, Index, CFD);
return GetDefaultReply(CFD);
}

View File

@ -316,9 +316,7 @@ IPCCommandResult ES::DeleteTitle(const IOCtlVRequest& request)
if (!CanDeleteTitle(title_id))
return GetDefaultReply(ES_EINVAL);
const std::string title_dir =
StringFromFormat("%s/title/%08x/%08x/", RootUserPath(Common::FROM_SESSION_ROOT).c_str(),
static_cast<u32>(title_id >> 32), static_cast<u32>(title_id));
const std::string title_dir = Common::GetTitlePath(title_id, Common::FROM_SESSION_ROOT);
if (!File::IsDirectory(title_dir) ||
!DiscIO::CNANDContentManager::Access().RemoveTitle(title_id, Common::FROM_SESSION_ROOT))
{

View File

@ -56,8 +56,8 @@ IPCCommandResult ES::GetTicketViewCount(const IOCtlVRequest& request)
WARN_LOG(IOS_ES, "GetViewCount: Faking IOS title %016" PRIx64 " being present", TitleID);
}
INFO_LOG(IOS_ES, "IOCTL_ES_GETVIEWCNT for titleID: %08x/%08x (View Count = %u)",
static_cast<u32>(TitleID >> 32), static_cast<u32>(TitleID), view_count);
INFO_LOG(IOS_ES, "IOCTL_ES_GETVIEWCNT for titleID: %016" PRIx64 " (View Count = %u)", TitleID,
view_count);
Memory::Write_U32(view_count, request.io_vectors[0].address);
return GetDefaultReply(IPC_SUCCESS);
@ -89,8 +89,8 @@ IPCCommandResult ES::GetTicketViews(const IOCtlVRequest& request)
WARN_LOG(IOS_ES, "GetViews: Faking IOS title %016" PRIx64 " being present", TitleID);
}
INFO_LOG(IOS_ES, "IOCTL_ES_GETVIEWS for titleID: %08x/%08x (MaxViews = %i)", (u32)(TitleID >> 32),
(u32)TitleID, maxViews);
INFO_LOG(IOS_ES, "IOCTL_ES_GETVIEWS for titleID: %016" PRIx64 " (MaxViews = %i)", TitleID,
maxViews);
return GetDefaultReply(IPC_SUCCESS);
}

View File

@ -92,14 +92,12 @@ void ShutdownWiiRoot()
{
if (!s_temp_wii_root.empty())
{
std::string save_path =
Common::GetTitleDataPath(SConfig::GetInstance().GetTitleID(), Common::FROM_SESSION_ROOT);
std::string user_save_path =
Common::GetTitleDataPath(SConfig::GetInstance().GetTitleID(), Common::FROM_CONFIGURED_ROOT);
std::string user_backup_path =
File::GetUserPath(D_BACKUP_IDX) +
StringFromFormat("%08x/%08x/", static_cast<u32>(SConfig::GetInstance().GetTitleID() >> 32),
static_cast<u32>(SConfig::GetInstance().GetTitleID()));
const u64 title_id = SConfig::GetInstance().GetTitleID();
std::string save_path = Common::GetTitleDataPath(title_id, Common::FROM_SESSION_ROOT);
std::string user_save_path = Common::GetTitleDataPath(title_id, Common::FROM_CONFIGURED_ROOT);
std::string user_backup_path = File::GetUserPath(D_BACKUP_IDX) +
StringFromFormat("%08x/%08x/", static_cast<u32>(title_id >> 32),
static_cast<u32>(title_id));
if (File::Exists(save_path + "banner.bin") && SConfig::GetInstance().bEnableMemcardSdWriting)
{
// Backup the existing save just in case it's still needed.

View File

@ -9,6 +9,7 @@
#include "Core/ec_wii.h"
#include <cinttypes>
#include <cstdio>
#include <cstring>
@ -107,7 +108,7 @@ void MakeAPSigAndCert(u8* sig_out, u8* ap_cert_out, u64 title_id, u8* data, u32
memset(ap_cert_out + 4, 0, 60);
sprintf(signer, "Root-CA00000001-MS00000002-NG%08x", NG_id);
sprintf(name, "AP%08x%08x", (u32)(title_id >> 32), (u32)(title_id & 0xffffffff));
sprintf(name, "AP%016" PRIx64, title_id);
MakeBlankSigECCert(ap_cert_out, signer, name, ap_priv, 0);
mbedtls_sha1(ap_cert_out + 0x80, 0x100, hash);