mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2026-07-09 17:25:37 -06:00
username changes to onlineid once connected (#4633)
This commit is contained in:
parent
bd741ec57f
commit
bf98eaa982
@ -10,6 +10,7 @@
|
||||
#include "common/singleton.h"
|
||||
#include "core/emulator_settings.h"
|
||||
#include "core/libraries/libs.h"
|
||||
#include "core/libraries/np/np_handler.h"
|
||||
#include "core/libraries/np/np_manager.h"
|
||||
#include "core/libraries/system/userservice.h"
|
||||
#include "core/libraries/system/userservice_error.h"
|
||||
@ -18,6 +19,8 @@
|
||||
|
||||
namespace Libraries::UserService {
|
||||
|
||||
static bool g_shadnet_enabled = false;
|
||||
|
||||
int PS4_SYSV_ABI sceUserServiceInitializeForShellCore() {
|
||||
LOG_ERROR(Lib_UserService, "(STUBBED) called");
|
||||
return ORBIS_OK;
|
||||
@ -1102,6 +1105,7 @@ s32 PS4_SYSV_ABI sceUserServiceGetUserName(int user_id, char* user_name, std::si
|
||||
LOG_ERROR(Lib_UserService, "user_name is null");
|
||||
return ORBIS_USER_SERVICE_ERROR_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
std::string name = "shadPS4";
|
||||
auto const* u = UserManagement.GetUserByID(user_id);
|
||||
if (u != nullptr) {
|
||||
@ -1109,7 +1113,16 @@ s32 PS4_SYSV_ABI sceUserServiceGetUserName(int user_id, char* user_name, std::si
|
||||
} else {
|
||||
LOG_ERROR(Lib_UserService, "No user found");
|
||||
}
|
||||
if (size < name.length()) {
|
||||
// once signed in shadnet onlineid is set as username
|
||||
if (g_shadnet_enabled && Libraries::Np::NpHandler::GetInstance().IsPsnSignedIn(user_id)) {
|
||||
const auto np_id = Libraries::Np::NpHandler::GetInstance().GetNpId(user_id);
|
||||
const std::size_t handle_len = strnlen(np_id.handle.data, sizeof(np_id.handle.data));
|
||||
if (handle_len > 0) {
|
||||
name.assign(np_id.handle.data, handle_len);
|
||||
}
|
||||
}
|
||||
|
||||
if (size < name.length() + 1) {
|
||||
LOG_ERROR(Lib_UserService, "buffer is too short");
|
||||
return ORBIS_USER_SERVICE_ERROR_BUFFER_TOO_SHORT;
|
||||
}
|
||||
@ -2203,6 +2216,7 @@ int PS4_SYSV_ABI Func_D2B814603E7B4477() {
|
||||
}
|
||||
|
||||
void RegisterLib(Core::Loader::SymbolsResolver* sym) {
|
||||
g_shadnet_enabled = EmulatorSettings.IsShadNetEnabled();
|
||||
LIB_FUNCTION("Psl9mfs3duM", "libSceUserServiceForShellCore", 1, "libSceUserService",
|
||||
sceUserServiceInitializeForShellCore);
|
||||
LIB_FUNCTION("CydP+QtA0KI", "libSceUserServiceForShellCore", 1, "libSceUserService",
|
||||
|
||||
Loading…
Reference in New Issue
Block a user