From 02ba900a181c575337c96ae589428cde0b83fa12 Mon Sep 17 00:00:00 2001 From: Kawe Mazidjatari <48657826+Mauler125@users.noreply.github.com> Date: Sun, 6 Oct 2024 22:13:58 +0200 Subject: [PATCH] Tier0: don't check on MessageBoxA return type during errors Always terminate the process, MessageBoxA hangs the process anyways. If for some reason MessageBoxA fails then it will still terminate rather than continue and crash. --- src/tier0/cpu.cpp | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/src/tier0/cpu.cpp b/src/tier0/cpu.cpp index 82df6979..353848f9 100644 --- a/src/tier0/cpu.cpp +++ b/src/tier0/cpu.cpp @@ -581,10 +581,8 @@ void CheckSystemCPUForSSE2() if (!(pi.m_bSSE && pi.m_bSSE2)) { - if (MessageBoxA(NULL, "SSE and SSE2 are required.", "Unsupported CPU", MB_ICONERROR | MB_OK)) - { - TerminateProcess(GetCurrentProcess(), 0xFFFFFFFF); - } + MessageBoxA(NULL, "SSE and SSE2 are required.", "Unsupported CPU", MB_ICONERROR | MB_OK); + TerminateProcess(GetCurrentProcess(), 0xFFFFFFFF); } } @@ -594,10 +592,8 @@ void CheckSystemCPUForSSE3() if (!pi.m_bSSE3) { - if (MessageBoxA(NULL, "SSE3 is required.", "Unsupported CPU", MB_ICONERROR | MB_OK)) - { - TerminateProcess(GetCurrentProcess(), 0xFFFFFFFF); - } + MessageBoxA(NULL, "SSE3 is required.", "Unsupported CPU", MB_ICONERROR | MB_OK); + TerminateProcess(GetCurrentProcess(), 0xFFFFFFFF); } } @@ -607,10 +603,8 @@ void CheckSystemCPUForSupplementalSSE3() if (!pi.m_bSSSE3) { - if (MessageBoxA(NULL, "SSSE3 (Supplemental SSE3 Instructions) is required.", "Unsupported CPU", MB_ICONERROR | MB_OK)) - { - TerminateProcess(GetCurrentProcess(), 0xFFFFFFFF); - } + MessageBoxA(NULL, "SSSE3 (Supplemental SSE3 Instructions) is required.", "Unsupported CPU", MB_ICONERROR | MB_OK); + TerminateProcess(GetCurrentProcess(), 0xFFFFFFFF); } } @@ -620,10 +614,8 @@ void CheckSystemCPUForPopCount() if (!pi.m_bPOPCNT) { - if (MessageBoxA(NULL, "POPCNT is required.", "Unsupported CPU", MB_ICONERROR | MB_OK)) - { - TerminateProcess(GetCurrentProcess(), 0xFFFFFFFF); - } + MessageBoxA(NULL, "POPCNT is required.", "Unsupported CPU", MB_ICONERROR | MB_OK); + TerminateProcess(GetCurrentProcess(), 0xFFFFFFFF); } }