Merge pull request #5267 from leoetlino/more-es-ioctlvs

IOS/ES: Implement ES_DIGetTMD and ES_DIGetTMDSize
This commit is contained in:
Markus Wick 2017-04-21 11:08:05 +02:00 committed by GitHub
commit 207a95f4dc
3 changed files with 41 additions and 4 deletions

View File

@ -372,6 +372,10 @@ IPCCommandResult ES::IOCtlV(const IOCtlVRequest& request)
return DIGetTMDViewSize(request); return DIGetTMDViewSize(request);
case IOCTL_ES_DIGETTMDVIEW: case IOCTL_ES_DIGETTMDVIEW:
return DIGetTMDView(request); return DIGetTMDView(request);
case IOCTL_ES_DIGETTMDSIZE:
return DIGetTMDSize(request);
case IOCTL_ES_DIGETTMD:
return DIGetTMD(request);
case IOCTL_ES_GETCONSUMPTION: case IOCTL_ES_GETCONSUMPTION:
return GetConsumption(request); return GetConsumption(request);
@ -414,8 +418,6 @@ IPCCommandResult ES::IOCtlV(const IOCtlVRequest& request)
case IOCTL_ES_VERIFYSIGN: case IOCTL_ES_VERIFYSIGN:
case IOCTL_ES_DELETESHAREDCONTENT: case IOCTL_ES_DELETESHAREDCONTENT:
case IOCTL_ES_UNKNOWN_39:
case IOCTL_ES_UNKNOWN_3A:
case IOCTL_ES_UNKNOWN_3B: case IOCTL_ES_UNKNOWN_3B:
case IOCTL_ES_UNKNOWN_3C: case IOCTL_ES_UNKNOWN_3C:
case IOCTL_ES_UNKNOWN_3D: case IOCTL_ES_UNKNOWN_3D:

View File

@ -120,8 +120,8 @@ private:
IOCTL_ES_GETSHAREDCONTENTCNT = 0x36, IOCTL_ES_GETSHAREDCONTENTCNT = 0x36,
IOCTL_ES_GETSHAREDCONTENTS = 0x37, IOCTL_ES_GETSHAREDCONTENTS = 0x37,
IOCTL_ES_DELETESHAREDCONTENT = 0x38, IOCTL_ES_DELETESHAREDCONTENT = 0x38,
IOCTL_ES_UNKNOWN_39 = 0x39, IOCTL_ES_DIGETTMDSIZE = 0x39,
IOCTL_ES_UNKNOWN_3A = 0x3A, IOCTL_ES_DIGETTMD = 0x3A,
IOCTL_ES_UNKNOWN_3B = 0x3B, IOCTL_ES_UNKNOWN_3B = 0x3B,
IOCTL_ES_UNKNOWN_3C = 0x3C, IOCTL_ES_UNKNOWN_3C = 0x3C,
IOCTL_ES_UNKNOWN_3D = 0x3D, IOCTL_ES_UNKNOWN_3D = 0x3D,
@ -223,6 +223,8 @@ private:
IPCCommandResult DIGetTicketView(const IOCtlVRequest& request); IPCCommandResult DIGetTicketView(const IOCtlVRequest& request);
IPCCommandResult DIGetTMDViewSize(const IOCtlVRequest& request); IPCCommandResult DIGetTMDViewSize(const IOCtlVRequest& request);
IPCCommandResult DIGetTMDView(const IOCtlVRequest& request); IPCCommandResult DIGetTMDView(const IOCtlVRequest& request);
IPCCommandResult DIGetTMDSize(const IOCtlVRequest& request);
IPCCommandResult DIGetTMD(const IOCtlVRequest& request);
static bool LaunchIOS(u64 ios_title_id); static bool LaunchIOS(u64 ios_title_id);
static bool LaunchPPCTitle(u64 title_id, bool skip_reload); static bool LaunchPPCTitle(u64 title_id, bool skip_reload);

View File

@ -260,6 +260,39 @@ IPCCommandResult ES::DIGetTicketView(const IOCtlVRequest& request)
return GetDefaultReply(IPC_SUCCESS); return GetDefaultReply(IPC_SUCCESS);
} }
IPCCommandResult ES::DIGetTMDSize(const IOCtlVRequest& request)
{
if (!request.HasNumberOfValidVectors(0, 1) || request.io_vectors[0].size != sizeof(u32))
return GetDefaultReply(ES_EINVAL);
if (!GetTitleContext().active)
return GetDefaultReply(ES_EINVAL);
Memory::Write_U32(static_cast<u32>(GetTitleContext().tmd.GetRawTMD().size()),
request.io_vectors[0].address);
return GetDefaultReply(IPC_SUCCESS);
}
IPCCommandResult ES::DIGetTMD(const IOCtlVRequest& request)
{
if (!request.HasNumberOfValidVectors(1, 1) || request.in_vectors[0].size != sizeof(u32))
return GetDefaultReply(ES_EINVAL);
const u32 tmd_size = Memory::Read_U32(request.in_vectors[0].address);
if (tmd_size != request.io_vectors[0].size)
return GetDefaultReply(ES_EINVAL);
if (!GetTitleContext().active)
return GetDefaultReply(ES_EINVAL);
const std::vector<u8>& tmd_bytes = GetTitleContext().tmd.GetRawTMD();
if (static_cast<u32>(tmd_bytes.size()) > tmd_size)
return GetDefaultReply(ES_EINVAL);
Memory::CopyToEmu(request.io_vectors[0].address, tmd_bytes.data(), tmd_bytes.size());
return GetDefaultReply(IPC_SUCCESS);
}
} // namespace Device } // namespace Device
} // namespace HLE } // namespace HLE
} // namespace IOS } // namespace IOS