From af1e6114eb6eb5439072c403818db654d8ce6e64 Mon Sep 17 00:00:00 2001 From: DanielSvoboda Date: Wed, 9 Oct 2024 02:21:34 -0300 Subject: [PATCH] Timer 1 minute --- src/emulator.cpp | 5 +++++ src/emulator.h | 2 ++ 2 files changed, 7 insertions(+) diff --git a/src/emulator.cpp b/src/emulator.cpp index c6535f87a..347931021 100644 --- a/src/emulator.cpp +++ b/src/emulator.cpp @@ -134,6 +134,11 @@ void Emulator::Run(const std::filesystem::path& file) { } #ifdef ENABLE_QT_GUI MemoryPatcher::g_game_serial = id; + + // Timer for 'Play Time' + timer = new QTimer(); + QObject::connect(timer, &QTimer::timeout, [this, id]() { UpdatePlayTime(id); }); + timer->start(60000); // 60000 ms = 1 minute #endif title = param_sfo->GetString("TITLE").value_or("Unknown title"); LOG_INFO(Loader, "Game id: {} Title: {}", id, title); diff --git a/src/emulator.h b/src/emulator.h index dc2959af4..83f8cd99d 100644 --- a/src/emulator.h +++ b/src/emulator.h @@ -5,6 +5,7 @@ #include #include +#include #include "common/singleton.h" #include "core/linker.h" @@ -36,6 +37,7 @@ private: Core::Linker* linker; std::unique_ptr window; std::chrono::steady_clock::time_point start_time; + QTimer* timer; }; } // namespace Core