-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
112 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#pragma once | ||
|
||
#include <string> | ||
|
||
#include "Common/IniFile.h" | ||
#include "Common/FileUtil.h" | ||
#include "TimePlayed.h" | ||
|
||
TimePlayed::TimePlayed(std::string game_id) | ||
{ | ||
m_game_id = game_id; | ||
} | ||
|
||
void TimePlayed::AddTime(u64 time_emulated) | ||
{ | ||
IniFile ini; | ||
std::string ini_path = File::GetUserPath(D_CONFIG_IDX) + "TimePlayed.ini"; | ||
ini.Load(ini_path); | ||
|
||
auto time_list = ini.GetOrCreateSection("Time Played"); | ||
int previous_time = 0; | ||
|
||
time_list->Get(m_game_id, &previous_time); | ||
time_list->Set(m_game_id, previous_time + int(time_emulated)); //unlikely u64 to int conversion issue | ||
ini.Save(ini_path); | ||
} | ||
|
||
int TimePlayed::GetTimePlayed() | ||
{ | ||
IniFile ini; | ||
std::string ini_path = File::GetUserPath(D_CONFIG_IDX) + "TimePlayed.ini"; | ||
ini.Load(ini_path); | ||
|
||
auto time_list = ini.GetOrCreateSection("Time Played"); | ||
int previous_time; | ||
time_list->Get(m_game_id, &previous_time); | ||
return previous_time; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#pragma once | ||
#include "Common/CommonTypes.h" | ||
|
||
class TimePlayed | ||
{ | ||
public: | ||
TimePlayed(std::string game_id); | ||
|
||
void AddTime(u64 time_emulated); | ||
|
||
int GetTimePlayed(); | ||
|
||
private: | ||
std::string m_game_id; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters