[XAM] Added specific ctor for X_ACHIEVEMENT_UNLOCK_TIME
Added method X_ACHIEVEMENT_UNLOCK_TIME::to_time_point
This commit is contained in:
parent
ef8619b0a8
commit
b98ff2d278
|
@ -43,8 +43,7 @@ void GpdAchievementBackend::EarnAchievement(const uint64_t xuid,
|
|||
achievement->flags = achievement->flags |
|
||||
static_cast<uint32_t>(AchievementFlags::kAchieved) |
|
||||
static_cast<uint32_t>(AchievementFlags::kAchievedOnline);
|
||||
achievement->unlock_time.high_part = static_cast<uint32_t>(unlock_time >> 32);
|
||||
achievement->unlock_time.low_part = static_cast<uint32_t>(unlock_time);
|
||||
achievement->unlock_time = unlock_time;
|
||||
|
||||
SaveAchievementData(xuid, title_id, achievement_id);
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "xenia/base/chrono.h"
|
||||
#include "xenia/kernel/util/xdbf_utils.h"
|
||||
#include "xenia/xbox.h"
|
||||
|
||||
|
@ -53,6 +54,23 @@ enum class AchievementFlags : uint32_t {
|
|||
struct X_ACHIEVEMENT_UNLOCK_TIME {
|
||||
xe::be<uint32_t> high_part;
|
||||
xe::be<uint32_t> low_part;
|
||||
|
||||
X_ACHIEVEMENT_UNLOCK_TIME() {
|
||||
high_part = 0;
|
||||
low_part = 0;
|
||||
}
|
||||
|
||||
X_ACHIEVEMENT_UNLOCK_TIME(uint64_t filetime) {
|
||||
high_part = static_cast<uint32_t>(filetime >> 32);
|
||||
low_part = static_cast<uint32_t>(filetime);
|
||||
}
|
||||
|
||||
chrono::WinSystemClock::time_point to_time_point() const {
|
||||
const uint64_t filetime =
|
||||
(static_cast<uint64_t>(high_part) << 32) | low_part;
|
||||
|
||||
return chrono::WinSystemClock::from_file_time(filetime);
|
||||
}
|
||||
};
|
||||
|
||||
struct X_ACHIEVEMENT_DETAILS {
|
||||
|
|
|
@ -461,12 +461,8 @@ class GameAchievementsDialog final : public XamDialog {
|
|||
info.unlock_time = {};
|
||||
|
||||
if (entry.IsUnlocked()) {
|
||||
const uint64_t filetime_time =
|
||||
(static_cast<uint64_t>(entry.unlock_time.high_part) << 32) |
|
||||
entry.unlock_time.low_part;
|
||||
|
||||
info.unlock_time = chrono::WinSystemClock::to_sys(
|
||||
chrono::WinSystemClock::from_file_time(filetime_time));
|
||||
info.unlock_time =
|
||||
chrono::WinSystemClock::to_sys(entry.unlock_time.to_time_point());
|
||||
}
|
||||
|
||||
achievements_info_.insert({info.id, info});
|
||||
|
|
Loading…
Reference in New Issue