diff options
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/host_memory.cpp | 9 | ||||
-rw-r--r-- | src/common/settings.h | 11 |
2 files changed, 15 insertions, 5 deletions
diff --git a/src/common/host_memory.cpp b/src/common/host_memory.cpp index 2a5a7596c..6661244cf 100644 --- a/src/common/host_memory.cpp +++ b/src/common/host_memory.cpp @@ -6,7 +6,7 @@ #include <windows.h> #include "common/dynamic_library.h" -#elif defined(__linux__) // ^^^ Windows ^^^ vvv Linux vvv +#elif defined(__linux__) || defined(__FreeBSD__) // ^^^ Windows ^^^ vvv Linux vvv #ifndef _GNU_SOURCE #define _GNU_SOURCE @@ -343,7 +343,7 @@ private: std::unordered_map<size_t, size_t> placeholder_host_pointers; ///< Placeholder backing offset }; -#elif defined(__linux__) // ^^^ Windows ^^^ vvv Linux vvv +#elif defined(__linux__) || defined(__FreeBSD__) // ^^^ Windows ^^^ vvv Linux vvv class HostMemory::Impl { public: @@ -357,7 +357,12 @@ public: }); // Backing memory initialization +#if defined(__FreeBSD__) && __FreeBSD__ < 13 + // XXX Drop after FreeBSD 12.* reaches EOL on 2024-06-30 + fd = shm_open(SHM_ANON, O_RDWR, 0600); +#else fd = memfd_create("HostMemory", 0); +#endif if (fd == -1) { LOG_CRITICAL(HW_Memory, "memfd_create failed: {}", strerror(errno)); throw std::bad_alloc{}; diff --git a/src/common/settings.h b/src/common/settings.h index d8730f515..cfc1ab46f 100644 --- a/src/common/settings.h +++ b/src/common/settings.h @@ -42,6 +42,11 @@ enum class CPUAccuracy : u32 { Unsafe = 2, }; +enum class FullscreenMode : u32 { + Borderless = 0, + Exclusive = 1, +}; + /** The BasicSetting class is a simple resource manager. It defines a label and default value * alongside the actual value of the setting for simpler and less-error prone use with frontend * configurations. Setting a default value and label is required, though subclasses may deviate from @@ -322,11 +327,11 @@ struct Values { Setting<u16> resolution_factor{1, "resolution_factor"}; // *nix platforms may have issues with the borderless windowed fullscreen mode. // Default to exclusive fullscreen on these platforms for now. - Setting<int> fullscreen_mode{ + Setting<FullscreenMode> fullscreen_mode{ #ifdef _WIN32 - 0, + FullscreenMode::Borderless, #else - 1, + FullscreenMode::Exclusive, #endif "fullscreen_mode"}; Setting<int> aspect_ratio{0, "aspect_ratio"}; |