mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-23 07:59:42 +00:00
Improve CPU architecture and model name identification for Miyoo (#13704)
* features_cpu: Return model name on non-x86 Linux platforms Extract model name from /proc/cpuinfo. * platform/unix: Rework identification of classic Arm CPUs Identify pre-ARMv7 CPUs based on the machine hardware name starting with "arm" instead of matching every individual variant. This will then include the ARM926EJ-S which has armv5tejl as its machine hardware name.
This commit is contained in:
parent
c67806dbd7
commit
715c054de5
@ -1274,12 +1274,7 @@ static enum frontend_architecture frontend_unix_get_arch(void)
|
||||
string_is_equal(val, "armv7b")
|
||||
)
|
||||
return FRONTEND_ARCH_ARMV7;
|
||||
else if (
|
||||
string_is_equal(val, "armv6l") ||
|
||||
string_is_equal(val, "armv6b") ||
|
||||
string_is_equal(val, "armv5tel") ||
|
||||
string_is_equal(val, "arm")
|
||||
)
|
||||
else if (string_starts_with(val, "arm"))
|
||||
return FRONTEND_ARCH_ARM;
|
||||
else if (string_is_equal(val, "x86_64"))
|
||||
return FRONTEND_ARCH_X86_64;
|
||||
|
@ -46,8 +46,8 @@
|
||||
#if defined(_XBOX360)
|
||||
#include <PPCIntrinsics.h>
|
||||
#elif !defined(__MACH__) && (defined(__POWERPC__) || defined(__powerpc__) || defined(__ppc__) || defined(__PPC64__) || defined(__powerpc64__))
|
||||
#ifndef _PPU_INTRINSICS_H
|
||||
#include <ppu_intrinsics.h>
|
||||
#ifndef _PPU_INTRINSICS_H
|
||||
#include <ppu_intrinsics.h>
|
||||
#endif
|
||||
#elif defined(_POSIX_MONOTONIC_CLOCK) || defined(ANDROID) || defined(__QNX__) || defined(DJGPP)
|
||||
/* POSIX_MONOTONIC_CLOCK is not being defined in Android headers despite support being present. */
|
||||
@ -871,6 +871,35 @@ end:
|
||||
size_t len_size = len;
|
||||
sysctlbyname("machdep.cpu.brand_string", name, &len_size, NULL, 0);
|
||||
}
|
||||
#elif defined(__linux__)
|
||||
if (!name)
|
||||
return;
|
||||
{
|
||||
char *model_name, line[128];
|
||||
RFILE *fp = filestream_open("/proc/cpuinfo",
|
||||
RETRO_VFS_FILE_ACCESS_READ,
|
||||
RETRO_VFS_FILE_ACCESS_HINT_NONE);
|
||||
|
||||
if (!fp)
|
||||
return;
|
||||
|
||||
while (filestream_gets(fp, line, sizeof(line)))
|
||||
{
|
||||
if (strncmp(line, "model name", 10))
|
||||
continue;
|
||||
|
||||
if ((model_name = strstr(line + 10, ": ")))
|
||||
{
|
||||
model_name += 2;
|
||||
strncpy(name, model_name, len);
|
||||
name[len - 1] = '\0';
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
filestream_close(fp);
|
||||
}
|
||||
#else
|
||||
if (!name)
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user