[compat] re-enable startup checks and vulkan checks for unix-likes

This commit is contained in:
lizzie 2025-08-03 18:13:25 +01:00 committed by crueter
parent 1dc5a25bb4
commit ee6aa30b8e
Signed by: crueter
GPG key ID: 425ACD2D4830EBC6
7 changed files with 20 additions and 16 deletions

View file

@ -12,7 +12,7 @@
#ifdef _WIN32 #ifdef _WIN32
#include <winsock2.h> #include <winsock2.h>
#include <ws2tcpip.h> #include <ws2tcpip.h>
#elif YUZU_UNIX #elif defined(__unix__)
#include <arpa/inet.h> #include <arpa/inet.h>
#include <errno.h> #include <errno.h>
#include <fcntl.h> #include <fcntl.h>
@ -77,7 +77,7 @@ SOCKET GetInterruptSocket() {
sockaddr TranslateFromSockAddrIn(SockAddrIn input) { sockaddr TranslateFromSockAddrIn(SockAddrIn input) {
sockaddr_in result; sockaddr_in result;
#if YUZU_UNIX #ifdef __unix__
result.sin_len = sizeof(result); result.sin_len = sizeof(result);
#endif #endif
@ -162,7 +162,7 @@ Errno TranslateNativeError(int e, CallType call_type = CallType::Other) {
} }
} }
#elif YUZU_UNIX // ^ _WIN32 v YUZU_UNIX #elif defined(__unix__) // ^ _WIN32 v __unix__
using SOCKET = int; using SOCKET = int;
using WSAPOLLFD = pollfd; using WSAPOLLFD = pollfd;
@ -835,7 +835,7 @@ std::pair<s32, Errno> Socket::Send(std::span<const u8> message, int flags) {
ASSERT(flags == 0); ASSERT(flags == 0);
int native_flags = 0; int native_flags = 0;
#if YUZU_UNIX #ifdef __unix__
native_flags |= MSG_NOSIGNAL; // do not send us SIGPIPE native_flags |= MSG_NOSIGNAL; // do not send us SIGPIPE
#endif #endif
const auto result = send(fd, reinterpret_cast<const char*>(message.data()), const auto result = send(fd, reinterpret_cast<const char*>(message.data()),

View file

@ -13,7 +13,7 @@
#ifdef _WIN32 #ifdef _WIN32
#include <winsock2.h> #include <winsock2.h>
#elif YUZU_UNIX #else
#include <netinet/in.h> #include <netinet/in.h>
#endif #endif
@ -104,7 +104,7 @@ constexpr IPv4Address TranslateIPv4(in_addr addr) {
auto& bytes = addr.S_un.S_un_b; auto& bytes = addr.S_un.S_un_b;
return IPv4Address{bytes.s_b1, bytes.s_b2, bytes.s_b3, bytes.s_b4}; return IPv4Address{bytes.s_b1, bytes.s_b2, bytes.s_b3, bytes.s_b4};
} }
#elif YUZU_UNIX #elif defined(__unix__)
constexpr IPv4Address TranslateIPv4(in_addr addr) { constexpr IPv4Address TranslateIPv4(in_addr addr) {
const u32 bytes = addr.s_addr; const u32 bytes = addr.s_addr;
return IPv4Address{static_cast<u8>(bytes), static_cast<u8>(bytes >> 8), return IPv4Address{static_cast<u8>(bytes), static_cast<u8>(bytes >> 8),

View file

@ -15,7 +15,7 @@
#include "core/internal_network/socket_proxy.h" #include "core/internal_network/socket_proxy.h"
#include "network/network.h" #include "network/network.h"
#if YUZU_UNIX #ifdef __unix__
#include <sys/socket.h> #include <sys/socket.h>
#endif #endif

View file

@ -9,7 +9,11 @@
#include <utility> #include <utility>
#if defined(_WIN32) #if defined(_WIN32)
#elif !YUZU_UNIX // windows
#elif defined(__unix__)
// unix
#else
// haiku
#error "Platform not implemented" #error "Platform not implemented"
#endif #endif
@ -24,7 +28,7 @@ struct ProxyPacket;
class SocketBase { class SocketBase {
public: public:
#ifdef YUZU_UNIX #ifdef __unix__
using SOCKET = int; using SOCKET = int;
static constexpr SOCKET INVALID_SOCKET = -1; static constexpr SOCKET INVALID_SOCKET = -1;
static constexpr SOCKET SOCKET_ERROR = -1; static constexpr SOCKET SOCKET_ERROR = -1;

View file

@ -110,7 +110,7 @@ bool IsASTCSupported() {
static bool HasSlowSoftwareAstc(std::string_view vendor_name, std::string_view renderer) { static bool HasSlowSoftwareAstc(std::string_view vendor_name, std::string_view renderer) {
// ifdef for Unix reduces string comparisons for non-Windows drivers, and Intel // ifdef for Unix reduces string comparisons for non-Windows drivers, and Intel
#ifdef YUZU_UNIX #ifdef __unix__
// Sorted vaguely by how likely a vendor is to appear // Sorted vaguely by how likely a vendor is to appear
if (vendor_name == "AMD") { if (vendor_name == "AMD") {
// RadeonSI // RadeonSI

View file

@ -7,7 +7,7 @@
#include <cstring> #include <cstring>
#include <processthreadsapi.h> #include <processthreadsapi.h>
#include <windows.h> #include <windows.h>
#elif defined(YUZU_UNIX) #else
#include <cstring> #include <cstring>
#include <errno.h> #include <errno.h>
#include <spawn.h> #include <spawn.h>
@ -56,7 +56,7 @@ bool CheckEnvVars(bool* is_child) {
IS_CHILD_ENV_VAR, GetLastError()); IS_CHILD_ENV_VAR, GetLastError());
return true; return true;
} }
#elif defined(YUZU_UNIX) #else
const char* startup_check_var = getenv(STARTUP_CHECK_ENV_VAR); const char* startup_check_var = getenv(STARTUP_CHECK_ENV_VAR);
if (startup_check_var != nullptr && if (startup_check_var != nullptr &&
std::strncmp(startup_check_var, ENV_VAR_ENABLED_TEXT, 8) == 0) { std::strncmp(startup_check_var, ENV_VAR_ENABLED_TEXT, 8) == 0) {
@ -110,7 +110,7 @@ bool StartupChecks(const char* arg0, bool* has_broken_vulkan, bool perform_vulka
STARTUP_CHECK_ENV_VAR, GetLastError()); STARTUP_CHECK_ENV_VAR, GetLastError());
} }
#elif defined(YUZU_UNIX) #else
const int env_var_set = setenv(STARTUP_CHECK_ENV_VAR, ENV_VAR_ENABLED_TEXT, 1); const int env_var_set = setenv(STARTUP_CHECK_ENV_VAR, ENV_VAR_ENABLED_TEXT, 1);
if (env_var_set == -1) { if (env_var_set == -1) {
const int err = errno; const int err = errno;
@ -175,7 +175,7 @@ bool SpawnChild(const char* arg0, PROCESS_INFORMATION* pi, int flags) {
return true; return true;
} }
#elif defined(YUZU_UNIX) #else
pid_t SpawnChild(const char* arg0) { pid_t SpawnChild(const char* arg0) {
const pid_t pid = fork(); const pid_t pid = fork();

View file

@ -5,7 +5,7 @@
#ifdef _WIN32 #ifdef _WIN32
#include <windows.h> #include <windows.h>
#elif defined(YUZU_UNIX) #else
#include <sys/types.h> #include <sys/types.h>
#endif #endif
@ -19,6 +19,6 @@ bool StartupChecks(const char* arg0, bool* has_broken_vulkan, bool perform_vulka
#ifdef _WIN32 #ifdef _WIN32
bool SpawnChild(const char* arg0, PROCESS_INFORMATION* pi, int flags); bool SpawnChild(const char* arg0, PROCESS_INFORMATION* pi, int flags);
#elif defined(YUZU_UNIX) #else
pid_t SpawnChild(const char* arg0); pid_t SpawnChild(const char* arg0);
#endif #endif