summaryrefslogtreecommitdiff
path: root/src/yuzu
diff options
context:
space:
mode:
Diffstat (limited to 'src/yuzu')
-rw-r--r--src/yuzu/configuration/config.cpp6
-rw-r--r--src/yuzu/configuration/configure_graphics.cpp10
-rw-r--r--src/yuzu/configuration/configure_graphics.ui30
-rw-r--r--src/yuzu/main.cpp51
-rw-r--r--src/yuzu/main.h2
-rw-r--r--src/yuzu/main.ui8
6 files changed, 96 insertions, 11 deletions
diff --git a/src/yuzu/configuration/config.cpp b/src/yuzu/configuration/config.cpp
index 0bd46dbac..df55c3e3d 100644
--- a/src/yuzu/configuration/config.cpp
+++ b/src/yuzu/configuration/config.cpp
@@ -83,7 +83,8 @@ void Config::ReadValues() {
qt_config->beginGroup("Renderer");
Settings::values.resolution_factor = qt_config->value("resolution_factor", 1.0).toFloat();
- Settings::values.toggle_framelimit = qt_config->value("toggle_framelimit", true).toBool();
+ Settings::values.use_frame_limit = qt_config->value("use_frame_limit", true).toBool();
+ Settings::values.frame_limit = qt_config->value("frame_limit", 100).toInt();
Settings::values.use_accurate_framebuffers =
qt_config->value("use_accurate_framebuffers", false).toBool();
@@ -203,7 +204,8 @@ void Config::SaveValues() {
qt_config->beginGroup("Renderer");
qt_config->setValue("resolution_factor", (double)Settings::values.resolution_factor);
- qt_config->setValue("toggle_framelimit", Settings::values.toggle_framelimit);
+ qt_config->setValue("use_frame_limit", Settings::values.use_frame_limit);
+ qt_config->setValue("frame_limit", Settings::values.frame_limit);
qt_config->setValue("use_accurate_framebuffers", Settings::values.use_accurate_framebuffers);
// Cast to double because Qt's written float values are not human-readable
diff --git a/src/yuzu/configuration/configure_graphics.cpp b/src/yuzu/configuration/configure_graphics.cpp
index 4afe0f81b..ee1287028 100644
--- a/src/yuzu/configuration/configure_graphics.cpp
+++ b/src/yuzu/configuration/configure_graphics.cpp
@@ -12,6 +12,10 @@ ConfigureGraphics::ConfigureGraphics(QWidget* parent)
ui->setupUi(this);
this->setConfiguration();
+
+ ui->frame_limit->setEnabled(Settings::values.use_frame_limit);
+ connect(ui->toggle_frame_limit, &QCheckBox::stateChanged, ui->frame_limit,
+ &QSpinBox::setEnabled);
}
ConfigureGraphics::~ConfigureGraphics() = default;
@@ -58,13 +62,15 @@ Resolution FromResolutionFactor(float factor) {
void ConfigureGraphics::setConfiguration() {
ui->resolution_factor_combobox->setCurrentIndex(
static_cast<int>(FromResolutionFactor(Settings::values.resolution_factor)));
- ui->toggle_framelimit->setChecked(Settings::values.toggle_framelimit);
+ ui->toggle_frame_limit->setChecked(Settings::values.use_frame_limit);
+ ui->frame_limit->setValue(Settings::values.frame_limit);
ui->use_accurate_framebuffers->setChecked(Settings::values.use_accurate_framebuffers);
}
void ConfigureGraphics::applyConfiguration() {
Settings::values.resolution_factor =
ToResolutionFactor(static_cast<Resolution>(ui->resolution_factor_combobox->currentIndex()));
- Settings::values.toggle_framelimit = ui->toggle_framelimit->isChecked();
+ Settings::values.use_frame_limit = ui->toggle_frame_limit->isChecked();
+ Settings::values.frame_limit = ui->frame_limit->value();
Settings::values.use_accurate_framebuffers = ui->use_accurate_framebuffers->isChecked();
}
diff --git a/src/yuzu/configuration/configure_graphics.ui b/src/yuzu/configuration/configure_graphics.ui
index 7d092df03..3bc18c26e 100644
--- a/src/yuzu/configuration/configure_graphics.ui
+++ b/src/yuzu/configuration/configure_graphics.ui
@@ -23,11 +23,31 @@
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
- <widget class="QCheckBox" name="toggle_framelimit">
- <property name="text">
- <string>Limit framerate</string>
- </property>
- </widget>
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <item>
+ <widget class="QCheckBox" name="toggle_frame_limit">
+ <property name="text">
+ <string>Limit Speed Percent</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSpinBox" name="frame_limit">
+ <property name="suffix">
+ <string>%</string>
+ </property>
+ <property name="minimum">
+ <number>1</number>
+ </property>
+ <property name="maximum">
+ <number>9999</number>
+ </property>
+ <property name="value">
+ <number>100</number>
+ </property>
+ </widget>
+ </item>
+ </layout>
</item>
<item>
<widget class="QCheckBox" name="use_accurate_framebuffers">
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp
index e4cac5984..c62360bd4 100644
--- a/src/yuzu/main.cpp
+++ b/src/yuzu/main.cpp
@@ -216,6 +216,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();
}
@@ -224,11 +232,16 @@ 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);
hotkey_registry.RegisterHotkey("Main Window", "Toggle Speed Limit", QKeySequence("CTRL+Z"),
Qt::ApplicationShortcut);
+ hotkey_registry.RegisterHotkey("Main Window", "Increase Speed Limit", QKeySequence("+"),
+ Qt::ApplicationShortcut);
+ hotkey_registry.RegisterHotkey("Main Window", "Decrease Speed Limit", QKeySequence("-"),
+ Qt::ApplicationShortcut);
hotkey_registry.LoadHotkeys();
connect(hotkey_registry.GetHotkey("Main Window", "Load File", this), &QShortcut::activated,
@@ -245,6 +258,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),
@@ -258,9 +277,24 @@ void GMainWindow::InitializeHotkeys() {
});
connect(hotkey_registry.GetHotkey("Main Window", "Toggle Speed Limit", this),
&QShortcut::activated, this, [&] {
- Settings::values.toggle_framelimit = !Settings::values.toggle_framelimit;
+ Settings::values.use_frame_limit = !Settings::values.use_frame_limit;
UpdateStatusBar();
});
+ constexpr u16 SPEED_LIMIT_STEP = 5;
+ connect(hotkey_registry.GetHotkey("Main Window", "Increase Speed Limit", this),
+ &QShortcut::activated, this, [&] {
+ if (Settings::values.frame_limit < 9999 - SPEED_LIMIT_STEP) {
+ Settings::values.frame_limit += SPEED_LIMIT_STEP;
+ UpdateStatusBar();
+ }
+ });
+ connect(hotkey_registry.GetHotkey("Main Window", "Decrease Speed Limit", this),
+ &QShortcut::activated, this, [&] {
+ if (Settings::values.frame_limit > SPEED_LIMIT_STEP) {
+ Settings::values.frame_limit -= SPEED_LIMIT_STEP;
+ UpdateStatusBar();
+ }
+ });
}
void GMainWindow::SetDefaultUIGeometry() {
@@ -328,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
@@ -477,6 +512,8 @@ bool GMainWindow::LoadROM(const QString& filename) {
}
return false;
}
+ game_path = filename;
+
Core::Telemetry().AddField(Telemetry::FieldType::App, "Frontend", "Qt");
return true;
}
@@ -535,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();
@@ -547,6 +585,8 @@ void GMainWindow::ShutdownGame() {
emu_frametime_label->setVisible(false);
emulation_running = false;
+
+ game_path.clear();
}
void GMainWindow::StoreRecentFile(const QString& filename) {
@@ -840,6 +880,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() {
@@ -941,7 +982,13 @@ void GMainWindow::UpdateStatusBar() {
auto results = Core::System::GetInstance().GetAndResetPerfStats();
- emu_speed_label->setText(tr("Speed: %1%").arg(results.emulation_speed * 100.0, 0, 'f', 0));
+ if (Settings::values.use_frame_limit) {
+ emu_speed_label->setText(tr("Speed: %1% / %2%")
+ .arg(results.emulation_speed * 100.0, 0, 'f', 0)
+ .arg(Settings::values.frame_limit));
+ } else {
+ emu_speed_label->setText(tr("Speed: %1%").arg(results.emulation_speed * 100.0, 0, 'f', 0));
+ }
game_fps_label->setText(tr("Game: %1 FPS").arg(results.game_fps, 0, 'f', 0));
emu_frametime_label->setText(tr("Frame: %1 ms").arg(results.frametime * 1000.0, 0, 'f', 2));
diff --git a/src/yuzu/main.h b/src/yuzu/main.h
index 02df30878..d1d34552b 100644
--- a/src/yuzu/main.h
+++ b/src/yuzu/main.h
@@ -162,6 +162,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>