mirror of
https://github.com/MultiMC/MultiMC5.git
synced 2025-01-30 15:32:45 +00:00
NOISSUE add some arch probing code
This commit is contained in:
parent
9ec1d43565
commit
f458204a52
@ -12,6 +12,18 @@ enum class KernelType {
|
||||
Linux
|
||||
};
|
||||
|
||||
enum class ArchitectureType {
|
||||
Undetermined,
|
||||
I386,
|
||||
AMD64,
|
||||
ARM64
|
||||
};
|
||||
|
||||
struct Architecture {
|
||||
ArchitectureType type;
|
||||
QString raw;
|
||||
};
|
||||
|
||||
struct KernelInfo
|
||||
{
|
||||
QString kernelName;
|
||||
@ -57,6 +69,8 @@ DistributionInfo getDistributionInfo();
|
||||
|
||||
uint64_t getSystemRam();
|
||||
|
||||
Architecture systemArchitecture();
|
||||
|
||||
bool isSystem64bit();
|
||||
|
||||
bool isCPU64bit();
|
||||
|
@ -77,3 +77,21 @@ bool Sys::lookupSystemStatusCode(uint64_t code, std::string &name, std::string &
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Sys::Architecture Sys::systemArchitecture() {
|
||||
struct utsname buf;
|
||||
uname(&buf);
|
||||
QString arch = buf.machine;
|
||||
if (arch == "x86_64") {
|
||||
return { ArchitectureType::AMD64, arch };
|
||||
}
|
||||
else if (arch == "i386") {
|
||||
return { ArchitectureType::I386, arch };
|
||||
}
|
||||
else if (arch == "arm64") {
|
||||
return { ArchitectureType::ARM64, arch };
|
||||
}
|
||||
else {
|
||||
return { ArchitectureType::Undetermined, arch };
|
||||
}
|
||||
}
|
||||
|
@ -117,6 +117,22 @@ Sys::DistributionInfo Sys::getDistributionInfo()
|
||||
return result;
|
||||
}
|
||||
|
||||
Sys::Architecture Sys::systemArchitecture() {
|
||||
QString qtArch = QSysInfo::currentCpuArchitecture();
|
||||
if (qtArch == "x86_64") {
|
||||
return { ArchitectureType::AMD64, qtArch };
|
||||
}
|
||||
else if (qtArch == "i386") {
|
||||
return { ArchitectureType::I386, qtArch };
|
||||
}
|
||||
else if (qtArch == "arm64") {
|
||||
return { ArchitectureType::ARM64, qtArch };
|
||||
}
|
||||
else {
|
||||
return { ArchitectureType::Undetermined, qtArch };
|
||||
}
|
||||
}
|
||||
|
||||
bool Sys::lookupSystemStatusCode(uint64_t code, std::string &name, std::string &description)
|
||||
{
|
||||
return false;
|
||||
|
@ -94,3 +94,22 @@ bool Sys::lookupSystemStatusCode(uint64_t code, std::string &name, std::string &
|
||||
|
||||
return hasCodeName || hasDescription;
|
||||
}
|
||||
|
||||
Sys::Architecture Sys::systemArchitecture() {
|
||||
SYSTEM_INFO info;
|
||||
ZeroMemory(&info, sizeof(SYSTEM_INFO));
|
||||
GetNativeSystemInfo(&info);
|
||||
auto arch = info.wProcessorArchitecture;
|
||||
|
||||
QString qtArch = QSysInfo::currentCpuArchitecture();
|
||||
switch (arch) {
|
||||
case PROCESSOR_ARCHITECTURE_AMD64:
|
||||
return { ArchitectureType::AMD64, "x86_64" };
|
||||
case PROCESSOR_ARCHITECTURE_ARM64:
|
||||
return { ArchitectureType::ARM64, "arm64" };
|
||||
case PROCESSOR_ARCHITECTURE_INTEL:
|
||||
return { ArchitectureType::I386, "i386" };
|
||||
default:
|
||||
return { ArchitectureType::Undetermined, qtArch };
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user