diff --git a/plugins/GSdx/GS.cpp b/plugins/GSdx/GS.cpp index 495e2f462e..e6cfea1f9a 100644 --- a/plugins/GSdx/GS.cpp +++ b/plugins/GSdx/GS.cpp @@ -127,6 +127,8 @@ EXPORT_C_(int) GSinit() // can crash if the CPU does not support the instruction set. // Initialise it here instead - it's not ideal since we have to strip the // const type qualifier from all the affected variables. + theApp.Init(); + GSBlock::InitVectors(); GSClut::InitVectors(); GSDrawScanlineCodeGenerator::InitVectors(); @@ -815,6 +817,8 @@ EXPORT_C GSconfigure() { if(!GSUtil::CheckSSE()) return; + theApp.Init(); + #ifdef _WIN32 GSDialog::InitCommonControls(); if(GSSettingsDlg().DoModal() == IDOK) diff --git a/plugins/GSdx/GSdx.cpp b/plugins/GSdx/GSdx.cpp index 878de1ff33..36ca03079e 100644 --- a/plugins/GSdx/GSdx.cpp +++ b/plugins/GSdx/GSdx.cpp @@ -127,6 +127,21 @@ GSdxApp theApp; GSdxApp::GSdxApp() { + // Empty constructor causes an illegal instruction exception on an SSE4.2 machine on Windows. + // Non-empty doesn't, but raises a SIGILL signal when compiled against GCC 6.1.1. + // So here's a compromise. +#ifdef _WIN32 + Init(); +#endif +} + +void GSdxApp::Init() +{ + static bool is_initialised = false; + if (is_initialised) + return; + is_initialised = true; + m_ini = "inis/GSdx.ini"; m_section = "Settings"; diff --git a/plugins/GSdx/GSdx.h b/plugins/GSdx/GSdx.h index 31a5cc31c1..91f900e208 100644 --- a/plugins/GSdx/GSdx.h +++ b/plugins/GSdx/GSdx.h @@ -35,7 +35,8 @@ class GSdxApp public: GSdxApp(); - void* GetModuleHandlePtr(); + void Init(); + void* GetModuleHandlePtr(); #ifdef _WIN32 HMODULE GetModuleHandle() {return (HMODULE)GetModuleHandlePtr();} diff --git a/plugins/GSdx/PSX/GPU.cpp b/plugins/GSdx/PSX/GPU.cpp index 23375fd25b..5d1c7b2337 100644 --- a/plugins/GSdx/PSX/GPU.cpp +++ b/plugins/GSdx/PSX/GPU.cpp @@ -59,6 +59,8 @@ EXPORT_C_(uint32) PSEgetLibVersion() EXPORT_C_(int32) GPUinit() { + theApp.Init(); + GSVector4i::InitVectors(); GSVector4::InitVectors(); #if _M_SSE >= 0x500 @@ -153,6 +155,8 @@ EXPORT_C_(int32) GPUopen(void* hWnd) EXPORT_C_(int32) GPUconfigure() { + theApp.Init(); + #ifdef _WIN32 GPUSettingsDlg dlg;