Files
AnyPS5/core/libs/prx/libSceContentDelete/Export.cpp
T
screamm e8627d607b feat(libSceContentDelete): add sceContentDeleteById and sceContentDeleteByPath
Cult of the Lamb (PPSA06465, #2686) stops at start-up on the first one:

    FAIL: unresolved ELF import pXJh3aVk8Ks from libSceContentDelete.prx

Both exports have been on main without an implementation (#2740); the
call itself has not been observed yet.

Orbital (cc408367, tools/ida/db_types.json:541-542) and SharpProspero
(5dfdb4b0, Interop/Content/ContentDelete.cs:25-42) agree on the
signatures: a 64-bit SceContentSearchContentId and a UTF-8 path. The
content library is empty on the host, since libSceContentExport exports
nothing into it, so no id or path can be found. SharpProspero gives only
NoPermission (0x809D5006) and no public source gives the not-found code,
so both calls throw with the id or path named once the null path and the
initialization are checked, like the "not in the host content library"
throws of #3724. sceContentDeleteById moves from
guest_content_unimplemented to the new guest_content_delete test.

NIDs pXJh3aVk8Ks and qC3QW+AltHs match tools/nid_names.py and the shadPS4
aerolib list.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
(cherry picked from commit 928184824a4acdf36a58287034bff8154c861835)
2026-10-17 14:20:14 +02:00

44 lines
1.5 KiB
C++

#include <cstdint>
#include <cstddef>
#include "SceTypes.hpp"
#include "prx/libc/include/General.hpp"
#include <atomic>
#include <stdexcept>
#include <string>
namespace {
std::atomic<bool> g_initialized{false};
void RequireInitialized(const char* function) {
if (!g_initialized.load()) throw std::logic_error(std::string(function) + ": not initialized");
}
}
extern "C" {
int APS5_VABI sceContentDeleteInitialize(const ContentDeleteInitParam* init_param) {
if (init_param == nullptr) APS5_INVALID_ARG_EX;
bool expected = false;
if (!g_initialized.compare_exchange_strong(expected, true)) throw std::logic_error(std::string(__func__) + ": already initialized");
return 0;
}
int APS5_VABI sceContentDeleteByPath(const char* contentPath) {
if (contentPath == nullptr) APS5_INVALID_ARG_EX;
RequireInitialized(__func__);
throw std::logic_error(std::string(__func__) + ": " + contentPath + " is not in the host content library, which is empty, and the console's error for it is unknown");
}
int APS5_VABI sceContentDeleteById(std::int64_t contentId) {
RequireInitialized(__func__);
throw std::logic_error(std::string(__func__) + ": content id " + std::to_string(contentId) + " is not in the host content library, which is empty, and the console's error for it is unknown");
}
int APS5_VABI sceContentDeleteTerminate(void) {
bool expected = true;
if (!g_initialized.compare_exchange_strong(expected, false)) throw std::logic_error(std::string(__func__) + ": not initialized");
return 0;
}
}