diff options
Diffstat (limited to '')
| -rw-r--r-- | src/yuzu/main.cpp | 55 | ||||
| -rw-r--r-- | src/yuzu/main.h | 2 | ||||
| -rw-r--r-- | src/yuzu/main.ui | 9 |
3 files changed, 46 insertions, 20 deletions
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 592993c36..3ef59fbad 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp | |||
| @@ -894,6 +894,8 @@ void GMainWindow::ConnectMenuEvents() { | |||
| 894 | connect(ui.action_Open_FAQ, &QAction::triggered, this, &GMainWindow::OnOpenFAQ); | 894 | connect(ui.action_Open_FAQ, &QAction::triggered, this, &GMainWindow::OnOpenFAQ); |
| 895 | connect(ui.action_Restart, &QAction::triggered, this, [this] { BootGame(QString(game_path)); }); | 895 | connect(ui.action_Restart, &QAction::triggered, this, [this] { BootGame(QString(game_path)); }); |
| 896 | connect(ui.action_Configure, &QAction::triggered, this, &GMainWindow::OnConfigure); | 896 | connect(ui.action_Configure, &QAction::triggered, this, &GMainWindow::OnConfigure); |
| 897 | connect(ui.action_Configure_Current_Game, &QAction::triggered, this, | ||
| 898 | &GMainWindow::OnConfigurePerGame); | ||
| 897 | 899 | ||
| 898 | // View | 900 | // View |
| 899 | connect(ui.action_Single_Window_Mode, &QAction::triggered, this, | 901 | connect(ui.action_Single_Window_Mode, &QAction::triggered, this, |
| @@ -1167,6 +1169,7 @@ void GMainWindow::ShutdownGame() { | |||
| 1167 | ui.action_Pause->setEnabled(false); | 1169 | ui.action_Pause->setEnabled(false); |
| 1168 | ui.action_Stop->setEnabled(false); | 1170 | ui.action_Stop->setEnabled(false); |
| 1169 | ui.action_Restart->setEnabled(false); | 1171 | ui.action_Restart->setEnabled(false); |
| 1172 | ui.action_Configure_Current_Game->setEnabled(false); | ||
| 1170 | ui.action_Report_Compatibility->setEnabled(false); | 1173 | ui.action_Report_Compatibility->setEnabled(false); |
| 1171 | ui.action_Load_Amiibo->setEnabled(false); | 1174 | ui.action_Load_Amiibo->setEnabled(false); |
| 1172 | ui.action_Capture_Screenshot->setEnabled(false); | 1175 | ui.action_Capture_Screenshot->setEnabled(false); |
| @@ -1718,26 +1721,7 @@ void GMainWindow::OnGameListOpenPerGameProperties(const std::string& file) { | |||
| 1718 | return; | 1721 | return; |
| 1719 | } | 1722 | } |
| 1720 | 1723 | ||
| 1721 | ConfigurePerGame dialog(this, title_id); | 1724 | OpenPerGameConfiguration(title_id, file); |
| 1722 | dialog.LoadFromFile(v_file); | ||
| 1723 | auto result = dialog.exec(); | ||
| 1724 | if (result == QDialog::Accepted) { | ||
| 1725 | dialog.ApplyConfiguration(); | ||
| 1726 | |||
| 1727 | const auto reload = UISettings::values.is_game_list_reload_pending.exchange(false); | ||
| 1728 | if (reload) { | ||
| 1729 | game_list->PopulateAsync(UISettings::values.game_dirs); | ||
| 1730 | } | ||
| 1731 | |||
| 1732 | // Do not cause the global config to write local settings into the config file | ||
| 1733 | Settings::RestoreGlobalState(); | ||
| 1734 | |||
| 1735 | if (!Core::System::GetInstance().IsPoweredOn()) { | ||
| 1736 | config->Save(); | ||
| 1737 | } | ||
| 1738 | } else { | ||
| 1739 | Settings::RestoreGlobalState(); | ||
| 1740 | } | ||
| 1741 | } | 1725 | } |
| 1742 | 1726 | ||
| 1743 | void GMainWindow::OnMenuLoadFile() { | 1727 | void GMainWindow::OnMenuLoadFile() { |
| @@ -2066,6 +2050,7 @@ void GMainWindow::OnStartGame() { | |||
| 2066 | ui.action_Pause->setEnabled(true); | 2050 | ui.action_Pause->setEnabled(true); |
| 2067 | ui.action_Stop->setEnabled(true); | 2051 | ui.action_Stop->setEnabled(true); |
| 2068 | ui.action_Restart->setEnabled(true); | 2052 | ui.action_Restart->setEnabled(true); |
| 2053 | ui.action_Configure_Current_Game->setEnabled(true); | ||
| 2069 | ui.action_Report_Compatibility->setEnabled(true); | 2054 | ui.action_Report_Compatibility->setEnabled(true); |
| 2070 | 2055 | ||
| 2071 | discord_rpc->Update(); | 2056 | discord_rpc->Update(); |
| @@ -2255,6 +2240,36 @@ void GMainWindow::OnConfigure() { | |||
| 2255 | UpdateStatusButtons(); | 2240 | UpdateStatusButtons(); |
| 2256 | } | 2241 | } |
| 2257 | 2242 | ||
| 2243 | void GMainWindow::OnConfigurePerGame() { | ||
| 2244 | const u64 title_id = Core::System::GetInstance().CurrentProcess()->GetTitleID(); | ||
| 2245 | OpenPerGameConfiguration(title_id, game_path.toStdString()); | ||
| 2246 | } | ||
| 2247 | |||
| 2248 | void GMainWindow::OpenPerGameConfiguration(u64 title_id, const std::string& file_name) { | ||
| 2249 | const auto v_file = Core::GetGameFileFromPath(vfs, file_name); | ||
| 2250 | |||
| 2251 | ConfigurePerGame dialog(this, title_id); | ||
| 2252 | dialog.LoadFromFile(v_file); | ||
| 2253 | auto result = dialog.exec(); | ||
| 2254 | if (result == QDialog::Accepted) { | ||
| 2255 | dialog.ApplyConfiguration(); | ||
| 2256 | |||
| 2257 | const auto reload = UISettings::values.is_game_list_reload_pending.exchange(false); | ||
| 2258 | if (reload) { | ||
| 2259 | game_list->PopulateAsync(UISettings::values.game_dirs); | ||
| 2260 | } | ||
| 2261 | |||
| 2262 | // Do not cause the global config to write local settings into the config file | ||
| 2263 | Settings::RestoreGlobalState(); | ||
| 2264 | |||
| 2265 | if (!Core::System::GetInstance().IsPoweredOn()) { | ||
| 2266 | config->Save(); | ||
| 2267 | } | ||
| 2268 | } else { | ||
| 2269 | Settings::RestoreGlobalState(); | ||
| 2270 | } | ||
| 2271 | } | ||
| 2272 | |||
| 2258 | void GMainWindow::OnLoadAmiibo() { | 2273 | void GMainWindow::OnLoadAmiibo() { |
| 2259 | const QString extensions{QStringLiteral("*.bin")}; | 2274 | const QString extensions{QStringLiteral("*.bin")}; |
| 2260 | const QString file_filter = tr("Amiibo File (%1);; All Files (*.*)").arg(extensions); | 2275 | const QString file_filter = tr("Amiibo File (%1);; All Files (*.*)").arg(extensions); |
diff --git a/src/yuzu/main.h b/src/yuzu/main.h index 73a44a3bf..64c33830d 100644 --- a/src/yuzu/main.h +++ b/src/yuzu/main.h | |||
| @@ -216,6 +216,7 @@ private slots: | |||
| 216 | void OnMenuInstallToNAND(); | 216 | void OnMenuInstallToNAND(); |
| 217 | void OnMenuRecentFile(); | 217 | void OnMenuRecentFile(); |
| 218 | void OnConfigure(); | 218 | void OnConfigure(); |
| 219 | void OnConfigurePerGame(); | ||
| 219 | void OnLoadAmiibo(); | 220 | void OnLoadAmiibo(); |
| 220 | void OnOpenYuzuFolder(); | 221 | void OnOpenYuzuFolder(); |
| 221 | void OnAbout(); | 222 | void OnAbout(); |
| @@ -249,6 +250,7 @@ private: | |||
| 249 | void ShowMouseCursor(); | 250 | void ShowMouseCursor(); |
| 250 | void OpenURL(const QUrl& url); | 251 | void OpenURL(const QUrl& url); |
| 251 | void LoadTranslation(); | 252 | void LoadTranslation(); |
| 253 | void OpenPerGameConfiguration(u64 title_id, const std::string& file_name); | ||
| 252 | 254 | ||
| 253 | Ui::MainWindow ui; | 255 | Ui::MainWindow ui; |
| 254 | 256 | ||
diff --git a/src/yuzu/main.ui b/src/yuzu/main.ui index c3a1d715e..87ea985d8 100644 --- a/src/yuzu/main.ui +++ b/src/yuzu/main.ui | |||
| @@ -81,6 +81,7 @@ | |||
| 81 | <addaction name="action_Restart"/> | 81 | <addaction name="action_Restart"/> |
| 82 | <addaction name="separator"/> | 82 | <addaction name="separator"/> |
| 83 | <addaction name="action_Configure"/> | 83 | <addaction name="action_Configure"/> |
| 84 | <addaction name="action_Configure_Current_Game"/> | ||
| 84 | </widget> | 85 | </widget> |
| 85 | <widget class="QMenu" name="menu_View"> | 86 | <widget class="QMenu" name="menu_View"> |
| 86 | <property name="title"> | 87 | <property name="title"> |
| @@ -287,6 +288,14 @@ | |||
| 287 | <string>Capture Screenshot</string> | 288 | <string>Capture Screenshot</string> |
| 288 | </property> | 289 | </property> |
| 289 | </action> | 290 | </action> |
| 291 | <action name="action_Configure_Current_Game"> | ||
| 292 | <property name="enabled"> | ||
| 293 | <bool>false</bool> | ||
| 294 | </property> | ||
| 295 | <property name="text"> | ||
| 296 | <string>Configure Current Game..</string> | ||
| 297 | </property> | ||
| 298 | </action> | ||
| 290 | </widget> | 299 | </widget> |
| 291 | <resources/> | 300 | <resources/> |
| 292 | <connections/> | 301 | <connections/> |