Core: Convert logging over to fmt pt.3

Continues the migration over to fmt up to IOS' ES module.
This commit is contained in:
Lioncash committed 2020-11-21 05:56:37 -05:00
1 parent 858d7612ef
commit cbbf044064
36 files changed
+570 -539

No files matched your search

+62 -54
View File
@@ -5,7 +5,6 @@
#include "Core/IOS/ES/ES.h"
#include <algorithm>
#include <cinttypes>
#include <cstdio>
#include <memory>
#include <utility>
@@ -63,7 +62,10 @@ ES::ES(Kernel& ios, const std::string& device_name) : Device(ios, device_name)
const auto result = m_ios.GetFS()->CreateDirectory(PID_KERNEL, PID_KERNEL, directory.path,
directory.attribute, directory.modes);
if (result != FS::ResultCode::Success && result != FS::ResultCode::AlreadyExists)
ERROR_LOG(IOS_ES, "Failed to create %s: error %d", directory.path, FS::ConvertResult(result));
{
ERROR_LOG_FMT(IOS_ES, "Failed to create {}: error {}", directory.path,
FS::ConvertResult(result));
}
// Now update the UID/GID and other attributes.
m_ios.GetFS()->SetMetadata(0, directory.path, directory.uid, directory.gid, directory.attribute,
@@ -74,7 +76,7 @@ ES::ES(Kernel& ios, const std::string& device_name) : Device(ios, device_name)
if (s_title_to_launch != 0)
{
NOTICE_LOG(IOS, "Re-launching title after IOS reload.");
NOTICE_LOG_FMT(IOS, "Re-launching title after IOS reload.");
LaunchTitle(s_title_to_launch, true);
s_title_to_launch = 0;
}
@@ -99,7 +101,7 @@ void TitleContext::Update(const IOS::ES::TMDReader& tmd_, const IOS::ES::TicketR
{
if (!tmd_.IsValid() || !ticket_.IsValid())
{
ERROR_LOG(IOS_ES, "TMD or ticket is not valid -- refusing to update title context");
ERROR_LOG_FMT(IOS_ES, "TMD or ticket is not valid -- refusing to update title context");
return;
}
@@ -120,12 +122,13 @@ IPCCommandResult ES::GetTitleDirectory(const IOCtlVRequest& request)
if (!request.HasNumberOfValidVectors(1, 1))
return GetDefaultReply(ES_EINVAL);
u64 TitleID = Memory::Read_U64(request.in_vectors[0].address);
const u64 title_id = Memory::Read_U64(request.in_vectors[0].address);
char* Path = (char*)Memory::GetPointer(request.io_vectors[0].address);
sprintf(Path, "/title/%08x/%08x/data", (u32)(TitleID >> 32), (u32)TitleID);
char* path = reinterpret_cast<char*>(Memory::GetPointer(request.io_vectors[0].address));
sprintf(path, "/title/%08x/%08x/data", static_cast<u32>(title_id >> 32),
static_cast<u32>(title_id));
INFO_LOG(IOS_ES, "IOCTL_ES_GETTITLEDIR: %s", Path);
INFO_LOG_FMT(IOS_ES, "IOCTL_ES_GETTITLEDIR: {}", path);
return GetDefaultReply(IPC_SUCCESS);
}
@@ -148,8 +151,8 @@ IPCCommandResult ES::GetTitleId(const IOCtlVRequest& request)
return GetDefaultReply(ret);
Memory::Write_U64(title_id, request.io_vectors[0].address);
INFO_LOG(IOS_ES, "IOCTL_ES_GETTITLEID: %08x/%08x", static_cast<u32>(title_id >> 32),
static_cast<u32>(title_id));
INFO_LOG_FMT(IOS_ES, "IOCTL_ES_GETTITLEID: {:08x}/{:08x}", static_cast<u32>(title_id >> 32),
static_cast<u32>(title_id));
return GetDefaultReply(IPC_SUCCESS);
}
@@ -158,9 +161,9 @@ static bool UpdateUIDAndGID(Kernel& kernel, const IOS::ES::TMDReader& tmd)
IOS::ES::UIDSys uid_sys{kernel.GetFS()};
const u64 title_id = tmd.GetTitleId();
const u32 uid = uid_sys.GetOrInsertUIDForTitle(title_id);
if (!uid)
if (uid == 0)
{
ERROR_LOG(IOS_ES, "Failed to get UID for title %016" PRIx64, title_id);
ERROR_LOG_FMT(IOS_ES, "Failed to get UID for title {:016x}", title_id);
return false;
}
kernel.SetUidForPPC(uid);
@@ -200,7 +203,7 @@ IPCCommandResult ES::SetUID(u32 uid, const IOCtlVRequest& request)
const s32 ret = CheckIsAllowedToSetUID(m_ios, uid, m_title_context.tmd);
if (ret < 0)
{
ERROR_LOG(IOS_ES, "SetUID: Permission check failed with error %d", ret);
ERROR_LOG_FMT(IOS_ES, "SetUID: Permission check failed with error {}", ret);
return GetDefaultReply(ret);
}
@@ -210,7 +213,7 @@ IPCCommandResult ES::SetUID(u32 uid, const IOCtlVRequest& request)
if (!UpdateUIDAndGID(m_ios, tmd))
{
ERROR_LOG(IOS_ES, "SetUID: Failed to get UID for title %016" PRIx64, title_id);
ERROR_LOG_FMT(IOS_ES, "SetUID: Failed to get UID for title {:016x}", title_id);
return GetDefaultReply(ES_SHORT_READ);
}
@@ -220,17 +223,18 @@ IPCCommandResult ES::SetUID(u32 uid, const IOCtlVRequest& request)
bool ES::LaunchTitle(u64 title_id, bool skip_reload)
{
m_title_context.Clear();
INFO_LOG(IOS_ES, "ES_Launch: Title context changed: (none)");
INFO_LOG_FMT(IOS_ES, "ES_Launch: Title context changed: (none)");
NOTICE_LOG(IOS_ES, "Launching title %016" PRIx64 "...", title_id);
NOTICE_LOG_FMT(IOS_ES, "Launching title {:016x}...", title_id);
if ((title_id == Titles::SHOP || title_id == Titles::KOREAN_SHOP) &&
m_ios.GetIOSC().IsUsingDefaultId())
{
ERROR_LOG(IOS_ES, "Refusing to launch the shop channel with default device credentials");
CriticalAlertT("You cannot use the Wii Shop Channel without using your own device credentials."
"\nPlease refer to the NAND usage guide for setup instructions: "
"https://dolphin-emu.org/docs/guides/nand-usage-guide/");
ERROR_LOG_FMT(IOS_ES, "Refusing to launch the shop channel with default device credentials");
CriticalAlertFmtT(
"You cannot use the Wii Shop Channel without using your own device credentials."
"\nPlease refer to the NAND usage guide for setup instructions: "
"https://dolphin-emu.org/docs/guides/nand-usage-guide/");
// Send the user back to the system menu instead of returning an error, which would
// likely make the system menu crash. Doing this is okay as anyone who has the shop
@@ -256,7 +260,7 @@ bool ES::LaunchIOS(u64 ios_title_id)
// (indirectly via boot2), we can just launch MIOS when BC is launched.
if (ios_title_id == Titles::BC)
{
NOTICE_LOG(IOS, "BC: Launching MIOS...");
NOTICE_LOG_FMT(IOS, "BC: Launching MIOS...");
return LaunchIOS(Titles::MIOS);
}
@@ -271,9 +275,9 @@ bool ES::LaunchIOS(u64 ios_title_id)
if (!tmd.IsValid() || !ticket.IsValid() || !tmd.GetContent(tmd.GetBootIndex(), &content) ||
!m_ios.BootIOS(ios_title_id, GetContentPath(ios_title_id, content)))
{
PanicAlertT("Could not launch IOS %016" PRIx64 " because it is missing from the NAND.\n"
"The emulated software will likely hang now.",
ios_title_id);
PanicAlertFmtT("Could not launch IOS {0:016x} because it is missing from the NAND.\n"
"The emulated software will likely hang now.",
ios_title_id);
return false;
}
return true;
@@ -291,14 +295,14 @@ bool ES::LaunchPPCTitle(u64 title_id, bool skip_reload)
{
if (title_id == Titles::SYSTEM_MENU)
{
PanicAlertT("Could not launch the Wii Menu because it is missing from the NAND.\n"
"The emulated software will likely hang now.");
PanicAlertFmtT("Could not launch the Wii Menu because it is missing from the NAND.\n"
"The emulated software will likely hang now.");
}
else
{
PanicAlertT("Could not launch title %016" PRIx64 " because it is missing from the NAND.\n"
"The emulated software will likely hang now.",
title_id);
PanicAlertFmtT("Could not launch title {0:016x} because it is missing from the NAND.\n"
"The emulated software will likely hang now.",
title_id);
}
return false;
}
@@ -314,14 +318,14 @@ bool ES::LaunchPPCTitle(u64 title_id, bool skip_reload)
}
m_title_context.Update(tmd, ticket, DiscIO::Platform::WiiWAD);
INFO_LOG(IOS_ES, "LaunchPPCTitle: Title context changed: %016" PRIx64, tmd.GetTitleId());
INFO_LOG_FMT(IOS_ES, "LaunchPPCTitle: Title context changed: {:016x}", tmd.GetTitleId());
// Note: the UID/GID is also updated for IOS titles, but since we have no guarantee IOS titles
// are installed, we can only do this for PPC titles.
if (!UpdateUIDAndGID(m_ios, m_title_context.tmd))
{
m_title_context.Clear();
INFO_LOG(IOS_ES, "LaunchPPCTitle: Title context changed: (none)");
INFO_LOG_FMT(IOS_ES, "LaunchPPCTitle: Title context changed: (none)");
return false;
}
@@ -395,14 +399,14 @@ IPCCommandResult ES::Close(u32 fd)
context->active = false;
context->ipc_fd = -1;
INFO_LOG(IOS_ES, "ES: Close");
INFO_LOG_FMT(IOS_ES, "ES: Close");
m_is_active = false;
return GetDefaultReply(IPC_SUCCESS);
}
IPCCommandResult ES::IOCtlV(const IOCtlVRequest& request)
{
DEBUG_LOG(IOS_ES, "%s (0x%x)", GetDeviceName().c_str(), request.request);
DEBUG_LOG_FMT(IOS_ES, "{} ({:#x})", GetDeviceName(), request.request);
auto context = FindActiveContext(request.fd);
if (context == m_contexts.end())
return GetDefaultReply(ES_EINVAL);
@@ -552,8 +556,8 @@ IPCCommandResult ES::IOCtlV(const IOCtlVRequest& request)
case IOCTL_ES_UNKNOWN_41:
case IOCTL_ES_UNKNOWN_42:
PanicAlert("IOS-ES: Unimplemented ioctlv 0x%x (%zu in vectors, %zu io vectors)",
request.request, request.in_vectors.size(), request.io_vectors.size());
PanicAlertFmt("IOS-ES: Unimplemented ioctlv {:#x} ({} in vectors, {} io vectors)",
request.request, request.in_vectors.size(), request.io_vectors.size());
request.DumpUnknown(GetDeviceName(), Common::Log::IOS_ES, Common::Log::LERROR);
return GetDefaultReply(IPC_EINVAL);
@@ -570,7 +574,7 @@ IPCCommandResult ES::GetConsumption(const IOCtlVRequest& request)
// This is at least what crediar's ES module does
Memory::Write_U32(0, request.io_vectors[1].address);
INFO_LOG(IOS_ES, "IOCTL_ES_GETCONSUMPTION");
INFO_LOG_FMT(IOS_ES, "IOCTL_ES_GETCONSUMPTION");
return GetDefaultReply(IPC_SUCCESS);
}
@@ -579,23 +583,23 @@ IPCCommandResult ES::Launch(const IOCtlVRequest& request)
if (!request.HasNumberOfValidVectors(2, 0))
return GetDefaultReply(ES_EINVAL);
u64 TitleID = Memory::Read_U64(request.in_vectors[0].address);
u32 view = Memory::Read_U32(request.in_vectors[1].address);
u64 ticketid = Memory::Read_U64(request.in_vectors[1].address + 4);
u32 devicetype = Memory::Read_U32(request.in_vectors[1].address + 12);
u64 titleid = Memory::Read_U64(request.in_vectors[1].address + 16);
u16 access = Memory::Read_U16(request.in_vectors[1].address + 24);
const u64 title_id = Memory::Read_U64(request.in_vectors[0].address);
const u32 view = Memory::Read_U32(request.in_vectors[1].address);
const u64 ticketid = Memory::Read_U64(request.in_vectors[1].address + 4);
const u32 devicetype = Memory::Read_U32(request.in_vectors[1].address + 12);
const u64 titleid = Memory::Read_U64(request.in_vectors[1].address + 16);
const u16 access = Memory::Read_U16(request.in_vectors[1].address + 24);
INFO_LOG(IOS_ES, "IOCTL_ES_LAUNCH %016" PRIx64 " %08x %016" PRIx64 " %08x %016" PRIx64 " %04x",
TitleID, view, ticketid, devicetype, titleid, access);
INFO_LOG_FMT(IOS_ES, "IOCTL_ES_LAUNCH {:016x} {:08x} {:016x} {:08x} {:016x} {:04x}", title_id,
view, ticketid, devicetype, titleid, access);
// Prevent loading installed IOSes that are not emulated.
if (!IOS::HLE::IsEmulated(TitleID))
if (!IOS::HLE::IsEmulated(title_id))
return GetDefaultReply(FS_ENOENT);
// IOS replies to the request through the mailbox on failure, and acks if the launch succeeds.
// Note: Launch will potentially reset the whole IOS state -- including this ES instance.
if (!LaunchTitle(TitleID))
if (!LaunchTitle(title_id))
return GetDefaultReply(FS_ENOENT);
// ES_LAUNCH involves restarting IOS, which results in two acknowledgements in a row
@@ -655,7 +659,7 @@ static ReturnCode WriteTmdForDiVerify(FS::FileSystem* fs, const IOS::ES::TMDRead
ReturnCode ES::DIVerify(const IOS::ES::TMDReader& tmd, const IOS::ES::TicketReader& ticket)
{
m_title_context.Clear();
INFO_LOG(IOS_ES, "ES_DIVerify: Title context changed: (none)");
INFO_LOG_FMT(IOS_ES, "ES_DIVerify: Title context changed: (none)");
if (!tmd.IsValid() || !ticket.IsValid())
return ES_EINVAL;
@@ -664,7 +668,7 @@ ReturnCode ES::DIVerify(const IOS::ES::TMDReader& tmd, const IOS::ES::TicketRead
return ES_EINVAL;
m_title_context.Update(tmd, ticket, DiscIO::Platform::WiiDisc);
INFO_LOG(IOS_ES, "ES_DIVerify: Title context changed: %016" PRIx64, tmd.GetTitleId());
INFO_LOG_FMT(IOS_ES, "ES_DIVerify: Title context changed: {:016x}", tmd.GetTitleId());
// XXX: We are supposed to verify the TMD and ticket here, but cannot because
// this may cause issues with custom/patched games.
@@ -674,7 +678,7 @@ ReturnCode ES::DIVerify(const IOS::ES::TMDReader& tmd, const IOS::ES::TicketRead
{
if (const ReturnCode ret = WriteTmdForDiVerify(fs.get(), tmd))
{
ERROR_LOG(IOS_ES, "DiVerify failed to write disc TMD to NAND.");
ERROR_LOG_FMT(IOS_ES, "DiVerify failed to write disc TMD to NAND.");
return ret;
}
}
@@ -932,7 +936,7 @@ ReturnCode ES::VerifyContainer(VerifyContainerType type, VerifyMode mode,
ret = iosc.ImportCertificate(ca_cert, IOSC::HANDLE_ROOT_KEY, handle, PID_ES);
if (ret != IPC_SUCCESS)
{
ERROR_LOG(IOS_ES, "VerifyContainer: IOSC_ImportCertificate(ca) failed with error %d", ret);
ERROR_LOG_FMT(IOS_ES, "VerifyContainer: IOSC_ImportCertificate(ca) failed with error {}", ret);
return ret;
}
@@ -946,7 +950,8 @@ ReturnCode ES::VerifyContainer(VerifyContainerType type, VerifyMode mode,
ret = iosc.ImportCertificate(issuer_cert, handle, issuer_handle, PID_ES);
if (ret != IPC_SUCCESS)
{
ERROR_LOG(IOS_ES, "VerifyContainer: IOSC_ImportCertificate(issuer) failed with error %d", ret);
ERROR_LOG_FMT(IOS_ES, "VerifyContainer: IOSC_ImportCertificate(issuer) failed with error {}",
ret);
return ret;
}
@@ -955,7 +960,7 @@ ReturnCode ES::VerifyContainer(VerifyContainerType type, VerifyMode mode,
ret = iosc.VerifyPublicKeySign(signed_blob.GetSha1(), issuer_handle, signature, PID_ES);
if (ret != IPC_SUCCESS)
{
ERROR_LOG(IOS_ES, "VerifyContainer: IOSC_VerifyPublicKeySign failed with error %d", ret);
ERROR_LOG_FMT(IOS_ES, "VerifyContainer: IOSC_VerifyPublicKeySign failed with error {}", ret);
return ret;
}
@@ -963,11 +968,14 @@ ReturnCode ES::VerifyContainer(VerifyContainerType type, VerifyMode mode,
{
ret = WriteNewCertToStore(issuer_cert);
if (ret != IPC_SUCCESS)
ERROR_LOG(IOS_ES, "VerifyContainer: Writing the issuer cert failed with return code %d", ret);
{
ERROR_LOG_FMT(IOS_ES, "VerifyContainer: Writing the issuer cert failed with return code {}",
ret);
}
ret = WriteNewCertToStore(ca_cert);
if (ret != IPC_SUCCESS)
ERROR_LOG(IOS_ES, "VerifyContainer: Writing the CA cert failed with return code %d", ret);
ERROR_LOG_FMT(IOS_ES, "VerifyContainer: Writing the CA cert failed with return code {}", ret);
}
if (ret == IPC_SUCCESS && issuer_handle_out)
+4 -5
View File
@@ -6,7 +6,6 @@
#include <algorithm>
#include <array>
#include <cinttypes>
#include <cstddef>
#include <cstring>
#include <map>
@@ -430,8 +429,8 @@ std::array<u8, 16> TicketReader::GetTitleKey(const HLE::IOSC& iosc) const
u8 index = m_bytes.at(offsetof(Ticket, common_key_index));
if (index >= HLE::IOSC::COMMON_KEY_HANDLES.size())
{
PanicAlert("Bad common key index for title %016" PRIx64 ": %u -- using common key 0",
GetTitleId(), index);
PanicAlertFmt("Bad common key index for title {:016x}: {} -- using common key 0", GetTitleId(),
index);
index = 0;
}
auto common_key_handle = HLE::IOSC::COMMON_KEY_HANDLES[index];
@@ -654,7 +653,7 @@ u32 UIDSys::GetOrInsertUIDForTitle(const u64 title_id)
const u32 current_uid = GetUIDFromTitle(title_id);
if (current_uid)
{
INFO_LOG(IOS_ES, "Title %016" PRIx64 " already exists in uid.sys", title_id);
INFO_LOG_FMT(IOS_ES, "Title {:016x} already exists in uid.sys", title_id);
return current_uid;
}
@@ -671,7 +670,7 @@ u32 UIDSys::GetOrInsertUIDForTitle(const u64 title_id)
if (!file || !file->Seek(0, HLE::FS::SeekMode::End) || !file->Write(&swapped_title_id, 1) ||
!file->Write(&swapped_uid, 1))
{
ERROR_LOG(IOS_ES, "Failed to write to /sys/uid.sys");
ERROR_LOG_FMT(IOS_ES, "Failed to write to /sys/uid.sys");
return 0;
}
+8 -8
View File
@@ -23,7 +23,7 @@ namespace IOS::HLE::Device
ReturnCode ES::GetDeviceId(u32* device_id) const
{
*device_id = m_ios.GetIOSC().GetDeviceId();
INFO_LOG(IOS_ES, "GetDeviceId: %08X", *device_id);
INFO_LOG_FMT(IOS_ES, "GetDeviceId: {:08X}", *device_id);
return IPC_SUCCESS;
}
@@ -83,7 +83,7 @@ IPCCommandResult ES::CheckKoreaRegion(const IOCtlVRequest& request)
// IOS70 has this to let system menu 4.2 check if the console is region changed. it returns
// -1017
// if the IOS didn't find the Korean keys and 0 if it does. 0 leads to a error 003
INFO_LOG(IOS_ES, "IOCTL_ES_CHECKKOREAREGION: Title checked for Korean keys.");
INFO_LOG_FMT(IOS_ES, "IOCTL_ES_CHECKKOREAREGION: Title checked for Korean keys.");
return GetDefaultReply(ES_EINVAL);
}
@@ -92,7 +92,7 @@ IPCCommandResult ES::GetDeviceCertificate(const IOCtlVRequest& request)
if (!request.HasNumberOfValidVectors(0, 1) || request.io_vectors[0].size != 0x180)
return GetDefaultReply(ES_EINVAL);
INFO_LOG(IOS_ES, "IOCTL_ES_GETDEVICECERT");
INFO_LOG_FMT(IOS_ES, "IOCTL_ES_GETDEVICECERT");
const IOS::CertECC cert = m_ios.GetIOSC().GetDeviceCertificate();
Memory::CopyToEmu(request.io_vectors[0].address, &cert, sizeof(cert));
@@ -104,7 +104,7 @@ IPCCommandResult ES::Sign(const IOCtlVRequest& request)
if (!request.HasNumberOfValidVectors(1, 2))
return GetDefaultReply(ES_EINVAL);
INFO_LOG(IOS_ES, "IOCTL_ES_SIGN");
INFO_LOG_FMT(IOS_ES, "IOCTL_ES_SIGN");
u8* ap_cert_out = Memory::GetPointer(request.io_vectors[1].address);
u8* data = Memory::GetPointer(request.in_vectors[0].address);
u32 data_size = request.in_vectors[0].size;
@@ -148,14 +148,14 @@ ReturnCode ES::VerifySign(const std::vector<u8>& hash, const std::vector<u8>& ec
certs_bytes, ng_cert);
if (ret != IPC_SUCCESS)
{
ERROR_LOG(IOS_ES, "VerifySign: VerifyContainer(ng) failed with error %d", ret);
ERROR_LOG_FMT(IOS_ES, "VerifySign: VerifyContainer(ng) failed with error {}", ret);
return ret;
}
ret = iosc.VerifyPublicKeySign(ap.GetSha1(), ng_cert, ap.GetSignatureData(), PID_ES);
if (ret != IPC_SUCCESS)
{
ERROR_LOG(IOS_ES, "VerifySign: IOSC_VerifyPublicKeySign(ap) failed with error %d", ret);
ERROR_LOG_FMT(IOS_ES, "VerifySign: IOSC_VerifyPublicKeySign(ap) failed with error {}", ret);
return ret;
}
@@ -168,7 +168,7 @@ ReturnCode ES::VerifySign(const std::vector<u8>& hash, const std::vector<u8>& ec
ret = iosc.ImportPublicKey(ap_cert, ap.GetPublicKey().data(), nullptr, PID_ES);
if (ret != IPC_SUCCESS)
{
ERROR_LOG(IOS_ES, "VerifySign: IOSC_ImportPublicKey(ap) failed with error %d", ret);
ERROR_LOG_FMT(IOS_ES, "VerifySign: IOSC_ImportPublicKey(ap) failed with error {}", ret);
return ret;
}
@@ -177,7 +177,7 @@ ReturnCode ES::VerifySign(const std::vector<u8>& hash, const std::vector<u8>& ec
ret = iosc.VerifyPublicKeySign(sha1, ap_cert, ecc_signature, PID_ES);
if (ret != IPC_SUCCESS)
{
ERROR_LOG(IOS_ES, "VerifySign: IOSC_VerifyPublicKeySign(data) failed with error %d", ret);
ERROR_LOG_FMT(IOS_ES, "VerifySign: IOSC_VerifyPublicKeySign(data) failed with error {}", ret);
return ret;
}
+8 -9
View File
@@ -5,7 +5,6 @@
#include <algorithm>
#include <array>
#include <cctype>
#include <cinttypes>
#include <functional>
#include <iterator>
#include <string>
@@ -75,7 +74,7 @@ static std::vector<u64> GetTitlesInTitleOrImport(FS::FileSystem* fs, const std::
const auto entries = fs->ReadDirectory(PID_KERNEL, PID_KERNEL, titles_dir);
if (!entries)
{
ERROR_LOG(IOS_ES, "%s is not a directory", titles_dir.c_str());
ERROR_LOG_FMT(IOS_ES, "{} is not a directory", titles_dir);
return {};
}
@@ -128,7 +127,7 @@ std::vector<u64> ES::GetTitlesWithTickets() const
const auto entries = fs->ReadDirectory(PID_KERNEL, PID_KERNEL, "/ticket");
if (!entries)
{
ERROR_LOG(IOS_ES, "/ticket is not a directory");
ERROR_LOG_FMT(IOS_ES, "/ticket is not a directory");
return {};
}
@@ -232,7 +231,7 @@ bool ES::CreateTitleDirectories(u64 title_id, u16 group_id) const
fs->SetMetadata(PID_KERNEL, content_dir, PID_KERNEL, PID_KERNEL, 0, content_dir_modes);
if (result1 != FS::ResultCode::Success || result2 != FS::ResultCode::Success)
{
ERROR_LOG(IOS_ES, "Failed to create or set metadata on content dir for %016" PRIx64, title_id);
ERROR_LOG_FMT(IOS_ES, "Failed to create or set metadata on content dir for {:016x}", title_id);
return false;
}
@@ -242,7 +241,7 @@ bool ES::CreateTitleDirectories(u64 title_id, u16 group_id) const
fs->CreateDirectory(PID_KERNEL, PID_KERNEL, data_dir, 0,
data_dir_modes) != FS::ResultCode::Success))
{
ERROR_LOG(IOS_ES, "Failed to create data dir for %016" PRIx64, title_id);
ERROR_LOG_FMT(IOS_ES, "Failed to create data dir for {:016x}", title_id);
return false;
}
@@ -250,7 +249,7 @@ bool ES::CreateTitleDirectories(u64 title_id, u16 group_id) const
const u32 uid = uid_sys.GetOrInsertUIDForTitle(title_id);
if (fs->SetMetadata(0, data_dir, uid, group_id, 0, data_dir_modes) != FS::ResultCode::Success)
{
ERROR_LOG(IOS_ES, "Failed to set metadata on data dir for %016" PRIx64, title_id);
ERROR_LOG_FMT(IOS_ES, "Failed to set metadata on data dir for {:016x}", title_id);
return false;
}
@@ -268,7 +267,7 @@ bool ES::InitImport(const IOS::ES::TMDReader& tmd)
fs->CreateFullPath(PID_KERNEL, PID_KERNEL, import_content_dir + '/', 0, content_dir_modes);
if (result != FS::ResultCode::Success)
{
ERROR_LOG(IOS_ES, "InitImport: Failed to create content dir for %016" PRIx64, tmd.GetTitleId());
ERROR_LOG_FMT(IOS_ES, "InitImport: Failed to create content dir for {:016x}", tmd.GetTitleId());
return false;
}
@@ -282,7 +281,7 @@ bool ES::InitImport(const IOS::ES::TMDReader& tmd)
const auto rename_result = fs->Rename(PID_KERNEL, PID_KERNEL, content_dir, import_content_dir);
if (rename_result != FS::ResultCode::Success)
{
ERROR_LOG(IOS_ES, "InitImport: Failed to move content dir for %016" PRIx64, tmd.GetTitleId());
ERROR_LOG_FMT(IOS_ES, "InitImport: Failed to move content dir for {:016x}", tmd.GetTitleId());
return false;
}
DeleteDirectoriesIfEmpty(m_ios.GetFS().get(), import_content_dir);
@@ -316,7 +315,7 @@ bool ES::FinishImport(const IOS::ES::TMDReader& tmd)
if (fs->Rename(PID_KERNEL, PID_KERNEL, import_content_dir, content_dir) !=
FS::ResultCode::Success)
{
ERROR_LOG(IOS_ES, "FinishImport: Failed to rename import directory to %s", content_dir.c_str());
ERROR_LOG_FMT(IOS_ES, "FinishImport: Failed to rename import directory to {}", content_dir);
return false;
}
return true;
+2 -3
View File
@@ -4,7 +4,6 @@
#include "Core/IOS/ES/ES.h"
#include <cinttypes>
#include <utility>
#include <vector>
@@ -40,7 +39,7 @@ s32 ES::OpenContent(const IOS::ES::TMDReader& tmd, u16 content_index, u32 uid)
entry.m_content = content;
entry.m_title_id = title_id;
entry.m_uid = uid;
INFO_LOG(IOS_ES, "OpenContent: title ID %016" PRIx64 ", UID 0x%x, CFD %zu", title_id, uid, i);
INFO_LOG_FMT(IOS_ES, "OpenContent: title ID {:016x}, UID {:#x}, CFD {}", title_id, uid, i);
return static_cast<s32>(i);
}
@@ -125,7 +124,7 @@ ReturnCode ES::CloseContent(u32 cfd, u32 uid)
m_ios.GetFS()->Close(entry.m_fd);
entry = {};
INFO_LOG(IOS_ES, "CloseContent: CFD %u", cfd);
INFO_LOG_FMT(IOS_ES, "CloseContent: CFD {}", cfd);
return IPC_SUCCESS;
}
+10 -11
View File
@@ -4,7 +4,6 @@
#include "Core/IOS/ES/ES.h"
#include <cinttypes>
#include <cstdio>
#include <string>
#include <vector>
@@ -26,8 +25,8 @@ IPCCommandResult ES::GetStoredContentsCount(const IOS::ES::TMDReader& tmd,
const u16 num_contents = static_cast<u16>(GetStoredContentsFromTMD(tmd).size());
Memory::Write_U32(num_contents, request.io_vectors[0].address);
INFO_LOG(IOS_ES, "GetStoredContentsCount (0x%x): %u content(s) for %016" PRIx64, request.request,
num_contents, tmd.GetTitleId());
INFO_LOG_FMT(IOS_ES, "GetStoredContentsCount ({:#x}): {} content(s) for {:016x}",
request.request, num_contents, tmd.GetTitleId());
return GetDefaultReply(IPC_SUCCESS);
}
@@ -129,7 +128,7 @@ IPCCommandResult ES::GetTitles(const std::vector<u64>& titles, const IOCtlVReque
for (size_t i = 0; i < std::min(max_count, titles.size()); i++)
{
Memory::Write_U64(titles[i], request.io_vectors[0].address + static_cast<u32>(i) * sizeof(u64));
INFO_LOG(IOS_ES, " title %016" PRIx64, titles[i]);
INFO_LOG_FMT(IOS_ES, " title {:016x}", titles[i]);
}
return GetDefaultReply(IPC_SUCCESS);
}
@@ -137,7 +136,7 @@ IPCCommandResult ES::GetTitles(const std::vector<u64>& titles, const IOCtlVReque
IPCCommandResult ES::GetTitleCount(const IOCtlVRequest& request)
{
const std::vector<u64> titles = GetInstalledTitles();
INFO_LOG(IOS_ES, "GetTitleCount: %zu titles", titles.size());
INFO_LOG_FMT(IOS_ES, "GetTitleCount: {} titles", titles.size());
return GetTitleCount(titles, request);
}
@@ -159,7 +158,7 @@ IPCCommandResult ES::GetStoredTMDSize(const IOCtlVRequest& request)
const u32 tmd_size = static_cast<u32>(tmd.GetBytes().size());
Memory::Write_U32(tmd_size, request.io_vectors[0].address);
INFO_LOG(IOS_ES, "GetStoredTMDSize: %u bytes for %016" PRIx64, tmd_size, title_id);
INFO_LOG_FMT(IOS_ES, "GetStoredTMDSize: {} bytes for {:016x}", tmd_size, title_id);
return GetDefaultReply(IPC_SUCCESS);
}
@@ -183,14 +182,14 @@ IPCCommandResult ES::GetStoredTMD(const IOCtlVRequest& request)
Memory::CopyToEmu(request.io_vectors[0].address, raw_tmd.data(), raw_tmd.size());
INFO_LOG(IOS_ES, "GetStoredTMD: title %016" PRIx64 " (buffer size: %u)", title_id, MaxCount);
INFO_LOG_FMT(IOS_ES, "GetStoredTMD: title {:016x} (buffer size: {})", title_id, MaxCount);
return GetDefaultReply(IPC_SUCCESS);
}
IPCCommandResult ES::GetOwnedTitleCount(const IOCtlVRequest& request)
{
const std::vector<u64> titles = GetTitlesWithTickets();
INFO_LOG(IOS_ES, "GetOwnedTitleCount: %zu titles", titles.size());
INFO_LOG_FMT(IOS_ES, "GetOwnedTitleCount: {} titles", titles.size());
return GetTitleCount(titles, request);
}
@@ -204,7 +203,7 @@ IPCCommandResult ES::GetBoot2Version(const IOCtlVRequest& request)
if (!request.HasNumberOfValidVectors(0, 1))
return GetDefaultReply(ES_EINVAL);
INFO_LOG(IOS_ES, "IOCTL_ES_GETBOOT2VERSION");
INFO_LOG_FMT(IOS_ES, "IOCTL_ES_GETBOOT2VERSION");
// as of 26/02/2012, this was latest bootmii version
Memory::Write_U32(4, request.io_vectors[0].address);
@@ -219,7 +218,7 @@ IPCCommandResult ES::GetSharedContentsCount(const IOCtlVRequest& request) const
const u32 count = GetSharedContentsCount();
Memory::Write_U32(count, request.io_vectors[0].address);
INFO_LOG(IOS_ES, "GetSharedContentsCount: %u contents", count);
INFO_LOG_FMT(IOS_ES, "GetSharedContentsCount: {} contents", count);
return GetDefaultReply(IPC_SUCCESS);
}
@@ -236,7 +235,7 @@ IPCCommandResult ES::GetSharedContents(const IOCtlVRequest& request) const
const u32 count = std::min(static_cast<u32>(hashes.size()), max_count);
Memory::CopyToEmu(request.io_vectors[0].address, hashes.data(), 20 * count);
INFO_LOG(IOS_ES, "GetSharedContents: %u contents (%u requested)", count, max_count);
INFO_LOG_FMT(IOS_ES, "GetSharedContents: {} contents ({} requested)", count, max_count);
return GetDefaultReply(IPC_SUCCESS);
}
} // namespace IOS::HLE::Device
+32 -31
View File
@@ -63,14 +63,15 @@ ReturnCode ES::ImportTicket(const std::vector<u8>& ticket_bytes, const std::vect
{
if (device_id != ticket_device_id)
{
WARN_LOG(IOS_ES, "Device ID mismatch: ticket %08x, device %08x", ticket_device_id, device_id);
WARN_LOG_FMT(IOS_ES, "Device ID mismatch: ticket {:08x}, device {:08x}", ticket_device_id,
device_id);
return ES_DEVICE_ID_MISMATCH;
}
const ReturnCode ret = ticket.Unpersonalise(m_ios.GetIOSC());
if (ret < 0)
{
ERROR_LOG(IOS_ES, "ImportTicket: Failed to unpersonalise ticket for %016" PRIx64 " (%d)",
ticket.GetTitleId(), ret);
ERROR_LOG_FMT(IOS_ES, "ImportTicket: Failed to unpersonalise ticket for {:016x} ({})",
ticket.GetTitleId(), ret);
return ret;
}
}
@@ -87,7 +88,7 @@ ReturnCode ES::ImportTicket(const std::vector<u8>& ticket_bytes, const std::vect
if (write_ret != IPC_SUCCESS)
return write_ret;
INFO_LOG(IOS_ES, "ImportTicket: Imported ticket for title %016" PRIx64, ticket.GetTitleId());
INFO_LOG_FMT(IOS_ES, "ImportTicket: Imported ticket for title {:016x}", ticket.GetTitleId());
return IPC_SUCCESS;
}
@@ -137,7 +138,7 @@ static void ResetTitleImportContext(ES::Context* context, IOSC& iosc)
ReturnCode ES::ImportTmd(Context& context, const std::vector<u8>& tmd_bytes)
{
INFO_LOG(IOS_ES, "ImportTmd");
INFO_LOG_FMT(IOS_ES, "ImportTmd");
// Ioctlv 0x2b writes the TMD to /tmp/title.tmd (for imports) and doesn't seem to write it
// to either /import or /title. So here we simply have to set the import TMD.
@@ -155,13 +156,13 @@ ReturnCode ES::ImportTmd(Context& context, const std::vector<u8>& tmd_bytes)
context.title_import_export.tmd, cert_store);
if (ret != IPC_SUCCESS)
{
ERROR_LOG(IOS_ES, "ImportTmd: VerifyContainer failed with error %d", ret);
ERROR_LOG_FMT(IOS_ES, "ImportTmd: VerifyContainer failed with error {}", ret);
return ret;
}
if (!InitImport(context.title_import_export.tmd))
{
ERROR_LOG(IOS_ES, "ImportTmd: Failed to initialise title import");
ERROR_LOG_FMT(IOS_ES, "ImportTmd: Failed to initialise title import");
return ES_EIO;
}
@@ -169,11 +170,11 @@ ReturnCode ES::ImportTmd(Context& context, const std::vector<u8>& tmd_bytes)
InitBackupKey(m_title_context.tmd, m_ios.GetIOSC(), &context.title_import_export.key_handle);
if (ret != IPC_SUCCESS)
{
ERROR_LOG(IOS_ES, "ImportTmd: InitBackupKey failed with error %d", ret);
ERROR_LOG_FMT(IOS_ES, "ImportTmd: InitBackupKey failed with error {}", ret);
return ret;
}
INFO_LOG(IOS_ES, "ImportTmd: All checks passed, marking context as valid");
INFO_LOG_FMT(IOS_ES, "ImportTmd: All checks passed, marking context as valid");
context.title_import_export.valid = true;
return IPC_SUCCESS;
}
@@ -211,12 +212,12 @@ static ReturnCode InitTitleImportKey(const std::vector<u8>& ticket_bytes, IOSC&
ReturnCode ES::ImportTitleInit(Context& context, const std::vector<u8>& tmd_bytes,
const std::vector<u8>& cert_chain, VerifySignature verify_signature)
{
INFO_LOG(IOS_ES, "ImportTitleInit");
INFO_LOG_FMT(IOS_ES, "ImportTitleInit");
ResetTitleImportContext(&context, m_ios.GetIOSC());
context.title_import_export.tmd.SetBytes(tmd_bytes);
if (!context.title_import_export.tmd.IsValid())
{
ERROR_LOG(IOS_ES, "Invalid TMD while adding title (size = %zd)", tmd_bytes.size());
ERROR_LOG_FMT(IOS_ES, "Invalid TMD while adding title (size = {})", tmd_bytes.size());
return ES_EINVAL;
}
@@ -281,25 +282,23 @@ ReturnCode ES::ImportContentBegin(Context& context, u64 title_id, u32 content_id
{
if (context.title_import_export.content.valid)
{
ERROR_LOG(IOS_ES, "Trying to add content when we haven't finished adding "
"another content. Unsupported.");
ERROR_LOG_FMT(IOS_ES, "Trying to add content when we haven't finished adding "
"another content. Unsupported.");
return ES_EINVAL;
}
context.title_import_export.content = {};
context.title_import_export.content.id = content_id;
INFO_LOG(IOS_ES, "ImportContentBegin: title %016" PRIx64 ", content ID %08x", title_id,
context.title_import_export.content.id);
INFO_LOG_FMT(IOS_ES, "ImportContentBegin: title {:016x}, content ID {:08x}", title_id,
context.title_import_export.content.id);
if (!context.title_import_export.valid)
return ES_EINVAL;
if (title_id != context.title_import_export.tmd.GetTitleId())
{
ERROR_LOG(IOS_ES,
"ImportContentBegin: title id %016" PRIx64 " != "
"TMD title id %016" PRIx64 ", ignoring",
title_id, context.title_import_export.tmd.GetTitleId());
ERROR_LOG_FMT(IOS_ES, "ImportContentBegin: title id {:016x} != TMD title id {:016x}, ignoring",
title_id, context.title_import_export.tmd.GetTitleId());
return ES_EINVAL;
}
@@ -334,7 +333,7 @@ IPCCommandResult ES::ImportContentBegin(Context& context, const IOCtlVRequest& r
ReturnCode ES::ImportContentData(Context& context, u32 content_fd, const u8* data, u32 data_size)
{
INFO_LOG(IOS_ES, "ImportContentData: content fd %08x, size %d", content_fd, data_size);
INFO_LOG_FMT(IOS_ES, "ImportContentData: content fd {:08x}, size {}", content_fd, data_size);
context.title_import_export.content.buffer.insert(
context.title_import_export.content.buffer.end(), data, data + data_size);
return IPC_SUCCESS;
@@ -365,7 +364,7 @@ static std::string GetImportContentPath(u64 title_id, u32 content_id)
ReturnCode ES::ImportContentEnd(Context& context, u32 content_fd)
{
INFO_LOG(IOS_ES, "ImportContentEnd: content fd %08x", content_fd);
INFO_LOG_FMT(IOS_ES, "ImportContentEnd: content fd {:08x}", content_fd);
if (!context.title_import_export.valid || !context.title_import_export.content.valid)
return ES_EINVAL;
@@ -383,7 +382,8 @@ ReturnCode ES::ImportContentEnd(Context& context, u32 content_fd)
&content_info);
if (!CheckIfContentHashMatches(decrypted_data, content_info))
{
ERROR_LOG(IOS_ES, "ImportContentEnd: Hash for content %08x doesn't match", content_info.id);
ERROR_LOG_FMT(IOS_ES, "ImportContentEnd: Hash for content {:08x} doesn't match",
content_info.id);
return ES_HASH_MISMATCH;
}
@@ -408,7 +408,7 @@ ReturnCode ES::ImportContentEnd(Context& context, u32 content_fd)
const auto file = fs->CreateAndOpenFile(PID_KERNEL, PID_KERNEL, temp_path, content_modes);
if (!file || !file->Write(decrypted_data.data(), content_info.size))
{
ERROR_LOG(IOS_ES, "ImportContentEnd: Failed to write to %s", temp_path.c_str());
ERROR_LOG_FMT(IOS_ES, "ImportContentEnd: Failed to write to {}", temp_path);
return ES_EIO;
}
}
@@ -417,7 +417,7 @@ ReturnCode ES::ImportContentEnd(Context& context, u32 content_fd)
if (rename_result != FS::ResultCode::Success)
{
fs->Delete(PID_KERNEL, PID_KERNEL, temp_path);
ERROR_LOG(IOS_ES, "ImportContentEnd: Failed to move content to %s", content_path.c_str());
ERROR_LOG_FMT(IOS_ES, "ImportContentEnd: Failed to move content to {}", content_path);
return FS::ConvertResult(rename_result);
}
@@ -457,7 +457,8 @@ ReturnCode ES::ImportTitleDone(Context& context)
{
if (!context.title_import_export.valid || context.title_import_export.content.valid)
{
ERROR_LOG(IOS_ES, "ImportTitleDone: No title import, or a content import is still in progress");
ERROR_LOG_FMT(IOS_ES,
"ImportTitleDone: No title import, or a content import is still in progress");
return ES_EINVAL;
}
@@ -466,23 +467,23 @@ ReturnCode ES::ImportTitleDone(Context& context)
if (title_id - 0x100000001LL <= 0x100 &&
!HasAllRequiredContents(m_ios, context.title_import_export.tmd))
{
ERROR_LOG(IOS_ES, "ImportTitleDone: Some required contents are missing");
ERROR_LOG_FMT(IOS_ES, "ImportTitleDone: Some required contents are missing");
return ES_EINVAL;
}
if (!WriteImportTMD(context.title_import_export.tmd))
{
ERROR_LOG(IOS_ES, "ImportTitleDone: Failed to write import TMD");
ERROR_LOG_FMT(IOS_ES, "ImportTitleDone: Failed to write import TMD");
return ES_EIO;
}
if (!FinishImport(context.title_import_export.tmd))
{
ERROR_LOG(IOS_ES, "ImportTitleDone: Failed to finalise title import");
ERROR_LOG_FMT(IOS_ES, "ImportTitleDone: Failed to finalise title import");
return ES_EIO;
}
INFO_LOG(IOS_ES, "ImportTitleDone: title %016" PRIx64, title_id);
INFO_LOG_FMT(IOS_ES, "ImportTitleDone: title {:016x}", title_id);
ResetTitleImportContext(&context, m_ios.GetIOSC());
return IPC_SUCCESS;
}
@@ -506,7 +507,7 @@ ReturnCode ES::ImportTitleCancel(Context& context)
{
const u64 title_id = context.title_import_export.tmd.GetTitleId();
FinishStaleImport(title_id);
INFO_LOG(IOS_ES, "ImportTitleCancel: title %016" PRIx64, title_id);
INFO_LOG_FMT(IOS_ES, "ImportTitleCancel: title {:016x}", title_id);
}
ResetTitleImportContext(&context, m_ios.GetIOSC());
@@ -696,7 +697,7 @@ ReturnCode ES::ExportContentBegin(Context& context, u64 title_id, u32 content_id
if (!context.title_import_export.valid ||
context.title_import_export.tmd.GetTitleId() != title_id)
{
ERROR_LOG(IOS_ES, "Tried to use ExportContentBegin with an invalid title export context.");
ERROR_LOG_FMT(IOS_ES, "Tried to use ExportContentBegin with an invalid title export context.");
return ES_EINVAL;
}
+14 -17
View File
@@ -5,7 +5,6 @@
#include "Core/IOS/ES/ES.h"
#include <algorithm>
#include <cinttypes>
#include <cstddef>
#include <cstdio>
#include <vector>
@@ -43,7 +42,7 @@ IPCCommandResult ES::GetTicketViewCount(const IOCtlVRequest& request)
if (!request.HasNumberOfValidVectors(1, 1))
return GetDefaultReply(ES_EINVAL);
u64 TitleID = Memory::Read_U64(request.in_vectors[0].address);
const u64 TitleID = Memory::Read_U64(request.in_vectors[0].address);
const IOS::ES::TicketReader ticket = FindSignedTicket(TitleID);
u32 view_count = ticket.IsValid() ? static_cast<u32>(ticket.GetNumberOfTickets()) : 0;
@@ -51,16 +50,16 @@ IPCCommandResult ES::GetTicketViewCount(const IOCtlVRequest& request)
if (!IOS::HLE::IsEmulated(TitleID))
{
view_count = 0;
ERROR_LOG(IOS_ES, "GetViewCount: Dolphin doesn't emulate IOS title %016" PRIx64, TitleID);
ERROR_LOG_FMT(IOS_ES, "GetViewCount: Dolphin doesn't emulate IOS title {:016x}", TitleID);
}
else if (ShouldReturnFakeViewsForIOSes(TitleID, m_title_context))
{
view_count = 1;
WARN_LOG(IOS_ES, "GetViewCount: Faking IOS title %016" PRIx64 " being present", TitleID);
WARN_LOG_FMT(IOS_ES, "GetViewCount: Faking IOS title {:016x} being present", TitleID);
}
INFO_LOG(IOS_ES, "IOCTL_ES_GETVIEWCNT for titleID: %016" PRIx64 " (View Count = %u)", TitleID,
view_count);
INFO_LOG_FMT(IOS_ES, "IOCTL_ES_GETVIEWCNT for titleID: {:016x} (View Count = {})", TitleID,
view_count);
Memory::Write_U32(view_count, request.io_vectors[0].address);
return GetDefaultReply(IPC_SUCCESS);
@@ -71,14 +70,14 @@ IPCCommandResult ES::GetTicketViews(const IOCtlVRequest& request)
if (!request.HasNumberOfValidVectors(2, 1))
return GetDefaultReply(ES_EINVAL);
u64 TitleID = Memory::Read_U64(request.in_vectors[0].address);
u32 maxViews = Memory::Read_U32(request.in_vectors[1].address);
const u64 TitleID = Memory::Read_U64(request.in_vectors[0].address);
const u32 maxViews = Memory::Read_U32(request.in_vectors[1].address);
const IOS::ES::TicketReader ticket = FindSignedTicket(TitleID);
if (!IOS::HLE::IsEmulated(TitleID))
{
ERROR_LOG(IOS_ES, "GetViews: Dolphin doesn't emulate IOS title %016" PRIx64, TitleID);
ERROR_LOG_FMT(IOS_ES, "GetViews: Dolphin doesn't emulate IOS title {:016x}", TitleID);
}
else if (ticket.IsValid())
{
@@ -93,11 +92,10 @@ IPCCommandResult ES::GetTicketViews(const IOCtlVRequest& request)
else if (ShouldReturnFakeViewsForIOSes(TitleID, m_title_context))
{
Memory::Memset(request.io_vectors[0].address, 0, sizeof(IOS::ES::TicketView));
WARN_LOG(IOS_ES, "GetViews: Faking IOS title %016" PRIx64 " being present", TitleID);
WARN_LOG_FMT(IOS_ES, "GetViews: Faking IOS title {:016x} being present", TitleID);
}
INFO_LOG(IOS_ES, "IOCTL_ES_GETVIEWS for titleID: %016" PRIx64 " (MaxViews = %i)", TitleID,
maxViews);
INFO_LOG_FMT(IOS_ES, "IOCTL_ES_GETVIEWS for titleID: {:016x} (MaxViews = {})", TitleID, maxViews);
return GetDefaultReply(IPC_SUCCESS);
}
@@ -147,7 +145,7 @@ ReturnCode ES::GetTicketFromView(const u8* ticket_view, u8* ticket, u32* ticket_
// Currently, we have no support for v1 tickets at all (unlike IOS), so we fake it
// and return that there is no ticket.
// TODO: implement GetV1TicketFromView when we gain v1 ticket support.
ERROR_LOG(IOS_ES, "GetV1TicketFromView: Unimplemented -- returning -1028");
ERROR_LOG_FMT(IOS_ES, "GetV1TicketFromView: Unimplemented -- returning -1028");
return ES_NO_TICKET;
}
if (ticket != nullptr)
@@ -210,8 +208,7 @@ IPCCommandResult ES::GetTMDViewSize(const IOCtlVRequest& request)
if (!request.HasNumberOfValidVectors(1, 1))
return GetDefaultReply(ES_EINVAL);
u64 TitleID = Memory::Read_U64(request.in_vectors[0].address);
const u64 TitleID = Memory::Read_U64(request.in_vectors[0].address);
const IOS::ES::TMDReader tmd = FindInstalledTMD(TitleID);
if (!tmd.IsValid())
@@ -220,7 +217,7 @@ IPCCommandResult ES::GetTMDViewSize(const IOCtlVRequest& request)
const u32 view_size = static_cast<u32>(tmd.GetRawView().size());
Memory::Write_U32(view_size, request.io_vectors[0].address);
INFO_LOG(IOS_ES, "GetTMDViewSize: %u bytes for title %016" PRIx64, view_size, TitleID);
INFO_LOG_FMT(IOS_ES, "GetTMDViewSize: {} bytes for title {:016x}", view_size, TitleID);
return GetDefaultReply(IPC_SUCCESS);
}
@@ -246,7 +243,7 @@ IPCCommandResult ES::GetTMDViews(const IOCtlVRequest& request)
Memory::CopyToEmu(request.io_vectors[0].address, raw_view.data(), raw_view.size());
INFO_LOG(IOS_ES, "GetTMDView: %zu bytes for title %016" PRIx64, raw_view.size(), title_id);
INFO_LOG_FMT(IOS_ES, "GetTMDView: {} bytes for title {:016x}", raw_view.size(), title_id);
return GetDefaultReply(IPC_SUCCESS);
}