diff --git a/darwin/util/sysinfo_darwin.mm b/darwin/util/sysinfo_darwin.mm new file mode 100644 index 0000000000..67599f9d2c --- /dev/null +++ b/darwin/util/sysinfo_darwin.mm @@ -0,0 +1,21 @@ +#import + +namespace Darwin_Version +{ + NSOperatingSystemVersion osver = NSProcessInfo.processInfo.operatingSystemVersion; + + int getNSmajorVersion() + { + return osver.majorVersion; + } + + int getNSminorVersion() + { + return osver.minorVersion; + } + + int getNSpatchVersion() + { + return osver.patchVersion; + } +} diff --git a/rpcs3/Emu/CMakeLists.txt b/rpcs3/Emu/CMakeLists.txt index 8d1233fb1e..48de8e321d 100644 --- a/rpcs3/Emu/CMakeLists.txt +++ b/rpcs3/Emu/CMakeLists.txt @@ -59,6 +59,11 @@ target_sources(rpcs3_emu PRIVATE ../../Utilities/Thread.cpp ../../Utilities/version.cpp ) +if(APPLE) + target_sources(rpcs3_emu PRIVATE + ../../darwin/util/sysinfo_darwin.mm + ) +endif() target_include_directories(rpcs3_emu PUBLIC "${CMAKE_SOURCE_DIR}") diff --git a/rpcs3/util/sysinfo.cpp b/rpcs3/util/sysinfo.cpp index ce95411627..2b04395172 100755 --- a/rpcs3/util/sysinfo.cpp +++ b/rpcs3/util/sysinfo.cpp @@ -12,9 +12,11 @@ #else #include #include +#ifndef __APPLE__ #include #include #endif +#endif #include "util/asm.hpp" @@ -47,6 +49,16 @@ inline u64 utils::get_xgetbv(u32 xcr) #endif } +#ifdef __APPLE__ +// sysinfo_darwin.mm +namespace Darwin_Version +{ + extern int getNSmajorVersion(); + extern int getNSminorVersion(); + extern int getNSpatchVersion(); +} +#endif + bool utils::has_ssse3() { static const bool g_value = get_cpuid(0, 0)[0] >= 0x1 && get_cpuid(1, 0)[2] & 0x200; @@ -343,6 +355,13 @@ std::string utils::get_OS_version() fmt::append(output, "Operating system: Windows, Major: %lu, Minor: %lu, Build: %u, Service Pack: %s, Compatibility mode: %llu", version_major, version_minor, build, has_sp ? holder.data() : "none", compatibility_mode); +#elif defined (__APPLE__) + const int major_version = Darwin_Version::getNSmajorVersion(); + const int minor_version = Darwin_Version::getNSminorVersion(); + const int patch_version = Darwin_Version::getNSpatchVersion(); + + fmt::append(output, "Operating system: macOS, Version: %d.%d.%d", + major_version, minor_version, patch_version); #else struct utsname details = {};