diff --git a/core/libs/prx/libSceNpManager/Export.cpp b/core/libs/prx/libSceNpManager/Export.cpp index 511383f4c83..f7bf0f725f2 100644 --- a/core/libs/prx/libSceNpManager/Export.cpp +++ b/core/libs/prx/libSceNpManager/Export.cpp @@ -210,9 +210,9 @@ int APS5_VABI sceNpUnregisterPremiumEventCallback(void) { return 0; } -int APS5_VABI sceNpGetUserIdByAccountId() { - NotImplemented_nid_no_patch(__func__); - return 0; +int APS5_VABI sceNpGetUserIdByAccountId(uint64_t accountId, int* userId) { + if (accountId == 0 || !userId) return SCE_NP_ERROR_INVALID_ARGUMENT; + return SCE_NP_ERROR_SIGNED_OUT; } } diff --git a/core/libs/tests/GuestNpManager.cpp b/core/libs/tests/GuestNpManager.cpp index 106a1e05b8d..dfe11d6564f 100644 --- a/core/libs/tests/GuestNpManager.cpp +++ b/core/libs/tests/GuestNpManager.cpp @@ -6,6 +6,7 @@ #include extern "C" { +int APS5_VABI sceNpGetUserIdByAccountId(uint64_t accountId, int* userId); int APS5_VABI sceNpGetNpId(int user_id, NpId* np_id); } @@ -24,6 +25,11 @@ void Require(bool condition, const char* message) { } int main() { + int userId = 0x7a7a; + Require(sceNpGetUserIdByAccountId(0x1234, &userId) == SignedOut, "sceNpGetUserIdByAccountId must report the account as signed out"); + Require(userId == 0x7a7a, "sceNpGetUserIdByAccountId must leave the user id untouched"); + Require(sceNpGetUserIdByAccountId(0, &userId) == InvalidArgument, "sceNpGetUserIdByAccountId must reject account id 0"); + Require(sceNpGetUserIdByAccountId(0x1234, nullptr) == InvalidArgument, "sceNpGetUserIdByAccountId must reject a null user id"); NpId npId{}; std::memset(&npId, 0x5a, sizeof(npId)); NpId untouched{}; diff --git a/docs/dev/TechnicalDebt.md b/docs/dev/TechnicalDebt.md index 626b7958a63..d2875ca6efa 100644 --- a/docs/dev/TechnicalDebt.md +++ b/docs/dev/TechnicalDebt.md @@ -86,6 +86,7 @@ Throughout the project, every function at every stage either **does exactly what - [sceCoredumpWriteUserString](../../core/libs/prx/libkernel/System/src/Coredump.cpp) and [sceSaveDataConvert, sceSaveDataGetConvertProgress](../../core/libs/prx/libSceSaveData.native/Export.cpp) - imported by PPSA16064, not called during its start-up and added without an implementation; unknown signatures - [sce::Json::Parser::parse](../../core/libs/prx/libSceJson2/Export.cpp) (libSceJson2) - a number that overflows a double (e.g. `1e309`) throws: whether the console rejects the document or stores an infinite real is unknown - [sceUserServiceGetNpAccountId](../../core/libs/prx/libSceUserService/Export.cpp) (libSceUserService) - the account id for a user with no linked PSN account is assumed to be 0 with success; libSceNpManager's `sceNpGetAccountIdA` answers the same question with `SCE_NP_ERROR_SIGNED_OUT` +- [sceNpGetUserIdByAccountId](../../core/libs/prx/libSceNpManager/Export.cpp) (libSceNpManager) - the signature `(accountId, userId*)` and the errors for a zero account id or a null pointer are taken from [shadPS4](https://github.com/shadps4-emu/shadPS4/blob/945dbc3cc3eee80ac3e053b438502ed936fa6bb2/src/core/libraries/np/np_manager.cpp); not confirmed on a PS5 title (PPSA14632 imports it). No account is ever signed in here, so every valid lookup returns `SCE_NP_ERROR_SIGNED_OUT` - [sceUserServiceGetUserColor](../../core/libs/prx/libSceUserService/Export.cpp) (libSceUserService) - the default profile colour is assumed to be blue (0) - [kP2L8t3j-aM](../../core/libs/prx/libSceVideoOut/src/Output.cpp) (libSceVideoOut) - unknown name, signature - [LibwuIonIBw](../../core/libs/prx/libSceVideoOut/src/Output.cpp) (libSceVideoOut) - unknown name, signature