[App] Fix AVX check. For good this time. Hopefully.
This commit is contained in:
parent
1145d57007
commit
4f44bc3362
|
@ -50,18 +50,20 @@ project("xenia-app")
|
|||
files({
|
||||
"xenia_main.cc",
|
||||
"../base/main_"..platform_suffix..".cc",
|
||||
"../base/main_init_"..platform_suffix..".cc",
|
||||
})
|
||||
|
||||
filter("files:xenia_main.cc or ../base/main_"..platform_suffix..".cc")
|
||||
vectorextensions("IA32") -- Disable AVX for main_win.cc so our AVX check/error can happen.
|
||||
resincludedirs({
|
||||
project_root,
|
||||
})
|
||||
|
||||
filter("platforms:Windows")
|
||||
files({
|
||||
"main_resources.rc",
|
||||
})
|
||||
resincludedirs({
|
||||
project_root,
|
||||
})
|
||||
|
||||
filter("files:../base/main_init_"..platform_suffix..".cc")
|
||||
vectorextensions("IA32") -- Disable AVX for main_init_win.cc so our AVX check doesn't use AVX instructions.
|
||||
|
||||
filter("platforms:Linux")
|
||||
links({
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* Xenia : Xbox 360 Emulator Research Project *
|
||||
******************************************************************************
|
||||
* Copyright 2014 Ben Vanik. All rights reserved. *
|
||||
* Released under the BSD license - see LICENSE in the root for more details. *
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
#include "xenia/base/main.h"
|
||||
|
||||
#include <cstdlib>
|
||||
|
||||
#include "third_party/xbyak/xbyak/xbyak_util.h"
|
||||
|
||||
class StartupAvxCheck {
|
||||
public:
|
||||
StartupAvxCheck() {
|
||||
Xbyak::util::Cpu cpu;
|
||||
if (cpu.has(Xbyak::util::Cpu::tAVX)) {
|
||||
return;
|
||||
}
|
||||
// TODO(gibbed): detect app type and printf instead, if needed?
|
||||
MessageBoxA(
|
||||
nullptr,
|
||||
"Your CPU does not support AVX, which is required by Xenia. See the "
|
||||
"FAQ for system requirements at https://xenia.jp",
|
||||
"Xenia Error", MB_OK | MB_ICONERROR | MB_SETFOREGROUND);
|
||||
ExitProcess(static_cast<uint32_t>(-1));
|
||||
}
|
||||
};
|
||||
|
||||
// This is a hack to get an instance of StartupAvxCheck
|
||||
// constructed before any initialization code,
|
||||
// where the AVX check then happens in the constructor.
|
||||
//
|
||||
// https://docs.microsoft.com/en-us/cpp/preprocessor/init-seg
|
||||
#pragma warning(suppress : 4073)
|
||||
#pragma init_seg(lib)
|
||||
static StartupAvxCheck gStartupAvxCheck;
|
Loading…
Reference in New Issue