IOS/ES: Implement ES_DIGetTMD and ES_DIGetTMDSize
Used by Metroid Prime.
This commit is contained in:
parent
0d98ffa2b2
commit
183193e6ed
|
@ -372,6 +372,10 @@ IPCCommandResult ES::IOCtlV(const IOCtlVRequest& request)
|
|||
return DIGetTMDViewSize(request);
|
||||
case IOCTL_ES_DIGETTMDVIEW:
|
||||
return DIGetTMDView(request);
|
||||
case IOCTL_ES_DIGETTMDSIZE:
|
||||
return DIGetTMDSize(request);
|
||||
case IOCTL_ES_DIGETTMD:
|
||||
return DIGetTMD(request);
|
||||
|
||||
case IOCTL_ES_GETCONSUMPTION:
|
||||
return GetConsumption(request);
|
||||
|
@ -414,8 +418,6 @@ IPCCommandResult ES::IOCtlV(const IOCtlVRequest& request)
|
|||
|
||||
case IOCTL_ES_VERIFYSIGN:
|
||||
case IOCTL_ES_DELETESHAREDCONTENT:
|
||||
case IOCTL_ES_UNKNOWN_39:
|
||||
case IOCTL_ES_UNKNOWN_3A:
|
||||
case IOCTL_ES_UNKNOWN_3B:
|
||||
case IOCTL_ES_UNKNOWN_3C:
|
||||
case IOCTL_ES_UNKNOWN_3D:
|
||||
|
|
|
@ -120,8 +120,8 @@ private:
|
|||
IOCTL_ES_GETSHAREDCONTENTCNT = 0x36,
|
||||
IOCTL_ES_GETSHAREDCONTENTS = 0x37,
|
||||
IOCTL_ES_DELETESHAREDCONTENT = 0x38,
|
||||
IOCTL_ES_UNKNOWN_39 = 0x39,
|
||||
IOCTL_ES_UNKNOWN_3A = 0x3A,
|
||||
IOCTL_ES_DIGETTMDSIZE = 0x39,
|
||||
IOCTL_ES_DIGETTMD = 0x3A,
|
||||
IOCTL_ES_UNKNOWN_3B = 0x3B,
|
||||
IOCTL_ES_UNKNOWN_3C = 0x3C,
|
||||
IOCTL_ES_UNKNOWN_3D = 0x3D,
|
||||
|
@ -223,6 +223,8 @@ private:
|
|||
IPCCommandResult DIGetTicketView(const IOCtlVRequest& request);
|
||||
IPCCommandResult DIGetTMDViewSize(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 LaunchPPCTitle(u64 title_id, bool skip_reload);
|
||||
|
|
|
@ -260,6 +260,39 @@ IPCCommandResult ES::DIGetTicketView(const IOCtlVRequest& request)
|
|||
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 HLE
|
||||
} // namespace IOS
|
||||
|
|
Loading…
Reference in New Issue