mirror of
https://github.com/boykopovar/AnyPS5.git
synced 2026-10-22 00:22:57 -05:00
Four exports that titles call during start-up were missing. They now follow the single-user / offline model already used in this file (sceUserServiceGetInitialUser, sceUserServiceGetLoginUserIdList, sceUserServiceGetPlatformPrivacyWs1): - sceUserServiceGetForegroundUser(int*) -> the initial user - sceUserServiceGetRegisteredUserIdList(UserServiceRegisteredUserIdList*) -> initial user in slot 0, the other 15 slots invalid - sceUserServiceGetUserColor(int, int*) -> blue (0) - sceUserServiceGetNpAccountId(int, uint64_t*) -> 0 (no PSN account linked) Adds UserServiceRegisteredUserIdList (int[16]) to SceTypes.hpp and a CMakeLists.txt so the library can carry its guest test. Signatures follow the public OpenOrbis SDK headers. New test core/libs/tests/GuestUserService.cpp checks the valid returns, the pointer and wrong-user-id error paths; it fails without the change (the symbols are undefined) and passes with it.
45 lines
1.9 KiB
C++
45 lines
1.9 KiB
C++
#include "SceTypes.hpp"
|
|
#include "prx/libSceUserService/UserService.hpp"
|
|
#include <cstdint>
|
|
#include <cstdlib>
|
|
|
|
extern "C" {
|
|
int APS5_VABI sceUserServiceGetForegroundUser(int* user_id);
|
|
int APS5_VABI sceUserServiceGetRegisteredUserIdList(UserServiceRegisteredUserIdList* user_id_list);
|
|
int APS5_VABI sceUserServiceGetUserColor(int user_id, int* color);
|
|
int APS5_VABI sceUserServiceGetNpAccountId(int user_id, std::uint64_t* account_id);
|
|
}
|
|
|
|
namespace {
|
|
|
|
void Require(bool value) { if (!value) std::abort(); }
|
|
|
|
}
|
|
|
|
int main() {
|
|
Require(sceUserServiceGetForegroundUser(nullptr) == USER_SERVICE_ERROR_INVALID_ARGUMENT);
|
|
int foreground = -1;
|
|
Require(sceUserServiceGetForegroundUser(&foreground) == USER_SERVICE_OK);
|
|
Require(foreground == USER_SERVICE_INITIAL_USER_ID);
|
|
|
|
Require(sceUserServiceGetRegisteredUserIdList(nullptr) == USER_SERVICE_ERROR_INVALID_ARGUMENT);
|
|
UserServiceRegisteredUserIdList registered{};
|
|
Require(sceUserServiceGetRegisteredUserIdList(®istered) == USER_SERVICE_OK);
|
|
Require(registered.user_id[0] == USER_SERVICE_INITIAL_USER_ID);
|
|
for (int i = 1; i < 16; ++i) {
|
|
Require(registered.user_id[i] == USER_SERVICE_USER_ID_INVALID);
|
|
}
|
|
|
|
int color = -1;
|
|
Require(sceUserServiceGetUserColor(USER_SERVICE_INITIAL_USER_ID, nullptr) == USER_SERVICE_ERROR_INVALID_ARGUMENT);
|
|
Require(sceUserServiceGetUserColor(123, &color) == USER_SERVICE_ERROR_INVALID_ARGUMENT);
|
|
Require(sceUserServiceGetUserColor(USER_SERVICE_INITIAL_USER_ID, &color) == USER_SERVICE_OK);
|
|
Require(color == 0);
|
|
|
|
std::uint64_t account_id = 0xdeadbeefu;
|
|
Require(sceUserServiceGetNpAccountId(USER_SERVICE_INITIAL_USER_ID, nullptr) == USER_SERVICE_ERROR_INVALID_ARGUMENT);
|
|
Require(sceUserServiceGetNpAccountId(123, &account_id) == USER_SERVICE_ERROR_INVALID_ARGUMENT);
|
|
Require(sceUserServiceGetNpAccountId(USER_SERVICE_INITIAL_USER_ID, &account_id) == USER_SERVICE_OK);
|
|
Require(account_id == 0);
|
|
}
|