From f18829a487ae696ae9691adbaeb556dca5a013f0 Mon Sep 17 00:00:00 2001 From: Kawe Mazidjatari <48657826+Mauler125@users.noreply.github.com> Date: Fri, 5 Apr 2024 19:35:41 +0200 Subject: [PATCH] Tier0: split CPU feature checks into multiple functions --- r5dev/tier0/cpu.cpp | 28 +++++++++++++++++++++++++++- r5dev/tier0/cpu.h | 5 +++++ 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/r5dev/tier0/cpu.cpp b/r5dev/tier0/cpu.cpp index 7393b4bd..82df6979 100644 --- a/r5dev/tier0/cpu.cpp +++ b/r5dev/tier0/cpu.cpp @@ -575,7 +575,7 @@ const CPUInformation& GetCPUInformation(void) return pi; } -void CheckSystemCPU() +void CheckSystemCPUForSSE2() { const CPUInformation& pi = GetCPUInformation(); @@ -586,6 +586,12 @@ void CheckSystemCPU() TerminateProcess(GetCurrentProcess(), 0xFFFFFFFF); } } +} + +void CheckSystemCPUForSSE3() +{ + const CPUInformation& pi = GetCPUInformation(); + if (!pi.m_bSSE3) { if (MessageBoxA(NULL, "SSE3 is required.", "Unsupported CPU", MB_ICONERROR | MB_OK)) @@ -593,6 +599,12 @@ void CheckSystemCPU() TerminateProcess(GetCurrentProcess(), 0xFFFFFFFF); } } +} + +void CheckSystemCPUForSupplementalSSE3() +{ + const CPUInformation& pi = GetCPUInformation(); + if (!pi.m_bSSSE3) { if (MessageBoxA(NULL, "SSSE3 (Supplemental SSE3 Instructions) is required.", "Unsupported CPU", MB_ICONERROR | MB_OK)) @@ -600,6 +612,12 @@ void CheckSystemCPU() TerminateProcess(GetCurrentProcess(), 0xFFFFFFFF); } } +} + +void CheckSystemCPUForPopCount() +{ + const CPUInformation& pi = GetCPUInformation(); + if (!pi.m_bPOPCNT) { if (MessageBoxA(NULL, "POPCNT is required.", "Unsupported CPU", MB_ICONERROR | MB_OK)) @@ -608,3 +626,11 @@ void CheckSystemCPU() } } } + +void CheckSystemCPU() +{ + CheckSystemCPUForSSE2(); + CheckSystemCPUForSSE3(); + CheckSystemCPUForSupplementalSSE3(); + CheckSystemCPUForPopCount(); +} diff --git a/r5dev/tier0/cpu.h b/r5dev/tier0/cpu.h index 4425c486..0e03beb4 100644 --- a/r5dev/tier0/cpu.h +++ b/r5dev/tier0/cpu.h @@ -130,6 +130,11 @@ const char* GetProcessorBrand(bool bRemovePadding); const CPUInformation& GetCPUInformation(void); +void CheckSystemCPUForSSE2(); +void CheckSystemCPUForSSE3(); +void CheckSystemCPUForSupplementalSSE3(); +void CheckSystemCPUForPopCount(); + void CheckSystemCPU(); #endif // CPU_H