IOS/ES: Implement ES_DeleteContent (0x3e)
This commit is contained in:
parent
ced049c5e8
commit
90d590d1f3
|
@ -474,6 +474,8 @@ IPCCommandResult ES::IOCtlV(const IOCtlVRequest& request)
|
|||
return DeleteTitleContent(request);
|
||||
case IOCTL_ES_DELETESHAREDCONTENT:
|
||||
return DeleteSharedContent(request);
|
||||
case IOCTL_ES_DELETE_CONTENT:
|
||||
return DeleteContent(request);
|
||||
case IOCTL_ES_GETSTOREDTMDSIZE:
|
||||
return GetStoredTMDSize(request);
|
||||
case IOCTL_ES_GETSTOREDTMD:
|
||||
|
@ -515,7 +517,6 @@ IPCCommandResult ES::IOCtlV(const IOCtlVRequest& request)
|
|||
case IOCTL_ES_VERIFYSIGN:
|
||||
case IOCTL_ES_UNKNOWN_3C:
|
||||
case IOCTL_ES_UNKNOWN_3D:
|
||||
case IOCTL_ES_UNKNOWN_3E:
|
||||
case IOCTL_ES_UNKNOWN_41:
|
||||
case IOCTL_ES_UNKNOWN_42:
|
||||
PanicAlert("IOS-ES: Unimplemented ioctlv 0x%x (%zu in vectors, %zu io vectors)",
|
||||
|
|
|
@ -115,6 +115,7 @@ public:
|
|||
ReturnCode DeleteTitleContent(u64 title_id) const;
|
||||
ReturnCode DeleteTicket(const u8* ticket_view);
|
||||
ReturnCode DeleteSharedContent(const std::array<u8, 20>& sha1) const;
|
||||
ReturnCode DeleteContent(u64 title_id, u32 content_id) const;
|
||||
|
||||
// Views
|
||||
ReturnCode GetV0TicketFromView(const u8* ticket_view, u8* ticket) const;
|
||||
|
@ -184,7 +185,7 @@ private:
|
|||
IOCTL_ES_DIVERIFY_WITH_VIEW = 0x3B,
|
||||
IOCTL_ES_UNKNOWN_3C = 0x3C,
|
||||
IOCTL_ES_UNKNOWN_3D = 0x3D,
|
||||
IOCTL_ES_UNKNOWN_3E = 0x3E,
|
||||
IOCTL_ES_DELETE_CONTENT = 0x3E,
|
||||
IOCTL_ES_INVALID_3F = 0x3F,
|
||||
IOCTL_ES_GET_V0_TICKET_FROM_VIEW = 0x40,
|
||||
IOCTL_ES_UNKNOWN_41 = 0x41,
|
||||
|
@ -215,6 +216,7 @@ private:
|
|||
IPCCommandResult DeleteTitleContent(const IOCtlVRequest& request);
|
||||
IPCCommandResult DeleteTicket(const IOCtlVRequest& request);
|
||||
IPCCommandResult DeleteSharedContent(const IOCtlVRequest& request);
|
||||
IPCCommandResult DeleteContent(const IOCtlVRequest& request);
|
||||
|
||||
// Device identity and encryption
|
||||
IPCCommandResult GetConsoleID(const IOCtlVRequest& request);
|
||||
|
|
|
@ -440,6 +440,39 @@ IPCCommandResult ES::DeleteTitleContent(const IOCtlVRequest& request)
|
|||
return GetDefaultReply(DeleteTitleContent(Memory::Read_U64(request.in_vectors[0].address)));
|
||||
}
|
||||
|
||||
ReturnCode ES::DeleteContent(u64 title_id, u32 content_id) const
|
||||
{
|
||||
if (!CanDeleteTitle(title_id))
|
||||
return ES_EINVAL;
|
||||
|
||||
const auto tmd = IOS::ES::FindInstalledTMD(title_id);
|
||||
if (!tmd.IsValid())
|
||||
return FS_ENOENT;
|
||||
|
||||
IOS::ES::Content content;
|
||||
if (!tmd.FindContentById(content_id, &content))
|
||||
return ES_EINVAL;
|
||||
|
||||
if (!File::Delete(Common::GetTitleContentPath(title_id, Common::FROM_SESSION_ROOT) +
|
||||
StringFromFormat("%08x.app", content_id)))
|
||||
{
|
||||
return FS_ENOENT;
|
||||
}
|
||||
|
||||
return IPC_SUCCESS;
|
||||
}
|
||||
|
||||
IPCCommandResult ES::DeleteContent(const IOCtlVRequest& request)
|
||||
{
|
||||
if (!request.HasNumberOfValidVectors(2, 0) || request.in_vectors[0].size != sizeof(u64) ||
|
||||
request.in_vectors[1].size != sizeof(u32))
|
||||
{
|
||||
return GetDefaultReply(ES_EINVAL);
|
||||
}
|
||||
return GetDefaultReply(DeleteContent(Memory::Read_U64(request.in_vectors[0].address),
|
||||
Memory::Read_U32(request.in_vectors[1].address)));
|
||||
}
|
||||
|
||||
ReturnCode ES::ExportTitleInit(Context& context, u64 title_id, u8* tmd_bytes, u32 tmd_size)
|
||||
{
|
||||
// No concurrent title import/export is allowed.
|
||||
|
|
Loading…
Reference in New Issue