diff --git a/Source/Core/Core/IOS/ES/ES.cpp b/Source/Core/Core/IOS/ES/ES.cpp index edcb89dca8..e398d0bb5c 100644 --- a/Source/Core/Core/IOS/ES/ES.cpp +++ b/Source/Core/Core/IOS/ES/ES.cpp @@ -165,15 +165,24 @@ IPCCommandResult ES::GetTitleDirectory(const IOCtlVRequest& request) return GetDefaultReply(IPC_SUCCESS); } -IPCCommandResult ES::GetTitleID(const IOCtlVRequest& request) +ReturnCode ES::GetTitleId(u64* title_id) const +{ + if (!s_title_context.active) + return ES_EINVAL; + *title_id = s_title_context.tmd.GetTitleId(); + return IPC_SUCCESS; +} + +IPCCommandResult ES::GetTitleId(const IOCtlVRequest& request) { if (!request.HasNumberOfValidVectors(0, 1)) return GetDefaultReply(ES_EINVAL); - if (!s_title_context.active) - return GetDefaultReply(ES_EINVAL); + u64 title_id; + const ReturnCode ret = GetTitleId(&title_id); + if (ret != IPC_SUCCESS) + return GetDefaultReply(ret); - const u64 title_id = s_title_context.tmd.GetTitleId(); Memory::Write_U64(title_id, request.io_vectors[0].address); INFO_LOG(IOS_ES, "IOCTL_ES_GETTITLEID: %08x/%08x", static_cast(title_id >> 32), static_cast(title_id)); @@ -421,7 +430,7 @@ IPCCommandResult ES::IOCtlV(const IOCtlVRequest& request) case IOCTL_ES_GETTITLEDIR: return GetTitleDirectory(request); case IOCTL_ES_GETTITLEID: - return GetTitleID(request); + return GetTitleId(request); case IOCTL_ES_SETUID: return SetUID(context->uid, request); case IOCTL_ES_DIVERIFY: diff --git a/Source/Core/Core/IOS/ES/ES.h b/Source/Core/Core/IOS/ES/ES.h index 6352eec917..b21c3335d1 100644 --- a/Source/Core/Core/IOS/ES/ES.h +++ b/Source/Core/Core/IOS/ES/ES.h @@ -127,6 +127,7 @@ public: ReturnCode DeleteContent(u64 title_id, u32 content_id) const; ReturnCode GetDeviceId(u32* device_id) const; + ReturnCode GetTitleId(u64* device_id) const; // Views ReturnCode GetV0TicketFromView(const u8* ticket_view, u8* ticket) const; @@ -243,7 +244,7 @@ private: // Misc IPCCommandResult SetUID(u32 uid, const IOCtlVRequest& request); IPCCommandResult GetTitleDirectory(const IOCtlVRequest& request); - IPCCommandResult GetTitleID(const IOCtlVRequest& request); + IPCCommandResult GetTitleId(const IOCtlVRequest& request); IPCCommandResult GetConsumption(const IOCtlVRequest& request); IPCCommandResult Launch(const IOCtlVRequest& request); IPCCommandResult LaunchBC(const IOCtlVRequest& request);