[XAM] Implementation of: Profile Manager & Profiles Support

Thanks Emoose for Account Encrypt/Decrypt code!
This commit is contained in:
Gliniak
2024-09-28 10:42:32 +02:00
committed by Radosław Gliński
parent 9ba0f18c82
commit 9bdd07590c
28 changed files with 1775 additions and 298 deletions

View File

@@ -19,15 +19,11 @@ namespace xe {
namespace kernel {
namespace xam {
UserProfile::UserProfile(uint8_t index) {
UserProfile::UserProfile(uint64_t xuid, X_XAMACCOUNTINFO* account_info)
: xuid_(xuid), account_info_(*account_info) {
// 58410A1F checks the user XUID against a mask of 0x00C0000000000000 (3<<54),
// if non-zero, it prevents the user from playing the game.
// "You do not have permissions to perform this operation."
xuid_ = 0xB13EBABEBABEBABE + index;
name_ = "User";
if (index) {
name_ = "User_" + std::to_string(index);
}
// https://cs.rin.ru/forum/viewtopic.php?f=38&t=60668&hilit=gfwl+live&start=195
// https://github.com/arkem/py360/blob/master/py360/constants.py
@@ -136,7 +132,7 @@ UserSetting* UserProfile::GetSetting(uint32_t setting_id) {
void UserProfile::LoadSetting(UserSetting* setting) {
if (setting->is_title_specific()) {
const std::filesystem::path content_dir =
kernel_state()->content_manager()->ResolveGameUserContentPath();
kernel_state()->content_manager()->ResolveGameUserContentPath(xuid_);
const std::string setting_id_str =
fmt::format("{:08X}", setting->GetSettingId());
const std::filesystem::path file_path = content_dir / setting_id_str;
@@ -182,7 +178,7 @@ void UserProfile::SaveSetting(UserSetting* setting) {
if (setting->is_title_specific() &&
setting->GetSettingSource() == X_USER_PROFILE_SETTING_SOURCE::TITLE) {
const std::filesystem::path content_dir =
kernel_state()->content_manager()->ResolveGameUserContentPath();
kernel_state()->content_manager()->ResolveGameUserContentPath(xuid_);
std::filesystem::create_directories(content_dir);