mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2026-04-12 12:41:29 -06:00
started mapping usermanager to userservice
This commit is contained in:
parent
11f096bb7d
commit
12f5403214
@ -7,6 +7,7 @@
|
||||
#include "common/logging/log.h"
|
||||
|
||||
#include "common/singleton.h"
|
||||
#include "core/emulator_settings.h"
|
||||
#include "core/libraries/libs.h"
|
||||
#include "core/libraries/system/userservice.h"
|
||||
#include "core/libraries/system/userservice_error.h"
|
||||
@ -509,8 +510,7 @@ s32 PS4_SYSV_ABI sceUserServiceGetInitialUser(int* user_id) {
|
||||
LOG_ERROR(Lib_UserService, "user_id is null");
|
||||
return ORBIS_USER_SERVICE_ERROR_INVALID_ARGUMENT;
|
||||
}
|
||||
// select first user (TODO add more)
|
||||
*user_id = 1;
|
||||
*user_id = EmulatorSettings::GetInstance()->GetUserManager().GetDefaultUser();
|
||||
return ORBIS_OK;
|
||||
}
|
||||
|
||||
@ -1066,7 +1066,10 @@ s32 PS4_SYSV_ABI sceUserServiceGetUserColor(int user_id, OrbisUserServiceUserCol
|
||||
LOG_ERROR(Lib_UserService, "color is null");
|
||||
return ORBIS_USER_SERVICE_ERROR_INVALID_ARGUMENT;
|
||||
}
|
||||
*color = (OrbisUserServiceUserColor)(user_id - 1);
|
||||
*color = (OrbisUserServiceUserColor)EmulatorSettings::GetInstance()
|
||||
->GetUserManager()
|
||||
.GetUserByID(user_id)
|
||||
->user_color;
|
||||
return ORBIS_OK;
|
||||
}
|
||||
|
||||
@ -1091,7 +1094,8 @@ 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 = Config::getUserName(user_id - 1);
|
||||
std::string name =
|
||||
EmulatorSettings::GetInstance()->GetUserManager().GetUserByID(user_id)->user_name;
|
||||
if (size < name.length()) {
|
||||
LOG_ERROR(Lib_UserService, "buffer is too short");
|
||||
return ORBIS_USER_SERVICE_ERROR_BUFFER_TOO_SHORT;
|
||||
|
||||
@ -104,6 +104,10 @@ bool UserManager::SetDefaultUser(u32 user_id) {
|
||||
return true;
|
||||
}
|
||||
|
||||
u32 UserManager::GetDefaultUser() {
|
||||
return m_users.default_user_id;
|
||||
}
|
||||
|
||||
void UserManager::SetControllerPort(u32 user_id, int port) {
|
||||
for (auto& u : m_users.user) {
|
||||
if (u.user_id != user_id && u.controller_port == port)
|
||||
|
||||
@ -30,6 +30,7 @@ public:
|
||||
const std::vector<User>& GetAllUsers() const;
|
||||
std::vector<User> CreateDefaultUser();
|
||||
bool SetDefaultUser(u32 user_id);
|
||||
u32 GetDefaultUser();
|
||||
void SetControllerPort(u32 user_id, int port);
|
||||
std::vector<User> GetValidUsers() const;
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user