aboutsummaryrefslogtreecommitdiff
path: root/src/yuzu/main.cpp
diff options
context:
space:
mode:
authorinix <Nixy01@proton.me>2025-10-17 22:47:43 +0200
committercrueter <crueter@eden-emu.dev>2025-10-17 22:47:43 +0200
commit6bdf479488dd87a35bf5ccf9ec334f49bf43ffc7 (patch)
tree166376be36272e3177cc2fd474cc24c7eb9d1360 /src/yuzu/main.cpp
parent9c7ed0f59dd41ec0bbbfbc81678209ae60a36016 (diff)
[core, android] Initial playtime implementation (#2535)
So firstly, playtime code is moved to src/common and qt specific code to yuzu/utils.cpp. The dependency on ProfileManager was removed because it was working properly on Android, and I think a shared playtime is better behavior. Now, playtime is stored in a file called "playtime.bin". JNI code is from Azahar although modified by me, as well as that I added code to reset the game's playtime which was missing for some reason on there. Before this gets merged, I plan to add the ability to manually edit the database as well. Note: Code still needs a bit of cleanup. Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/2535 Reviewed-by: CamilleLaVey <camillelavey99@gmail.com> Reviewed-by: Lizzie <lizzie@eden-emu.dev> Reviewed-by: crueter <crueter@eden-emu.dev> Reviewed-by: MaranBr <maranbr@eden-emu.dev> Co-authored-by: inix <Nixy01@proton.me> Co-committed-by: inix <Nixy01@proton.me>
Diffstat (limited to 'src/yuzu/main.cpp')
-rw-r--r--src/yuzu/main.cpp21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp
index 98915c48ef..4f9dd4f9cd 100644
--- a/src/yuzu/main.cpp
+++ b/src/yuzu/main.cpp
@@ -15,6 +15,8 @@
#include <memory>
#include <thread>
+#include "set_play_time_dialog.h"
+
#ifdef __APPLE__
#include <unistd.h> // for chdir
#endif
@@ -164,7 +166,7 @@ static FileSys::VirtualFile VfsDirectoryCreateFileWrapper(const FileSys::Virtual
#include "yuzu/install_dialog.h"
#include "yuzu/loading_screen.h"
#include "yuzu/main.h"
-#include "yuzu/play_time_manager.h"
+#include "frontend_common/play_time_manager.h"
#include "yuzu/startup_checks.h"
#include "qt_common/config/uisettings.h"
#include "yuzu/util/clickable_label.h"
@@ -448,7 +450,7 @@ GMainWindow::GMainWindow(bool has_broken_vulkan)
SetDiscordEnabled(UISettings::values.enable_discord_presence.GetValue());
discord_rpc->Update();
- play_time_manager = std::make_unique<PlayTime::PlayTimeManager>(QtCommon::system->GetProfileManager());
+ play_time_manager = std::make_unique<PlayTime::PlayTimeManager>();
Network::Init();
@@ -1576,6 +1578,8 @@ void GMainWindow::ConnectWidgetEvents() {
connect(game_list, &GameList::RemoveFileRequested, this, &GMainWindow::OnGameListRemoveFile);
connect(game_list, &GameList::RemovePlayTimeRequested, this,
&GMainWindow::OnGameListRemovePlayTimeData);
+ connect(game_list, &GameList::SetPlayTimeRequested, this,
+ &GMainWindow::OnGameListSetPlayTime);
connect(game_list, &GameList::DumpRomFSRequested, this, &GMainWindow::OnGameListDumpRomFS);
connect(game_list, &GameList::VerifyIntegrityRequested, this,
&GMainWindow::OnGameListVerifyIntegrity);
@@ -2636,6 +2640,19 @@ void GMainWindow::OnGameListRemoveFile(u64 program_id, QtCommon::Game::GameListR
}
}
+void GMainWindow::OnGameListSetPlayTime(u64 program_id) {
+ const u64 current_play_time = play_time_manager->GetPlayTime(program_id);
+
+ SetPlayTimeDialog dialog(this, current_play_time);
+
+ if (dialog.exec() == QDialog::Accepted) {
+ const u64 total_seconds = dialog.GetTotalSeconds();
+ play_time_manager->SetPlayTime(program_id, total_seconds);
+ game_list->PopulateAsync(UISettings::values.game_dirs);
+ }
+}
+
+
void GMainWindow::OnGameListRemovePlayTimeData(u64 program_id) {
if (QMessageBox::question(this, tr("Remove Play Time Data"), tr("Reset play time?"),
QMessageBox::Yes | QMessageBox::No,