commit
85d99f873f
16 changed files with 337 additions and 14 deletions
|
@ -150,6 +150,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 "yuzu/startup_checks.h"
|
||||
#include "yuzu/uisettings.h"
|
||||
#include "yuzu/util/clickable_label.h"
|
||||
|
@ -338,6 +339,8 @@ GMainWindow::GMainWindow(std::unique_ptr<Config> config_, bool has_broken_vulkan
|
|||
SetDiscordEnabled(UISettings::values.enable_discord_presence.GetValue());
|
||||
discord_rpc->Update();
|
||||
|
||||
play_time_manager = std::make_unique<PlayTime::PlayTimeManager>();
|
||||
|
||||
system->GetRoomNetwork().Init();
|
||||
|
||||
RegisterMetaTypes();
|
||||
|
@ -986,7 +989,7 @@ void GMainWindow::InitializeWidgets() {
|
|||
render_window = new GRenderWindow(this, emu_thread.get(), input_subsystem, *system);
|
||||
render_window->hide();
|
||||
|
||||
game_list = new GameList(vfs, provider.get(), *system, this);
|
||||
game_list = new GameList(vfs, provider.get(), *play_time_manager, *system, this);
|
||||
ui->horizontalLayout->addWidget(game_list);
|
||||
|
||||
game_list_placeholder = new GameListPlaceholder(this);
|
||||
|
@ -1461,6 +1464,8 @@ void GMainWindow::ConnectWidgetEvents() {
|
|||
connect(game_list, &GameList::RemoveInstalledEntryRequested, this,
|
||||
&GMainWindow::OnGameListRemoveInstalledEntry);
|
||||
connect(game_list, &GameList::RemoveFileRequested, this, &GMainWindow::OnGameListRemoveFile);
|
||||
connect(game_list, &GameList::RemovePlayTimeRequested, this,
|
||||
&GMainWindow::OnGameListRemovePlayTimeData);
|
||||
connect(game_list, &GameList::DumpRomFSRequested, this, &GMainWindow::OnGameListDumpRomFS);
|
||||
connect(game_list, &GameList::VerifyIntegrityRequested, this,
|
||||
&GMainWindow::OnGameListVerifyIntegrity);
|
||||
|
@ -2535,6 +2540,17 @@ void GMainWindow::OnGameListRemoveFile(u64 program_id, GameListRemoveTarget targ
|
|||
}
|
||||
}
|
||||
|
||||
void GMainWindow::OnGameListRemovePlayTimeData(u64 program_id) {
|
||||
if (QMessageBox::question(this, tr("Remove Play Time Data"), tr("Reset play time?"),
|
||||
QMessageBox::Yes | QMessageBox::No,
|
||||
QMessageBox::No) != QMessageBox::Yes) {
|
||||
return;
|
||||
}
|
||||
|
||||
play_time_manager->ResetProgramPlayTime(program_id);
|
||||
game_list->PopulateAsync(UISettings::values.game_dirs);
|
||||
}
|
||||
|
||||
void GMainWindow::RemoveTransferableShaderCache(u64 program_id, GameListRemoveTarget target) {
|
||||
const auto target_file_name = [target] {
|
||||
switch (target) {
|
||||
|
@ -3358,6 +3374,9 @@ void GMainWindow::OnStartGame() {
|
|||
UpdateMenuState();
|
||||
OnTasStateChanged();
|
||||
|
||||
play_time_manager->SetProgramId(system->GetApplicationProcessProgramID());
|
||||
play_time_manager->Start();
|
||||
|
||||
discord_rpc->Update();
|
||||
}
|
||||
|
||||
|
@ -3373,6 +3392,7 @@ void GMainWindow::OnRestartGame() {
|
|||
|
||||
void GMainWindow::OnPauseGame() {
|
||||
emu_thread->SetRunning(false);
|
||||
play_time_manager->Stop();
|
||||
UpdateMenuState();
|
||||
AllowOSSleep();
|
||||
}
|
||||
|
@ -3393,6 +3413,9 @@ void GMainWindow::OnStopGame() {
|
|||
return;
|
||||
}
|
||||
|
||||
play_time_manager->Stop();
|
||||
// Update game list to show new play time
|
||||
game_list->PopulateAsync(UISettings::values.game_dirs);
|
||||
if (OnShutdownBegin()) {
|
||||
OnShutdownBeginDialog();
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue