mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Tools: check CPU for SSE2
SSE and SSE2 instructions are being used, check for them instead of crashing somewhere in the program.
This commit is contained in:
parent
3fec8793e9
commit
05a84339ce
@ -4060,17 +4060,7 @@ void MathLib_Init(float gamma, float texGamma, float brightness, int overbright)
|
||||
// FIXME: Hook SSE into VectorAligned + Vector4DAligned
|
||||
|
||||
#if !defined( _GAMECONSOLE )
|
||||
// Grab the processor information:
|
||||
const CPUInformation& pi = GetCPUInformation();
|
||||
|
||||
if (!(pi.m_bSSE && pi.m_bSSE2))
|
||||
{
|
||||
Assert(0);
|
||||
if (MessageBoxA(NULL, "SSE and SSE2 are required.", "Unsupported CPU", MB_ICONERROR | MB_OK))
|
||||
{
|
||||
TerminateProcess(GetCurrentProcess(), EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
CheckCPUforSSE2();
|
||||
#endif //!360
|
||||
|
||||
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include "core/stdafx.h"
|
||||
#include "core/logdef.h"
|
||||
#include "core/logger.h"
|
||||
#include "tier0/cpu.h"
|
||||
#include "tier0/utility.h"
|
||||
#include "tier1/NetAdr.h"
|
||||
#include "tier2/socketcreator.h"
|
||||
@ -360,6 +361,8 @@ bool CNetCon::IsConnected(void)
|
||||
//-----------------------------------------------------------------------------
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
CheckCPUforSSE2();
|
||||
|
||||
bool bEnableColor = false;
|
||||
|
||||
for (int i = 0; i < argc; i++)
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include "core/logdef.h"
|
||||
#include "core/logger.h"
|
||||
#include "tier0/fasttimer.h"
|
||||
#include "tier0/cpu.h"
|
||||
#include "tier1/cmd.h"
|
||||
#include "tier1/keyvalues.h"
|
||||
#include "windows/console.h"
|
||||
@ -41,6 +42,8 @@ CFileSystem_Stdio* FileSystem()
|
||||
//-----------------------------------------------------------------------------
|
||||
static void ReVPK_Init()
|
||||
{
|
||||
CheckCPUforSSE2();
|
||||
|
||||
g_CoreMsgVCallback = EngineLoggerSink;
|
||||
lzham_enable_fail_exceptions(true);
|
||||
|
||||
|
@ -572,3 +572,17 @@ const CPUInformation& GetCPUInformation(void)
|
||||
}
|
||||
return pi;
|
||||
}
|
||||
|
||||
void CheckCPUforSSE2()
|
||||
{
|
||||
const CPUInformation& pi = GetCPUInformation();
|
||||
|
||||
if (!(pi.m_bSSE && pi.m_bSSE2))
|
||||
{
|
||||
Assert(0);
|
||||
if (MessageBoxA(NULL, "SSE and SSE2 are required.", "Unsupported CPU", MB_ICONERROR | MB_OK))
|
||||
{
|
||||
TerminateProcess(GetCurrentProcess(), EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -126,4 +126,6 @@ const char* GetProcessorBrand(bool bRemovePadding);
|
||||
|
||||
const CPUInformation& GetCPUInformation(void);
|
||||
|
||||
void CheckCPUforSSE2();
|
||||
|
||||
#endif // CPU_H
|
||||
|
@ -121,7 +121,7 @@ void Console_Init(const bool bAnsiColor)
|
||||
{
|
||||
// Warn the user if 'VirtualTerminalLevel' could not be set on users environment.
|
||||
MessageBoxA(NULL, "Failed to set console mode 'VirtualTerminalLevel'.\n"
|
||||
"Please omit the '-ansicolor' parameter and restart \nthe program if output logging appears distorted.", "SDK Warning", MB_ICONEXCLAMATION | MB_OK);
|
||||
"Please disable ansi-colors and restart \nthe program if output logging appears distorted.", "SDK Warning", MB_ICONEXCLAMATION | MB_OK);
|
||||
}
|
||||
|
||||
SetConsoleBackgroundColor(0x00000000);
|
||||
|
Loading…
x
Reference in New Issue
Block a user