[Kernel] Fixed issue with WINE crash while opening played titles or achievements tab

This commit is contained in:
Gliniak
2025-10-06 21:40:38 +02:00
committed by Radosław Gliński
parent 703531d541
commit 2e9c459846
5 changed files with 20 additions and 17 deletions

View File

@@ -103,21 +103,21 @@ xe::ui::ImmediateTexture* GameAchievementsUI::GetIcon(
std::string GameAchievementsUI::GetUnlockedTime(
const Achievement& achievement_entry) const {
if (achievement_entry.IsUnlockedOnline()) {
const auto unlock_time = chrono::WinSystemClock::to_local(
achievement_entry.unlock_time.to_time_point());
const auto unlock_time =
std::chrono::system_clock::to_time_t(chrono::WinSystemClock::to_sys(
achievement_entry.unlock_time.to_time_point()));
return fmt::format(
"Unlocked: {:%Y-%m-%d %H:%M}",
std::chrono::system_clock::time_point(unlock_time.time_since_epoch()));
return fmt::format("Unlocked: {:%Y-%m-%d %H:%M}",
fmt::localtime(unlock_time));
}
if (achievement_entry.unlock_time.is_valid()) {
const auto unlock_time = chrono::WinSystemClock::to_local(
achievement_entry.unlock_time.to_time_point());
const auto unlock_time =
std::chrono::system_clock::to_time_t(chrono::WinSystemClock::to_sys(
achievement_entry.unlock_time.to_time_point()));
return fmt::format(
"Unlocked: Offline ({:%Y-%m-%d %H:%M})",
std::chrono::system_clock::time_point(unlock_time.time_since_epoch()));
return fmt::format("Unlocked: Offline ({:%Y-%m-%d %H:%M})",
fmt::localtime(unlock_time));
}
return fmt::format("Unlocked: Offline");
}

View File

@@ -86,8 +86,9 @@ void TitleListUI::DrawTitleEntry(ImGuiIO& io, TitleInfo& entry) {
if (entry.WasTitlePlayed()) {
ImGui::TextUnformatted(
fmt::format("Last played: {:%Y-%m-%d %H:%M}",
std::chrono::system_clock::time_point(
entry.last_played.time_since_epoch()))
fmt::localtime(std::chrono::system_clock::to_time_t(
std::chrono::system_clock::time_point(
entry.last_played.time_since_epoch()))))
.c_str());
} else {
ImGui::TextUnformatted("Last played: Unknown");

View File

@@ -235,8 +235,8 @@ std::optional<TitleInfo> UserTracker::GetUserTitleInfo(
info.icon = game_gpd->second.GetImage(kXdbfIdTitle);
if (title_data->last_played.is_valid()) {
info.last_played = chrono::WinSystemClock::to_local(
title_data->last_played.to_time_point());
info.last_played =
chrono::WinSystemClock::to_sys(title_data->last_played.to_time_point());
}
return info;
@@ -270,7 +270,7 @@ std::vector<TitleInfo> UserTracker::GetPlayedTitles(uint64_t xuid) const {
info.title_name = user->dashboard_gpd_.GetTitleName(title_data->title_id);
if (title_data->last_played.is_valid()) {
info.last_played = chrono::WinSystemClock::to_local(
info.last_played = chrono::WinSystemClock::to_sys(
title_data->last_played.to_time_point());
}

View File

@@ -34,7 +34,7 @@ struct TitleInfo {
X_XDBF_AVATARAWARDS_COUNTER all_avatar_awards;
X_XDBF_AVATARAWARDS_COUNTER male_avatar_awards;
X_XDBF_AVATARAWARDS_COUNTER female_avatar_awards;
std::chrono::local_time<std::chrono::system_clock::duration> last_played;
std::chrono::sys_time<std::chrono::system_clock::duration> last_played;
std::span<const uint8_t> icon;