summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/yuzu/startup_checks.cpp15
1 files changed, 6 insertions, 9 deletions
diff --git a/src/yuzu/startup_checks.cpp b/src/yuzu/startup_checks.cpp
index 6bd895400..b27b9c8d9 100644
--- a/src/yuzu/startup_checks.cpp
+++ b/src/yuzu/startup_checks.cpp
@@ -14,17 +14,12 @@
14#endif 14#endif
15 15
16#include <cstdio> 16#include <cstdio>
17#include <filesystem>
18#include <fstream>
19#include "common/fs/fs.h"
20#include "common/fs/path_util.h"
21#include "common/logging/log.h"
22#include "video_core/vulkan_common/vulkan_instance.h" 17#include "video_core/vulkan_common/vulkan_instance.h"
23#include "video_core/vulkan_common/vulkan_library.h" 18#include "video_core/vulkan_common/vulkan_library.h"
24#include "yuzu/startup_checks.h" 19#include "yuzu/startup_checks.h"
25#include "yuzu/uisettings.h"
26 20
27void CheckVulkan() { 21void CheckVulkan() {
22 // Just start the Vulkan loader, this will crash if something is wrong
28 try { 23 try {
29 Vulkan::vk::InstanceDispatch dld; 24 Vulkan::vk::InstanceDispatch dld;
30 const Common::DynamicLibrary library = Vulkan::OpenLibrary(); 25 const Common::DynamicLibrary library = Vulkan::OpenLibrary();
@@ -32,7 +27,7 @@ void CheckVulkan() {
32 Vulkan::CreateInstance(library, dld, VK_API_VERSION_1_0); 27 Vulkan::CreateInstance(library, dld, VK_API_VERSION_1_0);
33 28
34 } catch (const Vulkan::vk::Exception& exception) { 29 } catch (const Vulkan::vk::Exception& exception) {
35 LOG_ERROR(Frontend, "Failed to initialize Vulkan: {}", exception.what()); 30 std::fprintf(stderr, "Failed to initialize Vulkan: %s\n", exception.what());
36 } 31 }
37} 32}
38 33
@@ -63,7 +58,7 @@ bool StartupChecks(const char* arg0, bool* has_broken_vulkan) {
63 return false; 58 return false;
64 } 59 }
65 60
66 // wait until the processs exits 61 // Wait until the processs exits and get exit code from it
67 DWORD exit_code = STILL_ACTIVE; 62 DWORD exit_code = STILL_ACTIVE;
68 while (exit_code == STILL_ACTIVE) { 63 while (exit_code == STILL_ACTIVE) {
69 const int err = GetExitCodeProcess(process_info.hProcess, &exit_code); 64 const int err = GetExitCodeProcess(process_info.hProcess, &exit_code);
@@ -73,6 +68,7 @@ bool StartupChecks(const char* arg0, bool* has_broken_vulkan) {
73 } 68 }
74 } 69 }
75 70
71 // Vulkan is broken if the child crashed (return value is not zero)
76 *has_broken_vulkan = (exit_code != 0); 72 *has_broken_vulkan = (exit_code != 0);
77 73
78 if (CloseHandle(process_info.hProcess) == 0) { 74 if (CloseHandle(process_info.hProcess) == 0) {
@@ -93,6 +89,7 @@ bool StartupChecks(const char* arg0, bool* has_broken_vulkan) {
93 return false; 89 return false;
94 } 90 }
95 91
92 // Get exit code from child process
96 int status; 93 int status;
97 const int r_val = wait(&status); 94 const int r_val = wait(&status);
98 if (r_val == -1) { 95 if (r_val == -1) {
@@ -100,6 +97,7 @@ bool StartupChecks(const char* arg0, bool* has_broken_vulkan) {
100 std::fprintf(stderr, "wait failed with error %d\n", err); 97 std::fprintf(stderr, "wait failed with error %d\n", err);
101 return false; 98 return false;
102 } 99 }
100 // Vulkan is broken if the child crashed (return value is not zero)
103 *has_broken_vulkan = (status != 0); 101 *has_broken_vulkan = (status != 0);
104#endif 102#endif
105 return false; 103 return false;
@@ -115,7 +113,6 @@ bool SpawnChild(const char* arg0, PROCESS_INFORMATION* pi) {
115 char p_name[255]; 113 char p_name[255];
116 std::strncpy(p_name, arg0, 255); 114 std::strncpy(p_name, arg0, 255);
117 115
118 // TODO: use argv[0] instead of yuzu.exe
119 const bool process_created = CreateProcessA(nullptr, // lpApplicationName 116 const bool process_created = CreateProcessA(nullptr, // lpApplicationName
120 p_name, // lpCommandLine 117 p_name, // lpCommandLine
121 nullptr, // lpProcessAttributes 118 nullptr, // lpProcessAttributes