From 3ff418065eaa3e82d7d4f2683c1d8d7e9ba2152e Mon Sep 17 00:00:00 2001 From: pineappleEA Date: Thu, 22 Dec 2022 06:11:48 +0100 Subject: [PATCH] early-access version 3239 --- README.md | 2 +- src/yuzu/bootmanager.cpp | 1 - src/yuzu/main.cpp | 14 +++++++++++--- src/yuzu/util/overlay_dialog.cpp | 3 ++- 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 14eb95218..18442ffc1 100755 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ yuzu emulator early access ============= -This is the source code for early-access 3238. +This is the source code for early-access 3239. ## Legal Notice diff --git a/src/yuzu/bootmanager.cpp b/src/yuzu/bootmanager.cpp index ef74d621e..ab2c1ae27 100755 --- a/src/yuzu/bootmanager.cpp +++ b/src/yuzu/bootmanager.cpp @@ -78,7 +78,6 @@ void EmuThread::run() { gpu.Start(); m_system.GetCpuManager().OnGpuReady(); - m_system.RegisterExitCallback([this] { m_stop_source.request_stop(); }); if (m_system.DebuggerEnabled()) { m_system.InitializeDebugger(); diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 5d40cbc6a..823e431e4 100755 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -1710,6 +1710,11 @@ void GMainWindow::BootGame(const QString& filename, u64 program_id, std::size_t system->RegisterExecuteProgramCallback( [this](std::size_t program_index_) { render_window->ExecuteProgram(program_index_); }); + system->RegisterExitCallback([this] { + emu_thread->ForceStop(); + render_window->Exit(); + }); + connect(render_window, &GRenderWindow::Closed, this, &GMainWindow::OnStopGame); connect(render_window, &GRenderWindow::MouseActivity, this, &GMainWindow::OnMouseActivity); // BlockingQueuedConnection is important here, it makes sure we've finished refreshing our views @@ -1814,9 +1819,8 @@ void GMainWindow::OnShutdownBegin() { } void GMainWindow::OnShutdownBeginDialog() { - shutdown_dialog = - new OverlayDialog(render_window, *system, QString{}, tr("Closing software..."), QString{}, - QString{}, Qt::AlignHCenter | Qt::AlignVCenter); + shutdown_dialog = new OverlayDialog(this, *system, QString{}, tr("Closing software..."), + QString{}, QString{}, Qt::AlignHCenter | Qt::AlignVCenter); shutdown_dialog->open(); } @@ -4178,6 +4182,10 @@ bool GMainWindow::ConfirmForceLockedExit() { } void GMainWindow::RequestGameExit() { + if (!system->IsPoweredOn()) { + return; + } + auto& sm{system->ServiceManager()}; auto applet_oe = sm.GetService("appletOE"); auto applet_ae = sm.GetService("appletAE"); diff --git a/src/yuzu/util/overlay_dialog.cpp b/src/yuzu/util/overlay_dialog.cpp index d9b8ffdd6..42dde9e68 100755 --- a/src/yuzu/util/overlay_dialog.cpp +++ b/src/yuzu/util/overlay_dialog.cpp @@ -3,6 +3,7 @@ #include #include +#include #include "core/core.h" #include "core/hid/hid_types.h" @@ -162,7 +163,7 @@ void OverlayDialog::MoveAndResizeWindow() { const auto height = static_cast(parentWidget()->height()); // High DPI - const float dpi_scale = qApp->screenAt(pos)->logicalDotsPerInch() / 96.0f; + const float dpi_scale = parentWidget()->windowHandle()->screen()->logicalDotsPerInch() / 96.0f; const auto title_text_font_size = BASE_TITLE_FONT_SIZE * (height / BASE_HEIGHT) / dpi_scale; const auto body_text_font_size =