mirror of
https://git.eden-emu.dev/eden-emu/eden
synced 2026-06-03 05:17:15 +02:00
Address review comments
This commit is contained in:
parent
54a5b8062e
commit
1dc47986ee
11 changed files with 259 additions and 270 deletions
44
src/yuzu/play_time_manager.h
Normal file
44
src/yuzu/play_time_manager.h
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
// SPDX-FileCopyrightText: 2023 yuzu Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QString>
|
||||
|
||||
#include <map>
|
||||
|
||||
#include "common/common_funcs.h"
|
||||
#include "common/common_types.h"
|
||||
#include "common/polyfill_thread.h"
|
||||
|
||||
namespace PlayTime {
|
||||
|
||||
using ProgramId = u64;
|
||||
using PlayTime = u64;
|
||||
using PlayTimeDatabase = std::map<ProgramId, PlayTime>;
|
||||
|
||||
class PlayTimeManager {
|
||||
public:
|
||||
explicit PlayTimeManager();
|
||||
~PlayTimeManager();
|
||||
|
||||
YUZU_NON_COPYABLE(PlayTimeManager);
|
||||
YUZU_NON_MOVEABLE(PlayTimeManager);
|
||||
|
||||
u64 GetPlayTime(u64 program_id) const;
|
||||
void ResetProgramPlayTime(u64 program_id);
|
||||
void SetProgramId(u64 program_id);
|
||||
void Start();
|
||||
void Stop();
|
||||
|
||||
private:
|
||||
PlayTimeDatabase database;
|
||||
u64 running_program_id;
|
||||
std::jthread play_time_thread;
|
||||
void AutoTimestamp(std::stop_token stop_token);
|
||||
void Save();
|
||||
};
|
||||
|
||||
QString ReadablePlayTime(qulonglong time_seconds);
|
||||
|
||||
} // namespace PlayTime
|
||||
Loading…
Add table
Add a link
Reference in a new issue