Main: add processor detection.

This commit is contained in:
Guillaume Jacquemin 2022-11-21 09:51:21 +01:00
parent 714d8cc6bb
commit e21e7a1aba
1 changed files with 16 additions and 1 deletions

View File

@ -18,6 +18,10 @@
#include <fstream>
#endif
#include <SDL_messagebox.h>
#include <cpuid.h>
#include <errhandlingapi.h>
#include <synchapi.h>
#include <winerror.h>
@ -59,7 +63,18 @@ int main(int argc, char** argv) {
return EXIT_FAILURE;
}
Utility::Debug{} << "===Initialising OpenGL renderer===";
std::uint32_t brand[12];
if (!__get_cpuid_max(0x80000004, nullptr)) {
Utility::Warning{} << "Warning: CPUID features not supported. Can't get the current processor's model.";
}
else {
__get_cpuid(0x80000002, brand+0x0, brand+0x1, brand+0x2, brand+0x3);
__get_cpuid(0x80000003, brand+0x4, brand+0x5, brand+0x6, brand+0x7);
__get_cpuid(0x80000004, brand+0x8, brand+0x9, brand+0xa, brand+0xb);
Utility::Debug{} << "Processor:" << Containers::arrayCast<const char>(brand).data();
}
SaveTool app({argc, argv});
Int result = app.exec();