diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/hle/service/am/am.cpp | 2 | ||||
| -rw-r--r-- | src/yuzu/main.cpp | 41 | ||||
| -rw-r--r-- | src/yuzu/main.h | 2 |
3 files changed, 44 insertions, 1 deletions
diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp index a64e9c430..c4ddc7c69 100644 --- a/src/core/hle/service/am/am.cpp +++ b/src/core/hle/service/am/am.cpp | |||
| @@ -282,7 +282,7 @@ ISelfController::ISelfController(Core::System& system, | |||
| 282 | 282 | ||
| 283 | RegisterHandlers(functions); | 283 | RegisterHandlers(functions); |
| 284 | 284 | ||
| 285 | auto& kernel = system_.Kernel(); | 285 | auto& kernel = system.Kernel(); |
| 286 | launchable_event = Kernel::WritableEvent::CreateEventPair(kernel, Kernel::ResetType::Manual, | 286 | launchable_event = Kernel::WritableEvent::CreateEventPair(kernel, Kernel::ResetType::Manual, |
| 287 | "ISelfController:LaunchableEvent"); | 287 | "ISelfController:LaunchableEvent"); |
| 288 | 288 | ||
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index f147044d9..328f599f1 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp | |||
| @@ -22,6 +22,8 @@ | |||
| 22 | #include "core/frontend/applets/general_frontend.h" | 22 | #include "core/frontend/applets/general_frontend.h" |
| 23 | #include "core/frontend/scope_acquire_window_context.h" | 23 | #include "core/frontend/scope_acquire_window_context.h" |
| 24 | #include "core/hle/service/acc/profile_manager.h" | 24 | #include "core/hle/service/acc/profile_manager.h" |
| 25 | #include "core/hle/service/am/applet_ae.h" | ||
| 26 | #include "core/hle/service/am/applet_oe.h" | ||
| 25 | #include "core/hle/service/am/applets/applets.h" | 27 | #include "core/hle/service/am/applets/applets.h" |
| 26 | #include "core/hle/service/hid/controllers/npad.h" | 28 | #include "core/hle/service/hid/controllers/npad.h" |
| 27 | #include "core/hle/service/hid/hid.h" | 29 | #include "core/hle/service/hid/hid.h" |
| @@ -83,6 +85,7 @@ static FileSys::VirtualFile VfsDirectoryCreateFileWrapper(const FileSys::Virtual | |||
| 83 | #include "core/file_sys/submission_package.h" | 85 | #include "core/file_sys/submission_package.h" |
| 84 | #include "core/frontend/applets/software_keyboard.h" | 86 | #include "core/frontend/applets/software_keyboard.h" |
| 85 | #include "core/hle/kernel/process.h" | 87 | #include "core/hle/kernel/process.h" |
| 88 | #include "core/hle/service/am/am.h" | ||
| 86 | #include "core/hle/service/filesystem/filesystem.h" | 89 | #include "core/hle/service/filesystem/filesystem.h" |
| 87 | #include "core/hle/service/nfp/nfp.h" | 90 | #include "core/hle/service/nfp/nfp.h" |
| 88 | #include "core/hle/service/sm/sm.h" | 91 | #include "core/hle/service/sm/sm.h" |
| @@ -1674,6 +1677,11 @@ void GMainWindow::OnStartGame() { | |||
| 1674 | } | 1677 | } |
| 1675 | 1678 | ||
| 1676 | void GMainWindow::OnPauseGame() { | 1679 | void GMainWindow::OnPauseGame() { |
| 1680 | Core::System& system{Core::System::GetInstance()}; | ||
| 1681 | if (system.GetExitLock() && !ConfirmForceLockedExit()) { | ||
| 1682 | return; | ||
| 1683 | } | ||
| 1684 | |||
| 1677 | emu_thread->SetRunning(false); | 1685 | emu_thread->SetRunning(false); |
| 1678 | 1686 | ||
| 1679 | ui.action_Start->setEnabled(true); | 1687 | ui.action_Start->setEnabled(true); |
| @@ -1685,6 +1693,11 @@ void GMainWindow::OnPauseGame() { | |||
| 1685 | } | 1693 | } |
| 1686 | 1694 | ||
| 1687 | void GMainWindow::OnStopGame() { | 1695 | void GMainWindow::OnStopGame() { |
| 1696 | Core::System& system{Core::System::GetInstance()}; | ||
| 1697 | if (system.GetExitLock() && !ConfirmForceLockedExit()) { | ||
| 1698 | return; | ||
| 1699 | } | ||
| 1700 | |||
| 1688 | ShutdownGame(); | 1701 | ShutdownGame(); |
| 1689 | } | 1702 | } |
| 1690 | 1703 | ||
| @@ -2189,6 +2202,34 @@ bool GMainWindow::ConfirmChangeGame() { | |||
| 2189 | return answer != QMessageBox::No; | 2202 | return answer != QMessageBox::No; |
| 2190 | } | 2203 | } |
| 2191 | 2204 | ||
| 2205 | bool GMainWindow::ConfirmForceLockedExit() { | ||
| 2206 | if (emu_thread == nullptr) | ||
| 2207 | return true; | ||
| 2208 | |||
| 2209 | auto answer = | ||
| 2210 | QMessageBox::question(this, tr("yuzu"), | ||
| 2211 | tr("The currently running application has requested yuzu to not " | ||
| 2212 | "exit.\n\nWould you like to bypass this and exit anyway?"), | ||
| 2213 | QMessageBox::Yes | QMessageBox::No, QMessageBox::No); | ||
| 2214 | return answer != QMessageBox::No; | ||
| 2215 | } | ||
| 2216 | |||
| 2217 | void GMainWindow::RequestGameExit() { | ||
| 2218 | auto& sm{Core::System::GetInstance().ServiceManager()}; | ||
| 2219 | auto applet_oe = sm.GetService<Service::AM::AppletOE>("appletOE"); | ||
| 2220 | auto applet_ae = sm.GetService<Service::AM::AppletAE>("appletAE"); | ||
| 2221 | bool has_signalled = false; | ||
| 2222 | |||
| 2223 | if (applet_oe != nullptr) { | ||
| 2224 | applet_oe->GetMessageQueue()->RequestExit(); | ||
| 2225 | has_signalled = true; | ||
| 2226 | } | ||
| 2227 | |||
| 2228 | if (applet_ae != nullptr && !has_signalled) { | ||
| 2229 | applet_ae->GetMessageQueue()->RequestExit(); | ||
| 2230 | } | ||
| 2231 | } | ||
| 2232 | |||
| 2192 | void GMainWindow::filterBarSetChecked(bool state) { | 2233 | void GMainWindow::filterBarSetChecked(bool state) { |
| 2193 | ui.action_Show_Filter_Bar->setChecked(state); | 2234 | ui.action_Show_Filter_Bar->setChecked(state); |
| 2194 | emit(OnToggleFilterBar()); | 2235 | emit(OnToggleFilterBar()); |
diff --git a/src/yuzu/main.h b/src/yuzu/main.h index 7d16188cb..e942d1248 100644 --- a/src/yuzu/main.h +++ b/src/yuzu/main.h | |||
| @@ -172,6 +172,8 @@ private: | |||
| 172 | */ | 172 | */ |
| 173 | bool ConfirmClose(); | 173 | bool ConfirmClose(); |
| 174 | bool ConfirmChangeGame(); | 174 | bool ConfirmChangeGame(); |
| 175 | bool ConfirmForceLockedExit(); | ||
| 176 | void RequestGameExit(); | ||
| 175 | void closeEvent(QCloseEvent* event) override; | 177 | void closeEvent(QCloseEvent* event) override; |
| 176 | 178 | ||
| 177 | private slots: | 179 | private slots: |