From 3110d6f9282c2de92a7abef03ca7b9268b508cae Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Fri, 26 Jun 2015 21:55:51 -0700 Subject: [PATCH] Show some cpu name if possible on Android. --- Common/ArmCPUDetect.cpp | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/Common/ArmCPUDetect.cpp b/Common/ArmCPUDetect.cpp index 738836bc63..2c3b281bd9 100644 --- a/Common/ArmCPUDetect.cpp +++ b/Common/ArmCPUDetect.cpp @@ -15,6 +15,7 @@ // Official SVN repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ +#include #include "Common.h" #include "CPUDetect.h" #include "StringUtils.h" @@ -50,6 +51,33 @@ std::string GetCPUString() return cpu_string; } +std::string GetCPUBrandString() +{ + std::string line, marker = "Processor\t: "; + std::string brand_string = "Unknown"; + std::fstream file; + if (!File::OpenCPPFile(file, procfile, std::ios::in)) + return brand_string; + + while (std::getline(file, line)) + { + if (line.find(marker) != std::string::npos) + { + brand_string = line.substr(marker.length()); + if (brand_string.back() == '\n') + brand_string.pop_back(); // Drop the new-line character + + if (brand_string.length() == 0 || isdigit(brand_string[0])) { + brand_string = "Unknown"; + continue; + } + break; + } + } + + return brand_string; +} + unsigned char GetCPUImplementer() { std::string line, marker = "CPU implementer\t: "; @@ -218,6 +246,8 @@ void CPUInfo::Detect() bASIMD = false; #else // __linux__ strncpy(cpu_string, GetCPUString().c_str(), sizeof(cpu_string)); + strncpy(brand_string, GetCPUBrandString().c_str(), sizeof(brand_string)); + bSwp = CheckCPUFeature("swp"); bHalf = CheckCPUFeature("half"); bThumb = CheckCPUFeature("thumb");