IOS/ES: Expose GetDeviceId

This commit is contained in:
Léo Lam 2017-06-13 00:52:53 +02:00
parent 60c6fbe9cc
commit 860f07f5a1
3 changed files with 19 additions and 7 deletions
Source/Core/Core/IOS/ES

@ -423,7 +423,7 @@ IPCCommandResult ES::IOCtlV(const IOCtlVRequest& request)
case IOCTL_ES_ADDTITLECANCEL: case IOCTL_ES_ADDTITLECANCEL:
return ImportTitleCancel(*context, request); return ImportTitleCancel(*context, request);
case IOCTL_ES_GETDEVICEID: case IOCTL_ES_GETDEVICEID:
return GetConsoleID(request); return GetDeviceId(request);
case IOCTL_ES_OPENTITLECONTENT: case IOCTL_ES_OPENTITLECONTENT:
return OpenTitleContent(context->uid, request); return OpenTitleContent(context->uid, request);
case IOCTL_ES_OPENCONTENT: case IOCTL_ES_OPENCONTENT:

@ -132,6 +132,8 @@ public:
ReturnCode DeleteSharedContent(const std::array<u8, 20>& sha1) const; ReturnCode DeleteSharedContent(const std::array<u8, 20>& sha1) const;
ReturnCode DeleteContent(u64 title_id, u32 content_id) const; ReturnCode DeleteContent(u64 title_id, u32 content_id) const;
ReturnCode GetDeviceId(u32* device_id) const;
// Views // Views
ReturnCode GetV0TicketFromView(const u8* ticket_view, u8* ticket) const; ReturnCode GetV0TicketFromView(const u8* ticket_view, u8* ticket) const;
ReturnCode GetTicketFromView(const u8* ticket_view, u8* ticket, u32* ticket_size) const; ReturnCode GetTicketFromView(const u8* ticket_view, u8* ticket, u32* ticket_size) const;
@ -237,7 +239,7 @@ private:
IPCCommandResult DeleteContent(const IOCtlVRequest& request); IPCCommandResult DeleteContent(const IOCtlVRequest& request);
// Device identity and encryption // Device identity and encryption
IPCCommandResult GetConsoleID(const IOCtlVRequest& request); IPCCommandResult GetDeviceId(const IOCtlVRequest& request);
IPCCommandResult GetDeviceCertificate(const IOCtlVRequest& request); IPCCommandResult GetDeviceCertificate(const IOCtlVRequest& request);
IPCCommandResult CheckKoreaRegion(const IOCtlVRequest& request); IPCCommandResult CheckKoreaRegion(const IOCtlVRequest& request);
IPCCommandResult Sign(const IOCtlVRequest& request); IPCCommandResult Sign(const IOCtlVRequest& request);

@ -18,14 +18,24 @@ namespace HLE
{ {
namespace Device namespace Device
{ {
IPCCommandResult ES::GetConsoleID(const IOCtlVRequest& request) ReturnCode ES::GetDeviceId(u32* device_id) const
{ {
if (!request.HasNumberOfValidVectors(0, 1)) const EcWii& ec = EcWii::GetInstance();
*device_id = ec.GetNGID();
INFO_LOG(IOS_ES, "GetDeviceId: %08X", *device_id);
return IPC_SUCCESS;
}
IPCCommandResult ES::GetDeviceId(const IOCtlVRequest& request)
{
if (!request.HasNumberOfValidVectors(0, 1) || request.io_vectors[0].size != sizeof(u32))
return GetDefaultReply(ES_EINVAL); return GetDefaultReply(ES_EINVAL);
const EcWii& ec = EcWii::GetInstance(); u32 device_id;
INFO_LOG(IOS_ES, "IOCTL_ES_GETDEVICEID %08X", ec.GetNGID()); const ReturnCode ret = GetDeviceId(&device_id);
Memory::Write_U32(ec.GetNGID(), request.io_vectors[0].address); if (ret != IPC_SUCCESS)
return GetDefaultReply(ret);
Memory::Write_U32(device_id, request.io_vectors[0].address);
return GetDefaultReply(IPC_SUCCESS); return GetDefaultReply(IPC_SUCCESS);
} }