[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

@@ -14,6 +14,7 @@
#include <sstream>
#include "third_party/fmt/include/fmt/format.h"
#include "third_party/stb/stb_image.h"
#include "xenia/kernel/kernel_state.h"
#include "xenia/kernel/util/shim_utils.h"
#include "xenia/kernel/xam/user_data.h"
@@ -158,6 +159,10 @@ void UserTracker::AddTitleToPlayedList(uint64_t xuid) {
return;
}
if (!spa_data_->include_in_profile() || spa_data_->is_system_app()) {
return;
}
const uint32_t title_id = spa_data_->title_id();
auto title_gpd = user->games_gpd_.find(title_id);
if (title_gpd == user->games_gpd_.end()) {
@@ -733,6 +738,35 @@ void UserTracker::UpsertSetting(uint64_t xuid, uint32_t title_id,
FlushUserData(xuid);
}
bool UserTracker::UpdateUserIcon(uint64_t xuid,
std::span<const uint8_t> icon_data) {
auto user = kernel_state()->xam_state()->GetUserProfile(xuid);
if (!user) {
return false;
}
int width, height, channels;
if (!stbi_info_from_memory(icon_data.data(),
static_cast<int>(icon_data.size()), &width,
&height, &channels)) {
return false;
}
XTileType icon_type = XTileType::kGameIcon;
if (std::pair<uint16_t, uint16_t>(width, height) == kProfileIconSize) {
icon_type = XTileType::kGamerTile;
} else if (std::pair<uint16_t, uint16_t>(width, height) ==
kProfileIconSizeSmall) {
icon_type = XTileType::kGamerTileSmall;
} else {
return false;
}
user->WriteProfileIcon(icon_type, icon_data);
return true;
}
std::span<const uint8_t> UserTracker::GetIcon(uint64_t xuid, uint32_t title_id,
XTileType tile_type,
uint64_t tile_id) const {