mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-04-28 13:28:01 +03:00
Implement proper macOS version check (#11352)
This commit is contained in:
parent
0d1c0e72a6
commit
ef66b002e0
3 changed files with 45 additions and 0 deletions
21
darwin/util/sysinfo_darwin.mm
Normal file
21
darwin/util/sysinfo_darwin.mm
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
#import <Foundation/Foundation.h>
|
||||||
|
|
||||||
|
namespace Darwin_Version
|
||||||
|
{
|
||||||
|
NSOperatingSystemVersion osver = NSProcessInfo.processInfo.operatingSystemVersion;
|
||||||
|
|
||||||
|
int getNSmajorVersion()
|
||||||
|
{
|
||||||
|
return osver.majorVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
int getNSminorVersion()
|
||||||
|
{
|
||||||
|
return osver.minorVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
int getNSpatchVersion()
|
||||||
|
{
|
||||||
|
return osver.patchVersion;
|
||||||
|
}
|
||||||
|
}
|
|
@ -59,6 +59,11 @@ target_sources(rpcs3_emu PRIVATE
|
||||||
../../Utilities/Thread.cpp
|
../../Utilities/Thread.cpp
|
||||||
../../Utilities/version.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}")
|
target_include_directories(rpcs3_emu PUBLIC "${CMAKE_SOURCE_DIR}")
|
||||||
|
|
||||||
|
|
|
@ -12,9 +12,11 @@
|
||||||
#else
|
#else
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/resource.h>
|
#include <sys/resource.h>
|
||||||
|
#ifndef __APPLE__
|
||||||
#include <sys/utsname.h>
|
#include <sys/utsname.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "util/asm.hpp"
|
#include "util/asm.hpp"
|
||||||
|
|
||||||
|
@ -47,6 +49,16 @@ inline u64 utils::get_xgetbv(u32 xcr)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef __APPLE__
|
||||||
|
// sysinfo_darwin.mm
|
||||||
|
namespace Darwin_Version
|
||||||
|
{
|
||||||
|
extern int getNSmajorVersion();
|
||||||
|
extern int getNSminorVersion();
|
||||||
|
extern int getNSpatchVersion();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
bool utils::has_ssse3()
|
bool utils::has_ssse3()
|
||||||
{
|
{
|
||||||
static const bool g_value = get_cpuid(0, 0)[0] >= 0x1 && get_cpuid(1, 0)[2] & 0x200;
|
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,
|
fmt::append(output,
|
||||||
"Operating system: Windows, Major: %lu, Minor: %lu, Build: %u, Service Pack: %s, Compatibility mode: %llu",
|
"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);
|
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
|
#else
|
||||||
struct utsname details = {};
|
struct utsname details = {};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue