[Kernel] Added support for writing/reading GPD files

This breaks settings in games that are using them and savefiles in games that use settings to store progress
This commit is contained in:
Gliniak
2024-12-15 13:58:08 +01:00
committed by Radosław Gliński
parent ccf7adf015
commit 1110cdd372
58 changed files with 4642 additions and 2122 deletions

View File

@@ -26,6 +26,14 @@ class KernelState;
} // namespace kernel
} // namespace xe
namespace xe {
namespace kernel {
namespace xam {
class UserTracker;
} // namespace xam
} // namespace kernel
} // namespace xe
namespace xe {
namespace kernel {
namespace xam {
@@ -34,33 +42,6 @@ constexpr uint32_t kDashboardID = 0xFFFE07D1;
const static std::string kDashboardStringID =
fmt::format("{:08X}", kDashboardID);
enum class XTileType {
kAchievement,
kGameIcon,
kGamerTile,
kGamerTileSmall,
kLocalGamerTile,
kLocalGamerTileSmall,
kBkgnd,
kAwardedGamerTile,
kAwardedGamerTileSmall,
kGamerTileByImageId,
kPersonalGamerTile,
kPersonalGamerTileSmall,
kGamerTileByKey,
kAvatarGamerTile,
kAvatarGamerTileSmall,
kAvatarFullBody
};
// TODO: find filenames of other tile types that are stored in profile
static const std::map<XTileType, std::string> kTileFileNames = {
{XTileType::kPersonalGamerTile, "tile_64.png"},
{XTileType::kPersonalGamerTileSmall, "tile_32.png"},
{XTileType::kAvatarGamerTile, "avtr_64.png"},
{XTileType::kAvatarGamerTileSmall, "avtr_32.png"},
};
class ProfileManager {
public:
static bool DecryptAccountFile(const uint8_t* data, X_XAMACCOUNTINFO* output,
@@ -75,7 +56,7 @@ class ProfileManager {
// Loading Profile means load everything
// Loading Account means load basic data
ProfileManager(KernelState* kernel_state);
ProfileManager(KernelState* kernel_state, UserTracker* user_tracker);
~ProfileManager();
@@ -114,7 +95,8 @@ class ProfileManager {
bool IsAnyProfileSignedIn() const { return !logged_profiles_.empty(); }
std::filesystem::path GetProfileContentPath(
const uint64_t xuid, const uint32_t title_id = -1) const;
const uint64_t xuid, const uint32_t title_id = -1,
const XContentType content_type = XContentType::kInvalid) const;
static bool IsGamertagValid(const std::string gamertag);
@@ -142,6 +124,7 @@ class ProfileManager {
std::map<uint8_t, std::unique_ptr<UserProfile>> logged_profiles_;
KernelState* kernel_state_;
UserTracker* user_tracker_;
};
} // namespace xam