fix(libSceContentSearch): report metadata access as not implemented

Past their initialization and argument errors, sceContentSearchOpenMetadata, sceContentSearchOpenMetadataByContentId, sceContentSearchGetMetadataFieldInfo and sceContentSearchGetMetadataValue threw a bare logic_error for every valid call, so progress.py counted them as done. The host content library is empty and the console's errors for missing content and unopened metadata ids are unknown, so the four now go through NotImplemented_nid_no_patch. ThrowUnknownMetadataId had no other caller and goes.
This commit is contained in:
Yunus Shaikh committed 2026-10-25 12:53:43 +00:00
1 parent aa3499790c
commit 70cb02625d
3 files changed
+24 -12

No files matched your search

+8 -7
View File
@@ -58,9 +58,6 @@ void ValidateOrderBy(const char* funcName, const ContentSearchContentOrderByCond
}
}
[[noreturn]] void ThrowUnknownMetadataId(const char* funcName, std::int32_t metadataId) {
throw std::logic_error(std::string(funcName) + ": metadata id " + std::to_string(metadataId) + " was never opened, as the host content library is empty, and the console's error for it is unknown");
}
}
extern "C" {
@@ -81,19 +78,22 @@ int APS5_VABI sceContentSearchCloseMetadata(std::int32_t metadataId) {
int APS5_VABI sceContentSearchGetMetadataFieldInfo(std::int32_t metadataId, const char* field, std::int32_t* metadataType, std::int32_t* size) {
if (!g_initialized.load()) return ErrorNotInitialized;
if (field == nullptr || metadataType == nullptr || size == nullptr) return ErrorInvalidArgument;
ThrowUnknownMetadataId(__func__, metadataId);
NotImplemented_nid_no_patch(__func__);
return 0;
}
int APS5_VABI sceContentSearchGetMetadataValue(std::int32_t metadataId, const char* field, void* value) {
if (!g_initialized.load()) return ErrorNotInitialized;
if (field == nullptr || value == nullptr) return ErrorInvalidArgument;
ThrowUnknownMetadataId(__func__, metadataId);
NotImplemented_nid_no_patch(__func__);
return 0;
}
int APS5_VABI sceContentSearchOpenMetadata(const char* filePath, std::int32_t* metadataId) {
if (!g_initialized.load()) return ErrorNotInitialized;
if (filePath == nullptr || metadataId == nullptr) return ErrorInvalidArgument;
throw std::logic_error(std::string(__func__) + ": " + filePath + " is not in the host content library, which is empty, and the console's error for it is unknown");
NotImplemented_nid_no_patch(__func__);
return 0;
}
int APS5_VABI sceContentSearchSearchContent(const ContentSearchContentColumnSet* columnSet, std::uint32_t columnSetLength, const ContentSearchContentOrderByCondition* orderByConditions, std::uint32_t orderByConditionsLength, std::uint32_t offset, std::uint32_t limit, std::int64_t* numOfContent, void* infos, std::int64_t* lastUpdateId) {
@@ -119,7 +119,8 @@ int APS5_VABI sceContentSearchGetContentLastUpdateId(std::int64_t* lastUpdateId)
int APS5_VABI sceContentSearchOpenMetadataByContentId(std::int64_t contentId, std::int32_t* metadataId) {
if (!g_initialized.load()) return ErrorNotInitialized;
if (metadataId == nullptr) return ErrorInvalidArgument;
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");
NotImplemented_nid_no_patch(__func__);
return 0;
}
int APS5_VABI sceContentSearchGetTotalContentSize(const ContentSearchContentColumnSet* columnSet, std::uint32_t columnSetLength, std::int64_t* size, std::int64_t* lastUpdateId) {
+15 -4
View File
@@ -3,11 +3,22 @@
#include <cstdint>
#include <cstdlib>
#include <stdexcept>
#include <string>
namespace {
void Require(bool value) { if (!value) std::abort(); }
template <typename TAction>
bool NotImplemented(TAction action, const std::string& name) {
try {
action();
} catch (const std::runtime_error& error) {
return error.what() == name + " not implemented";
}
return false;
}
template <typename TAction>
bool ThrowsRuntimeError(TAction action) {
try {
@@ -122,12 +133,12 @@ int main() {
Require(sceContentSearchGetTotalContentSize(&columnSet, 0, &size, &updateId) == ErrorInvalidArgument);
Require(count == -1 && updateId == -1);
Require(Throws([&] { sceContentSearchOpenMetadata("/data/photo.jpg", &metadataId); }));
Require(Throws([&] { sceContentSearchOpenMetadataByContentId(1, &metadataId); }));
Require(NotImplemented([&] { sceContentSearchOpenMetadata("/data/photo.jpg", &metadataId); }, "sceContentSearchOpenMetadata"));
Require(NotImplemented([&] { sceContentSearchOpenMetadataByContentId(1, &metadataId); }, "sceContentSearchOpenMetadataByContentId"));
Require(metadataId == -1);
Require(sceContentSearchCloseMetadata(1) == ErrorInvalidArgument);
Require(Throws([&] { sceContentSearchGetMetadataFieldInfo(1, "title", &metadataType, &fieldSize); }));
Require(Throws([&] { sceContentSearchGetMetadataValue(1, "title", &value); }));
Require(NotImplemented([&] { sceContentSearchGetMetadataFieldInfo(1, "title", &metadataType, &fieldSize); }, "sceContentSearchGetMetadataFieldInfo"));
Require(NotImplemented([&] { sceContentSearchGetMetadataValue(1, "title", &value); }, "sceContentSearchGetMetadataValue"));
Require(metadataType == -1 && fieldSize == -1 && value.size == -1);
Require(sceContentSearchTerm() == 0);
+1 -1
View File
@@ -7,4 +7,4 @@
### Functional
- [Content queries](../../../core/libs/prx/libSceContentSearch/Export.cpp) use an empty host library and always report update id 0; the console's initial update id is unverified. No content rows are produced. Every title is assumed to have search permission. Nested filter/sort validation is incomplete: empty nested column sets, null filter values and unknown enum values throw. Guest heap allocation and the platform-dependent minimum heap size are unimplemented. Initialization and outer pointer/count/limit validation follow the supplied module.
- [Metadata access](../../../core/libs/prx/libSceContentSearch/Export.cpp) cannot open metadata by path or content id because missing-content errors remain unresolved. No metadata handles are issued. Queries reject invalid outer pointers but still throw for valid pointers because errors depend on the requested field; closing an unopened handle returns the confirmed invalid-argument error.
- [Metadata access](../../../core/libs/prx/libSceContentSearch/Export.cpp) cannot open metadata by path or content id because missing-content errors remain unresolved: past their argument checks, both opening calls go through `NotImplemented_nid_no_patch`. No metadata handles are issued. The field-info and value queries reject invalid outer pointers, then go through `NotImplemented_nid_no_patch`, as no metadata id is ever opened and the console's error for one depends on the requested field; closing an unopened handle returns the confirmed invalid-argument error.