From 1c9ac4e82559039f125588223718b852723e4879 Mon Sep 17 00:00:00 2001 From: Brad Parker Date: Sat, 23 Feb 2019 17:29:08 -0500 Subject: [PATCH] osx: add cpu model name --- frontend/drivers/platform_darwin.m | 10 +++++++++- libretro-common/features/features_cpu.c | 4 ++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/frontend/drivers/platform_darwin.m b/frontend/drivers/platform_darwin.m index bdf33d5cde..d6f285f029 100644 --- a/frontend/drivers/platform_darwin.m +++ b/frontend/drivers/platform_darwin.m @@ -110,6 +110,8 @@ typedef enum CFAllDomainsMask = 0x0ffff /* All domains: all of the above and future items */ } CFDomainMask; +static char darwin_cpu_model_name[64] = {0}; + static NSSearchPathDirectory NSConvertFlagsCF(unsigned flags) { switch (flags) @@ -736,6 +738,12 @@ static uint64_t frontend_darwin_get_mem_used(void) return 0; } +static const char* frontend_darwin_get_cpu_model_name(void) +{ + cpu_features_get_model_name(darwin_cpu_model_name, sizeof(darwin_cpu_model_name)); + return darwin_cpu_model_name; +} + frontend_ctx_driver_t frontend_ctx_darwin = { frontend_darwin_get_environment_settings, NULL, /* init */ @@ -763,6 +771,6 @@ frontend_ctx_driver_t frontend_ctx_darwin = { NULL, /* watch_path_for_changes */ NULL, /* check_for_path_changes */ NULL, /* set_sustained_performance_mode */ - NULL, /* get_cpu_model_name */ + frontend_darwin_get_cpu_model_name, "darwin", }; diff --git a/libretro-common/features/features_cpu.c b/libretro-common/features/features_cpu.c index d37e4a1284..e247e46a02 100644 --- a/libretro-common/features/features_cpu.c +++ b/libretro-common/features/features_cpu.c @@ -873,6 +873,10 @@ end: /* terminate our string */ if (pos < len) name[pos] = '\0'; +#elif defined(__MACH__) + if (!name) + return; + sysctlbyname("machdep.cpu.brand_string", name, &len, NULL, 0); #else if (!name) return;