[XAM] Fixed assertion related to incorrect casting

This should fix crash in 12xxx dashboard while browsing achievements

- Fixed issue with invalid time being presented for some achievements
- Added stub for: XampWebInstrumentationSetProfileCounts
This commit is contained in:
Gliniak 2025-05-07 20:05:29 +02:00
parent dd112ed462
commit f6d9e76fca
3 changed files with 15 additions and 3 deletions

View File

@ -747,6 +747,13 @@ void XamGetActiveDashAppInfo_entry(pointer_t<X_DASH_APP_INFO> dash_app) {
}
DECLARE_XAM_EXPORT1(XamGetActiveDashAppInfo, kNone, kImplemented);
void XampWebInstrumentationSetProfileCounts_entry(dword_t live_profiles,
dword_t local_profiles,
dword_t adult_profiles,
dword_t child_profiles) {}
DECLARE_XAM_EXPORT1(XampWebInstrumentationSetProfileCounts, kUserProfiles,
kStub);
} // namespace xam
} // namespace kernel
} // namespace xe

View File

@ -560,7 +560,7 @@ dword_result_t XamUserCreateAchievementEnumerator_entry(
requester_xuid = xuid;
}
uint32_t title_id_ =
const uint32_t title_id_ =
title_id ? static_cast<uint32_t>(title_id) : kernel_state()->title_id();
const auto user_title_achievements =
@ -569,10 +569,15 @@ dword_result_t XamUserCreateAchievementEnumerator_entry(
if (!user_title_achievements.empty()) {
for (const auto& entry : user_title_achievements) {
auto unlock_time = X_FILETIME();
if (entry.IsUnlocked() && entry.unlock_time.is_valid()) {
unlock_time = entry.unlock_time;
}
auto item = AchievementDetails(
entry.achievement_id, entry.achievement_name.c_str(),
entry.unlocked_description.c_str(), entry.locked_description.c_str(),
entry.image_id, entry.gamerscore, entry.unlock_time, entry.flags);
entry.image_id, entry.gamerscore, unlock_time, entry.flags);
e->AppendItem(item);
}

View File

@ -412,7 +412,7 @@ int32_t format_core(PPCContext* ppc_context, FormatData& data, ArgList& args,
start[0] = '\0';
while (precision-- > 0 || value != 0) {
auto digit = (int32_t)(value % radix);
const auto digit = static_cast<uint64_t>(value) % radix;
value /= radix;
assert_true(digit < strlen(digits));
*--start = digits[digit];