mirror of
https://github.com/cemu-project/Cemu.git
synced 2026-04-26 04:45:18 -06:00
move cpu name stuff over to cpu_features.cpp
This commit is contained in:
parent
7eccfea36f
commit
c43782aab6
@ -467,20 +467,7 @@ namespace CafeSystem
|
||||
|
||||
void logCPUAndMemoryInfo()
|
||||
{
|
||||
#if BOOST_OS_MACOS
|
||||
std::string cpuName;
|
||||
size_t cpu_len = 0;
|
||||
if (sysctlbyname("machdep.cpu.brand_string", NULL, &cpu_len, NULL, 0) == 0 && cpu_len > 1)
|
||||
{
|
||||
cpuName.resize(cpu_len);
|
||||
if (sysctlbyname("machdep.cpu.brand_string", cpuName.data(), &cpu_len, NULL, 0) != 0 || cpu_len == 0)
|
||||
cpuName.clear();
|
||||
else if (!cpuName.empty() && cpuName.back() == '\0')
|
||||
cpuName.pop_back();
|
||||
}
|
||||
#else
|
||||
std::string cpuName = g_CPUFeatures.GetCPUName();
|
||||
#endif
|
||||
if (!cpuName.empty())
|
||||
cemuLog_log(LogType::Force, "CPU: {}", cpuName);
|
||||
#if BOOST_OS_WINDOWS
|
||||
|
||||
@ -1,5 +1,10 @@
|
||||
#include "cpu_features.h"
|
||||
|
||||
#if BOOST_OS_MACOS
|
||||
#include <sys/types.h>
|
||||
#include <sys/sysctl.h>
|
||||
#endif
|
||||
|
||||
// wrappers with uniform prototype for implementation-specific x86 CPU id
|
||||
#if defined(ARCH_X86_64)
|
||||
#ifdef __GNUC__
|
||||
@ -30,7 +35,23 @@ inline void cpuidex(int cpuInfo[4], int functionId, int subFunctionId) {
|
||||
|
||||
CPUFeaturesImpl::CPUFeaturesImpl()
|
||||
{
|
||||
#if defined(ARCH_X86_64)
|
||||
#if BOOST_OS_MACOS
|
||||
std::string cpuName;
|
||||
size_t size = 0;
|
||||
|
||||
if (sysctlbyname("machdep.cpu.brand_string", nullptr, &size, nullptr, 0) == 0 && size > 0)
|
||||
{
|
||||
std::vector<char> buffer(size);
|
||||
|
||||
if (sysctlbyname("machdep.cpu.brand_string", buffer.data(), &size, nullptr, 0) == 0 && size > 0)
|
||||
{
|
||||
cpuName.assign(buffer.data());
|
||||
}
|
||||
}
|
||||
|
||||
strncpy(m_cpuBrandName, cpuName.c_str(), sizeof(m_cpuBrandName) - 1);
|
||||
m_cpuBrandName[sizeof(m_cpuBrandName) - 1] = '\0';
|
||||
#elif defined(ARCH_X86_64)
|
||||
int cpuInfo[4];
|
||||
cpuid(cpuInfo, 0x80000001);
|
||||
x86.lzcnt = ((cpuInfo[2] >> 5) & 1) != 0;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user