summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/core/core.cpp25
-rw-r--r--src/core/core.h7
-rw-r--r--src/core/hle/service/am/am.cpp8
-rw-r--r--src/yuzu/main.cpp14
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
946void System::SetExitLock(bool locked) { 949void System::SetExitLocked(bool locked) {
947 impl->exit_lock = locked; 950 impl->exit_locked = locked;
948} 951}
949 952
950bool System::GetExitLock() const { 953bool System::GetExitLocked() const {
951 return impl->exit_lock; 954 return impl->exit_locked;
955}
956
957void System::SetExitRequested(bool requested) {
958 impl->exit_requested = requested;
959}
960
961bool System::GetExitRequested() const {
962 return impl->exit_requested;
952} 963}
953 964
954void System::SetApplicationProcessBuildID(const CurrentBuildProcessID& id) { 965void 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 da33f0e44..e92f400de 100644
--- a/src/core/hle/service/am/am.cpp
+++ b/src/core/hle/service/am/am.cpp
@@ -341,7 +341,7 @@ void ISelfController::Exit(HLERequestContext& ctx) {
341void ISelfController::LockExit(HLERequestContext& ctx) { 341void ISelfController::LockExit(HLERequestContext& ctx) {
342 LOG_DEBUG(Service_AM, "called"); 342 LOG_DEBUG(Service_AM, "called");
343 343
344 system.SetExitLock(true); 344 system.SetExitLocked(true);
345 345
346 IPC::ResponseBuilder rb{ctx, 2}; 346 IPC::ResponseBuilder rb{ctx, 2};
347 rb.Push(ResultSuccess); 347 rb.Push(ResultSuccess);
@@ -350,10 +350,14 @@ void ISelfController::LockExit(HLERequestContext& ctx) {
350void ISelfController::UnlockExit(HLERequestContext& ctx) { 350void ISelfController::UnlockExit(HLERequestContext& ctx) {
351 LOG_DEBUG(Service_AM, "called"); 351 LOG_DEBUG(Service_AM, "called");
352 352
353 system.SetExitLock(false); 353 system.SetExitLocked(false);
354 354
355 IPC::ResponseBuilder rb{ctx, 2}; 355 IPC::ResponseBuilder rb{ctx, 2};
356 rb.Push(ResultSuccess); 356 rb.Push(ResultSuccess);
357
358 if (system.GetExitRequested()) {
359 system.Exit();
360 }
357} 361}
358 362
359void ISelfController::EnterFatalSection(HLERequestContext& ctx) { 363void ISelfController::EnterFatalSection(HLERequestContext& ctx) {
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp
index 33c9fd0af..9ee7a5ee4 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
3263void GMainWindow::OnStopGame() { 3271void GMainWindow::OnStopGame() {
3264 if (system->GetExitLock() && !ConfirmForceLockedExit()) { 3272 if (system->GetExitLocked() && !ConfirmForceLockedExit()) {
3265 return; 3273 return;
3266 } 3274 }
3267 3275
@@ -4515,6 +4523,8 @@ void GMainWindow::RequestGameExit() {
4515 auto applet_ae = sm.GetService<Service::AM::AppletAE>("appletAE"); 4523 auto applet_ae = sm.GetService<Service::AM::AppletAE>("appletAE");
4516 bool has_signalled = false; 4524 bool has_signalled = false;
4517 4525
4526 system->SetExitRequested(true);
4527
4518 if (applet_oe != nullptr) { 4528 if (applet_oe != nullptr) {
4519 applet_oe->GetMessageQueue()->RequestExit(); 4529 applet_oe->GetMessageQueue()->RequestExit();
4520 has_signalled = true; 4530 has_signalled = true;