[User] Added method for calculating gamerscore
This commit is contained in:
parent
d565d87d8d
commit
9d637ae402
|
@ -118,7 +118,8 @@ UserProfile::UserProfile() : dash_gpd_(kDashboardID) {
|
|||
// XPROFILE_GAMERCARD_REGION
|
||||
AddSetting(std::make_unique<Int32Setting>(0x10040005, 0));
|
||||
// XPROFILE_GAMERCARD_CRED
|
||||
AddSetting(std::make_unique<Int32Setting>(0x10040006, 0xFA));
|
||||
AddSetting(
|
||||
std::make_unique<Int32Setting>(0x10040006, CalculateUserGamerscore()));
|
||||
// XPROFILE_GAMERCARD_REP
|
||||
AddSetting(std::make_unique<FloatSetting>(0x5004000B, 0.0f));
|
||||
// XPROFILE_OPTION_VOICE_MUTED
|
||||
|
@ -202,7 +203,8 @@ void UserProfile::LoadProfile() {
|
|||
mmap_->Close();
|
||||
}
|
||||
|
||||
XELOGI("Loading profile GPDs from path %S", xe::to_wstring(cvars::profile_directory).c_str());
|
||||
XELOGI("Loading profile GPDs from path %S",
|
||||
xe::to_wstring(cvars::profile_directory).c_str());
|
||||
|
||||
mmap_ = MappedMemory::Open(
|
||||
xe::to_wstring(cvars::profile_directory) + L"FFFE07D1.gpd",
|
||||
|
@ -598,9 +600,7 @@ void UserProfile::SaveSetting(UserProfile::Setting* setting) {
|
|||
}
|
||||
}
|
||||
|
||||
xdbf::GpdFile* UserProfile::GetDashboardGpd() {
|
||||
return &dash_gpd_;
|
||||
}
|
||||
xdbf::GpdFile* UserProfile::GetDashboardGpd() { return &dash_gpd_; }
|
||||
|
||||
xdbf::SpaFile* UserProfile::GetTitleSpa(uint32_t title_id) {
|
||||
std::wstring file_location = xe::to_wstring(cvars::profile_directory) +
|
||||
|
@ -619,6 +619,18 @@ xdbf::SpaFile* UserProfile::GetTitleSpa(uint32_t title_id) {
|
|||
return (game_entry);
|
||||
}
|
||||
|
||||
uint32_t UserProfile::CalculateUserGamerscore() const {
|
||||
uint32_t score = 0;
|
||||
|
||||
std::vector<xdbf::TitlePlayed> titles;
|
||||
dash_gpd_.GetTitles(&titles);
|
||||
|
||||
for (auto title : titles)
|
||||
score += title.gamerscore_earned;
|
||||
|
||||
return score;
|
||||
}
|
||||
|
||||
} // namespace xam
|
||||
} // namespace kernel
|
||||
} // namespace xe
|
||||
|
|
|
@ -317,6 +317,7 @@ class UserProfile {
|
|||
uint64_t xuid() const { return account_.xuid_online; }
|
||||
std::string name() const { return account_.GetGamertagString(); }
|
||||
// uint32_t signin_state() const { return 1; }
|
||||
uint32_t CalculateUserGamerscore() const;
|
||||
|
||||
void AddSetting(std::unique_ptr<Setting> setting);
|
||||
Setting* GetSetting(uint32_t setting_id);
|
||||
|
|
Loading…
Reference in New Issue