mirror of
https://github.com/BernardoGiordano/Checkpoint
synced 2024-11-10 03:54:13 +00:00
Fix displayed played time
This commit is contained in:
parent
da3b79eb19
commit
1ca3d2c3aa
2 changed files with 12 additions and 11 deletions
|
@ -51,9 +51,9 @@ public:
|
||||||
u64 id(void);
|
u64 id(void);
|
||||||
std::string name(void);
|
std::string name(void);
|
||||||
std::string path(void);
|
std::string path(void);
|
||||||
u32 playTimeMinutes(void);
|
u64 playTimeNanoseconds(void);
|
||||||
std::string playTime(void);
|
std::string playTime(void);
|
||||||
void playTimeMinutes(u32 playTimeMinutes);
|
void playTimeNanoseconds(u64 playTimeNanoseconds);
|
||||||
u32 lastPlayedTimestamp(void);
|
u32 lastPlayedTimestamp(void);
|
||||||
void lastPlayedTimestamp(u32 lastPlayedTimestamp);
|
void lastPlayedTimestamp(u32 lastPlayedTimestamp);
|
||||||
std::string fullPath(size_t index);
|
std::string fullPath(size_t index);
|
||||||
|
@ -78,7 +78,7 @@ private:
|
||||||
std::vector<std::string> mFullSavePaths;
|
std::vector<std::string> mFullSavePaths;
|
||||||
u8 mSaveDataType;
|
u8 mSaveDataType;
|
||||||
std::pair<std::string, std::string> mDisplayName;
|
std::pair<std::string, std::string> mDisplayName;
|
||||||
u32 mPlayTimeMinutes;
|
u64 mPlayTimeNanoseconds;
|
||||||
u32 mLastPlayedTimestamp;
|
u32 mLastPlayedTimestamp;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -156,19 +156,20 @@ SDL_Texture* Title::icon(void)
|
||||||
return it != icons.end() ? it->second : NULL;
|
return it != icons.end() ? it->second : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 Title::playTimeMinutes(void)
|
u64 Title::playTimeNanoseconds(void)
|
||||||
{
|
{
|
||||||
return mPlayTimeMinutes;
|
return mPlayTimeNanoseconds;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Title::playTime(void)
|
std::string Title::playTime(void)
|
||||||
{
|
{
|
||||||
return StringUtils::format("%d", mPlayTimeMinutes / 60) + ":" + StringUtils::format("%02d", mPlayTimeMinutes % 60) + " hours";
|
const u64 playTimeMinutes = mPlayTimeNanoseconds / 60000000000;
|
||||||
|
return StringUtils::format("%d", playTimeMinutes / 60) + ":" + StringUtils::format("%02d", playTimeMinutes % 60) + " hours";
|
||||||
}
|
}
|
||||||
|
|
||||||
void Title::playTimeMinutes(u32 playTimeMinutes)
|
void Title::playTimeNanoseconds(u64 playTimeNanoseconds)
|
||||||
{
|
{
|
||||||
mPlayTimeMinutes = playTimeMinutes;
|
mPlayTimeNanoseconds = playTimeNanoseconds;
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 Title::lastPlayedTimestamp(void)
|
u32 Title::lastPlayedTimestamp(void)
|
||||||
|
@ -265,8 +266,8 @@ void loadTitles(void)
|
||||||
PdmPlayStatistics stats;
|
PdmPlayStatistics stats;
|
||||||
res = pdmqryQueryPlayStatisticsByApplicationIdAndUserAccountId(tid, uid, false, &stats);
|
res = pdmqryQueryPlayStatisticsByApplicationIdAndUserAccountId(tid, uid, false, &stats);
|
||||||
if (R_SUCCEEDED(res)) {
|
if (R_SUCCEEDED(res)) {
|
||||||
title.playTimeMinutes(stats.playtimeMinutes);
|
title.playTimeNanoseconds(stats.playtime);
|
||||||
title.lastPlayedTimestamp(stats.last_timestampUser);
|
title.lastPlayedTimestamp(stats.last_timestamp_user);
|
||||||
}
|
}
|
||||||
|
|
||||||
loadIcon(tid, nsacd, outsize - sizeof(nsacd->nacp));
|
loadIcon(tid, nsacd, outsize - sizeof(nsacd->nacp));
|
||||||
|
@ -307,7 +308,7 @@ void sortTitles(void)
|
||||||
case SORT_LAST_PLAYED:
|
case SORT_LAST_PLAYED:
|
||||||
return l.lastPlayedTimestamp() > r.lastPlayedTimestamp();
|
return l.lastPlayedTimestamp() > r.lastPlayedTimestamp();
|
||||||
case SORT_PLAY_TIME:
|
case SORT_PLAY_TIME:
|
||||||
return l.playTimeMinutes() > r.playTimeMinutes();
|
return l.playTimeNanoseconds() > r.playTimeNanoseconds();
|
||||||
case SORT_ALPHA:
|
case SORT_ALPHA:
|
||||||
default:
|
default:
|
||||||
return l.name() < r.name();
|
return l.name() < r.name();
|
||||||
|
|
Loading…
Reference in a new issue