[UI] Added modify profile UI

- Changed default icons size from 75x75 to 64x64 to match console icons size
- Added png_utils
- Removed all dialogs from xam_ui.cc into separate entities under xam/ui
- Added option to return INT32 and WSTRING type settings to host
- Added multiple enums related to user settings
- Added code to handle changing user pfp
- Fixed bug with system app being added to GPD played list
- Changed logic in: XamUserGetUserFlagsFromXUID
- Implemented: XamUserIsOnlineEnabled
- Implemented: XamUserGetMembershipTier
- Implemented: XamUserGetMembershipTierFromXUID
- Implemented: XamUserGetUserTenure
- Partially Implemented: XamUserGetSubscriptionType
This commit is contained in:
Gliniak
2025-05-10 12:52:05 +02:00
committed by Radosław Gliński
parent 270e88a7a7
commit e601b5ab87
30 changed files with 2904 additions and 1404 deletions

View File

@@ -10,9 +10,7 @@
#include "xenia/kernel/xam/profile_manager.h"
#include <filesystem>
#include <vector>
#include "third_party/fmt/include/fmt/format.h"
#include "xenia/base/logging.h"
#include "xenia/emulator.h"
#include "xenia/hid/input_system.h"
@@ -139,6 +137,14 @@ ProfileManager::ProfileManager(KernelState* kernel_state,
ProfileManager::~ProfileManager() {}
void ProfileManager::ReloadProfile(const uint64_t xuid) {
if (accounts_.contains(xuid)) {
accounts_.erase(xuid);
}
LoadAccount(xuid);
}
void ProfileManager::ReloadProfiles() { LoadAccounts(FindProfiles()); }
UserProfile* ProfileManager::GetProfile(const uint64_t xuid) const {
@@ -226,7 +232,7 @@ bool ProfileManager::LoadAccount(const uint64_t xuid) {
// We need it only when we want to login into this account!
DismountProfile(xuid);
accounts_.insert({xuid, tmp_acct});
accounts_.insert_or_assign(xuid, tmp_acct);
return true;
}
@@ -236,26 +242,6 @@ void ProfileManager::LoadAccounts(const std::vector<uint64_t> profiles_xuids) {
}
}
void ProfileManager::ModifyGamertag(const uint64_t xuid, std::string gamertag) {
if (!accounts_.count(xuid)) {
return;
}
xe::X_XAMACCOUNTINFO* account = &accounts_[xuid];
std::u16string gamertag_u16 = xe::to_utf16(gamertag);
string_util::copy_truncating(account->gamertag, gamertag_u16,
sizeof(account->gamertag));
if (!MountProfile(xuid)) {
return;
}
UpdateAccount(xuid, account);
DismountProfile(xuid);
}
bool ProfileManager::MountProfile(const uint64_t xuid, std::string mount_path) {
std::filesystem::path profile_path = GetProfilePath(xuid);
if (mount_path.empty()) {
@@ -282,7 +268,7 @@ bool ProfileManager::DismountProfile(const uint64_t xuid) {
void ProfileManager::Login(const uint64_t xuid, const uint8_t user_index,
bool notify) {
if (logged_profiles_.size() >= 4 && user_index >= XUserMaxUserCount) {
if (logged_profiles_.size() >= XUserMaxUserCount) {
XELOGE(
"Cannot login account with XUID: {:016X} due to lack of free slots "
"(Max 4 accounts at once)",
@@ -567,6 +553,9 @@ bool ProfileManager::UpdateAccount(const uint64_t xuid,
std::span<uint8_t>(encrypted_data.data(), encrypted_data.size()), 0,
&written_bytes);
output_file->Destroy();
// Refresh the in-memory account data
accounts_.insert_or_assign(xuid, *account);
return true;
}