diff --git a/CMakeLists.txt b/CMakeLists.txt index e593bf476e..44e126a885 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -749,7 +749,11 @@ elseif (WIN32) endif() elseif (PLATFORM_HAIKU) # Haiku is so special :) - set(PLATFORM_LIBRARIES bsd network) + # Some fucking genius decided to name an entire module "network" in 2019 + # this caused great disaster amongst the Haiku community who had came first with + # their "libnetwork.so"; since CMake doesn't do magic, we have to use an ABSOLUTE PATH + # to the library itself, otherwise it will think we are linking to... our network thing + set(PLATFORM_LIBRARIES bsd /boot/system/lib/libnetwork.so) elseif (CMAKE_SYSTEM_NAME MATCHES "^(Linux|kFreeBSD|GNU|SunOS)$") set(PLATFORM_LIBRARIES rt) endif() diff --git a/docs/user/Basics.md b/docs/user/Basics.md index 5751c6a6a3..5101f4d9c3 100644 --- a/docs/user/Basics.md +++ b/docs/user/Basics.md @@ -25,6 +25,7 @@ Eden will store configuration files in the following directories: - **Windows**: `%AppData%\Roaming`. - **Android**: Data is stored internally. - **Linux, macOS, FreeBSD, Solaris, OpenBSD**: `$XDG_DATA_HOME`, `$XDG_CACHE_HOME`, `$XDG_CONFIG_HOME`. +- **HaikuOS**: `/boot/home/config/settings/eden` If a `user` directory is present in the current working directory, that will override all global configuration directories and the emulator will use that instead. diff --git a/src/common/host_memory.cpp b/src/common/host_memory.cpp index 3838c12903..ea4131363d 100644 --- a/src/common/host_memory.cpp +++ b/src/common/host_memory.cpp @@ -394,7 +394,7 @@ private: std::unordered_map placeholder_host_pointers; ///< Placeholder backing offset }; -#elif defined(__linux__) || defined(__FreeBSD__) || defined(__sun__) || defined(__APPLE__) // ^^^ Windows ^^^ vvv POSIX vvv +#elif defined(__linux__) || defined(__FreeBSD__) || defined(__sun__) || defined(__APPLE__) || defined(__HAIKU__) // ^^^ Windows ^^^ vvv POSIX vvv #ifdef ARCHITECTURE_arm64 diff --git a/src/video_core/renderer_opengl/gl_device.cpp b/src/video_core/renderer_opengl/gl_device.cpp index f3d884f0eb..0aad8a3efc 100644 --- a/src/video_core/renderer_opengl/gl_device.cpp +++ b/src/video_core/renderer_opengl/gl_device.cpp @@ -50,20 +50,24 @@ bool TestProgram(const GLchar* glsl) { return link_status == GL_TRUE; } -std::vector GetExtensions() { +/// @brief Query OpenGL extensions +/// DO NOT use string_view, the driver can immediately free up the extension name and such +/// do NOT under ANY circumstances use string_view, make a copy, it's required +std::vector GetExtensions() { GLint num_extensions; glGetIntegerv(GL_NUM_EXTENSIONS, &num_extensions); - std::vector extensions; - extensions.reserve(num_extensions); + std::vector extensions; for (GLint index = 0; index < num_extensions; ++index) { - extensions.push_back( - reinterpret_cast(glGetStringi(GL_EXTENSIONS, static_cast(index)))); + auto const* p = reinterpret_cast(glGetStringi(GL_EXTENSIONS, GLuint(index))); + if (p != nullptr) // Fuck you? - sincerely, buggy mesa drivers + extensions.push_back(std::string{p}); } return extensions; } -bool HasExtension(std::span extensions, std::string_view extension) { - return std::ranges::find(extensions, extension) != extensions.end(); +/// @brief Find extension in set of extensions (string) +bool HasExtension(std::span extensions, std::string_view extension) { + return std::ranges::find(extensions, std::string{extension}) != extensions.end(); } std::array BuildMaxUniformBuffers() noexcept { @@ -148,7 +152,7 @@ static bool HasSlowSoftwareAstc(std::string_view vendor_name, std::string_view r return false; } -[[nodiscard]] bool IsDebugToolAttached(std::span extensions) { +[[nodiscard]] bool IsDebugToolAttached(std::span extensions) { const bool nsight = std::getenv("NVTX_INJECTION64_PATH") || std::getenv("NSIGHT_LAUNCHED"); return nsight || HasExtension(extensions, "GL_EXT_debug_tool") || Settings::values.renderer_debug.GetValue(); @@ -161,9 +165,9 @@ Device::Device(Core::Frontend::EmuWindow& emu_window) { throw std::runtime_error{"Insufficient version"}; } vendor_name = reinterpret_cast(glGetString(GL_VENDOR)); - const std::string_view version = reinterpret_cast(glGetString(GL_VERSION)); - const std::string_view renderer = reinterpret_cast(glGetString(GL_RENDERER)); - const std::vector extensions = GetExtensions(); + const std::string version = reinterpret_cast(glGetString(GL_VERSION)); + const std::string renderer = reinterpret_cast(glGetString(GL_RENDERER)); + const std::vector extensions = GetExtensions(); const bool is_nvidia = vendor_name == "NVIDIA Corporation"; const bool is_amd = vendor_name == "ATI Technologies Inc.";