Files
dolphin/Source/Core/Core/TimePlayed.h
Aneesh Maganti 803241c64b Core: Add TimePlayed class to track game playtime
Creates TimePlayed class and implemented constructors, AddTime, GetTimePlayed, and Reload methods. Updates CMakeLists.txt and DolphinLib.props as appropriate.
2025-02-16 23:15:11 +01:00

41 lines
952 B
C++

// Copyright 2025 Dolphin Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include <chrono>
#include <string>
#include "Common/CommonTypes.h"
#include "Common/IniFile.h"
class TimePlayed
{
public:
// used for QT interface - general access to time played for games
TimePlayed();
TimePlayed(std::string game_id);
// not copyable due to the stored section pointer
TimePlayed(const TimePlayed& other) = delete;
TimePlayed(TimePlayed&& other) = delete;
TimePlayed& operator=(const TimePlayed& other) = delete;
TimePlayed& operator=(TimePlayed&& other) = delete;
~TimePlayed();
void AddTime(std::chrono::milliseconds time_emulated);
std::chrono::milliseconds GetTimePlayed() const;
std::chrono::milliseconds GetTimePlayed(std::string game_id) const;
void Reload();
private:
std::string m_game_id;
std::string m_ini_path;
Common::IniFile m_ini;
Common::IniFile::Section* m_time_list;
};