IOS/ES: Fix DeleteTitle to not use CNANDContentManager

* CNANDContentManager does things that are absolutely useless. In
  particular, it parses the ticket, the TMD, reads contents, etc.
  when we only need to remove the title directory.

* This means it will fail if the ticket cannot be found, when that
  should not be the case.

* This also obviously caused DeleteTitle to be incredibly inefficient.

* We are already removing the title directory later in the function,
  as CNANDContentManager does not even delete titles correctly.
  DeleteTitle != DeleteTitleContents.
This commit is contained in:
Léo Lam 2017-05-07 16:20:41 +02:00
parent cc5b5c15ac
commit 3cdb8fd297
1 changed files with 3 additions and 4 deletions

View File

@ -317,17 +317,16 @@ IPCCommandResult ES::DeleteTitle(const IOCtlVRequest& request)
return GetDefaultReply(ES_EINVAL); return GetDefaultReply(ES_EINVAL);
const std::string title_dir = Common::GetTitlePath(title_id, Common::FROM_SESSION_ROOT); const std::string title_dir = Common::GetTitlePath(title_id, Common::FROM_SESSION_ROOT);
if (!File::IsDirectory(title_dir) || if (!File::IsDirectory(title_dir))
!DiscIO::CNANDContentManager::Access().RemoveTitle(title_id, Common::FROM_SESSION_ROOT))
{
return GetDefaultReply(FS_ENOENT); return GetDefaultReply(FS_ENOENT);
}
if (!File::DeleteDirRecursively(title_dir)) if (!File::DeleteDirRecursively(title_dir))
{ {
ERROR_LOG(IOS_ES, "DeleteTitle: Failed to delete title directory: %s", title_dir.c_str()); ERROR_LOG(IOS_ES, "DeleteTitle: Failed to delete title directory: %s", title_dir.c_str());
return GetDefaultReply(FS_EACCESS); return GetDefaultReply(FS_EACCESS);
} }
// XXX: ugly, but until we drop CNANDContentManager everywhere, this is going to be needed.
DiscIO::CNANDContentManager::Access().ClearCache();
return GetDefaultReply(IPC_SUCCESS); return GetDefaultReply(IPC_SUCCESS);
} }