From 568a0ac3974d837d7114e4480691b1d717451be2 Mon Sep 17 00:00:00 2001 From: lat9nq Date: Sun, 10 Jul 2022 11:46:53 -0400 Subject: yuzu: Rename check_vulkan to startup_checks --- src/yuzu/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/yuzu/main.cpp') diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index b460020b1..64be8bf61 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -115,7 +115,6 @@ static FileSys::VirtualFile VfsDirectoryCreateFileWrapper(const FileSys::Virtual #include "video_core/shader_notify.h" #include "yuzu/about_dialog.h" #include "yuzu/bootmanager.h" -#include "yuzu/check_vulkan.h" #include "yuzu/compatdb.h" #include "yuzu/compatibility_list.h" #include "yuzu/configuration/config.h" @@ -131,6 +130,7 @@ static FileSys::VirtualFile VfsDirectoryCreateFileWrapper(const FileSys::Virtual #include "yuzu/install_dialog.h" #include "yuzu/loading_screen.h" #include "yuzu/main.h" +#include "yuzu/startup_checks.h" #include "yuzu/uisettings.h" using namespace Common::Literals; -- cgit v1.2.3 From 4f15d9ed6fba4fa1804c5be3f9378e3ad3d32688 Mon Sep 17 00:00:00 2001 From: lat9nq Date: Sun, 10 Jul 2022 14:08:20 -0400 Subject: yuzu: Check Vulkan on startup with a child --- src/yuzu/main.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/yuzu/main.cpp') diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 64be8bf61..f2e449560 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -3853,6 +3853,21 @@ void GMainWindow::SetDiscordEnabled([[maybe_unused]] bool state) { #endif int main(int argc, char* argv[]) { +#ifdef _WIN32 + char variable_contents[32]; + const DWORD startup_check_var = + GetEnvironmentVariable(STARTUP_CHECK_ENV_VAR, variable_contents, 32); + if (startup_check_var != 0) { + std::fprintf(stderr, "perform statup checks\n"); + CheckVulkan(); + return 0; + } else { + std::fprintf(stderr, "%d\n", StartupChecks()); + } +#elif YUZU_UNIX +#error "Unimplemented" +#endif + Common::DetachedTasks detached_tasks; MicroProfileOnThreadCreate("Frontend"); SCOPE_EXIT({ MicroProfileShutdown(); }); -- cgit v1.2.3 From 33abdfff9bf0a549b0d1d327e914e9a1ab4b799b Mon Sep 17 00:00:00 2001 From: lat9nq Date: Sun, 10 Jul 2022 16:10:35 -0400 Subject: yuzu: Simplify broken Vulkan handling --- src/yuzu/main.cpp | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) (limited to 'src/yuzu/main.cpp') diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index f2e449560..a2b11fdbf 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -252,7 +252,7 @@ static QString PrettyProductName() { return QSysInfo::prettyProductName(); } -GMainWindow::GMainWindow() +GMainWindow::GMainWindow(bool has_broken_vulkan) : ui{std::make_unique()}, system{std::make_unique()}, input_subsystem{std::make_shared()}, config{std::make_unique(*system)}, @@ -352,17 +352,15 @@ GMainWindow::GMainWindow() MigrateConfigFiles(); - if (!CheckVulkan()) { - config->Save(); + if (has_broken_vulkan) { + UISettings::values.has_broken_vulkan = true; + + QMessageBox::warning(this, tr("Broken Vulkan Installation Detected"), + tr("Vulkan initialization failed during boot.

Click " + "here for instructions to fix the issue.")); - QMessageBox::warning( - this, tr("Broken Vulkan Installation Detected"), - tr("Vulkan initialization failed on the previous boot.

Click here for " - "instructions to fix the issue.")); - } - if (UISettings::values.has_broken_vulkan) { Settings::values.renderer_backend = Settings::RendererBackend::OpenGL; renderer_status_button->setDisabled(true); @@ -3853,17 +3851,17 @@ void GMainWindow::SetDiscordEnabled([[maybe_unused]] bool state) { #endif int main(int argc, char* argv[]) { + bool has_broken_vulkan = false; #ifdef _WIN32 char variable_contents[32]; const DWORD startup_check_var = GetEnvironmentVariable(STARTUP_CHECK_ENV_VAR, variable_contents, 32); - if (startup_check_var != 0) { - std::fprintf(stderr, "perform statup checks\n"); + const std::string variable_contents_s{variable_contents}; + if (startup_check_var > 0 && variable_contents_s == "ON") { CheckVulkan(); return 0; - } else { - std::fprintf(stderr, "%d\n", StartupChecks()); } + StartupChecks(argv[0], &has_broken_vulkan); #elif YUZU_UNIX #error "Unimplemented" #endif @@ -3907,7 +3905,7 @@ int main(int argc, char* argv[]) { // generating shaders setlocale(LC_ALL, "C"); - GMainWindow main_window{}; + GMainWindow main_window{has_broken_vulkan}; // After settings have been loaded by GMainWindow, apply the filter main_window.show(); -- cgit v1.2.3 From fd4e48f96e8328bbace2d4df4f2a6f7ab9a699f1 Mon Sep 17 00:00:00 2001 From: lat9nq Date: Sun, 10 Jul 2022 17:01:37 -0400 Subject: startup_checks: Implement unix side code Wow fork() is nice, isn't it? --- src/yuzu/main.cpp | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) (limited to 'src/yuzu/main.cpp') diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index a2b11fdbf..69f9cdd9c 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -3852,19 +3852,9 @@ void GMainWindow::SetDiscordEnabled([[maybe_unused]] bool state) { int main(int argc, char* argv[]) { bool has_broken_vulkan = false; -#ifdef _WIN32 - char variable_contents[32]; - const DWORD startup_check_var = - GetEnvironmentVariable(STARTUP_CHECK_ENV_VAR, variable_contents, 32); - const std::string variable_contents_s{variable_contents}; - if (startup_check_var > 0 && variable_contents_s == "ON") { - CheckVulkan(); + if (StartupChecks(argv[0], &has_broken_vulkan)) { return 0; } - StartupChecks(argv[0], &has_broken_vulkan); -#elif YUZU_UNIX -#error "Unimplemented" -#endif Common::DetachedTasks detached_tasks; MicroProfileOnThreadCreate("Frontend"); -- cgit v1.2.3