diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/common/settings.h | 1 | ||||
| -rw-r--r-- | src/yuzu/configuration/config.cpp | 2 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_debug.cpp | 2 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_debug.ui | 10 | ||||
| -rw-r--r-- | src/yuzu/main.cpp | 3 | ||||
| -rw-r--r-- | src/yuzu/startup_checks.cpp | 91 | ||||
| -rw-r--r-- | src/yuzu/startup_checks.h | 2 |
7 files changed, 66 insertions, 45 deletions
diff --git a/src/common/settings.h b/src/common/settings.h index 851812f28..d2452c93b 100644 --- a/src/common/settings.h +++ b/src/common/settings.h | |||
| @@ -531,6 +531,7 @@ struct Values { | |||
| 531 | Setting<bool> use_auto_stub{false, "use_auto_stub"}; | 531 | Setting<bool> use_auto_stub{false, "use_auto_stub"}; |
| 532 | Setting<bool> enable_all_controllers{false, "enable_all_controllers"}; | 532 | Setting<bool> enable_all_controllers{false, "enable_all_controllers"}; |
| 533 | Setting<bool> create_crash_dumps{false, "create_crash_dumps"}; | 533 | Setting<bool> create_crash_dumps{false, "create_crash_dumps"}; |
| 534 | Setting<bool> perform_vulkan_check{true, "perform_vulkan_check"}; | ||
| 534 | 535 | ||
| 535 | // Miscellaneous | 536 | // Miscellaneous |
| 536 | Setting<std::string> log_filter{"*:Info", "log_filter"}; | 537 | Setting<std::string> log_filter{"*:Info", "log_filter"}; |
diff --git a/src/yuzu/configuration/config.cpp b/src/yuzu/configuration/config.cpp index a4ed68422..195074bf2 100644 --- a/src/yuzu/configuration/config.cpp +++ b/src/yuzu/configuration/config.cpp | |||
| @@ -546,6 +546,7 @@ void Config::ReadDebuggingValues() { | |||
| 546 | ReadBasicSetting(Settings::values.use_auto_stub); | 546 | ReadBasicSetting(Settings::values.use_auto_stub); |
| 547 | ReadBasicSetting(Settings::values.enable_all_controllers); | 547 | ReadBasicSetting(Settings::values.enable_all_controllers); |
| 548 | ReadBasicSetting(Settings::values.create_crash_dumps); | 548 | ReadBasicSetting(Settings::values.create_crash_dumps); |
| 549 | ReadBasicSetting(Settings::values.perform_vulkan_check); | ||
| 549 | 550 | ||
| 550 | qt_config->endGroup(); | 551 | qt_config->endGroup(); |
| 551 | } | 552 | } |
| @@ -1162,6 +1163,7 @@ void Config::SaveDebuggingValues() { | |||
| 1162 | WriteBasicSetting(Settings::values.disable_macro_jit); | 1163 | WriteBasicSetting(Settings::values.disable_macro_jit); |
| 1163 | WriteBasicSetting(Settings::values.enable_all_controllers); | 1164 | WriteBasicSetting(Settings::values.enable_all_controllers); |
| 1164 | WriteBasicSetting(Settings::values.create_crash_dumps); | 1165 | WriteBasicSetting(Settings::values.create_crash_dumps); |
| 1166 | WriteBasicSetting(Settings::values.perform_vulkan_check); | ||
| 1165 | 1167 | ||
| 1166 | qt_config->endGroup(); | 1168 | qt_config->endGroup(); |
| 1167 | } | 1169 | } |
diff --git a/src/yuzu/configuration/configure_debug.cpp b/src/yuzu/configuration/configure_debug.cpp index 622808e94..dacc75a20 100644 --- a/src/yuzu/configuration/configure_debug.cpp +++ b/src/yuzu/configuration/configure_debug.cpp | |||
| @@ -77,6 +77,7 @@ void ConfigureDebug::SetConfiguration() { | |||
| 77 | ui->disable_loop_safety_checks->setChecked( | 77 | ui->disable_loop_safety_checks->setChecked( |
| 78 | Settings::values.disable_shader_loop_safety_checks.GetValue()); | 78 | Settings::values.disable_shader_loop_safety_checks.GetValue()); |
| 79 | ui->extended_logging->setChecked(Settings::values.extended_logging.GetValue()); | 79 | ui->extended_logging->setChecked(Settings::values.extended_logging.GetValue()); |
| 80 | ui->perform_vulkan_check->setChecked(Settings::values.perform_vulkan_check.GetValue()); | ||
| 80 | 81 | ||
| 81 | #ifdef YUZU_USE_QT_WEB_ENGINE | 82 | #ifdef YUZU_USE_QT_WEB_ENGINE |
| 82 | ui->disable_web_applet->setChecked(UISettings::values.disable_web_applet.GetValue()); | 83 | ui->disable_web_applet->setChecked(UISettings::values.disable_web_applet.GetValue()); |
| @@ -117,6 +118,7 @@ void ConfigureDebug::ApplyConfiguration() { | |||
| 117 | ui->disable_loop_safety_checks->isChecked(); | 118 | ui->disable_loop_safety_checks->isChecked(); |
| 118 | Settings::values.disable_macro_jit = ui->disable_macro_jit->isChecked(); | 119 | Settings::values.disable_macro_jit = ui->disable_macro_jit->isChecked(); |
| 119 | Settings::values.extended_logging = ui->extended_logging->isChecked(); | 120 | Settings::values.extended_logging = ui->extended_logging->isChecked(); |
| 121 | Settings::values.perform_vulkan_check = ui->perform_vulkan_check->isChecked(); | ||
| 120 | UISettings::values.disable_web_applet = ui->disable_web_applet->isChecked(); | 122 | UISettings::values.disable_web_applet = ui->disable_web_applet->isChecked(); |
| 121 | Debugger::ToggleConsole(); | 123 | Debugger::ToggleConsole(); |
| 122 | Common::Log::Filter filter; | 124 | Common::Log::Filter filter; |
diff --git a/src/yuzu/configuration/configure_debug.ui b/src/yuzu/configuration/configure_debug.ui index 314d47af5..102c8c66c 100644 --- a/src/yuzu/configuration/configure_debug.ui +++ b/src/yuzu/configuration/configure_debug.ui | |||
| @@ -313,6 +313,16 @@ | |||
| 313 | </property> | 313 | </property> |
| 314 | </widget> | 314 | </widget> |
| 315 | </item> | 315 | </item> |
| 316 | <item row="3" column="0"> | ||
| 317 | <widget class="QCheckBox" name="perform_vulkan_check"> | ||
| 318 | <property name="toolTip"> | ||
| 319 | <string>Enables yuzu to check for a working Vulkan environment when the program starts up. Disable this if this is causing issues with external programs seeing yuzu.</string> | ||
| 320 | </property> | ||
| 321 | <property name="text"> | ||
| 322 | <string>Perform Startup Vulkan Check</string> | ||
| 323 | </property> | ||
| 324 | </widget> | ||
| 325 | </item> | ||
| 316 | </layout> | 326 | </layout> |
| 317 | </widget> | 327 | </widget> |
| 318 | </item> | 328 | </item> |
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 3c1bd19db..23245a976 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp | |||
| @@ -4086,7 +4086,8 @@ int main(int argc, char* argv[]) { | |||
| 4086 | } | 4086 | } |
| 4087 | #endif | 4087 | #endif |
| 4088 | 4088 | ||
| 4089 | if (StartupChecks(argv[0], &has_broken_vulkan)) { | 4089 | if (StartupChecks(argv[0], &has_broken_vulkan, |
| 4090 | Settings::values.perform_vulkan_check.GetValue())) { | ||
| 4090 | return 0; | 4091 | return 0; |
| 4091 | } | 4092 | } |
| 4092 | 4093 | ||
diff --git a/src/yuzu/startup_checks.cpp b/src/yuzu/startup_checks.cpp index 29b87da05..fc2693f9d 100644 --- a/src/yuzu/startup_checks.cpp +++ b/src/yuzu/startup_checks.cpp | |||
| @@ -57,7 +57,7 @@ bool CheckEnvVars(bool* is_child) { | |||
| 57 | return false; | 57 | return false; |
| 58 | } | 58 | } |
| 59 | 59 | ||
| 60 | bool StartupChecks(const char* arg0, bool* has_broken_vulkan) { | 60 | bool StartupChecks(const char* arg0, bool* has_broken_vulkan, bool perform_vulkan_check) { |
| 61 | #ifdef _WIN32 | 61 | #ifdef _WIN32 |
| 62 | // Set the startup variable for child processes | 62 | // Set the startup variable for child processes |
| 63 | const bool env_var_set = SetEnvironmentVariableA(STARTUP_CHECK_ENV_VAR, ENV_VAR_ENABLED_TEXT); | 63 | const bool env_var_set = SetEnvironmentVariableA(STARTUP_CHECK_ENV_VAR, ENV_VAR_ENABLED_TEXT); |
| @@ -67,29 +67,32 @@ bool StartupChecks(const char* arg0, bool* has_broken_vulkan) { | |||
| 67 | return false; | 67 | return false; |
| 68 | } | 68 | } |
| 69 | 69 | ||
| 70 | PROCESS_INFORMATION process_info; | 70 | if (perform_vulkan_check) { |
| 71 | std::memset(&process_info, '\0', sizeof(process_info)); | 71 | // Spawn child process that performs Vulkan check |
| 72 | 72 | PROCESS_INFORMATION process_info; | |
| 73 | if (!SpawnChild(arg0, &process_info, 0)) { | 73 | std::memset(&process_info, '\0', sizeof(process_info)); |
| 74 | return false; | 74 | |
| 75 | } | 75 | if (!SpawnChild(arg0, &process_info, 0)) { |
| 76 | 76 | return false; | |
| 77 | // Wait until the processs exits and get exit code from it | 77 | } |
| 78 | WaitForSingleObject(process_info.hProcess, INFINITE); | 78 | |
| 79 | DWORD exit_code = STILL_ACTIVE; | 79 | // Wait until the processs exits and get exit code from it |
| 80 | const int err = GetExitCodeProcess(process_info.hProcess, &exit_code); | 80 | WaitForSingleObject(process_info.hProcess, INFINITE); |
| 81 | if (err == 0) { | 81 | DWORD exit_code = STILL_ACTIVE; |
| 82 | std::fprintf(stderr, "GetExitCodeProcess failed with error %d\n", GetLastError()); | 82 | const int err = GetExitCodeProcess(process_info.hProcess, &exit_code); |
| 83 | } | 83 | if (err == 0) { |
| 84 | 84 | std::fprintf(stderr, "GetExitCodeProcess failed with error %d\n", GetLastError()); | |
| 85 | // Vulkan is broken if the child crashed (return value is not zero) | 85 | } |
| 86 | *has_broken_vulkan = (exit_code != 0); | 86 | |
| 87 | 87 | // Vulkan is broken if the child crashed (return value is not zero) | |
| 88 | if (CloseHandle(process_info.hProcess) == 0) { | 88 | *has_broken_vulkan = (exit_code != 0); |
| 89 | std::fprintf(stderr, "CloseHandle failed with error %d\n", GetLastError()); | 89 | |
| 90 | } | 90 | if (CloseHandle(process_info.hProcess) == 0) { |
| 91 | if (CloseHandle(process_info.hThread) == 0) { | 91 | std::fprintf(stderr, "CloseHandle failed with error %d\n", GetLastError()); |
| 92 | std::fprintf(stderr, "CloseHandle failed with error %d\n", GetLastError()); | 92 | } |
| 93 | if (CloseHandle(process_info.hThread) == 0) { | ||
| 94 | std::fprintf(stderr, "CloseHandle failed with error %d\n", GetLastError()); | ||
| 95 | } | ||
| 93 | } | 96 | } |
| 94 | 97 | ||
| 95 | if (!SetEnvironmentVariableA(STARTUP_CHECK_ENV_VAR, nullptr)) { | 98 | if (!SetEnvironmentVariableA(STARTUP_CHECK_ENV_VAR, nullptr)) { |
| @@ -98,26 +101,28 @@ bool StartupChecks(const char* arg0, bool* has_broken_vulkan) { | |||
| 98 | } | 101 | } |
| 99 | 102 | ||
| 100 | #elif defined(YUZU_UNIX) | 103 | #elif defined(YUZU_UNIX) |
| 101 | const pid_t pid = fork(); | 104 | if (perform_vulkan_check) { |
| 102 | if (pid == 0) { | 105 | const pid_t pid = fork(); |
| 103 | CheckVulkan(); | 106 | if (pid == 0) { |
| 104 | return true; | 107 | CheckVulkan(); |
| 105 | } else if (pid == -1) { | 108 | return true; |
| 106 | const int err = errno; | 109 | } else if (pid == -1) { |
| 107 | std::fprintf(stderr, "fork failed with error %d\n", err); | 110 | const int err = errno; |
| 108 | return false; | 111 | std::fprintf(stderr, "fork failed with error %d\n", err); |
| 109 | } | 112 | return false; |
| 110 | 113 | } | |
| 111 | // Get exit code from child process | 114 | |
| 112 | int status; | 115 | // Get exit code from child process |
| 113 | const int r_val = wait(&status); | 116 | int status; |
| 114 | if (r_val == -1) { | 117 | const int r_val = wait(&status); |
| 115 | const int err = errno; | 118 | if (r_val == -1) { |
| 116 | std::fprintf(stderr, "wait failed with error %d\n", err); | 119 | const int err = errno; |
| 117 | return false; | 120 | std::fprintf(stderr, "wait failed with error %d\n", err); |
| 121 | return false; | ||
| 122 | } | ||
| 123 | // Vulkan is broken if the child crashed (return value is not zero) | ||
| 124 | *has_broken_vulkan = (status != 0); | ||
| 118 | } | 125 | } |
| 119 | // Vulkan is broken if the child crashed (return value is not zero) | ||
| 120 | *has_broken_vulkan = (status != 0); | ||
| 121 | #endif | 126 | #endif |
| 122 | return false; | 127 | return false; |
| 123 | } | 128 | } |
diff --git a/src/yuzu/startup_checks.h b/src/yuzu/startup_checks.h index f2fc2d9d4..d8e563be6 100644 --- a/src/yuzu/startup_checks.h +++ b/src/yuzu/startup_checks.h | |||
| @@ -13,7 +13,7 @@ constexpr char ENV_VAR_ENABLED_TEXT[] = "ON"; | |||
| 13 | 13 | ||
| 14 | void CheckVulkan(); | 14 | void CheckVulkan(); |
| 15 | bool CheckEnvVars(bool* is_child); | 15 | bool CheckEnvVars(bool* is_child); |
| 16 | bool StartupChecks(const char* arg0, bool* has_broken_vulkan); | 16 | bool StartupChecks(const char* arg0, bool* has_broken_vulkan, bool perform_vulkan_check); |
| 17 | 17 | ||
| 18 | #ifdef _WIN32 | 18 | #ifdef _WIN32 |
| 19 | bool SpawnChild(const char* arg0, PROCESS_INFORMATION* pi, int flags); | 19 | bool SpawnChild(const char* arg0, PROCESS_INFORMATION* pi, int flags); |