diff options
Diffstat (limited to '')
| -rw-r--r-- | src/core/core.cpp | 25 | ||||
| -rw-r--r-- | src/core/core.h | 7 | ||||
| -rw-r--r-- | src/core/hle/service/am/am.cpp | 8 | ||||
| -rw-r--r-- | src/yuzu/main.cpp | 14 |
4 files changed, 41 insertions, 13 deletions
diff --git a/src/core/core.cpp b/src/core/core.cpp index 2f67e60a9..e95ae80da 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp | |||
| @@ -273,7 +273,8 @@ struct System::Impl { | |||
| 273 | time_manager.Initialize(); | 273 | time_manager.Initialize(); |
| 274 | 274 | ||
| 275 | is_powered_on = true; | 275 | is_powered_on = true; |
| 276 | exit_lock = false; | 276 | exit_locked = false; |
| 277 | exit_requested = false; | ||
| 277 | 278 | ||
| 278 | microprofile_cpu[0] = MICROPROFILE_TOKEN(ARM_CPU0); | 279 | microprofile_cpu[0] = MICROPROFILE_TOKEN(ARM_CPU0); |
| 279 | microprofile_cpu[1] = MICROPROFILE_TOKEN(ARM_CPU1); | 280 | microprofile_cpu[1] = MICROPROFILE_TOKEN(ARM_CPU1); |
| @@ -398,7 +399,8 @@ struct System::Impl { | |||
| 398 | } | 399 | } |
| 399 | 400 | ||
| 400 | is_powered_on = false; | 401 | is_powered_on = false; |
| 401 | exit_lock = false; | 402 | exit_locked = false; |
| 403 | exit_requested = false; | ||
| 402 | 404 | ||
| 403 | if (gpu_core != nullptr) { | 405 | if (gpu_core != nullptr) { |
| 404 | gpu_core->NotifyShutdown(); | 406 | gpu_core->NotifyShutdown(); |
| @@ -507,7 +509,8 @@ struct System::Impl { | |||
| 507 | 509 | ||
| 508 | CpuManager cpu_manager; | 510 | CpuManager cpu_manager; |
| 509 | std::atomic_bool is_powered_on{}; | 511 | std::atomic_bool is_powered_on{}; |
| 510 | bool exit_lock = false; | 512 | bool exit_locked = false; |
| 513 | bool exit_requested = false; | ||
| 511 | 514 | ||
| 512 | bool nvdec_active{}; | 515 | bool nvdec_active{}; |
| 513 | 516 | ||
| @@ -943,12 +946,20 @@ const Service::Time::TimeManager& System::GetTimeManager() const { | |||
| 943 | return impl->time_manager; | 946 | return impl->time_manager; |
| 944 | } | 947 | } |
| 945 | 948 | ||
| 946 | void System::SetExitLock(bool locked) { | 949 | void System::SetExitLocked(bool locked) { |
| 947 | impl->exit_lock = locked; | 950 | impl->exit_locked = locked; |
| 948 | } | 951 | } |
| 949 | 952 | ||
| 950 | bool System::GetExitLock() const { | 953 | bool System::GetExitLocked() const { |
| 951 | return impl->exit_lock; | 954 | return impl->exit_locked; |
| 955 | } | ||
| 956 | |||
| 957 | void System::SetExitRequested(bool requested) { | ||
| 958 | impl->exit_requested = requested; | ||
| 959 | } | ||
| 960 | |||
| 961 | bool System::GetExitRequested() const { | ||
| 962 | return impl->exit_requested; | ||
| 952 | } | 963 | } |
| 953 | 964 | ||
| 954 | void System::SetApplicationProcessBuildID(const CurrentBuildProcessID& id) { | 965 | void System::SetApplicationProcessBuildID(const CurrentBuildProcessID& id) { |
diff --git a/src/core/core.h b/src/core/core.h index c70ea1965..a9ff9315e 100644 --- a/src/core/core.h +++ b/src/core/core.h | |||
| @@ -412,8 +412,11 @@ public: | |||
| 412 | /// Gets an immutable reference to the Room Network. | 412 | /// Gets an immutable reference to the Room Network. |
| 413 | [[nodiscard]] const Network::RoomNetwork& GetRoomNetwork() const; | 413 | [[nodiscard]] const Network::RoomNetwork& GetRoomNetwork() const; |
| 414 | 414 | ||
| 415 | void SetExitLock(bool locked); | 415 | void SetExitLocked(bool locked); |
| 416 | [[nodiscard]] bool GetExitLock() const; | 416 | bool GetExitLocked() const; |
| 417 | |||
| 418 | void SetExitRequested(bool requested); | ||
| 419 | bool GetExitRequested() const; | ||
| 417 | 420 | ||
| 418 | void SetApplicationProcessBuildID(const CurrentBuildProcessID& id); | 421 | void SetApplicationProcessBuildID(const CurrentBuildProcessID& id); |
| 419 | [[nodiscard]] const CurrentBuildProcessID& GetApplicationProcessBuildID() const; | 422 | [[nodiscard]] const CurrentBuildProcessID& GetApplicationProcessBuildID() const; |
diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp index 8d057b3a8..d82a3169d 100644 --- a/src/core/hle/service/am/am.cpp +++ b/src/core/hle/service/am/am.cpp | |||
| @@ -340,7 +340,7 @@ void ISelfController::Exit(HLERequestContext& ctx) { | |||
| 340 | void ISelfController::LockExit(HLERequestContext& ctx) { | 340 | void ISelfController::LockExit(HLERequestContext& ctx) { |
| 341 | LOG_DEBUG(Service_AM, "called"); | 341 | LOG_DEBUG(Service_AM, "called"); |
| 342 | 342 | ||
| 343 | system.SetExitLock(true); | 343 | system.SetExitLocked(true); |
| 344 | 344 | ||
| 345 | IPC::ResponseBuilder rb{ctx, 2}; | 345 | IPC::ResponseBuilder rb{ctx, 2}; |
| 346 | rb.Push(ResultSuccess); | 346 | rb.Push(ResultSuccess); |
| @@ -349,10 +349,14 @@ void ISelfController::LockExit(HLERequestContext& ctx) { | |||
| 349 | void ISelfController::UnlockExit(HLERequestContext& ctx) { | 349 | void ISelfController::UnlockExit(HLERequestContext& ctx) { |
| 350 | LOG_DEBUG(Service_AM, "called"); | 350 | LOG_DEBUG(Service_AM, "called"); |
| 351 | 351 | ||
| 352 | system.SetExitLock(false); | 352 | system.SetExitLocked(false); |
| 353 | 353 | ||
| 354 | IPC::ResponseBuilder rb{ctx, 2}; | 354 | IPC::ResponseBuilder rb{ctx, 2}; |
| 355 | rb.Push(ResultSuccess); | 355 | rb.Push(ResultSuccess); |
| 356 | |||
| 357 | if (system.GetExitRequested()) { | ||
| 358 | system.Exit(); | ||
| 359 | } | ||
| 356 | } | 360 | } |
| 357 | 361 | ||
| 358 | void ISelfController::EnterFatalSection(HLERequestContext& ctx) { | 362 | void ISelfController::EnterFatalSection(HLERequestContext& ctx) { |
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 8e933af64..aa7e9156a 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp | |||
| @@ -2010,8 +2010,16 @@ bool GMainWindow::OnShutdownBegin() { | |||
| 2010 | 2010 | ||
| 2011 | emit EmulationStopping(); | 2011 | emit EmulationStopping(); |
| 2012 | 2012 | ||
| 2013 | int shutdown_time = 1000; | ||
| 2014 | |||
| 2015 | if (system->DebuggerEnabled()) { | ||
| 2016 | shutdown_time = 0; | ||
| 2017 | } else if (system->GetExitLocked()) { | ||
| 2018 | shutdown_time = 5000; | ||
| 2019 | } | ||
| 2020 | |||
| 2013 | shutdown_timer.setSingleShot(true); | 2021 | shutdown_timer.setSingleShot(true); |
| 2014 | shutdown_timer.start(system->DebuggerEnabled() ? 0 : 5000); | 2022 | shutdown_timer.start(shutdown_time); |
| 2015 | connect(&shutdown_timer, &QTimer::timeout, this, &GMainWindow::OnEmulationStopTimeExpired); | 2023 | connect(&shutdown_timer, &QTimer::timeout, this, &GMainWindow::OnEmulationStopTimeExpired); |
| 2016 | connect(emu_thread.get(), &QThread::finished, this, &GMainWindow::OnEmulationStopped); | 2024 | connect(emu_thread.get(), &QThread::finished, this, &GMainWindow::OnEmulationStopped); |
| 2017 | 2025 | ||
| @@ -3261,7 +3269,7 @@ void GMainWindow::OnPauseContinueGame() { | |||
| 3261 | } | 3269 | } |
| 3262 | 3270 | ||
| 3263 | void GMainWindow::OnStopGame() { | 3271 | void GMainWindow::OnStopGame() { |
| 3264 | if (system->GetExitLock() && !ConfirmForceLockedExit()) { | 3272 | if (system->GetExitLocked() && !ConfirmForceLockedExit()) { |
| 3265 | return; | 3273 | return; |
| 3266 | } | 3274 | } |
| 3267 | 3275 | ||
| @@ -4514,6 +4522,8 @@ void GMainWindow::RequestGameExit() { | |||
| 4514 | auto applet_ae = sm.GetService<Service::AM::AppletAE>("appletAE"); | 4522 | auto applet_ae = sm.GetService<Service::AM::AppletAE>("appletAE"); |
| 4515 | bool has_signalled = false; | 4523 | bool has_signalled = false; |
| 4516 | 4524 | ||
| 4525 | system->SetExitRequested(true); | ||
| 4526 | |||
| 4517 | if (applet_oe != nullptr) { | 4527 | if (applet_oe != nullptr) { |
| 4518 | applet_oe->GetMessageQueue()->RequestExit(); | 4528 | applet_oe->GetMessageQueue()->RequestExit(); |
| 4519 | has_signalled = true; | 4529 | has_signalled = true; |