diff options
Diffstat (limited to 'src/yuzu')
| -rw-r--r-- | src/yuzu/game_list.cpp | 1 | ||||
| -rw-r--r-- | src/yuzu/game_list_p.h | 3 | ||||
| -rw-r--r-- | src/yuzu/main.cpp | 24 | ||||
| -rw-r--r-- | src/yuzu/main.h | 2 | ||||
| -rw-r--r-- | src/yuzu/main.ui | 8 |
5 files changed, 38 insertions, 0 deletions
diff --git a/src/yuzu/game_list.cpp b/src/yuzu/game_list.cpp index bc4b93033..a974fb933 100644 --- a/src/yuzu/game_list.cpp +++ b/src/yuzu/game_list.cpp @@ -16,6 +16,7 @@ #include "common/string_util.h" #include "core/file_sys/content_archive.h" #include "core/file_sys/control_metadata.h" +#include "core/file_sys/registered_cache.h" #include "core/file_sys/romfs.h" #include "core/file_sys/vfs_real.h" #include "core/loader/loader.h" diff --git a/src/yuzu/game_list_p.h b/src/yuzu/game_list_p.h index 10c2ef075..c59613769 100644 --- a/src/yuzu/game_list_p.h +++ b/src/yuzu/game_list_p.h @@ -6,12 +6,15 @@ #include <array> #include <atomic> +#include <map> +#include <memory> #include <utility> #include <QImage> #include <QRunnable> #include <QStandardItem> #include <QString> #include "common/string_util.h" +#include "core/file_sys/content_archive.h" #include "ui_settings.h" #include "yuzu/util/util.h" diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 41f765f12..62ff7a2d7 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -27,7 +27,9 @@ #include "common/string_util.h" #include "core/core.h" #include "core/crypto/key_manager.h" +#include "core/file_sys/bis_factory.h" #include "core/file_sys/card_image.h" +#include "core/file_sys/registered_cache.h" #include "core/file_sys/vfs_real.h" #include "core/gdbstub/gdbstub.h" #include "core/loader/loader.h" @@ -213,6 +215,14 @@ void GMainWindow::InitializeRecentFileMenuActions() { ui.menu_recent_files->addAction(actions_recent_files[i]); } + ui.menu_recent_files->addSeparator(); + QAction* action_clear_recent_files = new QAction(this); + action_clear_recent_files->setText(tr("Clear Recent Files")); + connect(action_clear_recent_files, &QAction::triggered, this, [this] { + UISettings::values.recent_files.clear(); + UpdateRecentFiles(); + }); + ui.menu_recent_files->addAction(action_clear_recent_files); UpdateRecentFiles(); } @@ -221,6 +231,7 @@ void GMainWindow::InitializeHotkeys() { hotkey_registry.RegisterHotkey("Main Window", "Load File", QKeySequence::Open); hotkey_registry.RegisterHotkey("Main Window", "Start Emulation"); hotkey_registry.RegisterHotkey("Main Window", "Continue/Pause", QKeySequence(Qt::Key_F4)); + hotkey_registry.RegisterHotkey("Main Window", "Restart", QKeySequence(Qt::Key_F5)); hotkey_registry.RegisterHotkey("Main Window", "Fullscreen", QKeySequence::FullScreen); hotkey_registry.RegisterHotkey("Main Window", "Exit Fullscreen", QKeySequence(Qt::Key_Escape), Qt::ApplicationShortcut); @@ -246,6 +257,12 @@ void GMainWindow::InitializeHotkeys() { } } }); + connect(hotkey_registry.GetHotkey("Main Window", "Restart", this), &QShortcut::activated, this, + [this] { + if (!Core::System::GetInstance().IsPoweredOn()) + return; + BootGame(QString(game_path)); + }); connect(hotkey_registry.GetHotkey("Main Window", "Fullscreen", render_window), &QShortcut::activated, ui.action_Fullscreen, &QAction::trigger); connect(hotkey_registry.GetHotkey("Main Window", "Fullscreen", render_window), @@ -345,6 +362,7 @@ void GMainWindow::ConnectMenuEvents() { connect(ui.action_Start, &QAction::triggered, this, &GMainWindow::OnStartGame); connect(ui.action_Pause, &QAction::triggered, this, &GMainWindow::OnPauseGame); connect(ui.action_Stop, &QAction::triggered, this, &GMainWindow::OnStopGame); + connect(ui.action_Restart, &QAction::triggered, this, [this] { BootGame(QString(game_path)); }); connect(ui.action_Configure, &QAction::triggered, this, &GMainWindow::OnConfigure); // View @@ -494,6 +512,8 @@ bool GMainWindow::LoadROM(const QString& filename) { } return false; } + game_path = filename; + Core::Telemetry().AddField(Telemetry::FieldType::App, "Frontend", "Qt"); return true; } @@ -552,6 +572,7 @@ void GMainWindow::ShutdownGame() { ui.action_Start->setText(tr("Start")); ui.action_Pause->setEnabled(false); ui.action_Stop->setEnabled(false); + ui.action_Restart->setEnabled(false); render_window->hide(); game_list->show(); game_list->setFilterFocus(); @@ -564,6 +585,8 @@ void GMainWindow::ShutdownGame() { emu_frametime_label->setVisible(false); emulation_running = false; + + game_path.clear(); } void GMainWindow::StoreRecentFile(const QString& filename) { @@ -828,6 +851,7 @@ void GMainWindow::OnPauseGame() { ui.action_Start->setEnabled(true); ui.action_Pause->setEnabled(false); ui.action_Stop->setEnabled(true); + ui.action_Restart->setEnabled(true); } void GMainWindow::OnStopGame() { diff --git a/src/yuzu/main.h b/src/yuzu/main.h index 5f4d2ab9a..0534d4f99 100644 --- a/src/yuzu/main.h +++ b/src/yuzu/main.h @@ -161,6 +161,8 @@ private: // Whether emulation is currently running in yuzu. bool emulation_running = false; std::unique_ptr<EmuThread> emu_thread; + // The path to the game currently running + QString game_path; // FS FileSys::VirtualFilesystem vfs; diff --git a/src/yuzu/main.ui b/src/yuzu/main.ui index a3bfb2af3..d4c26b80a 100644 --- a/src/yuzu/main.ui +++ b/src/yuzu/main.ui @@ -211,6 +211,14 @@ <string>Fullscreen</string> </property> </action> + <action name="action_Restart"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>Restart</string> + </property> + </action> </widget> <resources/> </ui> |
