Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions core/libs/prx/libSceNpAuth/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
add_library(libSceNpAuth SHARED EXCLUDE_FROM_ALL Export.cpp)
target_include_directories(libSceNpAuth PRIVATE ${LIBS_INCLUDE_DIR})
configure_windows_unwind(libSceNpAuth)

if(BUILD_TESTING)
add_test_executable(guest_np_auth_authorized_app_code_tests ${LIBS_INCLUDE_DIR}/tests/GuestNpAuthAuthorizedAppCode.cpp)
target_include_directories(guest_np_auth_authorized_app_code_tests PRIVATE ${LIBS_INCLUDE_DIR})
target_link_libraries(guest_np_auth_authorized_app_code_tests PRIVATE libSceNpAuth)
add_test(NAME guest_np_auth_authorized_app_code COMMAND guest_np_auth_authorized_app_code_tests)
if(WIN32)
set_tests_properties(guest_np_auth_authorized_app_code PROPERTIES ENVIRONMENT_MODIFICATION
"PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceNpAuth>")
endif()
endif()
3 changes: 1 addition & 2 deletions core/libs/prx/libSceNpAuth/Export.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@ int APS5_VABI sceNpAuthDeleteRequest(int req_id) {
}

int APS5_VABI sceNpAuthGetAuthorizedAppCode() {
NotImplemented_nid_no_patch(__func__);
return 0;
return SCE_NP_ERROR_SIGNED_OUT;
}

int APS5_VABI sceNpAuthGetAuthorizationCodeV3(int req_id, const void* param, void* auth_code, int* issuer_id) {
Expand Down
13 changes: 13 additions & 0 deletions core/libs/tests/GuestNpAuthAuthorizedAppCode.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#include "prx/libc/include/general/VabiMacros.hpp"
#include <cstdlib>

extern "C" {
int APS5_VABI sceNpAuthGetAuthorizedAppCode();
}

int main() {
constexpr int kSignedOut = static_cast<int>(0x80550006);
if (sceNpAuthGetAuthorizedAppCode() != kSignedOut) std::abort();
if (sceNpAuthGetAuthorizedAppCode() != kSignedOut) std::abort();
return 0;
}
2 changes: 1 addition & 1 deletion docs/dev/debt/libSceNpAuth.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

### Unknown function info

- [sceNpAuthGetAuthorizedAppCode](../../../core/libs/prx/libSceNpAuth/Export.cpp) (libSceNpAuth) - declared without parameters as a throwing stub; Minecraft (PPSA17221) imports it and fails to load without it. The request parameter and code output are not known, and there is no PSN sign-in for it to succeed against.
- [sceNpAuthGetAuthorizedAppCode](../../../core/libs/prx/libSceNpAuth/Export.cpp) (libSceNpAuth) - declared without parameters and returns `SCE_NP_ERROR_SIGNED_OUT` without reading them, as there is no PSN sign-in; the request parameter and code output are not known. Minecraft (PPSA17221) imports it, fails to load without it, and after its sign-in dialog treats the signed-out code as offline play.
- [sceNpAuthAbortRequest, sceNpAuthGetAuthorizationCodeV3, sceNpAuthGetIdTokenV3, sceNpAuthPollAsync, sceNpAuthWaitAsync](../../../core/libs/prx/libSceNpAuth/Export.cpp) (libSceNpAuth) - request tracking, `ORBIS_NP_AUTH_ERROR_REQUEST_NOT_FOUND` (0x80550306) on unknown request IDs, `ORBIS_NP_AUTH_ERROR_INVALID_ID` (0x80550307) on non-async or unprocessed requests in Poll/Wait, `ORBIS_NP_AUTH_ERROR_INVALID_ARGUMENT` (0x80550301) on null arguments and repeated calls on completed requests, and `ORBIS_NP_AUTH_ERROR_ABORTED` (0x80550304) after an abort follow [shadPS4](https://github.com/shadps4-emu/shadPS4/blob/main/src/core/libraries/np/np_auth.cpp) (PS4); async requests return OK and defer `SCE_NP_ERROR_SIGNED_OUT` to `sceNpAuthPollAsync`/`sceNpAuthWaitAsync` while sync requests fail immediately; PlayStation Network is not contacted. The parameter `size` fields are not checked (`ORBIS_NP_AUTH_ERROR_INVALID_SIZE`, structure layouts unknown), the request table has no limit (`ORBIS_NP_AUTH_ERROR_REQUEST_MAX`), and console behavior on PS5 is unverified
Loading